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

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

Issue 2620943002: [ESnext] Implement Object Rest (Closed)
Patch Set: Remove comment 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
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 397ad6c383d2ae9b55418bc5f6e9a126528b0e47..f9f32465548ac0ff5b250c2d1a1b6d2cdac58d2e 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -776,7 +776,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);
@@ -785,12 +785,31 @@ 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, MaybeHandle<JSArray>(), false),
+ isolate->heap()->exception());
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, source, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSArray, excluded_properties, 1);
adamk 2017/01/10 23:22:56 As discussed, I think it'd be simpler to just pass
+
+ // 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();
+ }
+
+ 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());

Powered by Google App Engine
This is Rietveld 408576698