diff --git a/src/array-iterator.js b/src/array-iterator.js index fb18789f98..f04d6c974a 100644 --- a/src/array-iterator.js +++ b/src/array-iterator.js @@ -110,8 +110,8 @@ function SetUpArrayIterator() { 'next', ArrayIteratorNext )); %FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]'); - %AddProperty(ArrayIterator.prototype, symbolIterator, ArrayIteratorIterator, - DONT_ENUM); + %AddNamedProperty(ArrayIterator.prototype, symbolIterator, + ArrayIteratorIterator, DONT_ENUM); } SetUpArrayIterator(); @@ -125,7 +125,7 @@ function ExtendArrayPrototype() { 'keys', ArrayKeys )); - %AddProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM); + %AddNamedProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM); } ExtendArrayPrototype(); @@ -146,10 +146,10 @@ macro TYPED_ARRAYS(FUNCTION) endmacro macro EXTEND_TYPED_ARRAY(NAME) - %AddProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); - %AddProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); - %AddProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); - %AddProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); + %AddNamedProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); + %AddNamedProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); + %AddNamedProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); + %AddNamedProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); endmacro TYPED_ARRAYS(EXTEND_TYPED_ARRAY) diff --git a/src/array.js b/src/array.js index ca91c69d2c..15cbbf21a6 100644 --- a/src/array.js +++ b/src/array.js @@ -1460,7 +1460,7 @@ function SetUpArray() { // Set up non-enumerable constructor property on the Array.prototype // object. - %AddProperty($Array.prototype, "constructor", $Array, DONT_ENUM); + %AddNamedProperty($Array.prototype, "constructor", $Array, DONT_ENUM); // Set up non-enumerable functions on the Array object. InstallFunctions($Array, DONT_ENUM, $Array( diff --git a/src/arraybuffer.js b/src/arraybuffer.js index a34469cefb..e1c887fdb8 100644 --- a/src/arraybuffer.js +++ b/src/arraybuffer.js @@ -74,7 +74,8 @@ function SetUpArrayBuffer() { %FunctionSetPrototype($ArrayBuffer, new $Object()); // Set up the constructor property on the ArrayBuffer prototype object. - %AddProperty($ArrayBuffer.prototype, "constructor", $ArrayBuffer, DONT_ENUM); + %AddNamedProperty( + $ArrayBuffer.prototype, "constructor", $ArrayBuffer, DONT_ENUM); InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen); diff --git a/src/collection-iterator.js b/src/collection-iterator.js index 096e30dcab..2bccc8d7a2 100644 --- a/src/collection-iterator.js +++ b/src/collection-iterator.js @@ -75,7 +75,7 @@ function SetUpSetIterator() { )); %FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]'); - %AddProperty(SetIterator.prototype, symbolIterator, + %AddNamedProperty(SetIterator.prototype, symbolIterator, SetIteratorSymbolIterator, DONT_ENUM); } @@ -91,7 +91,7 @@ function ExtendSetPrototype() { 'values', SetValues )); - %AddProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM); + %AddNamedProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM); } ExtendSetPrototype(); @@ -172,7 +172,7 @@ function SetUpMapIterator() { )); %FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]'); - %AddProperty(MapIterator.prototype, symbolIterator, + %AddNamedProperty(MapIterator.prototype, symbolIterator, MapIteratorSymbolIterator, DONT_ENUM); } @@ -188,7 +188,7 @@ function ExtendMapPrototype() { 'values', MapValues )); - %AddProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM); + %AddNamedProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM); } ExtendMapPrototype(); diff --git a/src/collection.js b/src/collection.js index ac12331eed..e5fc0b33c8 100644 --- a/src/collection.js +++ b/src/collection.js @@ -147,7 +147,7 @@ function SetUpSet() { %SetCode($Set, SetConstructor); %FunctionSetPrototype($Set, new $Object()); - %AddProperty($Set.prototype, "constructor", $Set, DONT_ENUM); + %AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM); %FunctionSetLength(SetForEach, 1); @@ -282,7 +282,7 @@ function SetUpMap() { %SetCode($Map, MapConstructor); %FunctionSetPrototype($Map, new $Object()); - %AddProperty($Map.prototype, "constructor", $Map, DONT_ENUM); + %AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM); %FunctionSetLength(MapForEach, 1); diff --git a/src/date.js b/src/date.js index c4c7f6e383..87c87bfda6 100644 --- a/src/date.js +++ b/src/date.js @@ -763,7 +763,7 @@ function SetUpDate() { )); // Set up non-enumerable constructor property of the Date prototype object. - %AddProperty($Date.prototype, "constructor", $Date, DONT_ENUM); + %AddNamedProperty($Date.prototype, "constructor", $Date, DONT_ENUM); // Set up non-enumerable functions of the Date prototype object and // set their names. diff --git a/src/generator.js b/src/generator.js index 316ffa0f01..54f6d8cd7e 100644 --- a/src/generator.js +++ b/src/generator.js @@ -63,13 +63,13 @@ function SetUpGenerators() { ["next", GeneratorObjectNext, "throw", GeneratorObjectThrow]); %FunctionSetName(GeneratorObjectIterator, '[Symbol.iterator]'); - %AddProperty(GeneratorObjectPrototype, symbolIterator, + %AddNamedProperty(GeneratorObjectPrototype, symbolIterator, GeneratorObjectIterator, DONT_ENUM | DONT_DELETE | READ_ONLY); - %AddProperty(GeneratorObjectPrototype, "constructor", + %AddNamedProperty(GeneratorObjectPrototype, "constructor", GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); %SetPrototype(GeneratorFunctionPrototype, $Function.prototype); %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); - %AddProperty(GeneratorFunctionPrototype, "constructor", + %AddNamedProperty(GeneratorFunctionPrototype, "constructor", GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); %SetPrototype(GeneratorFunction, $Function); %SetCode(GeneratorFunction, GeneratorFunctionConstructor); diff --git a/src/i18n.js b/src/i18n.js index 6dcb86fe9e..61e0ac98e5 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -942,7 +942,7 @@ function initializeCollator(collator, locales, options) { * * @constructor */ -%AddProperty(Intl, 'Collator', function() { +%AddNamedProperty(Intl, 'Collator', function() { var locales = %_Arguments(0); var options = %_Arguments(1); @@ -960,7 +960,7 @@ function initializeCollator(collator, locales, options) { /** * Collator resolvedOptions method. */ -%AddProperty(Intl.Collator.prototype, 'resolvedOptions', function() { +%AddNamedProperty(Intl.Collator.prototype, 'resolvedOptions', function() { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -997,7 +997,7 @@ function initializeCollator(collator, locales, options) { * order in the returned list as in the input list. * Options are optional parameter. */ -%AddProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { +%AddNamedProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1169,7 +1169,7 @@ function initializeNumberFormat(numberFormat, locales, options) { * * @constructor */ -%AddProperty(Intl, 'NumberFormat', function() { +%AddNamedProperty(Intl, 'NumberFormat', function() { var locales = %_Arguments(0); var options = %_Arguments(1); @@ -1187,7 +1187,7 @@ function initializeNumberFormat(numberFormat, locales, options) { /** * NumberFormat resolvedOptions method. */ -%AddProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() { +%AddNamedProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1243,7 +1243,7 @@ function initializeNumberFormat(numberFormat, locales, options) { * order in the returned list as in the input list. * Options are optional parameter. */ -%AddProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { +%AddNamedProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1562,7 +1562,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { * * @constructor */ -%AddProperty(Intl, 'DateTimeFormat', function() { +%AddNamedProperty(Intl, 'DateTimeFormat', function() { var locales = %_Arguments(0); var options = %_Arguments(1); @@ -1580,7 +1580,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { /** * DateTimeFormat resolvedOptions method. */ -%AddProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() { +%AddNamedProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1636,7 +1636,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { * order in the returned list as in the input list. * Options are optional parameter. */ -%AddProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { +%AddNamedProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1768,7 +1768,7 @@ function initializeBreakIterator(iterator, locales, options) { * * @constructor */ -%AddProperty(Intl, 'v8BreakIterator', function() { +%AddNamedProperty(Intl, 'v8BreakIterator', function() { var locales = %_Arguments(0); var options = %_Arguments(1); @@ -1786,7 +1786,8 @@ function initializeBreakIterator(iterator, locales, options) { /** * BreakIterator resolvedOptions method. */ -%AddProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() { +%AddNamedProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', + function() { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } @@ -1819,7 +1820,8 @@ function initializeBreakIterator(iterator, locales, options) { * order in the returned list as in the input list. * Options are optional parameter. */ -%AddProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { +%AddNamedProperty(Intl.v8BreakIterator, 'supportedLocalesOf', + function(locales) { if (%_IsConstructCall()) { throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); } diff --git a/src/math.js b/src/math.js index 679fc5fce8..6491399292 100644 --- a/src/math.js +++ b/src/math.js @@ -260,7 +260,7 @@ function SetUpMath() { %CheckIsBootstrapping(); %SetPrototype($Math, $Object.prototype); - %AddProperty(global, "Math", $Math, DONT_ENUM); + %AddNamedProperty(global, "Math", $Math, DONT_ENUM); %FunctionSetInstanceClassName(MathConstructor, 'Math'); // Set up math constants. diff --git a/src/messages.js b/src/messages.js index 5aa4111b5d..28af372b7f 100644 --- a/src/messages.js +++ b/src/messages.js @@ -286,8 +286,8 @@ function MakeGenericError(constructor, type, args) { * Set up the Script function and constructor. */ %FunctionSetInstanceClassName(Script, 'Script'); -%AddProperty(Script.prototype, 'constructor', Script, - DONT_ENUM | DONT_DELETE | READ_ONLY); +%AddNamedProperty(Script.prototype, 'constructor', Script, + DONT_ENUM | DONT_DELETE | READ_ONLY); %SetCode(Script, function(x) { // Script objects can only be created by the VM. throw new $Error("Not supported"); @@ -1160,9 +1160,9 @@ function SetUpError() { // effects when overwriting the error functions from // user code. var name = f.name; - %AddProperty(global, name, f, DONT_ENUM); - %AddProperty(builtins, '$' + name, f, - DONT_ENUM | DONT_DELETE | READ_ONLY); + %AddNamedProperty(global, name, f, DONT_ENUM); + %AddNamedProperty(builtins, '$' + name, f, + DONT_ENUM | DONT_DELETE | READ_ONLY); // Configure the error function. if (name == 'Error') { // The prototype of the Error object must itself be an error. @@ -1177,16 +1177,16 @@ function SetUpError() { %FunctionSetPrototype(f, new $Error()); } %FunctionSetInstanceClassName(f, 'Error'); - %AddProperty(f.prototype, 'constructor', f, DONT_ENUM); - %AddProperty(f.prototype, "name", name, DONT_ENUM); + %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); + %AddNamedProperty(f.prototype, "name", name, DONT_ENUM); %SetCode(f, function(m) { if (%_IsConstructCall()) { // Define all the expected properties directly on the error // object. This avoids going through getters and setters defined // on prototype objects. - %AddProperty(this, 'stack', UNDEFINED, DONT_ENUM); + %AddNamedProperty(this, 'stack', UNDEFINED, DONT_ENUM); if (!IS_UNDEFINED(m)) { - %AddProperty(this, 'message', ToString(m), DONT_ENUM); + %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); } try { captureStackTrace(this, f); } catch (e) { } } else { @@ -1209,7 +1209,7 @@ SetUpError(); $Error.captureStackTrace = captureStackTrace; -%AddProperty($Error.prototype, 'message', '', DONT_ENUM); +%AddNamedProperty($Error.prototype, 'message', '', DONT_ENUM); // Global list of error objects visited during ErrorToString. This is // used to detect cycles in error toString formatting. diff --git a/src/object-observe.js b/src/object-observe.js index 9d80784d61..76f39159e1 100644 --- a/src/object-observe.js +++ b/src/object-observe.js @@ -450,7 +450,8 @@ function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { for (var prop in changeRecord) { if (prop === 'object' || (hasType && prop === 'type')) continue; - %AddProperty(newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); + %DefineDataPropertyUnchecked( + newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); } ObjectFreezeJS(newRecord); diff --git a/src/promise.js b/src/promise.js index c94e05968d..2797d79acb 100644 --- a/src/promise.js +++ b/src/promise.js @@ -325,7 +325,7 @@ var lastMicrotaskId = 0; // Install exported functions. %CheckIsBootstrapping(); - %AddProperty(global, 'Promise', $Promise, DONT_ENUM); + %AddNamedProperty(global, 'Promise', $Promise, DONT_ENUM); InstallFunctions($Promise, DONT_ENUM, [ "defer", PromiseDeferred, "accept", PromiseResolved, diff --git a/src/regexp.js b/src/regexp.js index 556ca37ac6..d7883fb693 100644 --- a/src/regexp.js +++ b/src/regexp.js @@ -381,7 +381,7 @@ var lastMatchInfoOverride = null; function SetUpRegExp() { %CheckIsBootstrapping(); %FunctionSetInstanceClassName($RegExp, 'RegExp'); - %AddProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); + %AddNamedProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); %SetCode($RegExp, RegExpConstructor); InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( diff --git a/src/runtime.cc b/src/runtime.cc index 432f20a916..2f0b50dfd8 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -5195,12 +5195,12 @@ RUNTIME_FUNCTION(Runtime_SetHiddenProperty) { } -RUNTIME_FUNCTION(Runtime_AddProperty) { +RUNTIME_FUNCTION(Runtime_AddNamedProperty) { HandleScope scope(isolate); RUNTIME_ASSERT(args.length() == 4); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); + CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); RUNTIME_ASSERT( @@ -5210,27 +5210,17 @@ RUNTIME_FUNCTION(Runtime_AddProperty) { static_cast(unchecked_attributes); #ifdef DEBUG - bool duplicate; uint32_t index = 0; - if (key->IsName() || !key->ToArrayIndex(&index)) { - if (key->IsNumber()) { - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, key, - Execution::ToString(isolate, key)); - } - LookupIterator it(object, Handle::cast(key), - LookupIterator::CHECK_OWN_REAL); - JSReceiver::GetPropertyAttributes(&it); - duplicate = it.IsFound(); - } else { - duplicate = JSReceiver::HasOwnElement(object, index); - } - RUNTIME_ASSERT(!duplicate); + ASSERT(!key->ToArrayIndex(&index)); + LookupIterator it(object, key, LookupIterator::CHECK_OWN_REAL); + JSReceiver::GetPropertyAttributes(&it); + RUNTIME_ASSERT(!it.IsFound()); #endif Handle result; ASSIGN_RETURN_FAILURE_ON_EXCEPTION( isolate, result, - Runtime::DefineObjectProperty(object, key, value, attributes)); + JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attributes)); return *result; } diff --git a/src/runtime.h b/src/runtime.h index 475721bb30..00f38ca22b 100644 --- a/src/runtime.h +++ b/src/runtime.h @@ -224,7 +224,7 @@ namespace internal { F(GlobalProxy, 1, 1) \ F(IsAttachedGlobal, 1, 1) \ \ - F(AddProperty, 4, 1) \ + F(AddNamedProperty, 4, 1) \ F(AddPropertyForTemplate, 4, 1) \ F(SetProperty, 4, 1) \ F(DefineDataPropertyUnchecked, 4, 1) \ diff --git a/src/string-iterator.js b/src/string-iterator.js index 7a2309de70..7222885a56 100644 --- a/src/string-iterator.js +++ b/src/string-iterator.js @@ -84,8 +84,8 @@ function SetUpStringIterator() { 'next', StringIteratorNext )); %FunctionSetName(StringIteratorIterator, '[Symbol.iterator]'); - %AddProperty(StringIterator.prototype, symbolIterator, StringIteratorIterator, - DONT_ENUM); + %AddNamedProperty(StringIterator.prototype, symbolIterator, + StringIteratorIterator, DONT_ENUM); } SetUpStringIterator(); @@ -100,7 +100,7 @@ function ExtendStringPrototypeWithIterator() { %CheckIsBootstrapping(); %FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]'); - %AddProperty($String.prototype, symbolIterator, StringPrototypeIterator, - DONT_ENUM); + %AddNamedProperty($String.prototype, symbolIterator, + StringPrototypeIterator, DONT_ENUM); } ExtendStringPrototypeWithIterator(); diff --git a/src/string.js b/src/string.js index d949c64433..9719df4c28 100644 --- a/src/string.js +++ b/src/string.js @@ -915,7 +915,7 @@ function SetUpString() { %FunctionSetPrototype($String, new $String()); // Set up the constructor property on the String prototype object. - %AddProperty($String.prototype, "constructor", $String, DONT_ENUM); + %AddNamedProperty($String.prototype, "constructor", $String, DONT_ENUM); // Set up the non-enumerable functions on the String object. InstallFunctions($String, DONT_ENUM, $Array( diff --git a/src/symbol.js b/src/symbol.js index c3e2aec0bc..0ac3a125a0 100644 --- a/src/symbol.js +++ b/src/symbol.js @@ -113,7 +113,7 @@ function SetUpSymbol() { "keyFor", SymbolKeyFor )); - %AddProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); + %AddNamedProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); InstallFunctions($Symbol.prototype, DONT_ENUM, $Array( "toString", SymbolToString, "valueOf", SymbolValueOf diff --git a/src/typedarray.js b/src/typedarray.js index ab5fc5c9e3..c149b35b98 100644 --- a/src/typedarray.js +++ b/src/typedarray.js @@ -299,13 +299,13 @@ macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) %SetCode(global.NAME, NAMEConstructor); %FunctionSetPrototype(global.NAME, new $Object()); - %AddProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, - READ_ONLY | DONT_ENUM | DONT_DELETE); - %AddProperty(global.NAME.prototype, - "constructor", global.NAME, DONT_ENUM); - %AddProperty(global.NAME.prototype, - "BYTES_PER_ELEMENT", ELEMENT_SIZE, - READ_ONLY | DONT_ENUM | DONT_DELETE); + %AddNamedProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, + READ_ONLY | DONT_ENUM | DONT_DELETE); + %AddNamedProperty(global.NAME.prototype, + "constructor", global.NAME, DONT_ENUM); + %AddNamedProperty(global.NAME.prototype, + "BYTES_PER_ELEMENT", ELEMENT_SIZE, + READ_ONLY | DONT_ENUM | DONT_DELETE); InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer); InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset); InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength); @@ -436,7 +436,7 @@ function SetupDataView() { %FunctionSetPrototype($DataView, new $Object); // Set up constructor property on the DataView prototype. - %AddProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM); + %AddNamedProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM); InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS); InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset); diff --git a/src/v8natives.js b/src/v8natives.js index 576186a8a7..009a3fb112 100644 --- a/src/v8natives.js +++ b/src/v8natives.js @@ -28,7 +28,7 @@ function InstallFunctions(object, attributes, functions) { var f = functions[i + 1]; %FunctionSetName(f, key); %FunctionRemovePrototype(f); - %AddProperty(object, key, f, attributes); + %AddNamedProperty(object, key, f, attributes); %SetNativeFlag(f); } %ToFastProperties(object); @@ -65,7 +65,7 @@ function InstallConstants(object, constants) { for (var i = 0; i < constants.length; i += 2) { var name = constants[i]; var k = constants[i + 1]; - %AddProperty(object, name, k, attributes); + %AddNamedProperty(object, name, k, attributes); } %ToFastProperties(object); } @@ -86,13 +86,14 @@ function SetUpLockedPrototype(constructor, fields, methods) { } if (fields) { for (var i = 0; i < fields.length; i++) { - %AddProperty(prototype, fields[i], UNDEFINED, DONT_ENUM | DONT_DELETE); + %AddNamedProperty(prototype, fields[i], + UNDEFINED, DONT_ENUM | DONT_DELETE); } } for (var i = 0; i < methods.length; i += 2) { var key = methods[i]; var f = methods[i + 1]; - %AddProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY); + %AddNamedProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY); %SetNativeFlag(f); } %SetPrototype(prototype, null); @@ -190,13 +191,13 @@ function SetUpGlobal() { var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY; // ECMA 262 - 15.1.1.1. - %AddProperty(global, "NaN", NAN, attributes); + %AddNamedProperty(global, "NaN", NAN, attributes); // ECMA-262 - 15.1.1.2. - %AddProperty(global, "Infinity", INFINITY, attributes); + %AddNamedProperty(global, "Infinity", INFINITY, attributes); // ECMA-262 - 15.1.1.3. - %AddProperty(global, "undefined", UNDEFINED, attributes); + %AddNamedProperty(global, "undefined", UNDEFINED, attributes); // Set up non-enumerable function on the global object. InstallFunctions(global, DONT_ENUM, $Array( @@ -386,22 +387,22 @@ function FromGenericPropertyDescriptor(desc) { var obj = new $Object(); if (desc.hasValue()) { - %AddProperty(obj, "value", desc.getValue(), NONE); + %AddNamedProperty(obj, "value", desc.getValue(), NONE); } if (desc.hasWritable()) { - %AddProperty(obj, "writable", desc.isWritable(), NONE); + %AddNamedProperty(obj, "writable", desc.isWritable(), NONE); } if (desc.hasGetter()) { - %AddProperty(obj, "get", desc.getGet(), NONE); + %AddNamedProperty(obj, "get", desc.getGet(), NONE); } if (desc.hasSetter()) { - %AddProperty(obj, "set", desc.getSet(), NONE); + %AddNamedProperty(obj, "set", desc.getSet(), NONE); } if (desc.hasEnumerable()) { - %AddProperty(obj, "enumerable", desc.isEnumerable(), NONE); + %AddNamedProperty(obj, "enumerable", desc.isEnumerable(), NONE); } if (desc.hasConfigurable()) { - %AddProperty(obj, "configurable", desc.isConfigurable(), NONE); + %AddNamedProperty(obj, "configurable", desc.isConfigurable(), NONE); } return obj; } @@ -1407,7 +1408,7 @@ function SetUpObject() { %SetNativeFlag($Object); %SetCode($Object, ObjectConstructor); - %AddProperty($Object.prototype, "constructor", $Object, DONT_ENUM); + %AddNamedProperty($Object.prototype, "constructor", $Object, DONT_ENUM); // Set up non-enumerable functions on the Object.prototype object. InstallFunctions($Object.prototype, DONT_ENUM, $Array( @@ -1494,7 +1495,7 @@ function SetUpBoolean () { %SetCode($Boolean, BooleanConstructor); %FunctionSetPrototype($Boolean, new $Boolean(false)); - %AddProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); + %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); InstallFunctions($Boolean.prototype, DONT_ENUM, $Array( "toString", BooleanToString, @@ -1677,7 +1678,7 @@ function SetUpNumber() { %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); // Set up the constructor property on the Number prototype object. - %AddProperty($Number.prototype, "constructor", $Number, DONT_ENUM); + %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM); InstallConstants($Number, $Array( // ECMA-262 section 15.7.3.1. @@ -1860,7 +1861,7 @@ function SetUpFunction() { %CheckIsBootstrapping(); %SetCode($Function, FunctionConstructor); - %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); + %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM); InstallFunctions($Function.prototype, DONT_ENUM, $Array( "bind", FunctionBind, diff --git a/src/weak_collection.js b/src/weak_collection.js index d61243aa13..d9666ca128 100644 --- a/src/weak_collection.js +++ b/src/weak_collection.js @@ -89,7 +89,7 @@ function SetUpWeakMap() { %SetCode($WeakMap, WeakMapConstructor); %FunctionSetPrototype($WeakMap, new $Object()); - %AddProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); + %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); // Set up the non-enumerable functions on the WeakMap prototype object. InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( @@ -169,7 +169,7 @@ function SetUpWeakSet() { %SetCode($WeakSet, WeakSetConstructor); %FunctionSetPrototype($WeakSet, new $Object()); - %AddProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); + %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); // Set up the non-enumerable functions on the WeakSet prototype object. InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 625117205a..f4b410b591 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -21634,7 +21634,7 @@ TEST(AccessCheckThrows) { CheckCorrectThrow("has_own_property(other, 'x')"); CheckCorrectThrow("%GetProperty(other, 'x')"); CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)"); - CheckCorrectThrow("%AddProperty(other, 'x', 'foo', 1)"); + CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)"); CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); CheckCorrectThrow("%DeleteProperty(other, '1', 0)"); CheckCorrectThrow("%HasOwnProperty(other, 'x')"); diff --git a/test/mjsunit/regress/regress-1199637.js b/test/mjsunit/regress/regress-1199637.js index 3db48555fe..397aeb8762 100644 --- a/test/mjsunit/regress/regress-1199637.js +++ b/test/mjsunit/regress/regress-1199637.js @@ -34,43 +34,43 @@ const NONE = 0; const READ_ONLY = 1; // Use DeclareGlobal... -%AddProperty(this.__proto__, "a", 1234, NONE); +%AddNamedProperty(this.__proto__, "a", 1234, NONE); assertEquals(1234, a); eval("var a = 5678;"); assertEquals(5678, a); -%AddProperty(this.__proto__, "b", 1234, NONE); +%AddNamedProperty(this.__proto__, "b", 1234, NONE); assertEquals(1234, b); eval("const b = 5678;"); assertEquals(5678, b); -%AddProperty(this.__proto__, "c", 1234, READ_ONLY); +%AddNamedProperty(this.__proto__, "c", 1234, READ_ONLY); assertEquals(1234, c); eval("var c = 5678;"); assertEquals(5678, c); -%AddProperty(this.__proto__, "d", 1234, READ_ONLY); +%AddNamedProperty(this.__proto__, "d", 1234, READ_ONLY); assertEquals(1234, d); eval("const d = 5678;"); assertEquals(5678, d); // Use DeclareContextSlot... -%AddProperty(this.__proto__, "x", 1234, NONE); +%AddNamedProperty(this.__proto__, "x", 1234, NONE); assertEquals(1234, x); eval("with({}) { var x = 5678; }"); assertEquals(5678, x); -%AddProperty(this.__proto__, "y", 1234, NONE); +%AddNamedProperty(this.__proto__, "y", 1234, NONE); assertEquals(1234, y); eval("with({}) { const y = 5678; }"); assertEquals(5678, y); -%AddProperty(this.__proto__, "z", 1234, READ_ONLY); +%AddNamedProperty(this.__proto__, "z", 1234, READ_ONLY); assertEquals(1234, z); eval("with({}) { var z = 5678; }"); assertEquals(5678, z); -%AddProperty(this.__proto__, "w", 1234, READ_ONLY); +%AddNamedProperty(this.__proto__, "w", 1234, READ_ONLY); assertEquals(1234, w); eval("with({}) { const w = 5678; }"); assertEquals(5678, w); diff --git a/test/mjsunit/regress/regress-334.js b/test/mjsunit/regress/regress-334.js index 2a001d3c2f..c52c72aa90 100644 --- a/test/mjsunit/regress/regress-334.js +++ b/test/mjsunit/regress/regress-334.js @@ -37,10 +37,10 @@ function func1(){} function func2(){} var object = {__proto__:{}}; -%AddProperty(object, "foo", func1, DONT_ENUM | DONT_DELETE); -%AddProperty(object, "bar", func1, DONT_ENUM | READ_ONLY); -%AddProperty(object, "baz", func1, DONT_DELETE | READ_ONLY); -%AddProperty(object.__proto__, "bif", func1, DONT_ENUM | DONT_DELETE); +%AddNamedProperty(object, "foo", func1, DONT_ENUM | DONT_DELETE); +%AddNamedProperty(object, "bar", func1, DONT_ENUM | READ_ONLY); +%AddNamedProperty(object, "baz", func1, DONT_DELETE | READ_ONLY); +%AddNamedProperty(object.__proto__, "bif", func1, DONT_ENUM | DONT_DELETE); object.bif = func2; function enumerable(obj) { diff --git a/test/mjsunit/regress/regress-cntl-descriptors-enum.js b/test/mjsunit/regress/regress-cntl-descriptors-enum.js index 861ab27393..fd4ac6d6c0 100644 --- a/test/mjsunit/regress/regress-cntl-descriptors-enum.js +++ b/test/mjsunit/regress/regress-cntl-descriptors-enum.js @@ -30,10 +30,10 @@ DontEnum = 2; var o = {}; -%AddProperty(o, "a", 0, DontEnum); +%AddNamedProperty(o, "a", 0, DontEnum); var o2 = {}; -%AddProperty(o2, "a", 0, DontEnum); +%AddNamedProperty(o2, "a", 0, DontEnum); assertTrue(%HaveSameMap(o, o2)); diff --git a/test/mjsunit/runtime-gen/addproperty.js b/test/mjsunit/runtime-gen/addnamedproperty.js similarity index 75% rename from test/mjsunit/runtime-gen/addproperty.js rename to test/mjsunit/runtime-gen/addnamedproperty.js index 48b985d094..df4aaed9db 100644 --- a/test/mjsunit/runtime-gen/addproperty.js +++ b/test/mjsunit/runtime-gen/addnamedproperty.js @@ -2,7 +2,7 @@ // AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY // Flags: --allow-natives-syntax --harmony var _object = new Object(); -var arg1 = 10; +var arg1 = "bla"; var _value = new Object(); var _unchecked_attributes = 1; -%AddProperty(_object, arg1, _value, _unchecked_attributes); +%AddNamedProperty(_object, arg1, _value, _unchecked_attributes); diff --git a/tools/generate-runtime-tests.py b/tools/generate-runtime-tests.py index c81d90007b..be12501436 100755 --- a/tools/generate-runtime-tests.py +++ b/tools/generate-runtime-tests.py @@ -211,7 +211,7 @@ _NUMBER_FORMAT = ( # Format: "FunctionName": ["arg0", "arg1", ..., argslength]. # None means "fall back to autodetected value". CUSTOM_KNOWN_GOOD_INPUT = { - "AddProperty": [None, 10, None, None, None], + "AddNamedProperty": [None, "\"bla\"", None, None, None], "AddPropertyForTemplate": [None, 10, None, None, None], "Apply": ["function() {}", None, None, None, None, None], "ArrayBufferSliceImpl": [None, None, 0, None],