From f5631f737835f33638b1f0b4978d45aa7b192350 Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Wed, 14 May 2014 08:51:10 +0000 Subject: [PATCH] Avoid name clashes of builtins and runtime functions. This makes it possible to use %Percent() notation to call any given builtin or runtime function in tests. R=dslomov@chromium.org Review URL: https://codereview.chromium.org/280243002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21298 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/array.js | 10 ++--- src/arraybuffer.js | 4 +- src/bootstrapper.cc | 2 +- src/builtins.cc | 6 +-- src/collection.js | 44 +++++++++++----------- src/harmony-math.js | 4 +- src/hydrogen.cc | 2 +- src/math.js | 10 ++--- src/messages.js | 4 +- src/object-observe.js | 18 ++++----- src/regexp.js | 4 +- src/runtime.cc | 6 +-- src/runtime.h | 6 +-- src/string.js | 36 +++++++++--------- src/uri.js | 8 ++-- src/v8natives.js | 44 +++++++++++----------- .../runtime-gen/{mathexp.js => mathexprt.js} | 2 +- .../runtime-gen/{mathfloor.js => mathfloorrt.js} | 2 +- .../runtime-gen/{mathsqrt.js => mathsqrtrt.js} | 2 +- 19 files changed, 107 insertions(+), 107 deletions(-) rename test/mjsunit/runtime-gen/{mathexp.js => mathexprt.js} (92%) rename test/mjsunit/runtime-gen/{mathfloor.js => mathfloorrt.js} (91%) rename test/mjsunit/runtime-gen/{mathsqrt.js => mathsqrtrt.js} (91%) diff --git a/src/array.js b/src/array.js index c37f468..5b036e6 100644 --- a/src/array.js +++ b/src/array.js @@ -45,7 +45,7 @@ function GetSortedArrayKeys(array, indices) { } -function SparseJoinWithSeparator(array, len, convert, separator) { +function SparseJoinWithSeparatorJS(array, len, convert, separator) { var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, len)); var totalLength = 0; var elements = new InternalArray(keys.length * 2); @@ -111,7 +111,7 @@ function Join(array, length, separator, convert) { if (separator.length == 0) { return SparseJoin(array, length, convert); } else { - return SparseJoinWithSeparator(array, length, convert, separator); + return SparseJoinWithSeparatorJS(array, length, convert, separator); } } @@ -457,7 +457,7 @@ function ArrayPush() { // Returns an array containing the array elements of the object followed // by the array elements of each argument in order. See ECMA-262, // section 15.4.4.7. -function ArrayConcat(arg1) { // length == 1 +function ArrayConcatJS(arg1) { // length == 1 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.concat"); var array = ToObject(this); @@ -1492,7 +1492,7 @@ function SetUpArray() { "join", getFunction("join", ArrayJoin), "pop", getFunction("pop", ArrayPop), "push", getFunction("push", ArrayPush, 1), - "concat", getFunction("concat", ArrayConcat, 1), + "concat", getFunction("concat", ArrayConcatJS, 1), "reverse", getFunction("reverse", ArrayReverse), "shift", getFunction("shift", ArrayShift), "unshift", getFunction("unshift", ArrayUnshift, 1), @@ -1516,7 +1516,7 @@ function SetUpArray() { // exposed to user code. // Adding only the functions that are actually used. SetUpLockedPrototype(InternalArray, $Array(), $Array( - "concat", getFunction("concat", ArrayConcat), + "concat", getFunction("concat", ArrayConcatJS), "indexOf", getFunction("indexOf", ArrayIndexOf), "join", getFunction("join", ArrayJoin), "pop", getFunction("pop", ArrayPop), diff --git a/src/arraybuffer.js b/src/arraybuffer.js index 44989f5..d1324bb 100644 --- a/src/arraybuffer.js +++ b/src/arraybuffer.js @@ -62,7 +62,7 @@ function ArrayBufferSlice(start, end) { return result; } -function ArrayBufferIsView(obj) { +function ArrayBufferIsViewJS(obj) { return %ArrayBufferIsView(obj); } @@ -79,7 +79,7 @@ function SetUpArrayBuffer() { InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen); InstallFunctions($ArrayBuffer, DONT_ENUM, $Array( - "isView", ArrayBufferIsView + "isView", ArrayBufferIsViewJS )); InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array( diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index d783d24..480aab1 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1548,7 +1548,7 @@ void Genesis::InstallNativeFunctions() { void Genesis::InstallExperimentalNativeFunctions() { - INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); + INSTALL_NATIVE(JSFunction, "RunMicrotasksJS", run_microtasks); INSTALL_NATIVE(JSFunction, "EnqueueMicrotask", enqueue_microtask); if (FLAG_harmony_proxies) { diff --git a/src/builtins.cc b/src/builtins.cc index b523450..fd0fc81 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -995,7 +995,7 @@ BUILTIN(ArrayConcat) { JSObject::cast(native_context->array_function()->prototype()); if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { AllowHeapAllocation allow_allocation; - return CallJsBuiltin(isolate, "ArrayConcat", args); + return CallJsBuiltin(isolate, "ArrayConcatJS", args); } // Iterate through all the arguments performing checks @@ -1007,7 +1007,7 @@ BUILTIN(ArrayConcat) { !JSArray::cast(arg)->HasFastElements() || JSArray::cast(arg)->GetPrototype() != array_proto) { AllowHeapAllocation allow_allocation; - return CallJsBuiltin(isolate, "ArrayConcat", args); + return CallJsBuiltin(isolate, "ArrayConcatJS", args); } int len = Smi::cast(JSArray::cast(arg)->length())->value(); @@ -1020,7 +1020,7 @@ BUILTIN(ArrayConcat) { if (result_len > FixedDoubleArray::kMaxLength) { AllowHeapAllocation allow_allocation; - return CallJsBuiltin(isolate, "ArrayConcat", args); + return CallJsBuiltin(isolate, "ArrayConcatJS", args); } ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); diff --git a/src/collection.js b/src/collection.js index f8f3fa9..b201d57 100644 --- a/src/collection.js +++ b/src/collection.js @@ -43,7 +43,7 @@ function SetConstructor() { } -function SetAdd(key) { +function SetAddJS(key) { if (!IS_SET(this)) { throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.add', this]); @@ -52,7 +52,7 @@ function SetAdd(key) { } -function SetHas(key) { +function SetHasJS(key) { if (!IS_SET(this)) { throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.has', this]); @@ -61,7 +61,7 @@ function SetHas(key) { } -function SetDelete(key) { +function SetDeleteJS(key) { if (!IS_SET(this)) { throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.delete', this]); @@ -76,7 +76,7 @@ function SetDelete(key) { } -function SetGetSize() { +function SetGetSizeJS() { if (!IS_SET(this)) { throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.size', this]); @@ -85,7 +85,7 @@ function SetGetSize() { } -function SetClear() { +function SetClearJS() { if (!IS_SET(this)) { throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.clear', this]); @@ -128,12 +128,12 @@ function SetUpSet() { %FunctionSetLength(SetForEach, 1); // Set up the non-enumerable functions on the Set prototype object. - InstallGetter($Set.prototype, "size", SetGetSize); + InstallGetter($Set.prototype, "size", SetGetSizeJS); InstallFunctions($Set.prototype, DONT_ENUM, $Array( - "add", SetAdd, - "has", SetHas, - "delete", SetDelete, - "clear", SetClear, + "add", SetAddJS, + "has", SetHasJS, + "delete", SetDeleteJS, + "clear", SetClearJS, "forEach", SetForEach )); } @@ -153,7 +153,7 @@ function MapConstructor() { } -function MapGet(key) { +function MapGetJS(key) { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.get', this]); @@ -162,7 +162,7 @@ function MapGet(key) { } -function MapSet(key, value) { +function MapSetJS(key, value) { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.set', this]); @@ -171,7 +171,7 @@ function MapSet(key, value) { } -function MapHas(key) { +function MapHasJS(key) { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.has', this]); @@ -180,7 +180,7 @@ function MapHas(key) { } -function MapDelete(key) { +function MapDeleteJS(key) { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.delete', this]); @@ -189,7 +189,7 @@ function MapDelete(key) { } -function MapGetSize() { +function MapGetSizeJS() { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.size', this]); @@ -198,7 +198,7 @@ function MapGetSize() { } -function MapClear() { +function MapClearJS() { if (!IS_MAP(this)) { throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.clear', this]); @@ -241,13 +241,13 @@ function SetUpMap() { %FunctionSetLength(MapForEach, 1); // Set up the non-enumerable functions on the Map prototype object. - InstallGetter($Map.prototype, "size", MapGetSize); + InstallGetter($Map.prototype, "size", MapGetSizeJS); InstallFunctions($Map.prototype, DONT_ENUM, $Array( - "get", MapGet, - "set", MapSet, - "has", MapHas, - "delete", MapDelete, - "clear", MapClear, + "get", MapGetJS, + "set", MapSetJS, + "has", MapHasJS, + "delete", MapDeleteJS, + "clear", MapClearJS, "forEach", MapForEach )); } diff --git a/src/harmony-math.js b/src/harmony-math.js index 505e9a1..4a8d95b 100644 --- a/src/harmony-math.js +++ b/src/harmony-math.js @@ -132,7 +132,7 @@ function MathHypot(x, y) { // Function length is 2. // ES6 draft 09-27-13, section 20.2.2.16. -function MathFround(x) { +function MathFroundJS(x) { return %MathFround(TO_NUMBER_INLINE(x)); } @@ -234,7 +234,7 @@ function ExtendMath() { "log10", MathLog10, "log2", MathLog2, "hypot", MathHypot, - "fround", MathFround, + "fround", MathFroundJS, "clz32", MathClz32, "cbrt", MathCbrt, "log1p", MathLog1p, diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 46f893d..b232a5e 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -11126,7 +11126,7 @@ void HOptimizedGraphBuilder::GenerateMathLog(CallRuntime* call) { } -void HOptimizedGraphBuilder::GenerateMathSqrt(CallRuntime* call) { +void HOptimizedGraphBuilder::GenerateMathSqrtRT(CallRuntime* call) { ASSERT(call->arguments()->length() == 1); CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); HValue* value = Pop(); diff --git a/src/math.js b/src/math.js index fe10de4..0ad5453 100644 --- a/src/math.js +++ b/src/math.js @@ -47,7 +47,7 @@ function MathAtan(x) { // ECMA 262 - 15.8.2.5 // The naming of y and x matches the spec, as does the order in which // ToNumber (valueOf) is called. -function MathAtan2(y, x) { +function MathAtan2JS(y, x) { return %MathAtan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x)); } @@ -64,7 +64,7 @@ function MathCos(x) { // ECMA 262 - 15.8.2.8 function MathExp(x) { - return %MathExp(TO_NUMBER_INLINE(x)); + return %MathExpRT(TO_NUMBER_INLINE(x)); } // ECMA 262 - 15.8.2.9 @@ -79,7 +79,7 @@ function MathFloor(x) { // has to be -0, which wouldn't be the case with the shift. return TO_UINT32(x); } else { - return %MathFloor(x); + return %MathFloorRT(x); } } @@ -173,7 +173,7 @@ function MathSin(x) { // ECMA 262 - 15.8.2.17 function MathSqrt(x) { - return %_MathSqrt(TO_NUMBER_INLINE(x)); + return %_MathSqrtRT(TO_NUMBER_INLINE(x)); } // ECMA 262 - 15.8.2.18 @@ -296,7 +296,7 @@ function SetUpMath() { "sin", MathSin, "sqrt", MathSqrt, "tan", MathTan, - "atan2", MathAtan2, + "atan2", MathAtan2JS, "pow", MathPow, "max", MathMax, "min", MathMin, diff --git a/src/messages.js b/src/messages.js index 6c50b1b..5f01dc9 100644 --- a/src/messages.js +++ b/src/messages.js @@ -957,12 +957,12 @@ function CallSiteToString() { var methodName = this.getMethodName(); if (functionName) { if (typeName && - %_CallFunction(functionName, typeName, StringIndexOf) != 0) { + %_CallFunction(functionName, typeName, StringIndexOfJS) != 0) { line += typeName + "."; } line += functionName; if (methodName && - (%_CallFunction(functionName, "." + methodName, StringIndexOf) != + (%_CallFunction(functionName, "." + methodName, StringIndexOfJS) != functionName.length - methodName.length - 1)) { line += " [as " + methodName + "]"; } diff --git a/src/object-observe.js b/src/object-observe.js index f4b1f53..26a1e18 100644 --- a/src/object-observe.js +++ b/src/object-observe.js @@ -35,7 +35,7 @@ var observationState; -function GetObservationState() { +function GetObservationStateJS() { if (IS_UNDEFINED(observationState)) observationState = %GetObservationState(); @@ -76,7 +76,7 @@ var contextMaps; function GetContextMaps() { if (IS_UNDEFINED(contextMaps)) { var map = GetWeakMapWrapper(); - var observationState = GetObservationState(); + var observationState = GetObservationStateJS(); contextMaps = { callbackInfoMap: new map(observationState.callbackInfoMap), objectInfoMap: new map(observationState.objectInfoMap), @@ -100,15 +100,15 @@ function GetNotifierObjectInfoMap() { } function GetPendingObservers() { - return GetObservationState().pendingObservers; + return GetObservationStateJS().pendingObservers; } function SetPendingObservers(pendingObservers) { - GetObservationState().pendingObservers = pendingObservers; + GetObservationStateJS().pendingObservers = pendingObservers; } function GetNextCallbackPriority() { - return GetObservationState().nextCallbackPriority++; + return GetObservationStateJS().nextCallbackPriority++; } function nullProtoObject() { @@ -440,7 +440,7 @@ function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { %DefineOrRedefineDataProperty(newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); } - ObjectFreeze(newRecord); + ObjectFreezeJS(newRecord); ObjectInfoEnqueueInternalChangeRecord(objectInfo, newRecord); } @@ -488,8 +488,8 @@ function EnqueueSpliceRecord(array, index, removed, addedCount) { addedCount: addedCount }; - ObjectFreeze(changeRecord); - ObjectFreeze(changeRecord.removed); + ObjectFreezeJS(changeRecord); + ObjectFreezeJS(changeRecord.removed); ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord); } @@ -512,7 +512,7 @@ function NotifyChange(type, object, name, oldValue) { }; } - ObjectFreeze(changeRecord); + ObjectFreezeJS(changeRecord); ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord); } diff --git a/src/regexp.js b/src/regexp.js index 6a0e2b5..d58ca26 100644 --- a/src/regexp.js +++ b/src/regexp.js @@ -80,7 +80,7 @@ function RegExpConstructor(pattern, flags) { // were called again. In SpiderMonkey, this method returns the regexp object. // In JSC, it returns undefined. For compatibility with JSC, we match their // behavior. -function RegExpCompile(pattern, flags) { +function RegExpCompileJS(pattern, flags) { // Both JSC and SpiderMonkey treat a missing pattern argument as the // empty subject string, and an actual undefined value passed as the // pattern as the string 'undefined'. Note that JSC is inconsistent @@ -381,7 +381,7 @@ function SetUpRegExp() { "exec", RegExpExec, "test", RegExpTest, "toString", RegExpToString, - "compile", RegExpCompile + "compile", RegExpCompileJS )); // The length of compile is 1 in SpiderMonkey. diff --git a/src/runtime.cc b/src/runtime.cc index a63fd65..f73c5b1 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -7850,7 +7850,7 @@ RUNTIME_FUNCTION(Runtime_MathAtan2) { } -RUNTIME_FUNCTION(Runtime_MathExp) { +RUNTIME_FUNCTION(Runtime_MathExpRT) { HandleScope scope(isolate); ASSERT(args.length() == 1); isolate->counters()->math_exp()->Increment(); @@ -7861,7 +7861,7 @@ RUNTIME_FUNCTION(Runtime_MathExp) { } -RUNTIME_FUNCTION(Runtime_MathFloor) { +RUNTIME_FUNCTION(Runtime_MathFloorRT) { HandleScope scope(isolate); ASSERT(args.length() == 1); isolate->counters()->math_floor()->Increment(); @@ -7956,7 +7956,7 @@ RUNTIME_FUNCTION(Runtime_RoundNumber) { } -RUNTIME_FUNCTION(Runtime_MathSqrt) { +RUNTIME_FUNCTION(Runtime_MathSqrtRT) { HandleScope scope(isolate); ASSERT(args.length() == 1); isolate->counters()->math_sqrt()->Increment(); diff --git a/src/runtime.h b/src/runtime.h index 6c498de..f0bc718 100644 --- a/src/runtime.h +++ b/src/runtime.h @@ -138,9 +138,9 @@ namespace internal { F(MathAcos, 1, 1) \ F(MathAsin, 1, 1) \ F(MathAtan, 1, 1) \ - F(MathFloor, 1, 1) \ + F(MathFloorRT, 1, 1) \ F(MathAtan2, 2, 1) \ - F(MathExp, 1, 1) \ + F(MathExpRT, 1, 1) \ F(RoundNumber, 1, 1) \ F(MathFround, 1, 1) \ \ @@ -684,7 +684,7 @@ namespace internal { F(ConstructDouble, 2, 1) \ F(DoubleHi, 1, 1) \ F(DoubleLo, 1, 1) \ - F(MathSqrt, 1, 1) \ + F(MathSqrtRT, 1, 1) \ F(MathLog, 1, 1) \ /* Debugger */ \ F(DebugCallbackSupportsStepping, 1, 1) diff --git a/src/string.js b/src/string.js index 9c90427..1120479 100644 --- a/src/string.js +++ b/src/string.js @@ -83,7 +83,7 @@ function StringConcat() { // ECMA-262 section 15.5.4.7 -function StringIndexOf(pattern /* position */) { // length == 1 +function StringIndexOfJS(pattern /* position */) { // length == 1 CHECK_OBJECT_COERCIBLE(this, "String.prototype.indexOf"); var subject = TO_STRING_INLINE(this); @@ -100,7 +100,7 @@ function StringIndexOf(pattern /* position */) { // length == 1 // ECMA-262 section 15.5.4.8 -function StringLastIndexOf(pat /* position */) { // length == 1 +function StringLastIndexOfJS(pat /* position */) { // length == 1 CHECK_OBJECT_COERCIBLE(this, "String.prototype.lastIndexOf"); var sub = TO_STRING_INLINE(this); @@ -131,7 +131,7 @@ function StringLastIndexOf(pat /* position */) { // length == 1 // // This function is implementation specific. For now, we do not // do anything locale specific. -function StringLocaleCompare(other) { +function StringLocaleCompareJS(other) { CHECK_OBJECT_COERCIBLE(this, "String.prototype.localeCompare"); return %StringLocaleCompare(TO_STRING_INLINE(this), @@ -140,7 +140,7 @@ function StringLocaleCompare(other) { // ECMA-262 section 15.5.4.10 -function StringMatch(regexp) { +function StringMatchJS(regexp) { CHECK_OBJECT_COERCIBLE(this, "String.prototype.match"); var subject = TO_STRING_INLINE(this); @@ -170,7 +170,7 @@ var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; // For now we do nothing, as proper normalization requires big tables. // If Intl is enabled, then i18n.js will override it and provide the the // proper functionality. -function StringNormalize(form) { +function StringNormalizeJS(form) { CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); var form = form ? TO_STRING_INLINE(form) : 'NFC'; @@ -585,7 +585,7 @@ function StringSlice(start, end) { // ECMA-262 section 15.5.4.14 -function StringSplit(separator, limit) { +function StringSplitJS(separator, limit) { CHECK_OBJECT_COERCIBLE(this, "String.prototype.split"); var subject = TO_STRING_INLINE(this); @@ -756,7 +756,7 @@ function StringSubstr(start, n) { // ECMA-262, 15.5.4.16 -function StringToLowerCase() { +function StringToLowerCaseJS() { CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLowerCase"); return %StringToLowerCase(TO_STRING_INLINE(this)); @@ -772,7 +772,7 @@ function StringToLocaleLowerCase() { // ECMA-262, 15.5.4.18 -function StringToUpperCase() { +function StringToUpperCaseJS() { CHECK_OBJECT_COERCIBLE(this, "String.prototype.toUpperCase"); return %StringToUpperCase(TO_STRING_INLINE(this)); @@ -787,7 +787,7 @@ function StringToLocaleUpperCase() { } // ES5, 15.5.4.20 -function StringTrim() { +function StringTrimJS() { CHECK_OBJECT_COERCIBLE(this, "String.prototype.trim"); return %StringTrim(TO_STRING_INLINE(this), true, true); @@ -935,22 +935,22 @@ function SetUpString() { "charAt", StringCharAt, "charCodeAt", StringCharCodeAt, "concat", StringConcat, - "indexOf", StringIndexOf, - "lastIndexOf", StringLastIndexOf, - "localeCompare", StringLocaleCompare, - "match", StringMatch, - "normalize", StringNormalize, + "indexOf", StringIndexOfJS, + "lastIndexOf", StringLastIndexOfJS, + "localeCompare", StringLocaleCompareJS, + "match", StringMatchJS, + "normalize", StringNormalizeJS, "replace", StringReplace, "search", StringSearch, "slice", StringSlice, - "split", StringSplit, + "split", StringSplitJS, "substring", StringSubstring, "substr", StringSubstr, - "toLowerCase", StringToLowerCase, + "toLowerCase", StringToLowerCaseJS, "toLocaleLowerCase", StringToLocaleLowerCase, - "toUpperCase", StringToUpperCase, + "toUpperCase", StringToUpperCaseJS, "toLocaleUpperCase", StringToLocaleUpperCase, - "trim", StringTrim, + "trim", StringTrimJS, "trimLeft", StringTrimLeft, "trimRight", StringTrimRight, "link", StringLink, diff --git a/src/uri.js b/src/uri.js index 123503b..3cc1fe4 100644 --- a/src/uri.js +++ b/src/uri.js @@ -403,14 +403,14 @@ function IsValidHex(s) { // ECMA-262 - B.2.1. -function URIEscape(str) { +function URIEscapeJS(str) { var s = ToString(str); return %URIEscape(s); } // ECMA-262 - B.2.2. -function URIUnescape(str) { +function URIUnescapeJS(str) { var s = ToString(str); return %URIUnescape(s); } @@ -424,8 +424,8 @@ function SetUpUri() { // Set up non-enumerable URI functions on the global object and set // their names. InstallFunctions(global, DONT_ENUM, $Array( - "escape", URIEscape, - "unescape", URIUnescape, + "escape", URIEscapeJS, + "unescape", URIUnescapeJS, "decodeURI", URIDecode, "decodeURIComponent", URIDecodeComponent, "encodeURI", URIEncode, diff --git a/src/v8natives.js b/src/v8natives.js index cd60cb4..46dfab4 100644 --- a/src/v8natives.js +++ b/src/v8natives.js @@ -263,7 +263,7 @@ function ObjectPropertyIsEnumerable(V) { // TODO(rossberg): adjust once there is a story for symbols vs proxies. if (IS_SYMBOL(V)) return false; - var desc = GetOwnProperty(this, P); + var desc = GetOwnPropertyJS(this, P); return IS_UNDEFINED(desc) ? false : desc.isEnumerable(); } return %IsPropertyEnumerable(ToObject(this), P); @@ -627,7 +627,7 @@ function CallTrap2(handler, name, defaultTrap, x, y) { // ES5 section 8.12.1. -function GetOwnProperty(obj, v) { +function GetOwnPropertyJS(obj, v) { var p = ToName(v); if (%IsJSProxy(obj)) { // TODO(rossberg): adjust once there is a story for symbols vs proxies. @@ -659,7 +659,7 @@ function GetOwnProperty(obj, v) { // ES5 section 8.12.7. function Delete(obj, p, should_throw) { - var desc = GetOwnProperty(obj, p); + var desc = GetOwnPropertyJS(obj, p); if (IS_UNDEFINED(desc)) return true; if (desc.isConfigurable()) { %DeleteProperty(obj, p, 0); @@ -866,7 +866,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) { if (new_length != ToNumber(desc.getValue())) { throw new $RangeError('defineProperty() array length out of range'); } - var length_desc = GetOwnProperty(obj, "length"); + var length_desc = GetOwnPropertyJS(obj, "length"); if (new_length != length && !length_desc.isWritable()) { if (should_throw) { throw MakeTypeError("redefine_disallowed", [p]); @@ -888,7 +888,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) { while (new_length < length--) { var index = ToString(length); if (emit_splice) { - var deletedDesc = GetOwnProperty(obj, index); + var deletedDesc = GetOwnPropertyJS(obj, index); if (deletedDesc && deletedDesc.hasValue()) removed[length - new_length] = deletedDesc.getValue(); } @@ -935,7 +935,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) { BeginPerformSplice(obj); } - var length_desc = GetOwnProperty(obj, "length"); + var length_desc = GetOwnPropertyJS(obj, "length"); if ((index >= length && !length_desc.isWritable()) || !DefineObjectProperty(obj, p, desc, true)) { if (emit_splice) @@ -1007,7 +1007,7 @@ function ObjectGetOwnPropertyDescriptor(obj, p) { throw MakeTypeError("called_on_non_object", ["Object.getOwnPropertyDescriptor"]); } - var desc = GetOwnProperty(obj, p); + var desc = GetOwnPropertyJS(obj, p); return FromPropertyDescriptor(desc); } @@ -1157,7 +1157,7 @@ function ObjectDefineProperty(obj, p, attributes) { for (var i = 0; i < names.length; i++) { var N = names[i]; if (!(%HasLocalProperty(standardNames, N))) { - var attr = GetOwnProperty(attributes, N); + var attr = GetOwnPropertyJS(attributes, N); DefineOwnProperty(descObj, N, attr, true); } } @@ -1242,7 +1242,7 @@ function ObjectSeal(obj) { var names = ObjectGetOwnPropertyNames(obj); for (var i = 0; i < names.length; i++) { var name = names[i]; - var desc = GetOwnProperty(obj, name); + var desc = GetOwnPropertyJS(obj, name); if (desc.isConfigurable()) { desc.setConfigurable(false); DefineOwnProperty(obj, name, desc, true); @@ -1254,7 +1254,7 @@ function ObjectSeal(obj) { // ES5 section 15.2.3.9. -function ObjectFreeze(obj) { +function ObjectFreezeJS(obj) { if (!IS_SPEC_OBJECT(obj)) { throw MakeTypeError("called_on_non_object", ["Object.freeze"]); } @@ -1266,7 +1266,7 @@ function ObjectFreeze(obj) { var names = ObjectGetOwnPropertyNames(obj); for (var i = 0; i < names.length; i++) { var name = names[i]; - var desc = GetOwnProperty(obj, name); + var desc = GetOwnPropertyJS(obj, name); if (desc.isWritable() || desc.isConfigurable()) { if (IsDataDescriptor(desc)) desc.setWritable(false); desc.setConfigurable(false); @@ -1310,7 +1310,7 @@ function ObjectIsSealed(obj) { var names = ObjectGetOwnPropertyNames(obj); for (var i = 0; i < names.length; i++) { var name = names[i]; - var desc = GetOwnProperty(obj, name); + var desc = GetOwnPropertyJS(obj, name); if (desc.isConfigurable()) return false; } return true; @@ -1331,7 +1331,7 @@ function ObjectIsFrozen(obj) { var names = ObjectGetOwnPropertyNames(obj); for (var i = 0; i < names.length; i++) { var name = names[i]; - var desc = GetOwnProperty(obj, name); + var desc = GetOwnPropertyJS(obj, name); if (IsDataDescriptor(desc) && desc.isWritable()) return false; if (desc.isConfigurable()) return false; } @@ -1422,7 +1422,7 @@ function SetUpObject() { "create", ObjectCreate, "defineProperty", ObjectDefineProperty, "defineProperties", ObjectDefineProperties, - "freeze", ObjectFreeze, + "freeze", ObjectFreezeJS, "getPrototypeOf", ObjectGetPrototypeOf, "setPrototypeOf", ObjectSetPrototypeOf, "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, @@ -1554,7 +1554,7 @@ function NumberValueOf() { // ECMA-262 section 15.7.4.5 -function NumberToFixed(fractionDigits) { +function NumberToFixedJS(fractionDigits) { var x = this; if (!IS_NUMBER(this)) { if (!IS_NUMBER_WRAPPER(this)) { @@ -1579,7 +1579,7 @@ function NumberToFixed(fractionDigits) { // ECMA-262 section 15.7.4.6 -function NumberToExponential(fractionDigits) { +function NumberToExponentialJS(fractionDigits) { var x = this; if (!IS_NUMBER(this)) { if (!IS_NUMBER_WRAPPER(this)) { @@ -1605,7 +1605,7 @@ function NumberToExponential(fractionDigits) { // ECMA-262 section 15.7.4.7 -function NumberToPrecision(precision) { +function NumberToPrecisionJS(precision) { var x = this; if (!IS_NUMBER(this)) { if (!IS_NUMBER_WRAPPER(this)) { @@ -1694,9 +1694,9 @@ function SetUpNumber() { "toString", NumberToString, "toLocaleString", NumberToLocaleString, "valueOf", NumberValueOf, - "toFixed", NumberToFixed, - "toExponential", NumberToExponential, - "toPrecision", NumberToPrecision + "toFixed", NumberToFixedJS, + "toExponential", NumberToExponentialJS, + "toPrecision", NumberToPrecisionJS )); // Harmony Number constructor additions @@ -1823,7 +1823,7 @@ function NewFunctionString(arguments, function_token) { // If the formal parameters string include ) - an illegal // character - it may make the combined function expression // compile. We avoid this problem by checking for this early on. - if (%_CallFunction(p, ')', StringIndexOf) != -1) { + if (%_CallFunction(p, ')', StringIndexOfJS) != -1) { throw MakeSyntaxError('paren_in_arg_string', []); } // If the formal parameters include an unbalanced block comment, the @@ -1870,7 +1870,7 @@ SetUpFunction(); // Eventually, we should move to a real event queue that allows to maintain // relative ordering of different kinds of tasks. -function RunMicrotasks() { +function RunMicrotasksJS() { while (%SetMicrotaskPending(false)) { var microtaskState = %GetMicrotaskState(); if (IS_UNDEFINED(microtaskState.queue)) diff --git a/test/mjsunit/runtime-gen/mathexp.js b/test/mjsunit/runtime-gen/mathexprt.js similarity index 92% rename from test/mjsunit/runtime-gen/mathexp.js rename to test/mjsunit/runtime-gen/mathexprt.js index 828f624..4aaacd0 100644 --- a/test/mjsunit/runtime-gen/mathexp.js +++ b/test/mjsunit/runtime-gen/mathexprt.js @@ -2,4 +2,4 @@ // AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY // Flags: --allow-natives-syntax --harmony var _x = 1.5; -%MathExp(_x); +%MathExpRT(_x); diff --git a/test/mjsunit/runtime-gen/mathfloor.js b/test/mjsunit/runtime-gen/mathfloorrt.js similarity index 91% rename from test/mjsunit/runtime-gen/mathfloor.js rename to test/mjsunit/runtime-gen/mathfloorrt.js index 705c497..0918474 100644 --- a/test/mjsunit/runtime-gen/mathfloor.js +++ b/test/mjsunit/runtime-gen/mathfloorrt.js @@ -2,4 +2,4 @@ // AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY // Flags: --allow-natives-syntax --harmony var _x = 1.5; -%MathFloor(_x); +%MathFloorRT(_x); diff --git a/test/mjsunit/runtime-gen/mathsqrt.js b/test/mjsunit/runtime-gen/mathsqrtrt.js similarity index 91% rename from test/mjsunit/runtime-gen/mathsqrt.js rename to test/mjsunit/runtime-gen/mathsqrtrt.js index 9da0cae..35a155a 100644 --- a/test/mjsunit/runtime-gen/mathsqrt.js +++ b/test/mjsunit/runtime-gen/mathsqrtrt.js @@ -2,4 +2,4 @@ // AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY // Flags: --allow-natives-syntax --harmony var _x = 1.5; -%_MathSqrt(_x); +%_MathSqrtRT(_x); -- 2.7.4