Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/runtime/runtime-object.cc

Issue 2316233004: Class fields, part 2 (desugaring) (Closed)
Patch Set: rebase harder Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698