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 707 matching lines...) Loading... |
718 | 718 |
719 RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { | 719 RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { |
720 HandleScope scope(isolate); | 720 HandleScope scope(isolate); |
721 DCHECK(args.length() == 5); | 721 DCHECK(args.length() == 5); |
722 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 722 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
723 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 723 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
724 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 724 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
725 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 725 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
726 CONVERT_SMI_ARG_CHECKED(set_function_name, 4); | 726 CONVERT_SMI_ARG_CHECKED(set_function_name, 4); |
727 | 727 |
728 if (FLAG_harmony_function_name && set_function_name) { | 728 if (set_function_name) { |
729 DCHECK(value->IsJSFunction()); | 729 DCHECK(value->IsJSFunction()); |
730 JSFunction::SetName(Handle<JSFunction>::cast(value), name, | 730 JSFunction::SetName(Handle<JSFunction>::cast(value), name, |
731 isolate->factory()->empty_string()); | 731 isolate->factory()->empty_string()); |
732 } | 732 } |
733 | 733 |
734 LookupIterator it = LookupIterator::PropertyOrElement( | 734 LookupIterator it = LookupIterator::PropertyOrElement( |
735 isolate, object, name, object, LookupIterator::OWN); | 735 isolate, object, name, object, LookupIterator::OWN); |
736 // Cannot fail since this should only be called when | 736 // Cannot fail since this should only be called when |
737 // creating an object literal. | 737 // creating an object literal. |
738 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, | 738 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, |
(...skipping 48 matching lines...) Loading... |
787 | 787 |
788 | 788 |
789 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { | 789 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { |
790 HandleScope scope(isolate); | 790 HandleScope scope(isolate); |
791 DCHECK(args.length() == 4); | 791 DCHECK(args.length() == 4); |
792 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 792 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
793 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 793 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
794 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2); | 794 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2); |
795 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 795 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
796 | 796 |
797 if (FLAG_harmony_function_name && | 797 if (String::cast(getter->shared()->name())->length() == 0) { |
798 String::cast(getter->shared()->name())->length() == 0) { | |
799 JSFunction::SetName(getter, name, isolate->factory()->get_string()); | 798 JSFunction::SetName(getter, name, isolate->factory()->get_string()); |
800 } | 799 } |
801 | 800 |
802 RETURN_FAILURE_ON_EXCEPTION( | 801 RETURN_FAILURE_ON_EXCEPTION( |
803 isolate, | 802 isolate, |
804 JSObject::DefineAccessor(object, name, getter, | 803 JSObject::DefineAccessor(object, name, getter, |
805 isolate->factory()->null_value(), attrs)); | 804 isolate->factory()->null_value(), attrs)); |
806 return isolate->heap()->undefined_value(); | 805 return isolate->heap()->undefined_value(); |
807 } | 806 } |
808 | 807 |
809 | 808 |
810 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { | 809 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { |
811 HandleScope scope(isolate); | 810 HandleScope scope(isolate); |
812 DCHECK(args.length() == 4); | 811 DCHECK(args.length() == 4); |
813 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 812 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
814 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 813 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
815 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 814 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); |
816 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 815 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
817 | 816 |
818 if (FLAG_harmony_function_name && | 817 if (String::cast(setter->shared()->name())->length() == 0) { |
819 String::cast(setter->shared()->name())->length() == 0) { | |
820 JSFunction::SetName(setter, name, isolate->factory()->set_string()); | 818 JSFunction::SetName(setter, name, isolate->factory()->set_string()); |
821 } | 819 } |
822 | 820 |
823 RETURN_FAILURE_ON_EXCEPTION( | 821 RETURN_FAILURE_ON_EXCEPTION( |
824 isolate, | 822 isolate, |
825 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 823 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
826 setter, attrs)); | 824 setter, attrs)); |
827 return isolate->heap()->undefined_value(); | 825 return isolate->heap()->undefined_value(); |
828 } | 826 } |
829 | 827 |
(...skipping 160 matching lines...) Loading... |
990 isolate, o, key, &success, LookupIterator::OWN); | 988 isolate, o, key, &success, LookupIterator::OWN); |
991 if (!success) return isolate->heap()->exception(); | 989 if (!success) return isolate->heap()->exception(); |
992 MAYBE_RETURN( | 990 MAYBE_RETURN( |
993 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 991 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
994 isolate->heap()->exception()); | 992 isolate->heap()->exception()); |
995 return *value; | 993 return *value; |
996 } | 994 } |
997 | 995 |
998 } // namespace internal | 996 } // namespace internal |
999 } // namespace v8 | 997 } // namespace v8 |
OLD | NEW |