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

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

Issue 2620943002: [ESnext] Implement Object Rest (Closed)
Patch Set: fix nits Created 3 years, 11 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') | test/cctest/test-parsing.cc » ('j') | 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 e3518d3e09ea68e0036f906b98f71c70c8dffd20..9c675d0ce61f7d9c96de1b5d92474dab1d000d6e 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -746,7 +746,7 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
RUNTIME_FUNCTION(Runtime_CopyDataProperties) {
HandleScope scope(isolate);
- DCHECK(args.length() == 2);
+ DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, source, 1);
@@ -755,12 +755,35 @@ RUNTIME_FUNCTION(Runtime_CopyDataProperties) {
return isolate->heap()->undefined_value();
}
- MAYBE_RETURN(
- JSReceiver::SetOrCopyDataProperties(isolate, target, source, false),
- isolate->heap()->exception());
+ MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source,
+ nullptr, false),
+ isolate->heap()->exception());
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
+ HandleScope scope(isolate);
+ DCHECK_LE(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, source, 0);
+
+ // 2. If source is undefined or null, let keys be an empty List.
+ if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
+ return isolate->heap()->undefined_value();
+ }
+
+ ScopedVector<Handle<Name>> excluded_properties(args.length() - 1);
+ for (int i = 1; i < args.length(); i++) {
+ excluded_properties[i - 1] = args.at<Name>(i);
+ }
+
+ Handle<JSObject> target =
+ isolate->factory()->NewJSObject(isolate->object_function());
+ MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source,
+ &excluded_properties, false),
+ isolate->heap()->exception());
+ return *target;
+}
+
RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698