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

Unified Diff: src/objects.cc

Issue 1178123003: Use LookupIterator in GetOldValue (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 52c965eace4a46050511cb5c40f4258af7bf3364..65b6f6297ed59b70d2a72d2ae137eaee79ee8168 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11841,25 +11841,22 @@ void JSArray::Expand(Handle<JSArray> array, int required_size) {
}
-// Returns false if the passed-in index is marked non-configurable,
-// which will cause the ES5 truncation operation to halt, and thus
-// no further old values need be collected.
+// Returns false if the passed-in index is marked non-configurable, which will
+// cause the truncation operation to halt, and thus no further old values need
+// be collected.
static bool GetOldValue(Isolate* isolate,
Handle<JSObject> object,
uint32_t index,
List<Handle<Object> >* old_values,
List<uint32_t>* indices) {
- Maybe<PropertyAttributes> maybe =
- JSReceiver::GetOwnElementAttributes(object, index);
- DCHECK(maybe.IsJust());
- DCHECK(maybe.FromJust() != ABSENT);
- if (maybe.FromJust() == DONT_DELETE) return false;
- Handle<Object> value;
- if (!JSObject::GetOwnElementAccessorPair(object, index).is_null()) {
- value = Handle<Object>::cast(isolate->factory()->the_hole_value());
- } else {
- value = Object::GetElement(isolate, object, index).ToHandleChecked();
- }
+ LookupIterator it(isolate, object, index, LookupIterator::HIDDEN);
+ CHECK(JSReceiver::GetPropertyAttributes(&it).IsJust());
Jakob Kummerow 2015/06/11 14:35:24 Can this be a DCHECK?
Toon Verwaest 2015/06/11 14:46:26 No, in that case it wouldn't run in release mode.
+ DCHECK(it.IsFound());
+ if (!it.IsConfigurable()) return false;
+ Handle<Object> value =
+ it.state() == LookupIterator::ACCESSOR
+ ? Handle<Object>::cast(isolate->factory()->the_hole_value())
+ : JSReceiver::GetDataProperty(&it);
old_values->Add(value);
indices->Add(index);
return true;
@@ -12362,24 +12359,6 @@ void JSObject::EnsureCanContainElements(Handle<JSObject> object,
}
-MaybeHandle<AccessorPair> JSObject::GetOwnElementAccessorPair(
- Handle<JSObject> object,
- uint32_t index) {
- if (object->IsJSGlobalProxy()) {
- PrototypeIterator iter(object->GetIsolate(), object);
- if (iter.IsAtEnd()) return MaybeHandle<AccessorPair>();
- DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
- return GetOwnElementAccessorPair(
- Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), index);
- }
-
- // Check for lookup interceptor.
- if (object->HasIndexedInterceptor()) return MaybeHandle<AccessorPair>();
-
- return object->GetElementsAccessor()->GetAccessorPair(object, index);
-}
-
-
bool JSObject::HasFastArgumentsElements() {
Heap* heap = GetHeap();
if (!elements()->IsFixedArray()) return false;
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698