| Index: src/runtime/runtime-object.cc
|
| diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
|
| index d5e57562551a8944b11cc613909bd349c03ac9be..b1d5357a98cde36dea2717b2f87980e04fed8b68 100644
|
| --- a/src/runtime/runtime-object.cc
|
| +++ b/src/runtime/runtime-object.cc
|
| @@ -915,6 +915,30 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
|
| return *result;
|
| }
|
|
|
| +RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 5);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
| + CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
| + CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
|
| + CONVERT_SMI_ARG_CHECKED(set_function_name, 4);
|
| +
|
| + if (FLAG_harmony_function_name && set_function_name) {
|
| + DCHECK(value->IsJSFunction());
|
| + JSFunction::SetName(Handle<JSFunction>::cast(value), name,
|
| + isolate->factory()->empty_string());
|
| + }
|
| +
|
| + LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name,
|
| + LookupIterator::OWN);
|
| + // Cannot fail since this should only be called when
|
| + // creating an object literal.
|
| + CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs,
|
| + Object::DONT_THROW)
|
| + .IsJust());
|
| + return *object;
|
| +}
|
|
|
| // Return property without being observable by accessors or interceptors.
|
| RUNTIME_FUNCTION(Runtime_GetDataProperty) {
|
| @@ -1006,6 +1030,11 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
|
| CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2);
|
| CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
|
|
|
| + if (FLAG_harmony_function_name &&
|
| + String::cast(getter->shared()->name())->length() == 0) {
|
| + JSFunction::SetName(getter, name, isolate->factory()->get_string());
|
| + }
|
| +
|
| RETURN_FAILURE_ON_EXCEPTION(
|
| isolate,
|
| JSObject::DefineAccessor(object, name, getter,
|
| @@ -1022,6 +1051,11 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
|
| CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2);
|
| CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
|
|
|
| + if (FLAG_harmony_function_name &&
|
| + String::cast(setter->shared()->name())->length() == 0) {
|
| + JSFunction::SetName(setter, name, isolate->factory()->set_string());
|
| + }
|
| +
|
| RETURN_FAILURE_ON_EXCEPTION(
|
| isolate,
|
| JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
|
|
|