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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 JSFunction::SetName(getter, name, isolate->factory()->get_string()); | 759 JSFunction::SetName(getter, name, isolate->factory()->get_string()); |
760 } | 760 } |
761 | 761 |
762 RETURN_FAILURE_ON_EXCEPTION( | 762 RETURN_FAILURE_ON_EXCEPTION( |
763 isolate, | 763 isolate, |
764 JSObject::DefineAccessor(object, name, getter, | 764 JSObject::DefineAccessor(object, name, getter, |
765 isolate->factory()->null_value(), attrs)); | 765 isolate->factory()->null_value(), attrs)); |
766 return isolate->heap()->undefined_value(); | 766 return isolate->heap()->undefined_value(); |
767 } | 767 } |
768 | 768 |
| 769 RUNTIME_FUNCTION(Runtime_CopyDataProperties) { |
| 770 HandleScope scope(isolate); |
| 771 DCHECK(args.length() == 2); |
| 772 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); |
| 773 CONVERT_ARG_HANDLE_CHECKED(Object, source, 1); |
| 774 |
| 775 // 2. If source is undefined or null, let keys be an empty List. |
| 776 if (source->IsUndefined(isolate) || source->IsNull(isolate)) { |
| 777 return isolate->heap()->undefined_value(); |
| 778 } |
| 779 |
| 780 MAYBE_RETURN( |
| 781 JSReceiver::SetOrCopyDataProperties(isolate, target, source, false), |
| 782 isolate->heap()->exception()); |
| 783 return isolate->heap()->undefined_value(); |
| 784 } |
769 | 785 |
770 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { | 786 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { |
771 HandleScope scope(isolate); | 787 HandleScope scope(isolate); |
772 DCHECK_EQ(4, args.length()); | 788 DCHECK_EQ(4, args.length()); |
773 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 789 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
774 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 790 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
775 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 791 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); |
776 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 792 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
777 | 793 |
778 if (String::cast(setter->shared()->name())->length() == 0) { | 794 if (String::cast(setter->shared()->name())->length() == 0) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 if (!success) return isolate->heap()->exception(); | 963 if (!success) return isolate->heap()->exception(); |
948 MAYBE_RETURN( | 964 MAYBE_RETURN( |
949 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 965 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
950 isolate->heap()->exception()); | 966 isolate->heap()->exception()); |
951 return *value; | 967 return *value; |
952 } | 968 } |
953 | 969 |
954 | 970 |
955 } // namespace internal | 971 } // namespace internal |
956 } // namespace v8 | 972 } // namespace v8 |
OLD | NEW |