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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) { | 769 RUNTIME_FUNCTION(Runtime_CopyDataProperties) { | 
| 770 HandleScope scope(isolate); | 770 HandleScope scope(isolate); | 
| 771 DCHECK(args.length() == 2); | 771 DCHECK_EQ(2, args.length()); | 
| 772 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); | 772 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); | 
| 773 CONVERT_ARG_HANDLE_CHECKED(Object, source, 1); | 773 CONVERT_ARG_HANDLE_CHECKED(Object, source, 1); | 
| 774 | 774 | 
| 775 // 2. If source is undefined or null, let keys be an empty List. | 775 // 2. If source is undefined or null, let keys be an empty List. | 
| 776 if (source->IsUndefined(isolate) || source->IsNull(isolate)) { | 776 if (source->IsUndefined(isolate) || source->IsNull(isolate)) { | 
| 777 return isolate->heap()->undefined_value(); | 777 return isolate->heap()->undefined_value(); | 
| 778 } | 778 } | 
| 779 | 779 | 
| 780 MAYBE_RETURN( | 780 MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source, | 
| 781 JSReceiver::SetOrCopyDataProperties(isolate, target, source, false), | 781 nullptr, false), | 
| 782 isolate->heap()->exception()); | 782 isolate->heap()->exception()); | 
| 783 return isolate->heap()->undefined_value(); | 783 return isolate->heap()->undefined_value(); | 
| 784 } | 784 } | 
| 785 | 785 | 
| 786 RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) { | |
| 787 HandleScope scope(isolate); | |
| 788 DCHECK_LE(1, args.length()); | |
| 789 CONVERT_ARG_HANDLE_CHECKED(Object, source, 0); | |
| 790 | |
| 791 Arguments excluded_properties(1, args.arguments() - 1); | |
| 
 
adamk
2017/01/12 22:43:08
Passing 1 for length here seems wrong, how does th
 
gsathya
2017/01/17 19:28:59
Done.
 
 | |
| 792 | |
| 793 // 2. If source is undefined or null, let keys be an empty List. | |
| 794 if (source->IsUndefined(isolate) || source->IsNull(isolate)) { | |
| 795 return isolate->heap()->undefined_value(); | |
| 796 } | |
| 797 | |
| 798 Handle<JSObject> target = | |
| 799 isolate->factory()->NewJSObject(isolate->object_function()); | |
| 800 MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source, | |
| 801 &excluded_properties, false), | |
| 802 isolate->heap()->exception()); | |
| 803 return *target; | |
| 804 } | |
| 805 | |
| 786 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { | 806 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { | 
| 787 HandleScope scope(isolate); | 807 HandleScope scope(isolate); | 
| 788 DCHECK_EQ(4, args.length()); | 808 DCHECK_EQ(4, args.length()); | 
| 789 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 809 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 
| 790 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 810 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 
| 791 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 811 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 
| 792 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 812 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 
| 793 | 813 | 
| 794 if (String::cast(setter->shared()->name())->length() == 0) { | 814 if (String::cast(setter->shared()->name())->length() == 0) { | 
| 795 JSFunction::SetName(setter, name, isolate->factory()->set_string()); | 815 JSFunction::SetName(setter, name, isolate->factory()->set_string()); | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 if (!success) return isolate->heap()->exception(); | 983 if (!success) return isolate->heap()->exception(); | 
| 964 MAYBE_RETURN( | 984 MAYBE_RETURN( | 
| 965 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 985 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 
| 966 isolate->heap()->exception()); | 986 isolate->heap()->exception()); | 
| 967 return *value; | 987 return *value; | 
| 968 } | 988 } | 
| 969 | 989 | 
| 970 | 990 | 
| 971 } // namespace internal | 991 } // namespace internal | 
| 972 } // namespace v8 | 992 } // namespace v8 | 
| OLD | NEW |