| Index: src/runtime/runtime-object.cc
|
| diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
|
| index 6d4bad5c6f889e5f0f833c648a1db335eb10cd0b..d3d986c9009b9216c7ef05f89a7d0e27e17636ae 100644
|
| --- a/src/runtime/runtime-object.cc
|
| +++ b/src/runtime/runtime-object.cc
|
| @@ -676,6 +676,38 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
|
| return *object;
|
| }
|
|
|
| +RUNTIME_FUNCTION(Runtime_DefineDataProperty) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 5);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 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 (set_function_name) {
|
| + DCHECK(value->IsJSFunction());
|
| + JSFunction::SetName(Handle<JSFunction>::cast(value), name,
|
| + isolate->factory()->empty_string());
|
| + }
|
| +
|
| + PropertyDescriptor desc;
|
| + desc.set_writable(!(attrs & ReadOnly));
|
| + desc.set_enumerable(!(attrs & DontEnum));
|
| + desc.set_configurable(!(attrs & DontDelete));
|
| + desc.set_value(value);
|
| +
|
| + Maybe<bool> result = JSReceiver::DefineOwnProperty(isolate, receiver, name,
|
| + &desc, Object::DONT_THROW);
|
| + RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
|
| + if (result.IsNothing()) {
|
| + DCHECK(isolate->has_pending_exception());
|
| + return isolate->heap()->exception();
|
| + }
|
| +
|
| + return *receiver;
|
| +}
|
| +
|
| // Return property without being observable by accessors or interceptors.
|
| RUNTIME_FUNCTION(Runtime_GetDataProperty) {
|
| HandleScope scope(isolate);
|
|
|