Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index e3518d3e09ea68e0036f906b98f71c70c8dffd20..62c262b81d676f4b286531f4f54e55d3824af0cf 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); |
+ |
+ ScopedVector<Handle<Name>> excluded_properties(args.length() - 1); |
+ for (int i = 1; i < args.length(); i++) { |
+ excluded_properties[i - 1] = Handle<Name>::cast(args.at(i)); |
adamk
2017/01/17 19:56:33
Slightly shorter:
args.at<Name>(i);
gsathya
2017/01/17 21:59:23
Done.
|
+ } |
+ |
+ // 2. If source is undefined or null, let keys be an empty List. |
adamk
2017/01/17 19:56:33
Maybe move this before ScopedVector creation? It's
gsathya
2017/01/17 21:59:23
Done.
|
+ 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()); |