Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: src/objects.cc

Issue 1650033003: Revert of [runtime] further dismantle AccessorInfoHandling, reducing it to the single API usecase. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 } 5330 }
5331 return Just(true); 5331 return Just(true);
5332 } 5332 }
5333 } 5333 }
5334 } 5334 }
5335 5335
5336 return AddDataProperty(it, value, attributes, should_throw, 5336 return AddDataProperty(it, value, attributes, should_throw,
5337 CERTAINLY_NOT_STORE_FROM_KEYED); 5337 CERTAINLY_NOT_STORE_FROM_KEYED);
5338 } 5338 }
5339 5339
5340
5340 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( 5341 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
5341 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, 5342 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
5342 PropertyAttributes attributes) { 5343 PropertyAttributes attributes, AccessorInfoHandling handling) {
5343 DCHECK(!value->IsTheHole()); 5344 DCHECK(!value->IsTheHole());
5344 LookupIterator it(object, name, LookupIterator::OWN); 5345 LookupIterator it(object, name, LookupIterator::OWN);
5345 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); 5346 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
5346 } 5347 }
5347 5348
5349
5348 MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes( 5350 MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes(
5349 Handle<JSObject> object, uint32_t index, Handle<Object> value, 5351 Handle<JSObject> object, uint32_t index, Handle<Object> value,
5350 PropertyAttributes attributes) { 5352 PropertyAttributes attributes, AccessorInfoHandling handling) {
5351 Isolate* isolate = object->GetIsolate(); 5353 Isolate* isolate = object->GetIsolate();
5352 LookupIterator it(isolate, object, index, LookupIterator::OWN); 5354 LookupIterator it(isolate, object, index, LookupIterator::OWN);
5353 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); 5355 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
5354 } 5356 }
5355 5357
5358
5356 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( 5359 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes(
5357 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, 5360 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
5358 PropertyAttributes attributes) { 5361 PropertyAttributes attributes, AccessorInfoHandling handling) {
5359 Isolate* isolate = object->GetIsolate(); 5362 Isolate* isolate = object->GetIsolate();
5360 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name, 5363 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name,
5361 LookupIterator::OWN); 5364 LookupIterator::OWN);
5362 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); 5365 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
5363 } 5366 }
5364 5367
5365 5368
5366 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( 5369 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
5367 LookupIterator* it) { 5370 LookupIterator* it) {
5368 Isolate* isolate = it->isolate(); 5371 Isolate* isolate = it->isolate();
5369 // Make sure that the top context does not change when doing 5372 // Make sure that the top context does not change when doing
5370 // callbacks or interceptor calls. 5373 // callbacks or interceptor calls.
5371 AssertNoContextChange ncc(isolate); 5374 AssertNoContextChange ncc(isolate);
5372 HandleScope scope(isolate); 5375 HandleScope scope(isolate);
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
6584 // created property is set to its default value. 6587 // created property is set to its default value.
6585 if (it != NULL) { 6588 if (it != NULL) {
6586 if (!desc->has_writable()) desc->set_writable(false); 6589 if (!desc->has_writable()) desc->set_writable(false);
6587 if (!desc->has_enumerable()) desc->set_enumerable(false); 6590 if (!desc->has_enumerable()) desc->set_enumerable(false);
6588 if (!desc->has_configurable()) desc->set_configurable(false); 6591 if (!desc->has_configurable()) desc->set_configurable(false);
6589 Handle<Object> value( 6592 Handle<Object> value(
6590 desc->has_value() 6593 desc->has_value()
6591 ? desc->value() 6594 ? desc->value()
6592 : Handle<Object>::cast(isolate->factory()->undefined_value())); 6595 : Handle<Object>::cast(isolate->factory()->undefined_value()));
6593 MaybeHandle<Object> result = 6596 MaybeHandle<Object> result =
6594 JSObject::DefineOwnPropertyIgnoreAttributes(it, value, 6597 JSObject::DefineOwnPropertyIgnoreAttributes(
6595 desc->ToAttributes()); 6598 it, value, desc->ToAttributes(), JSObject::DONT_FORCE_FIELD);
6596 if (result.is_null()) return Nothing<bool>(); 6599 if (result.is_null()) return Nothing<bool>();
6597 } 6600 }
6598 } else { 6601 } else {
6599 // 2d. Else Desc must be an accessor Property Descriptor, 6602 // 2d. Else Desc must be an accessor Property Descriptor,
6600 DCHECK(desc_is_accessor_descriptor); 6603 DCHECK(desc_is_accessor_descriptor);
6601 // 2d i. If O is not undefined, create an own accessor property named P 6604 // 2d i. If O is not undefined, create an own accessor property named P
6602 // of object O whose [[Get]], [[Set]], [[Enumerable]] and 6605 // of object O whose [[Get]], [[Set]], [[Enumerable]] and
6603 // [[Configurable]] attribute values are described by Desc. If the value 6606 // [[Configurable]] attribute values are described by Desc. If the value
6604 // of an attribute field of Desc is absent, the attribute of the newly 6607 // of an attribute field of Desc is absent, the attribute of the newly
6605 // created property is set to its default value. 6608 // created property is set to its default value.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6777 } else { 6780 } else {
6778 attrs = static_cast<PropertyAttributes>( 6781 attrs = static_cast<PropertyAttributes>(
6779 attrs | (current->writable() ? NONE : READ_ONLY)); 6782 attrs | (current->writable() ? NONE : READ_ONLY));
6780 } 6783 }
6781 Handle<Object> value( 6784 Handle<Object> value(
6782 desc->has_value() ? desc->value() 6785 desc->has_value() ? desc->value()
6783 : current->has_value() 6786 : current->has_value()
6784 ? current->value() 6787 ? current->value()
6785 : Handle<Object>::cast( 6788 : Handle<Object>::cast(
6786 isolate->factory()->undefined_value())); 6789 isolate->factory()->undefined_value()));
6787 MaybeHandle<Object> result = 6790 MaybeHandle<Object> result = JSObject::DefineOwnPropertyIgnoreAttributes(
6788 JSObject::DefineOwnPropertyIgnoreAttributes(it, value, attrs); 6791 it, value, attrs, JSObject::DONT_FORCE_FIELD);
6789 if (result.is_null()) return Nothing<bool>(); 6792 if (result.is_null()) return Nothing<bool>();
6790 } else { 6793 } else {
6791 DCHECK(desc_is_accessor_descriptor || 6794 DCHECK(desc_is_accessor_descriptor ||
6792 (desc_is_generic_descriptor && 6795 (desc_is_generic_descriptor &&
6793 PropertyDescriptor::IsAccessorDescriptor(current))); 6796 PropertyDescriptor::IsAccessorDescriptor(current)));
6794 Handle<Object> getter( 6797 Handle<Object> getter(
6795 desc->has_get() 6798 desc->has_get()
6796 ? desc->get() 6799 ? desc->get()
6797 : current->has_get() 6800 : current->has_get()
6798 ? current->get() 6801 ? current->get()
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 DCHECK(it->GetReceiver()->IsJSObject()); 6845 DCHECK(it->GetReceiver()->IsJSObject());
6843 MAYBE_RETURN(JSReceiver::GetPropertyAttributes(it), Nothing<bool>()); 6846 MAYBE_RETURN(JSReceiver::GetPropertyAttributes(it), Nothing<bool>());
6844 6847
6845 if (it->IsFound()) { 6848 if (it->IsFound()) {
6846 if (!it->IsConfigurable()) return Just(false); 6849 if (!it->IsConfigurable()) return Just(false);
6847 } else { 6850 } else {
6848 if (!JSObject::IsExtensible(Handle<JSObject>::cast(it->GetReceiver()))) 6851 if (!JSObject::IsExtensible(Handle<JSObject>::cast(it->GetReceiver())))
6849 return Just(false); 6852 return Just(false);
6850 } 6853 }
6851 6854
6852 RETURN_ON_EXCEPTION_VALUE(it->isolate(), 6855 RETURN_ON_EXCEPTION_VALUE(
6853 DefineOwnPropertyIgnoreAttributes(it, value, NONE), 6856 it->isolate(),
6854 Nothing<bool>()); 6857 DefineOwnPropertyIgnoreAttributes(it, value, NONE, DONT_FORCE_FIELD),
6858 Nothing<bool>());
6855 6859
6856 return Just(true); 6860 return Just(true);
6857 } 6861 }
6858 6862
6859 6863
6860 // TODO(jkummerow): Consider unification with FastAsArrayLength() in 6864 // TODO(jkummerow): Consider unification with FastAsArrayLength() in
6861 // accessors.cc. 6865 // accessors.cc.
6862 bool PropertyKeyToArrayLength(Handle<Object> value, uint32_t* length) { 6866 bool PropertyKeyToArrayLength(Handle<Object> value, uint32_t* length) {
6863 DCHECK(value->IsNumber() || value->IsName()); 6867 DCHECK(value->IsNumber() || value->IsName());
6864 if (value->ToArrayLength(length)) return true; 6868 if (value->ToArrayLength(length)) return true;
(...skipping 12880 matching lines...) Expand 10 before | Expand all | Expand 10 after
19745 if (cell->value() != *new_value) { 19749 if (cell->value() != *new_value) {
19746 cell->set_value(*new_value); 19750 cell->set_value(*new_value);
19747 Isolate* isolate = cell->GetIsolate(); 19751 Isolate* isolate = cell->GetIsolate();
19748 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19752 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19749 isolate, DependentCode::kPropertyCellChangedGroup); 19753 isolate, DependentCode::kPropertyCellChangedGroup);
19750 } 19754 }
19751 } 19755 }
19752 19756
19753 } // namespace internal 19757 } // namespace internal
19754 } // namespace v8 19758 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698