diff options
Diffstat (limited to 'chromium/v8/src/runtime.js')
-rw-r--r-- | chromium/v8/src/runtime.js | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/chromium/v8/src/runtime.js b/chromium/v8/src/runtime.js index 35bc07a10e8..1dee2e08f61 100644 --- a/chromium/v8/src/runtime.js +++ b/chromium/v8/src/runtime.js @@ -1,29 +1,6 @@ // Copyright 2006-2008 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. // This files contains runtime support implemented in JavaScript. @@ -48,7 +25,6 @@ var $Number = global.Number; var $Function = global.Function; var $Boolean = global.Boolean; var $NaN = %GetRootNaN(); -var builtins = this; // ECMA-262 Section 11.9.3. function EQUALS(y) { @@ -76,11 +52,8 @@ function EQUALS(y) { y = %ToPrimitive(y, NO_HINT); } } else if (IS_SYMBOL(x)) { - while (true) { - if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1; - if (!IS_SPEC_OBJECT(y)) return 1; // not equal - y = %ToPrimitive(y, NO_HINT); - } + if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1; + return 1; // not equal } else if (IS_BOOLEAN(x)) { if (IS_BOOLEAN(y)) return %_ObjectEquals(x, y) ? 0 : 1; if (IS_NULL_OR_UNDEFINED(y)) return 1; @@ -98,6 +71,7 @@ function EQUALS(y) { return %_ObjectEquals(x, y) ? 0 : 1; } if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal + if (IS_SYMBOL(y)) return 1; // not equal if (IS_BOOLEAN(y)) y = %ToNumber(y); x = %ToPrimitive(x, NO_HINT); } @@ -467,7 +441,7 @@ function APPLY_PREPARE(args) { } -function APPLY_OVERFLOW(length) { +function STACK_OVERFLOW(length) { throw %MakeRangeError('stack_overflow', []); } @@ -502,7 +476,7 @@ function ToPrimitive(x, hint) { if (IS_STRING(x)) return x; // Normal behavior. if (!IS_SPEC_OBJECT(x)) return x; - if (IS_SYMBOL_WRAPPER(x)) return %_ValueOf(x); + if (IS_SYMBOL_WRAPPER(x)) throw MakeTypeError('symbol_to_primitive', []); if (hint == NO_HINT) hint = (IS_DATE(x)) ? STRING_HINT : NUMBER_HINT; return (hint == NUMBER_HINT) ? %DefaultNumber(x) : %DefaultString(x); } @@ -549,6 +523,7 @@ function ToString(x) { if (IS_NUMBER(x)) return %_NumberToString(x); if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; if (IS_UNDEFINED(x)) return 'undefined'; + if (IS_SYMBOL(x)) throw %MakeTypeError('symbol_to_string', []); return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); } @@ -556,6 +531,7 @@ function NonStringToString(x) { if (IS_NUMBER(x)) return %_NumberToString(x); if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; if (IS_UNDEFINED(x)) return 'undefined'; + if (IS_SYMBOL(x)) throw %MakeTypeError('symbol_to_string', []); return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); } @@ -569,9 +545,9 @@ function ToName(x) { // ECMA-262, section 9.9, page 36. function ToObject(x) { if (IS_STRING(x)) return new $String(x); - if (IS_SYMBOL(x)) return new $Symbol(x); if (IS_NUMBER(x)) return new $Number(x); if (IS_BOOLEAN(x)) return new $Boolean(x); + if (IS_SYMBOL(x)) return %NewSymbolWrapper(x); if (IS_NULL_OR_UNDEFINED(x) && !IS_UNDETECTABLE(x)) { throw %MakeTypeError('undefined_or_null_to_object', []); } |