From c842453d5afa091e6f87415b3d12779c07daf0ed Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 8 Jul 2013 20:20:00 -0700 Subject: [PATCH] Bug 891215 (part 4) - Slim down ParseNode-inl.h. r=terrence. --HG-- extra : rebase_source : 282aa80825d69f2faf012d920ac0cf916dda6b93 --- js/src/frontend/ParseNode-inl.h | 16 ---------------- js/src/frontend/ParseNode.h | 14 +++++++++++++- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/js/src/frontend/ParseNode-inl.h b/js/src/frontend/ParseNode-inl.h index 4d42571540e9..5cec8f9f91d5 100644 --- a/js/src/frontend/ParseNode-inl.h +++ b/js/src/frontend/ParseNode-inl.h @@ -13,22 +13,6 @@ namespace js { namespace frontend { -inline bool -UpvarCookie::set(JSContext *cx, unsigned newLevel, uint16_t newSlot) -{ - // This is an unsigned-to-uint16_t conversion, test for too-high values. - // In practice, recursion in Parser and/or BytecodeEmitter will blow the - // stack if we nest functions more than a few hundred deep, so this will - // never trigger. Oh well. - if (newLevel >= FREE_LEVEL) { - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str); - return false; - } - level_ = newLevel; - slot_ = newSlot; - return true; -} - inline PropertyName * ParseNode::name() const { diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index eff7fb061779..66d04abe31ce 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -51,7 +51,19 @@ class UpvarCookie uint16_t slot() const { JS_ASSERT(!isFree()); return slot_; } // This fails and issues an error message if newLevel is too large. - bool set(JSContext *cx, unsigned newLevel, uint16_t newSlot); + bool set(JSContext *cx, unsigned newLevel, uint16_t newSlot) { + // This is an unsigned-to-uint16_t conversion, test for too-high + // values. In practice, recursion in Parser and/or BytecodeEmitter + // will blow the stack if we nest functions more than a few hundred + // deep, so this will never trigger. Oh well. + if (newLevel >= FREE_LEVEL) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str); + return false; + } + level_ = newLevel; + slot_ = newSlot; + return true; + } void makeFree() { level_ = FREE_LEVEL;