OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 return ReadAbsentProperty(isolate, receiver, name, language_mode); | 791 return ReadAbsentProperty(isolate, receiver, name, language_mode); |
792 } | 792 } |
793 Handle<Object> return_value = v8::Utils::OpenHandle(*result); | 793 Handle<Object> return_value = v8::Utils::OpenHandle(*result); |
794 return_value->VerifyApiCallResultType(); | 794 return_value->VerifyApiCallResultType(); |
795 // Rebox handle before return. | 795 // Rebox handle before return. |
796 return handle(*return_value, isolate); | 796 return handle(*return_value, isolate); |
797 } | 797 } |
798 | 798 |
799 // Regular accessor. | 799 // Regular accessor. |
800 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); | 800 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); |
801 if (getter->IsSpecFunction()) { | 801 if (getter->IsCallable()) { |
802 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 802 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
803 return Object::GetPropertyWithDefinedGetter( | 803 return Object::GetPropertyWithDefinedGetter( |
804 receiver, Handle<JSReceiver>::cast(getter)); | 804 receiver, Handle<JSReceiver>::cast(getter)); |
805 } | 805 } |
806 // Getter is not a function. | 806 // Getter is not a function. |
807 return ReadAbsentProperty(isolate, receiver, it->GetName(), language_mode); | 807 return ReadAbsentProperty(isolate, receiver, it->GetName(), language_mode); |
808 } | 808 } |
809 | 809 |
810 | 810 |
811 bool AccessorInfo::IsCompatibleReceiverMap(Isolate* isolate, | 811 bool AccessorInfo::IsCompatibleReceiverMap(Isolate* isolate, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 847 |
848 LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name)); | 848 LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name)); |
849 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder); | 849 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder); |
850 args.Call(call_fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value)); | 850 args.Call(call_fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value)); |
851 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 851 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
852 return value; | 852 return value; |
853 } | 853 } |
854 | 854 |
855 // Regular accessor. | 855 // Regular accessor. |
856 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); | 856 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); |
857 if (setter->IsSpecFunction()) { | 857 if (setter->IsCallable()) { |
858 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 858 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
859 return SetPropertyWithDefinedSetter( | 859 return SetPropertyWithDefinedSetter( |
860 receiver, Handle<JSReceiver>::cast(setter), value); | 860 receiver, Handle<JSReceiver>::cast(setter), value); |
861 } | 861 } |
862 | 862 |
863 if (is_sloppy(language_mode)) return value; | 863 if (is_sloppy(language_mode)) return value; |
864 | 864 |
865 THROW_NEW_ERROR(isolate, | 865 THROW_NEW_ERROR(isolate, |
866 NewTypeError(MessageTemplate::kNoSetterInCallback, | 866 NewTypeError(MessageTemplate::kNoSetterInCallback, |
867 it->GetName(), it->GetHolder<JSObject>()), | 867 it->GetName(), it->GetHolder<JSObject>()), |
(...skipping 6043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6911 bool preexists = false; | 6911 bool preexists = false; |
6912 if (is_observed) { | 6912 if (is_observed) { |
6913 CHECK(GetPropertyAttributes(&it).IsJust()); | 6913 CHECK(GetPropertyAttributes(&it).IsJust()); |
6914 preexists = it.IsFound(); | 6914 preexists = it.IsFound(); |
6915 if (preexists && (it.state() == LookupIterator::DATA || | 6915 if (preexists && (it.state() == LookupIterator::DATA || |
6916 it.GetAccessors()->IsAccessorInfo())) { | 6916 it.GetAccessors()->IsAccessorInfo())) { |
6917 old_value = GetProperty(&it).ToHandleChecked(); | 6917 old_value = GetProperty(&it).ToHandleChecked(); |
6918 } | 6918 } |
6919 } | 6919 } |
6920 | 6920 |
6921 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || getter->IsNull()); | 6921 DCHECK(getter->IsCallable() || getter->IsUndefined() || getter->IsNull()); |
6922 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || setter->IsNull()); | 6922 DCHECK(setter->IsCallable() || setter->IsUndefined() || setter->IsNull()); |
6923 // At least one of the accessors needs to be a new value. | 6923 // At least one of the accessors needs to be a new value. |
6924 DCHECK(!getter->IsNull() || !setter->IsNull()); | 6924 DCHECK(!getter->IsNull() || !setter->IsNull()); |
6925 if (!getter->IsNull()) { | 6925 if (!getter->IsNull()) { |
6926 it.TransitionToAccessorProperty(ACCESSOR_GETTER, getter, attributes); | 6926 it.TransitionToAccessorProperty(ACCESSOR_GETTER, getter, attributes); |
6927 } | 6927 } |
6928 if (!setter->IsNull()) { | 6928 if (!setter->IsNull()) { |
6929 it.TransitionToAccessorProperty(ACCESSOR_SETTER, setter, attributes); | 6929 it.TransitionToAccessorProperty(ACCESSOR_SETTER, setter, attributes); |
6930 } | 6930 } |
6931 | 6931 |
6932 if (is_observed) { | 6932 if (is_observed) { |
(...skipping 9764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16697 if (cell->value() != *new_value) { | 16697 if (cell->value() != *new_value) { |
16698 cell->set_value(*new_value); | 16698 cell->set_value(*new_value); |
16699 Isolate* isolate = cell->GetIsolate(); | 16699 Isolate* isolate = cell->GetIsolate(); |
16700 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16700 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16701 isolate, DependentCode::kPropertyCellChangedGroup); | 16701 isolate, DependentCode::kPropertyCellChangedGroup); |
16702 } | 16702 } |
16703 } | 16703 } |
16704 | 16704 |
16705 } // namespace internal | 16705 } // namespace internal |
16706 } // namespace v8 | 16706 } // namespace v8 |
OLD | NEW |