Split SetProperty(...attributes, strictmode) into DefineProperty(...attributes) and SetProperty(...strictmode)

BUG=
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/351853005

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22064 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-06-27 13:48:37 +00:00
parent 0133d96be3
commit 63431b23d1
47 changed files with 298 additions and 344 deletions

View File

@ -3030,6 +3030,9 @@ uint32_t Value::Uint32Value() const {
}
// TODO(verwaest): Remove the attribs argument, since it doesn't make sense for
// existing properties. Use ForceSet instead to define or redefine properties
// with specific attributes.
bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
v8::PropertyAttribute attribs) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
@ -3041,12 +3044,8 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
has_pending_exception = i::Runtime::SetObjectProperty(
isolate,
self,
key_obj,
value_obj,
static_cast<PropertyAttributes>(attribs),
i::SLOPPY).is_null();
isolate, self, key_obj, value_obj, i::SLOPPY,
static_cast<PropertyAttributes>(attribs)).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
@ -3078,7 +3077,7 @@ bool v8::Object::ForceSet(v8::Handle<Value> key,
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
has_pending_exception = i::Runtime::ForceSetObjectProperty(
has_pending_exception = i::Runtime::DefineObjectProperty(
self,
key_obj,
value_obj,

View File

@ -30,10 +30,16 @@ function Instantiate(data, name) {
var Constructor = %GetTemplateField(data, kApiConstructorOffset);
// Note: Do not directly use a function template as a condition, our
// internal ToBoolean doesn't handle that!
var result = typeof Constructor === 'undefined' ?
{} : new (Instantiate(Constructor))();
ConfigureTemplateInstance(result, data);
result = %ToFastProperties(result);
var result;
if (typeof Constructor === 'undefined') {
result = {};
ConfigureTemplateInstance(result, data);
} else {
// ConfigureTemplateInstance is implicitly called before calling the API
// constructor in HandleApiCall.
result = new (Instantiate(Constructor))();
result = %ToFastProperties(result);
}
return result;
default:
throw 'Unknown API tag <' + tag + '>';
@ -93,15 +99,15 @@ function ConfigureTemplateInstance(obj, data) {
var prop_data = properties[i + 2];
var attributes = properties[i + 3];
var value = Instantiate(prop_data, name);
%SetProperty(obj, name, value, attributes);
%AddProperty(obj, name, value, attributes);
} else if (length == 4 || length == 5) {
// TODO(verwaest): The 5th value used to be access_control. Remove once
// the bindings are updated.
var name = properties[i + 1];
var getter = properties[i + 2];
var setter = properties[i + 3];
var getter = Instantiate(properties[i + 2]);
var setter = Instantiate(properties[i + 3]);
var attribute = properties[i + 4];
%SetAccessorProperty(obj, name, getter, setter, attribute);
%DefineAccessorPropertyUnchecked(obj, name, getter, setter, attribute);
} else {
throw "Bad properties array";
}

View File

@ -1696,7 +1696,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
if (property->emit_store()) {
__ mov(r0, Operand(Smi::FromInt(NONE))); // PropertyAttributes
__ push(r0);
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
__ Drop(3);
}
@ -1734,7 +1734,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->setter);
__ mov(r0, Operand(Smi::FromInt(NONE)));
__ push(r0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -872,11 +872,10 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
// Push receiver, key and value for runtime call.
__ Push(r2, r1, r0);
__ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes
__ mov(r0, Operand(Smi::FromInt(strict_mode))); // Strict mode.
__ Push(r1, r0);
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}

View File

@ -1698,7 +1698,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
__ Mov(x0, Smi::FromInt(NONE)); // PropertyAttributes
__ Push(x0);
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
VisitForEffect(key);
VisitForEffect(value);
@ -1736,7 +1736,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->setter);
__ Mov(x10, Smi::FromInt(NONE));
__ Push(x10);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -110,7 +110,7 @@ function SetUpArrayIterator() {
'next', ArrayIteratorNext
));
%FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]');
%SetProperty(ArrayIterator.prototype, symbolIterator, ArrayIteratorIterator,
%AddProperty(ArrayIterator.prototype, symbolIterator, ArrayIteratorIterator,
DONT_ENUM);
}
SetUpArrayIterator();
@ -125,7 +125,7 @@ function ExtendArrayPrototype() {
'keys', ArrayKeys
));
%SetProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM);
%AddProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM);
}
ExtendArrayPrototype();
@ -146,10 +146,10 @@ macro TYPED_ARRAYS(FUNCTION)
endmacro
macro EXTEND_TYPED_ARRAY(NAME)
%SetProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM);
%SetProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM);
%SetProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM);
%SetProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM);
%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);
endmacro
TYPED_ARRAYS(EXTEND_TYPED_ARRAY)

View File

@ -445,7 +445,7 @@ function ArrayPush() {
for (var i = 0; i < m; i++) {
// Use SetProperty rather than a direct keyed store to ensure that the store
// site doesn't become poisened with an elements transition KeyedStoreIC.
%SetProperty(array, i+n, %_Arguments(i), 0, kStrictMode);
%SetProperty(array, i+n, %_Arguments(i), kStrictMode);
}
var new_length = n + m;
@ -1462,7 +1462,7 @@ function SetUpArray() {
// Set up non-enumerable constructor property on the Array.prototype
// object.
%SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM);
%AddProperty($Array.prototype, "constructor", $Array, DONT_ENUM);
// Set up non-enumerable functions on the Array object.
InstallFunctions($Array, DONT_ENUM, $Array(

View File

@ -74,7 +74,7 @@ function SetUpArrayBuffer() {
%FunctionSetPrototype($ArrayBuffer, new $Object());
// Set up the constructor property on the ArrayBuffer prototype object.
%SetProperty($ArrayBuffer.prototype, "constructor", $ArrayBuffer, DONT_ENUM);
%AddProperty($ArrayBuffer.prototype, "constructor", $ArrayBuffer, DONT_ENUM);
InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen);

View File

@ -855,11 +855,11 @@ void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
native_context()->set_security_token(*inner_global);
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
Runtime::ForceSetObjectProperty(builtins_global,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global")),
inner_global,
attributes).Assert();
Runtime::DefineObjectProperty(builtins_global,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global")),
inner_global,
attributes).Assert();
// Set up the reference from the global object to the builtins object.
JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
TransferNamedProperties(inner_global_from_snapshot, inner_global);
@ -2669,11 +2669,11 @@ Genesis::Genesis(Isolate* isolate,
Utils::OpenHandle(*buffer)->set_should_be_freed(true);
v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems);
Handle<JSBuiltinsObject> builtins(native_context()->builtins());
Runtime::ForceSetObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("rngstate")),
Utils::OpenHandle(*ta),
NONE).Assert();
Runtime::DefineObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("rngstate")),
Utils::OpenHandle(*ta),
NONE).Assert();
// Initialize trigonometric lookup tables and constants.
const int table_num_bytes = TrigonometricLookupTable::table_num_bytes();
@ -2688,25 +2688,25 @@ Genesis::Genesis(Isolate* isolate,
v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New(
cos_buffer, 0, TrigonometricLookupTable::table_size());
Runtime::ForceSetObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSinTable")),
Utils::OpenHandle(*sin_table),
NONE).Assert();
Runtime::ForceSetObjectProperty(
Runtime::DefineObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSinTable")),
Utils::OpenHandle(*sin_table),
NONE).Assert();
Runtime::DefineObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kCosXIntervalTable")),
Utils::OpenHandle(*cos_table),
NONE).Assert();
Runtime::ForceSetObjectProperty(
Runtime::DefineObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSamples")),
factory()->NewHeapNumber(
TrigonometricLookupTable::samples()),
NONE).Assert();
Runtime::ForceSetObjectProperty(
Runtime::DefineObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kIndexConvert")),

View File

@ -75,7 +75,7 @@ function SetUpSetIterator() {
));
%FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]');
%SetProperty(SetIterator.prototype, symbolIterator,
%AddProperty(SetIterator.prototype, symbolIterator,
SetIteratorSymbolIterator, DONT_ENUM);
}
@ -90,8 +90,7 @@ function ExtendSetPrototype() {
'values', SetValues
));
%SetProperty($Set.prototype, symbolIterator, SetValues,
DONT_ENUM);
%AddProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM);
}
ExtendSetPrototype();
@ -172,7 +171,7 @@ function SetUpMapIterator() {
));
%FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]');
%SetProperty(MapIterator.prototype, symbolIterator,
%AddProperty(MapIterator.prototype, symbolIterator,
MapIteratorSymbolIterator, DONT_ENUM);
}
@ -188,8 +187,7 @@ function ExtendMapPrototype() {
'values', MapValues
));
%SetProperty($Map.prototype, symbolIterator, MapEntries,
DONT_ENUM);
%AddProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM);
}
ExtendMapPrototype();

View File

@ -147,7 +147,7 @@ function SetUpSet() {
%SetCode($Set, SetConstructor);
%FunctionSetPrototype($Set, new $Object());
%SetProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
%AddProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
%FunctionSetLength(SetForEach, 1);
@ -282,7 +282,7 @@ function SetUpMap() {
%SetCode($Map, MapConstructor);
%FunctionSetPrototype($Map, new $Object());
%SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
%AddProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
%FunctionSetLength(MapForEach, 1);

View File

@ -763,7 +763,7 @@ function SetUpDate() {
));
// Set up non-enumerable constructor property of the Date prototype object.
%SetProperty($Date.prototype, "constructor", $Date, DONT_ENUM);
%AddProperty($Date.prototype, "constructor", $Date, DONT_ENUM);
// Set up non-enumerable functions of the Date prototype object and
// set their names.

View File

@ -63,14 +63,14 @@ function SetUpGenerators() {
["next", GeneratorObjectNext,
"throw", GeneratorObjectThrow]);
%FunctionSetName(GeneratorObjectIterator, '[Symbol.iterator]');
%SetProperty(GeneratorObjectPrototype, symbolIterator, GeneratorObjectIterator,
DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetProperty(GeneratorObjectPrototype, "constructor",
GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY);
%AddProperty(GeneratorObjectPrototype, symbolIterator,
GeneratorObjectIterator, DONT_ENUM | DONT_DELETE | READ_ONLY);
%AddProperty(GeneratorObjectPrototype, "constructor",
GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetPrototype(GeneratorFunctionPrototype, $Function.prototype);
%SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
%SetProperty(GeneratorFunctionPrototype, "constructor",
GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
%AddProperty(GeneratorFunctionPrototype, "constructor",
GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetPrototype(GeneratorFunction, $Function);
%SetCode(GeneratorFunction, GeneratorFunctionConstructor);
}

View File

@ -942,7 +942,7 @@ function initializeCollator(collator, locales, options) {
*
* @constructor
*/
%SetProperty(Intl, 'Collator', function() {
%AddProperty(Intl, 'Collator', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
@ -960,7 +960,7 @@ function initializeCollator(collator, locales, options) {
/**
* Collator resolvedOptions method.
*/
%SetProperty(Intl.Collator.prototype, 'resolvedOptions', function() {
%AddProperty(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.
*/
%SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) {
%AddProperty(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
*/
%SetProperty(Intl, 'NumberFormat', function() {
%AddProperty(Intl, 'NumberFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
@ -1187,7 +1187,7 @@ function initializeNumberFormat(numberFormat, locales, options) {
/**
* NumberFormat resolvedOptions method.
*/
%SetProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() {
%AddProperty(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.
*/
%SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) {
%AddProperty(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
*/
%SetProperty(Intl, 'DateTimeFormat', function() {
%AddProperty(Intl, 'DateTimeFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
@ -1580,7 +1580,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
/**
* DateTimeFormat resolvedOptions method.
*/
%SetProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() {
%AddProperty(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.
*/
%SetProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) {
%AddProperty(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
*/
%SetProperty(Intl, 'v8BreakIterator', function() {
%AddProperty(Intl, 'v8BreakIterator', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
@ -1786,7 +1786,7 @@ function initializeBreakIterator(iterator, locales, options) {
/**
* BreakIterator resolvedOptions method.
*/
%SetProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() {
%AddProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() {
if (%_IsConstructCall()) {
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
}
@ -1819,7 +1819,7 @@ function initializeBreakIterator(iterator, locales, options) {
* order in the returned list as in the input list.
* Options are optional parameter.
*/
%SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) {
%AddProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) {
if (%_IsConstructCall()) {
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
}

View File

@ -1647,7 +1647,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
if (property->emit_store()) {
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
__ Drop(3);
}
@ -1680,7 +1680,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->getter);
EmitAccessor(it->second->setter);
__ push(Immediate(Smi::FromInt(NONE)));
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -1132,12 +1132,11 @@ void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
__ push(edx);
__ push(ecx);
__ push(eax);
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
__ push(Immediate(Smi::FromInt(strict_mode)));
__ push(ebx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
@ -1154,12 +1153,11 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
__ push(edx);
__ push(ecx);
__ push(eax);
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
__ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode.
__ push(ebx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}

View File

@ -1743,7 +1743,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
isolate(),
result,
Runtime::SetObjectProperty(
isolate(), object, key, value, NONE, strict_mode()),
isolate(), object, key, value, strict_mode()),
Object);
return result;
}
@ -1811,7 +1811,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
isolate(),
store_handle,
Runtime::SetObjectProperty(
isolate(), object, key, value, NONE, strict_mode()),
isolate(), object, key, value, strict_mode()),
Object);
}
@ -2143,7 +2143,7 @@ RUNTIME_FUNCTION(StoreIC_Slow) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
isolate, object, key, value, strict_mode));
return *result;
}
@ -2160,7 +2160,7 @@ RUNTIME_FUNCTION(KeyedStoreIC_Slow) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
isolate, object, key, value, strict_mode));
return *result;
}
@ -2184,7 +2184,7 @@ RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
isolate, object, key, value, strict_mode));
return *result;
}

View File

@ -260,7 +260,7 @@ function SetUpMath() {
%CheckIsBootstrapping();
%SetPrototype($Math, $Object.prototype);
%SetProperty(global, "Math", $Math, DONT_ENUM);
%AddProperty(global, "Math", $Math, DONT_ENUM);
%FunctionSetInstanceClassName(MathConstructor, 'Math');
// Set up math constants.

View File

@ -286,7 +286,7 @@ function MakeGenericError(constructor, type, args) {
* Set up the Script function and constructor.
*/
%FunctionSetInstanceClassName(Script, 'Script');
%SetProperty(Script.prototype, 'constructor', Script,
%AddProperty(Script.prototype, 'constructor', Script,
DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetCode(Script, function(x) {
// Script objects can only be created by the VM.
@ -1148,7 +1148,7 @@ function captureStackTrace(obj, cons_opt) {
// holder of this setter, the accessor pair is turned into a data property.
var setter = function(v) {
// Set data property on the receiver (not necessarily holder).
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
%DefineDataPropertyUnchecked(this, 'stack', v, NONE);
if (this === obj) {
// Release context values if holder is the same as the receiver.
stack = error_string = UNDEFINED;
@ -1163,14 +1163,14 @@ function captureStackTrace(obj, cons_opt) {
// Stack is still a raw array awaiting to be formatted.
var result = FormatStackTrace(obj, error_string, GetStackFrames(stack));
// Replace this accessor to return result directly.
%DefineOrRedefineAccessorProperty(
%DefineAccessorPropertyUnchecked(
obj, 'stack', function() { return result }, setter, DONT_ENUM);
// Release context values.
stack = error_string = UNDEFINED;
return result;
};
%DefineOrRedefineAccessorProperty(obj, 'stack', getter, setter, DONT_ENUM);
%DefineAccessorPropertyUnchecked(obj, 'stack', getter, setter, DONT_ENUM);
}
@ -1185,8 +1185,9 @@ function SetUpError() {
// effects when overwriting the error functions from
// user code.
var name = f.name;
%SetProperty(global, name, f, DONT_ENUM);
%SetProperty(builtins, '$' + name, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
%AddProperty(global, name, f, DONT_ENUM);
%AddProperty(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.
@ -1201,17 +1202,16 @@ function SetUpError() {
%FunctionSetPrototype(f, new $Error());
}
%FunctionSetInstanceClassName(f, 'Error');
%SetProperty(f.prototype, 'constructor', f, DONT_ENUM);
%SetProperty(f.prototype, "name", name, DONT_ENUM);
%AddProperty(f.prototype, 'constructor', f, DONT_ENUM);
%AddProperty(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.
%IgnoreAttributesAndSetProperty(this, 'stack', UNDEFINED, DONT_ENUM);
%AddProperty(this, 'stack', UNDEFINED, DONT_ENUM);
if (!IS_UNDEFINED(m)) {
%IgnoreAttributesAndSetProperty(
this, 'message', ToString(m), DONT_ENUM);
%AddProperty(this, 'message', ToString(m), DONT_ENUM);
}
captureStackTrace(this, f);
} else {
@ -1234,7 +1234,7 @@ SetUpError();
$Error.captureStackTrace = captureStackTrace;
%SetProperty($Error.prototype, 'message', '', DONT_ENUM);
%AddProperty($Error.prototype, 'message', '', DONT_ENUM);
// Global list of error objects visited during ErrorToString. This is
// used to detect cycles in error toString formatting.
@ -1311,7 +1311,7 @@ function SetUpStackOverflowBoilerplate() {
// Set the 'stack' property on the receiver. If the receiver is the same as
// holder of this setter, the accessor pair is turned into a data property.
var setter = function(v) {
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
%DefineDataPropertyUnchecked(this, 'stack', v, NONE);
// Tentatively clear the hidden property. If the receiver is the same as
// holder, we release the raw stack trace this way.
%GetAndClearOverflowedStackTrace(this);
@ -1333,12 +1333,12 @@ function SetUpStackOverflowBoilerplate() {
var result = FormatStackTrace(holder, error_string, GetStackFrames(stack));
// Replace this accessor to return result directly.
%DefineOrRedefineAccessorProperty(
%DefineAccessorPropertyUnchecked(
holder, 'stack', function() { return result }, setter, DONT_ENUM);
return result;
};
%DefineOrRedefineAccessorProperty(
%DefineAccessorPropertyUnchecked(
boilerplate, 'stack', getter, setter, DONT_ENUM);
return boilerplate;

View File

@ -1707,7 +1707,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
if (property->emit_store()) {
__ li(a0, Operand(Smi::FromInt(NONE))); // PropertyAttributes.
__ push(a0);
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
__ Drop(3);
}
@ -1744,7 +1744,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->setter);
__ li(a0, Operand(Smi::FromInt(NONE)));
__ push(a0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -438,8 +438,7 @@ function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) {
for (var prop in changeRecord) {
if (prop === 'object' || (hasType && prop === 'type')) continue;
%DefineOrRedefineDataProperty(newRecord, prop, changeRecord[prop],
READ_ONLY + DONT_DELETE);
%AddProperty(newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE);
}
ObjectFreezeJS(newRecord);

View File

@ -299,7 +299,7 @@ var promiseRaw = GLOBAL_PRIVATE("Promise#raw");
// Install exported functions.
%CheckIsBootstrapping();
%SetProperty(global, 'Promise', $Promise, DONT_ENUM);
%AddProperty(global, 'Promise', $Promise, DONT_ENUM);
InstallFunctions($Promise, DONT_ENUM, [
"defer", PromiseDeferred,
"accept", PromiseResolved,

View File

@ -381,7 +381,7 @@ var lastMatchInfoOverride = null;
function SetUpRegExp() {
%CheckIsBootstrapping();
%FunctionSetInstanceClassName($RegExp, 'RegExp');
%SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM);
%AddProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM);
%SetCode($RegExp, RegExpConstructor);
InstallFunctions($RegExp.prototype, DONT_ENUM, $Array(
@ -406,12 +406,12 @@ function SetUpRegExp() {
};
%OptimizeObjectForAddingMultipleProperties($RegExp, 22);
%DefineOrRedefineAccessorProperty($RegExp, 'input', RegExpGetInput,
RegExpSetInput, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$_', RegExpGetInput,
RegExpSetInput, DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$input', RegExpGetInput,
RegExpSetInput, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'input', RegExpGetInput,
RegExpSetInput, DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$_', RegExpGetInput,
RegExpSetInput, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$input', RegExpGetInput,
RegExpSetInput, DONT_ENUM | DONT_DELETE);
// The properties multiline and $* are aliases for each other. When this
// value is set in SpiderMonkey, the value it is set to is coerced to a
@ -425,40 +425,40 @@ function SetUpRegExp() {
var RegExpGetMultiline = function() { return multiline; };
var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; };
%DefineOrRedefineAccessorProperty($RegExp, 'multiline', RegExpGetMultiline,
RegExpSetMultiline, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$*', RegExpGetMultiline,
RegExpSetMultiline,
DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'multiline', RegExpGetMultiline,
RegExpSetMultiline, DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$*', RegExpGetMultiline,
RegExpSetMultiline,
DONT_ENUM | DONT_DELETE);
var NoOpSetter = function(ignored) {};
// Static properties set by a successful match.
%DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', RegExpGetLastMatch,
NoOpSetter, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$&', RegExpGetLastMatch,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'lastParen', RegExpGetLastParen,
NoOpSetter, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$+', RegExpGetLastParen,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'leftContext',
RegExpGetLeftContext, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$`', RegExpGetLeftContext,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'rightContext',
RegExpGetRightContext, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, "$'", RegExpGetRightContext,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'lastMatch', RegExpGetLastMatch,
NoOpSetter, DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$&', RegExpGetLastMatch,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'lastParen', RegExpGetLastParen,
NoOpSetter, DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$+', RegExpGetLastParen,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'leftContext',
RegExpGetLeftContext, NoOpSetter,
DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$`', RegExpGetLeftContext,
NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, 'rightContext',
RegExpGetRightContext, NoOpSetter,
DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, "$'", RegExpGetRightContext,
NoOpSetter, DONT_ENUM | DONT_DELETE);
for (var i = 1; i < 10; ++i) {
%DefineOrRedefineAccessorProperty($RegExp, '$' + i,
RegExpMakeCaptureGetter(i), NoOpSetter,
DONT_DELETE);
%DefineAccessorPropertyUnchecked($RegExp, '$' + i,
RegExpMakeCaptureGetter(i), NoOpSetter,
DONT_DELETE);
}
%ToFastProperties($RegExp);
}

View File

@ -273,8 +273,12 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
if (key->IsInternalizedString()) {
if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
// Array index as string (uint32).
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
if (value->IsUninitialized()) {
maybe_result = value;
} else {
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
}
} else {
Handle<String> name(String::cast(*key));
ASSERT(!name->AsArrayIndex(&element_index));
@ -284,8 +288,12 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
}
} else if (key->ToArrayIndex(&element_index)) {
// Array index (uint32).
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
if (value->IsUninitialized()) {
maybe_result = value;
} else {
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
}
} else {
// Non-uint32 number.
ASSERT(key->IsNumber());
@ -2097,37 +2105,6 @@ RUNTIME_FUNCTION(Runtime_EnableAccessChecks) {
}
// Transform getter or setter into something DefineAccessor can handle.
static Handle<Object> InstantiateAccessorComponent(Isolate* isolate,
Handle<Object> component) {
if (component->IsUndefined()) return isolate->factory()->null_value();
Handle<FunctionTemplateInfo> info =
Handle<FunctionTemplateInfo>::cast(component);
return Utils::OpenHandle(*Utils::ToLocal(info)->GetFunction());
}
RUNTIME_FUNCTION(Runtime_SetAccessorProperty) {
HandleScope scope(isolate);
ASSERT(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
CONVERT_SMI_ARG_CHECKED(attribute, 4);
RUNTIME_ASSERT(getter->IsUndefined() || getter->IsFunctionTemplateInfo());
RUNTIME_ASSERT(setter->IsUndefined() || setter->IsFunctionTemplateInfo());
RUNTIME_ASSERT(PropertyDetails::AttributesField::is_valid(
static_cast<PropertyAttributes>(attribute)));
JSObject::DefineAccessor(object,
name,
InstantiateAccessorComponent(isolate, getter),
InstantiateAccessorComponent(isolate, setter),
static_cast<PropertyAttributes>(attribute));
return isolate->heap()->undefined_value();
}
static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) {
HandleScope scope(isolate);
Handle<Object> args[1] = { name };
@ -5039,7 +5016,7 @@ static bool IsValidAccessor(Handle<Object> obj) {
// Steps 9c & 12 - replace an existing data property with an accessor property.
// Step 12 - update an existing accessor property with an accessor or generic
// descriptor.
RUNTIME_FUNCTION(Runtime_DefineOrRedefineAccessorProperty) {
RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
HandleScope scope(isolate);
ASSERT(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
@ -5068,7 +5045,7 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineAccessorProperty) {
// Steps 9b & 12 - replace an existing accessor property with a data property.
// Step 12 - update an existing data property with a data or generic
// descriptor.
RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
HandleScope scope(isolate);
ASSERT(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0);
@ -5126,7 +5103,7 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::ForceSetObjectProperty(
Runtime::DefineObjectProperty(
js_object, name, obj_value, attr,
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED));
return *result;
@ -5147,10 +5124,8 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
StrictMode strict_mode) {
SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY;
StrictMode strict_mode,
PropertyAttributes attrs) {
if (object->IsUndefined() || object->IsNull()) {
Handle<Object> args[2] = { key, object };
Handle<Object> error =
@ -5169,8 +5144,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
}
Handle<Name> name = Handle<Name>::cast(name_object);
return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value,
attr,
strict_mode);
attrs, strict_mode);
}
// If the object isn't a JavaScript object, we ignore the store.
@ -5202,7 +5176,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
}
MaybeHandle<Object> result = JSObject::SetElement(
js_object, index, value, attr, strict_mode, true, set_mode);
js_object, index, value, attrs, strict_mode, true, SET_PROPERTY);
JSObject::ValidateElements(js_object);
return result.is_null() ? result : value;
@ -5217,11 +5191,12 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
isolate, value, Execution::ToNumber(isolate, value), Object);
}
}
return JSObject::SetElement(js_object, index, value, attr,
strict_mode, true, set_mode);
return JSObject::SetElement(js_object, index, value, attrs,
strict_mode, true, SET_PROPERTY);
} else {
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
return JSReceiver::SetProperty(
js_object, name, value, attrs, strict_mode);
}
}
@ -5232,15 +5207,15 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
Handle<String> name = Handle<String>::cast(converted);
if (name->AsArrayIndex(&index)) {
return JSObject::SetElement(js_object, index, value, attr,
strict_mode, true, set_mode);
return JSObject::SetElement(js_object, index, value, attrs,
strict_mode, true, SET_PROPERTY);
} else {
return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
return JSReceiver::SetProperty(js_object, name, value, attrs, strict_mode);
}
}
MaybeHandle<Object> Runtime::ForceSetObjectProperty(
MaybeHandle<Object> Runtime::DefineObjectProperty(
Handle<JSObject> js_object,
Handle<Object> key,
Handle<Object> value,
@ -5345,11 +5320,11 @@ RUNTIME_FUNCTION(Runtime_SetHiddenProperty) {
}
RUNTIME_FUNCTION(Runtime_SetProperty) {
RUNTIME_FUNCTION(Runtime_AddProperty) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4 || args.length() == 5);
RUNTIME_ASSERT(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3);
@ -5359,17 +5334,41 @@ RUNTIME_FUNCTION(Runtime_SetProperty) {
PropertyAttributes attributes =
static_cast<PropertyAttributes>(unchecked_attributes);
StrictMode strict_mode = SLOPPY;
if (args.length() == 5) {
CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_arg, 4);
strict_mode = strict_mode_arg;
#ifdef DEBUG
if (key->IsName()) {
LookupIterator it(object, Handle<Name>::cast(key),
LookupIterator::CHECK_OWN);
JSReceiver::GetPropertyAttributes(&it);
RUNTIME_ASSERT(!it.IsFound());
} else {
uint32_t index = 0;
RUNTIME_ASSERT(key->ToArrayIndex(&index));
RUNTIME_ASSERT(!JSReceiver::HasOwnElement(object, index));
}
#endif
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, attributes, strict_mode));
Runtime::DefineObjectProperty(object, key, value, attributes));
return *result;
}
RUNTIME_FUNCTION(Runtime_SetProperty) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_arg, 3);
StrictMode strict_mode = strict_mode_arg;
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(isolate, object, key, value, strict_mode));
return *result;
}
@ -5523,32 +5522,6 @@ RUNTIME_FUNCTION(Runtime_DebugPromiseHandleEpilogue) {
}
// Set an own property, even if it is READ_ONLY. If the property does not
// exist, it will be added with attributes NONE.
RUNTIME_FUNCTION(Runtime_IgnoreAttributesAndSetProperty) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
// Compute attributes.
PropertyAttributes attributes = NONE;
if (args.length() == 4) {
CONVERT_SMI_ARG_CHECKED(unchecked_value, 3);
// Only attribute bits should be set.
RUNTIME_ASSERT(
(unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
attributes = static_cast<PropertyAttributes>(unchecked_value);
}
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetOwnPropertyIgnoreAttributes(
object, name, value, attributes));
return *result;
}
RUNTIME_FUNCTION(Runtime_DeleteProperty) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
@ -11418,7 +11391,7 @@ static MaybeHandle<JSObject> MaterializeStackLocalsWithFrameInspector(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY),
Runtime::SetObjectProperty(isolate, target, name, value, SLOPPY),
JSObject);
}
@ -11431,7 +11404,7 @@ static MaybeHandle<JSObject> MaterializeStackLocalsWithFrameInspector(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY),
Runtime::SetObjectProperty(isolate, target, name, value, SLOPPY),
JSObject);
}
@ -11520,8 +11493,7 @@ MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeLocalContext(
isolate, value, Object::GetPropertyOrElement(ext, key), JSObject);
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(
isolate, target, key, value, NONE, SLOPPY),
Runtime::SetObjectProperty(isolate, target, key, value, SLOPPY),
JSObject);
}
}
@ -11626,7 +11598,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
// We don't expect this to do anything except replacing
// property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE, SLOPPY).Assert();
SLOPPY).Assert();
return true;
}
}
@ -11677,8 +11649,7 @@ MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeClosure(
isolate, value, Object::GetPropertyOrElement(ext, key), JSObject);
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(
isolate, closure_scope, key, value, NONE, SLOPPY),
Runtime::DefineObjectProperty(closure_scope, key, value, NONE),
JSObject);
}
}
@ -11709,8 +11680,8 @@ static bool SetClosureVariableValue(Isolate* isolate,
Handle<JSObject> ext(JSObject::cast(context->extension()));
if (JSReceiver::HasProperty(ext, variable_name)) {
// We don't expect this to do anything except replacing property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE, SLOPPY).Assert();
Runtime::DefineObjectProperty(
ext, variable_name, new_value, NONE).Assert();
return true;
}
}
@ -11732,8 +11703,7 @@ MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope(
isolate->factory()->NewJSObject(isolate->object_function());
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, catch_scope, name, thrown_object,
NONE, SLOPPY),
Runtime::DefineObjectProperty(catch_scope, name, thrown_object, NONE),
JSObject);
return catch_scope;
}
@ -12796,8 +12766,7 @@ MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeArgumentsObject(
Handle<String> arguments_str = isolate->factory()->arguments_string();
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(
isolate, target, arguments_str, arguments, ::NONE, SLOPPY),
Runtime::DefineObjectProperty(target, arguments_str, arguments, NONE),
JSObject);
return target;
}

View File

@ -206,7 +206,6 @@ namespace internal {
F(GetTemplateField, 2, 1) \
F(DisableAccessChecks, 1, 1) \
F(EnableAccessChecks, 1, 1) \
F(SetAccessorProperty, 5, 1) \
\
/* Dates */ \
F(DateCurrentTime, 0, 1) \
@ -224,10 +223,10 @@ namespace internal {
F(GlobalReceiver, 1, 1) \
F(IsAttachedGlobal, 1, 1) \
\
F(SetProperty, -1 /* 4 or 5 */, 1) \
F(DefineOrRedefineDataProperty, 4, 1) \
F(DefineOrRedefineAccessorProperty, 5, 1) \
F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \
F(AddProperty, 4, 1) \
F(SetProperty, 4, 1) \
F(DefineDataPropertyUnchecked, 4, 1) \
F(DefineAccessorPropertyUnchecked, 5, 1) \
F(GetDataProperty, 2, 1) \
F(SetHiddenProperty, 3, 1) \
\
@ -800,21 +799,23 @@ class Runtime : public AllStatic {
Handle<Object> object,
uint32_t index);
// Do not use SetObjectProperty to configure a property with specific
// attributes. The argument will be removed once the API is adapted.
MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty(
Isolate* isolate,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
StrictMode strict_mode);
StrictMode strict_mode,
PropertyAttributes attributes = NONE);
MUST_USE_RESULT static MaybeHandle<Object> ForceSetObjectProperty(
MUST_USE_RESULT static MaybeHandle<Object> DefineObjectProperty(
Handle<JSObject> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
JSReceiver::StoreFromKeyed store_from_keyed
= JSReceiver::MAY_BE_STORE_FROM_KEYED);
JSReceiver::StoreFromKeyed store_from_keyed =
JSReceiver::MAY_BE_STORE_FROM_KEYED);
MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty(
Isolate* isolate,

View File

@ -368,13 +368,11 @@ bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
int context_index = Context::MIN_CONTEXT_SLOTS + i;
RETURN_ON_EXCEPTION_VALUE(
isolate,
Runtime::SetObjectProperty(
isolate,
Runtime::DefineObjectProperty(
scope_object,
Handle<String>(String::cast(scope_info->get(i + start))),
Handle<Object>(context->get(context_index), isolate),
::NONE,
SLOPPY),
::NONE),
false);
}
return true;

View File

@ -84,7 +84,7 @@ function SetUpStringIterator() {
'next', StringIteratorNext
));
%FunctionSetName(StringIteratorIterator, '[Symbol.iterator]');
%SetProperty(StringIterator.prototype, symbolIterator, StringIteratorIterator,
%AddProperty(StringIterator.prototype, symbolIterator, StringIteratorIterator,
DONT_ENUM);
}
SetUpStringIterator();
@ -100,7 +100,7 @@ function ExtendStringPrototypeWithIterator() {
%CheckIsBootstrapping();
%FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]');
%SetProperty($String.prototype, symbolIterator, StringPrototypeIterator,
%AddProperty($String.prototype, symbolIterator, StringPrototypeIterator,
DONT_ENUM);
}
ExtendStringPrototypeWithIterator();

View File

@ -915,7 +915,7 @@ function SetUpString() {
%FunctionSetPrototype($String, new $String());
// Set up the constructor property on the String prototype object.
%SetProperty($String.prototype, "constructor", $String, DONT_ENUM);
%AddProperty($String.prototype, "constructor", $String, DONT_ENUM);
// Set up the non-enumerable functions on the String object.
InstallFunctions($String, DONT_ENUM, $Array(

View File

@ -113,7 +113,7 @@ function SetUpSymbol() {
"keyFor", SymbolKeyFor
));
%SetProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM);
%AddProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM);
InstallFunctions($Symbol.prototype, DONT_ENUM, $Array(
"toString", SymbolToString,
"valueOf", SymbolValueOf

View File

@ -299,11 +299,11 @@ macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
%SetCode(global.NAME, NAMEConstructor);
%FunctionSetPrototype(global.NAME, new $Object());
%SetProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
%AddProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
READ_ONLY | DONT_ENUM | DONT_DELETE);
%SetProperty(global.NAME.prototype,
%AddProperty(global.NAME.prototype,
"constructor", global.NAME, DONT_ENUM);
%SetProperty(global.NAME.prototype,
%AddProperty(global.NAME.prototype,
"BYTES_PER_ELEMENT", ELEMENT_SIZE,
READ_ONLY | DONT_ENUM | DONT_DELETE);
InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer);
@ -436,7 +436,7 @@ function SetupDataView() {
%FunctionSetPrototype($DataView, new $Object);
// Set up constructor property on the DataView prototype.
%SetProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM);
%AddProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM);
InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS);
InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset);

View File

@ -28,7 +28,7 @@ function InstallFunctions(object, attributes, functions) {
var f = functions[i + 1];
%FunctionSetName(f, key);
%FunctionRemovePrototype(f);
%SetProperty(object, key, f, attributes);
%AddProperty(object, key, f, attributes);
%SetNativeFlag(f);
}
%ToFastProperties(object);
@ -39,7 +39,7 @@ function InstallFunctions(object, attributes, functions) {
function InstallGetter(object, name, getter) {
%FunctionSetName(getter, name);
%FunctionRemovePrototype(getter);
%DefineOrRedefineAccessorProperty(object, name, getter, null, DONT_ENUM);
%DefineAccessorPropertyUnchecked(object, name, getter, null, DONT_ENUM);
%SetNativeFlag(getter);
}
@ -50,7 +50,7 @@ function InstallGetterSetter(object, name, getter, setter) {
%FunctionSetName(setter, name);
%FunctionRemovePrototype(getter);
%FunctionRemovePrototype(setter);
%DefineOrRedefineAccessorProperty(object, name, getter, setter, DONT_ENUM);
%DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM);
%SetNativeFlag(getter);
%SetNativeFlag(setter);
}
@ -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];
%SetProperty(object, name, k, attributes);
%AddProperty(object, name, k, attributes);
}
%ToFastProperties(object);
}
@ -86,13 +86,13 @@ function SetUpLockedPrototype(constructor, fields, methods) {
}
if (fields) {
for (var i = 0; i < fields.length; i++) {
%SetProperty(prototype, fields[i], UNDEFINED, DONT_ENUM | DONT_DELETE);
%AddProperty(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];
%SetProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
%AddProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetNativeFlag(f);
}
%SetPrototype(prototype, null);
@ -190,13 +190,13 @@ function SetUpGlobal() {
var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
// ECMA 262 - 15.1.1.1.
%SetProperty(global, "NaN", NAN, attributes);
%AddProperty(global, "NaN", NAN, attributes);
// ECMA-262 - 15.1.1.2.
%SetProperty(global, "Infinity", INFINITY, attributes);
%AddProperty(global, "Infinity", INFINITY, attributes);
// ECMA-262 - 15.1.1.3.
%SetProperty(global, "undefined", UNDEFINED, attributes);
%AddProperty(global, "undefined", UNDEFINED, attributes);
// Set up non-enumerable function on the global object.
InstallFunctions(global, DONT_ENUM, $Array(
@ -386,24 +386,22 @@ function FromGenericPropertyDescriptor(desc) {
var obj = new $Object();
if (desc.hasValue()) {
%IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
%AddProperty(obj, "value", desc.getValue(), NONE);
}
if (desc.hasWritable()) {
%IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
%AddProperty(obj, "writable", desc.isWritable(), NONE);
}
if (desc.hasGetter()) {
%IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
%AddProperty(obj, "get", desc.getGet(), NONE);
}
if (desc.hasSetter()) {
%IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
%AddProperty(obj, "set", desc.getSet(), NONE);
}
if (desc.hasEnumerable()) {
%IgnoreAttributesAndSetProperty(obj, "enumerable",
desc.isEnumerable(), NONE);
%AddProperty(obj, "enumerable", desc.isEnumerable(), NONE);
}
if (desc.hasConfigurable()) {
%IgnoreAttributesAndSetProperty(obj, "configurable",
desc.isConfigurable(), NONE);
%AddProperty(obj, "configurable", desc.isConfigurable(), NONE);
}
return obj;
}
@ -833,7 +831,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
value = current.getValue();
}
%DefineOrRedefineDataProperty(obj, p, value, flag);
%DefineDataPropertyUnchecked(obj, p, value, flag);
} else {
// There are 3 cases that lead here:
// Step 4b - defining a new accessor property.
@ -843,7 +841,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
// descriptor.
var getter = desc.hasGetter() ? desc.getGet() : null;
var setter = desc.hasSetter() ? desc.getSet() : null;
%DefineOrRedefineAccessorProperty(obj, p, getter, setter, flag);
%DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag);
}
return true;
}
@ -901,7 +899,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) {
// Make sure the below call to DefineObjectProperty() doesn't overwrite
// any magic "length" property by removing the value.
// TODO(mstarzinger): This hack should be removed once we have addressed the
// respective TODO in Runtime_DefineOrRedefineDataProperty.
// respective TODO in Runtime_DefineDataPropertyUnchecked.
// For the time being, we need a hack to prevent Object.observe from
// generating two change records.
obj.length = new_length;
@ -1397,7 +1395,7 @@ function SetUpObject() {
%SetNativeFlag($Object);
%SetCode($Object, ObjectConstructor);
%SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
%AddProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
// Set up non-enumerable functions on the Object.prototype object.
InstallFunctions($Object.prototype, DONT_ENUM, $Array(
@ -1484,7 +1482,7 @@ function SetUpBoolean () {
%SetCode($Boolean, BooleanConstructor);
%FunctionSetPrototype($Boolean, new $Boolean(false));
%SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
%AddProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
"toString", BooleanToString,
@ -1667,7 +1665,7 @@ function SetUpNumber() {
%OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
// Set up the constructor property on the Number prototype object.
%SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
%AddProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
InstallConstants($Number, $Array(
// ECMA-262 section 15.7.3.1.
@ -1850,7 +1848,7 @@ function SetUpFunction() {
%CheckIsBootstrapping();
%SetCode($Function, FunctionConstructor);
%SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
%AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
"bind", FunctionBind,

View File

@ -89,7 +89,7 @@ function SetUpWeakMap() {
%SetCode($WeakMap, WeakMapConstructor);
%FunctionSetPrototype($WeakMap, new $Object());
%SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM);
%AddProperty($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());
%SetProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM);
%AddProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM);
// Set up the non-enumerable functions on the WeakSet prototype object.
InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array(

View File

@ -1680,7 +1680,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
if (property->emit_store()) {
__ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
__ Drop(3);
}
@ -1713,7 +1713,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->getter);
EmitAccessor(it->second->setter);
__ Push(Smi::FromInt(NONE));
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -1644,7 +1644,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
if (property->emit_store()) {
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
__ CallRuntime(Runtime::kSetProperty, 4);
__ CallRuntime(Runtime::kAddProperty, 4);
} else {
__ Drop(3);
}
@ -1677,7 +1677,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
EmitAccessor(it->second->getter);
EmitAccessor(it->second->setter);
__ push(Immediate(Smi::FromInt(NONE)));
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
}
if (expr->has_function()) {

View File

@ -21719,8 +21719,8 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("JSON.stringify(other)");
CheckCorrectThrow("has_own_property(other, 'x')");
CheckCorrectThrow("%GetProperty(other, 'x')");
CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 1, 0)");
CheckCorrectThrow("%IgnoreAttributesAndSetProperty(other, 'x', 'foo')");
CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)");
CheckCorrectThrow("%AddProperty(other, 'x', 'foo', 1)");
CheckCorrectThrow("%DeleteProperty(other, 'x', 0)");
CheckCorrectThrow("%DeleteProperty(other, '1', 0)");
CheckCorrectThrow("%HasOwnProperty(other, 'x')");
@ -21730,7 +21730,7 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("%GetPropertyNames(other)");
// PROPERTY_ATTRIBUTES_NONE = 0
CheckCorrectThrow("%GetOwnPropertyNames(other, 0)");
CheckCorrectThrow("%DefineOrRedefineAccessorProperty("
CheckCorrectThrow("%DefineAccessorPropertyUnchecked("
"other, 'x', null, null, 1)");
// Reset the failed access check callback so it does not influence

View File

@ -49,7 +49,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
Handle<String> internalized_name =
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object());
Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
Runtime::SetObjectProperty(isolate, global, internalized_name, object,
SLOPPY).Check();
}

View File

@ -109,10 +109,8 @@ class DebugLocalContext {
v8::Utils::OpenHandle(*context_->Global())));
Handle<v8::internal::String> debug_string =
factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("debug"));
v8::internal::Runtime::SetObjectProperty(isolate, global, debug_string,
Handle<Object>(debug_context->global_proxy(), isolate),
DONT_ENUM,
::v8::internal::SLOPPY).Check();
v8::internal::Runtime::DefineObjectProperty(global, debug_string,
handle(debug_context->global_proxy(), isolate), DONT_ENUM).Check();
}
private:

View File

@ -467,35 +467,35 @@ try {
}
// Test runtime calls to DefineOrRedefineDataProperty and
// DefineOrRedefineAccessorProperty - make sure we don't
// Test runtime calls to DefineDataPropertyUnchecked and
// DefineAccessorPropertyUnchecked - make sure we don't
// crash.
try {
%DefineOrRedefineAccessorProperty(0, 0, 0, 0, 0);
%DefineAccessorPropertyUnchecked(0, 0, 0, 0, 0);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
try {
%DefineOrRedefineDataProperty(0, 0, 0, 0);
%DefineDataPropertyUnchecked(0, 0, 0, 0);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
try {
%DefineOrRedefineDataProperty(null, null, null, null);
%DefineDataPropertyUnchecked(null, null, null, null);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
try {
%DefineOrRedefineAccessorProperty(null, null, null, null, null);
%DefineAccessorPropertyUnchecked(null, null, null, null, null);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
try {
%DefineOrRedefineDataProperty({}, null, null, null);
%DefineDataPropertyUnchecked({}, null, null, null);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
@ -503,13 +503,13 @@ try {
// Defining properties null should fail even when we have
// other allowed values
try {
%DefineOrRedefineAccessorProperty(null, 'foo', func, null, 0);
%DefineAccessorPropertyUnchecked(null, 'foo', func, null, 0);
} catch (e) {
assertTrue(/illegal access/.test(e));
}
try {
%DefineOrRedefineDataProperty(null, 'foo', 0, 0);
%DefineDataPropertyUnchecked(null, 'foo', 0, 0);
} catch (e) {
assertTrue(/illegal access/.test(e));
}

View File

@ -34,43 +34,43 @@ const NONE = 0;
const READ_ONLY = 1;
// Use DeclareGlobal...
%SetProperty(this.__proto__, "a", 1234, NONE);
%AddProperty(this.__proto__, "a", 1234, NONE);
assertEquals(1234, a);
eval("var a = 5678;");
assertEquals(5678, a);
%SetProperty(this.__proto__, "b", 1234, NONE);
%AddProperty(this.__proto__, "b", 1234, NONE);
assertEquals(1234, b);
eval("const b = 5678;");
assertEquals(5678, b);
%SetProperty(this.__proto__, "c", 1234, READ_ONLY);
%AddProperty(this.__proto__, "c", 1234, READ_ONLY);
assertEquals(1234, c);
eval("var c = 5678;");
assertEquals(5678, c);
%SetProperty(this.__proto__, "d", 1234, READ_ONLY);
%AddProperty(this.__proto__, "d", 1234, READ_ONLY);
assertEquals(1234, d);
eval("const d = 5678;");
assertEquals(5678, d);
// Use DeclareContextSlot...
%SetProperty(this.__proto__, "x", 1234, NONE);
%AddProperty(this.__proto__, "x", 1234, NONE);
assertEquals(1234, x);
eval("with({}) { var x = 5678; }");
assertEquals(5678, x);
%SetProperty(this.__proto__, "y", 1234, NONE);
%AddProperty(this.__proto__, "y", 1234, NONE);
assertEquals(1234, y);
eval("with({}) { const y = 5678; }");
assertEquals(5678, y);
%SetProperty(this.__proto__, "z", 1234, READ_ONLY);
%AddProperty(this.__proto__, "z", 1234, READ_ONLY);
assertEquals(1234, z);
eval("with({}) { var z = 5678; }");
assertEquals(5678, z);
%SetProperty(this.__proto__, "w", 1234, READ_ONLY);
%AddProperty(this.__proto__, "w", 1234, READ_ONLY);
assertEquals(1234, w);
eval("with({}) { const w = 5678; }");
assertEquals(5678, w);

View File

@ -37,10 +37,10 @@ function func1(){}
function func2(){}
var object = {__proto__:{}};
%SetProperty(object, "foo", func1, DONT_ENUM | DONT_DELETE);
%SetProperty(object, "bar", func1, DONT_ENUM | READ_ONLY);
%SetProperty(object, "baz", func1, DONT_DELETE | READ_ONLY);
%SetProperty(object.__proto__, "bif", func1, DONT_ENUM | DONT_DELETE);
%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);
object.bif = func2;
function enumerable(obj) {

View File

@ -30,10 +30,10 @@
DontEnum = 2;
var o = {};
%SetProperty(o, "a", 0, DontEnum);
%AddProperty(o, "a", 0, DontEnum);
var o2 = {};
%SetProperty(o2, "a", 0, DontEnum);
%AddProperty(o2, "a", 0, DontEnum);
assertTrue(%HaveSameMap(o, o2));

View File

@ -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 _name = "name";
var arg1 = 10;
var _value = new Object();
var _unchecked_value = 1;
%IgnoreAttributesAndSetProperty(_object, _name, _value, _unchecked_value);
var _unchecked_attributes = 1;
%AddProperty(_object, arg1, _value, _unchecked_attributes);

View File

@ -6,4 +6,4 @@ var _name = "name";
var arg2 = function() {};
var arg3 = function() {};
var arg4 = 2;
%DefineOrRedefineAccessorProperty(_obj, _name, arg2, arg3, arg4);
%DefineAccessorPropertyUnchecked(_obj, _name, arg2, arg3, arg4);

View File

@ -5,4 +5,4 @@ var _js_object = new Object();
var _name = "name";
var _obj_value = new Object();
var _unchecked = 1;
%DefineOrRedefineDataProperty(_js_object, _name, _obj_value, _unchecked);
%DefineDataPropertyUnchecked(_js_object, _name, _obj_value, _unchecked);

View File

@ -1,9 +0,0 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
// Flags: --allow-natives-syntax --harmony
var _object = new Object();
var _name = "name";
var arg2 = undefined;
var arg3 = undefined;
var _attribute = 1;
%SetAccessorProperty(_object, _name, arg2, arg3, _attribute);

View File

@ -4,6 +4,5 @@
var _object = new Object();
var _key = new Object();
var _value = new Object();
var _unchecked_attributes = 1;
var _strict_mode_arg = 1;
%SetProperty(_object, _key, _value, _unchecked_attributes, _strict_mode_arg);
%SetProperty(_object, _key, _value, _strict_mode_arg);

View File

@ -47,8 +47,8 @@ EXPAND_MACROS = [
# that the parser doesn't bit-rot. Change the values as needed when you add,
# remove or change runtime functions, but make sure we don't lose our ability
# to parse them!
EXPECTED_FUNCTION_COUNT = 415
EXPECTED_FUZZABLE_COUNT = 330
EXPECTED_FUNCTION_COUNT = 414
EXPECTED_FUZZABLE_COUNT = 329
EXPECTED_CCTEST_COUNT = 6
EXPECTED_UNKNOWN_COUNT = 4
EXPECTED_BUILTINS_COUNT = 806
@ -211,6 +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],
"Apply": ["function() {}", None, None, None, None, None],
"ArrayBufferSliceImpl": [None, None, 0, None],
"ArrayConcat": ["[1, 'a']", None],
@ -225,8 +226,8 @@ CUSTOM_KNOWN_GOOD_INPUT = {
"CreatePrivateSymbol": ["\"foo\"", None],
"CreateSymbol": ["\"foo\"", None],
"DateParseString": [None, "new Array(8)", None],
"DefineOrRedefineAccessorProperty": [None, None, "function() {}",
"function() {}", 2, None],
"DefineAccessorPropertyUnchecked": [None, None, "function() {}",
"function() {}", 2, None],
"FunctionBindArguments": [None, None, "undefined", None, None],
"GetBreakLocations": [None, 0, None],
"GetDefaultReceiver": ["function() {}", None],
@ -242,7 +243,7 @@ CUSTOM_KNOWN_GOOD_INPUT = {
"NumberToRadixString": [None, "2", None],
"ParseJson": ["\"{}\"", 1],
"RegExpExecMultiple": [None, None, "['a']", "['a']", None],
"SetAccessorProperty": [None, None, "undefined", "undefined", None, None],
"DefineAccessorProperty": [None, None, "undefined", "undefined", None, None],
"SetIteratorInitialize": [None, None, "2", None],
"SetDebugEventListener": ["undefined", None, None],
"SetFunctionBreakPoint": [None, 200, None, None],