Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 JSFunction::SetName(getter, name, isolate->factory()->get_string()); | 743 JSFunction::SetName(getter, name, isolate->factory()->get_string()); |
| 744 } | 744 } |
| 745 | 745 |
| 746 RETURN_FAILURE_ON_EXCEPTION( | 746 RETURN_FAILURE_ON_EXCEPTION( |
| 747 isolate, | 747 isolate, |
| 748 JSObject::DefineAccessor(object, name, getter, | 748 JSObject::DefineAccessor(object, name, getter, |
| 749 isolate->factory()->null_value(), attrs)); | 749 isolate->factory()->null_value(), attrs)); |
| 750 return isolate->heap()->undefined_value(); | 750 return isolate->heap()->undefined_value(); |
| 751 } | 751 } |
| 752 | 752 |
| 753 RUNTIME_FUNCTION(Runtime_CopyDataProperties) { | |
| 754 HandleScope scope(isolate); | |
| 755 DCHECK(args.length() == 2); | |
| 756 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0); | |
| 757 CONVERT_ARG_HANDLE_CHECKED(Object, source, 1); | |
| 758 | |
| 759 // 2. If source is undefined or null, let keys be an empty List. | |
| 760 if (source->IsUndefined(isolate) || source->IsNull(isolate)) { | |
| 761 return isolate->heap()->undefined_value(); | |
| 762 } | |
| 763 | |
| 764 MAYBE_RETURN( | |
|
adamk
2016/12/29 18:32:46
Can this fail?
gsathya
2017/01/05 22:18:36
Yes, the error needs to propagate up from SetOrCop
| |
| 765 JSReceiver::SetOrCopyDataProperties(isolate, target, source, false), | |
| 766 isolate->heap()->exception()); | |
| 767 | |
| 768 return isolate->heap()->undefined_value(); | |
| 769 } | |
| 753 | 770 |
| 754 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { | 771 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { |
| 755 HandleScope scope(isolate); | 772 HandleScope scope(isolate); |
| 756 DCHECK(args.length() == 4); | 773 DCHECK(args.length() == 4); |
| 757 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 774 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 758 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 775 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 759 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 776 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); |
| 760 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 777 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
| 761 | 778 |
| 762 if (String::cast(setter->shared()->name())->length() == 0) { | 779 if (String::cast(setter->shared()->name())->length() == 0) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 931 if (!success) return isolate->heap()->exception(); | 948 if (!success) return isolate->heap()->exception(); |
| 932 MAYBE_RETURN( | 949 MAYBE_RETURN( |
| 933 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 950 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
| 934 isolate->heap()->exception()); | 951 isolate->heap()->exception()); |
| 935 return *value; | 952 return *value; |
| 936 } | 953 } |
| 937 | 954 |
| 938 | 955 |
| 939 } // namespace internal | 956 } // namespace internal |
| 940 } // namespace v8 | 957 } // namespace v8 |
| OLD | NEW |