Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index e2668803a1941d2d88c5d781b2f444a0f7f66b51..2a6934cb48331af9248329a8019c6af9fa38f215 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -155,14 +155,14 @@ |
// ECMA 262 - 15.1.4 |
function GlobalIsNaN(number) { |
- number = TO_NUMBER_INLINE(number); |
+ if (!IS_NUMBER(number)) number = NonNumberToNumber(number); |
return NUMBER_IS_NAN(number); |
} |
// ECMA 262 - 15.1.5 |
function GlobalIsFinite(number) { |
- number = TO_NUMBER_INLINE(number); |
+ if (!IS_NUMBER(number)) number = NonNumberToNumber(number); |
return NUMBER_IS_FINITE(number); |
} |
@@ -290,9 +290,9 @@ |
if (IS_SYMBOL(V)) return false; |
var handler = %GetHandler(this); |
- return CallTrap1(handler, "hasOwn", $proxyDerivedHasOwnTrap, $toName(V)); |
- } |
- return %HasOwnProperty(TO_OBJECT_INLINE(this), $toName(V)); |
+ return CallTrap1(handler, "hasOwn", $proxyDerivedHasOwnTrap, ToName(V)); |
+ } |
+ return %HasOwnProperty(TO_OBJECT_INLINE(this), ToName(V)); |
} |
@@ -306,7 +306,7 @@ |
// ECMA-262 - 15.2.4.6 |
function ObjectPropertyIsEnumerable(V) { |
- var P = $toName(V); |
+ var P = ToName(V); |
if (%_IsJSProxy(this)) { |
// TODO(rossberg): adjust once there is a story for symbols vs proxies. |
if (IS_SYMBOL(V)) return false; |
@@ -331,7 +331,7 @@ |
desc.setGet(fun); |
desc.setEnumerable(true); |
desc.setConfigurable(true); |
- DefineOwnProperty(TO_OBJECT_INLINE(receiver), $toName(name), desc, false); |
+ DefineOwnProperty(TO_OBJECT_INLINE(receiver), ToName(name), desc, false); |
} |
@@ -340,7 +340,7 @@ |
if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
receiver = %GlobalProxy(global); |
} |
- return %LookupAccessor(TO_OBJECT_INLINE(receiver), $toName(name), GETTER); |
+ return %LookupAccessor(TO_OBJECT_INLINE(receiver), ToName(name), GETTER); |
} |
@@ -356,7 +356,7 @@ |
desc.setSet(fun); |
desc.setEnumerable(true); |
desc.setConfigurable(true); |
- DefineOwnProperty(TO_OBJECT_INLINE(receiver), $toName(name), desc, false); |
+ DefineOwnProperty(TO_OBJECT_INLINE(receiver), ToName(name), desc, false); |
} |
@@ -365,7 +365,7 @@ |
if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
receiver = %GlobalProxy(global); |
} |
- return %LookupAccessor(TO_OBJECT_INLINE(receiver), $toName(name), SETTER); |
+ return %LookupAccessor(TO_OBJECT_INLINE(receiver), ToName(name), SETTER); |
} |
@@ -458,11 +458,11 @@ |
var desc = new PropertyDescriptor(); |
if ("enumerable" in obj) { |
- desc.setEnumerable($toBoolean(obj.enumerable)); |
+ desc.setEnumerable(ToBoolean(obj.enumerable)); |
} |
if ("configurable" in obj) { |
- desc.setConfigurable($toBoolean(obj.configurable)); |
+ desc.setConfigurable(ToBoolean(obj.configurable)); |
} |
if ("value" in obj) { |
@@ -470,7 +470,7 @@ |
} |
if ("writable" in obj) { |
- desc.setWritable($toBoolean(obj.writable)); |
+ desc.setWritable(ToBoolean(obj.writable)); |
} |
if ("get" in obj) { |
@@ -667,7 +667,7 @@ |
// ES5 section 8.12.1. |
function GetOwnPropertyJS(obj, v) { |
- var p = $toName(v); |
+ var p = ToName(v); |
if (%_IsJSProxy(obj)) { |
// TODO(rossberg): adjust once there is a story for symbols vs proxies. |
if (IS_SYMBOL(v)) return UNDEFINED; |
@@ -724,7 +724,7 @@ |
var handler = %GetHandler(obj); |
var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); |
- if (!$toBoolean(result)) { |
+ if (!ToBoolean(result)) { |
if (should_throw) { |
throw MakeTypeError(kProxyHandlerReturned, |
handler, "false", "defineProperty"); |
@@ -738,7 +738,7 @@ |
// ES5 8.12.9. |
function DefineObjectProperty(obj, p, desc, should_throw) { |
- var current_array = %GetOwnProperty(obj, $toName(p)); |
+ var current_array = %GetOwnProperty(obj, ToName(p)); |
var current = ConvertDescriptorArrayToDescriptor(current_array); |
var extensible = %IsExtensible(obj); |
@@ -757,17 +757,17 @@ |
if ((IsGenericDescriptor(desc) || |
IsDataDescriptor(desc) == IsDataDescriptor(current)) && |
(!desc.hasEnumerable() || |
- $sameValue(desc.isEnumerable(), current.isEnumerable())) && |
+ SameValue(desc.isEnumerable(), current.isEnumerable())) && |
(!desc.hasConfigurable() || |
- $sameValue(desc.isConfigurable(), current.isConfigurable())) && |
+ SameValue(desc.isConfigurable(), current.isConfigurable())) && |
(!desc.hasWritable() || |
- $sameValue(desc.isWritable(), current.isWritable())) && |
+ SameValue(desc.isWritable(), current.isWritable())) && |
(!desc.hasValue() || |
- $sameValue(desc.getValue(), current.getValue())) && |
+ SameValue(desc.getValue(), current.getValue())) && |
(!desc.hasGetter() || |
- $sameValue(desc.getGet(), current.getGet())) && |
+ SameValue(desc.getGet(), current.getGet())) && |
(!desc.hasSetter() || |
- $sameValue(desc.getSet(), current.getSet()))) { |
+ SameValue(desc.getSet(), current.getSet()))) { |
return true; |
} |
if (!current.isConfigurable()) { |
@@ -801,7 +801,7 @@ |
} |
} |
if (!current.isWritable() && desc.hasValue() && |
- !$sameValue(desc.getValue(), current.getValue())) { |
+ !SameValue(desc.getValue(), current.getValue())) { |
if (should_throw) { |
throw MakeTypeError(kRedefineDisallowed, p); |
} else { |
@@ -811,15 +811,14 @@ |
} |
// Step 11 |
if (IsAccessorDescriptor(desc) && IsAccessorDescriptor(current)) { |
- if (desc.hasSetter() && |
- !$sameValue(desc.getSet(), current.getSet())) { |
+ if (desc.hasSetter() && !SameValue(desc.getSet(), current.getSet())) { |
if (should_throw) { |
throw MakeTypeError(kRedefineDisallowed, p); |
} else { |
return false; |
} |
} |
- if (desc.hasGetter() && !$sameValue(desc.getGet(),current.getGet())) { |
+ if (desc.hasGetter() && !SameValue(desc.getGet(),current.getGet())) { |
if (should_throw) { |
throw MakeTypeError(kRedefineDisallowed, p); |
} else { |
@@ -915,8 +914,8 @@ |
if (!desc.hasValue()) { |
return DefineObjectProperty(obj, "length", desc, should_throw); |
} |
- var new_length = $toUint32(desc.getValue()); |
- if (new_length != $toNumber(desc.getValue())) { |
+ var new_length = ToUint32(desc.getValue()); |
+ if (new_length != ToNumber(desc.getValue())) { |
throw MakeRangeError(kArrayLengthOutOfRange); |
} |
var length_desc = GetOwnPropertyJS(obj, "length"); |
@@ -939,7 +938,7 @@ |
} |
while (new_length < length--) { |
- var index = $toString(length); |
+ var index = ToString(length); |
if (emit_splice) { |
var deletedDesc = GetOwnPropertyJS(obj, index); |
if (deletedDesc && deletedDesc.hasValue()) |
@@ -971,9 +970,9 @@ |
// Step 4 - Special handling for array index. |
if (!IS_SYMBOL(p)) { |
- var index = $toUint32(p); |
+ var index = ToUint32(p); |
var emit_splice = false; |
- if ($toString(index) == p && index != 4294967295) { |
+ if (ToString(index) == p && index != 4294967295) { |
var length = obj.length; |
if (index >= length && %IsObserved(obj)) { |
emit_splice = true; |
@@ -1056,12 +1055,12 @@ |
if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError(kProxyNonObjectPropNames, trap, obj); |
} |
- var n = $toUint32(obj.length); |
+ var n = ToUint32(obj.length); |
var array = new GlobalArray(n); |
var realLength = 0; |
var names = { __proto__: null }; // TODO(rossberg): use sets once ready. |
for (var index = 0; index < n; index++) { |
- var s = $toName(obj[index]); |
+ var s = ToName(obj[index]); |
// TODO(rossberg): adjust once there is a story for symbols vs proxies. |
if (IS_SYMBOL(s) && !includeSymbols) continue; |
if (%HasOwnProperty(names, s)) { |
@@ -1130,7 +1129,7 @@ |
} |
} else { |
if (filter & PROPERTY_ATTRIBUTES_STRING) continue; |
- name = $toString(name); |
+ name = ToString(name); |
} |
if (seenKeys[name]) continue; |
seenKeys[name] = true; |
@@ -1187,7 +1186,7 @@ |
if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty"); |
} |
- var name = $toName(p); |
+ var name = ToName(p); |
if (%_IsJSProxy(obj)) { |
// Clone the attributes object for protection. |
// TODO(rossberg): not spec'ed yet, so not sure if this should involve |
@@ -1411,7 +1410,7 @@ |
// ECMA-262, Edition 6, section 19.1.2.10 |
function ObjectIs(obj1, obj2) { |
- return $sameValue(obj1, obj2); |
+ return SameValue(obj1, obj2); |
} |
@@ -1495,9 +1494,9 @@ |
function BooleanConstructor(x) { |
if (%_IsConstructCall()) { |
- %_SetValueOf(this, $toBoolean(x)); |
+ %_SetValueOf(this, ToBoolean(x)); |
} else { |
- return $toBoolean(x); |
+ return ToBoolean(x); |
} |
} |
@@ -1543,7 +1542,7 @@ |
// Number |
function NumberConstructor(x) { |
- var value = %_ArgumentsLength() == 0 ? 0 : $toNumber(x); |
+ var value = %_ArgumentsLength() == 0 ? 0 : ToNumber(x); |
if (%_IsConstructCall()) { |
%_SetValueOf(this, value); |
} else { |
@@ -1656,7 +1655,7 @@ |
// Get the value of this number in case it's an object. |
x = %_ValueOf(this); |
} |
- if (IS_UNDEFINED(precision)) return $toString(%_ValueOf(this)); |
+ if (IS_UNDEFINED(precision)) return ToString(%_ValueOf(this)); |
var p = TO_INTEGER(precision); |
if (NUMBER_IS_NAN(x)) return "NaN"; |
@@ -1871,9 +1870,9 @@ |
var n = args.length; |
var p = ''; |
if (n > 1) { |
- p = $toString(args[0]); |
+ p = ToString(args[0]); |
for (var i = 1; i < n - 1; i++) { |
- p += ',' + $toString(args[i]); |
+ p += ',' + ToString(args[i]); |
} |
// If the formal parameters string include ) - an illegal |
// character - it may make the combined function expression |
@@ -1886,7 +1885,7 @@ |
// comments we can include a trailing block comment to catch this. |
p += '\n/' + '**/'; |
} |
- var body = (n > 0) ? $toString(args[n - 1]) : ''; |
+ var body = (n > 0) ? ToString(args[n - 1]) : ''; |
return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; |
} |