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

Unified Diff: src/runtime.cc

Issue 540903002: Flatten property_kind into state. Add UNKNOWN as a state for dict-mode receivers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add DCHECKs Created 6 years, 3 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.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 8b33e3a06a8b3d63fd3b8292e9f0b85a78ec8dc4..f0c5edc53b1e8947646ddac4420a27a65d8149e9 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1990,8 +1990,7 @@ MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate,
if (attrs == ABSENT) return factory->undefined_value();
// Get AccessorPair if present.
- if (it.state() == LookupIterator::PROPERTY &&
- it.property_kind() == LookupIterator::ACCESSOR &&
+ if (it.state() == LookupIterator::ACCESSOR &&
it.GetAccessors()->IsAccessorPair()) {
maybe_accessors = Handle<AccessorPair>::cast(it.GetAccessors());
}
@@ -2323,7 +2322,7 @@ RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) {
// Ignore if we can't reconfigure the value.
if ((old_attributes & DONT_DELETE) != 0) {
if ((old_attributes & READ_ONLY) != 0 ||
- it.property_kind() == LookupIterator::ACCESSOR) {
+ it.state() == LookupIterator::ACCESSOR) {
return *value;
}
attr = static_cast<PropertyAttributes>(old_attributes | READ_ONLY);
@@ -2468,7 +2467,7 @@ RUNTIME_FUNCTION(Runtime_InitializeLegacyConstLookupSlot) {
// Ignore if we can't reconfigure the value.
if ((old_attributes & DONT_DELETE) != 0) {
if ((old_attributes & READ_ONLY) != 0 ||
- it.property_kind() == LookupIterator::ACCESSOR) {
+ it.state() == LookupIterator::ACCESSOR) {
return *value;
}
attr = static_cast<PropertyAttributes>(old_attributes | READ_ONLY);
@@ -4891,8 +4890,8 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
// Lookup cache miss. Perform lookup and update the cache if
// appropriate.
LookupIterator it(receiver, key, LookupIterator::OWN);
- if (it.IsFound() && it.state() == LookupIterator::PROPERTY &&
- it.HasProperty() && it.property_details().type() == FIELD) {
+ if (it.state() == LookupIterator::DATA &&
+ it.property_details().type() == FIELD) {
FieldIndex field_index = it.GetFieldIndex();
// Do not track double fields in the keyed lookup cache. Reading
// double values requires boxing.
@@ -5050,8 +5049,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
// Take special care when attributes are different and there is already
// a property.
- if (it.IsFound() && it.HasProperty() &&
- it.property_kind() == LookupIterator::ACCESSOR) {
+ if (it.state() == LookupIterator::ACCESSOR) {
// Use IgnoreAttributes version since a readonly property may be
// overridden and SetProperty does not allow this.
Handle<Object> result;
@@ -10898,6 +10896,7 @@ static Handle<Object> DebugGetProperty(LookupIterator* it,
switch (it->state()) {
case LookupIterator::NOT_FOUND:
case LookupIterator::TRANSITION:
+ case LookupIterator::UNKNOWN:
UNREACHABLE();
case LookupIterator::ACCESS_CHECK:
// Ignore access checks.
@@ -10905,30 +10904,25 @@ static Handle<Object> DebugGetProperty(LookupIterator* it,
case LookupIterator::INTERCEPTOR:
case LookupIterator::JSPROXY:
return it->isolate()->factory()->undefined_value();
- case LookupIterator::PROPERTY:
- if (!it->HasProperty()) continue;
- switch (it->property_kind()) {
- case LookupIterator::ACCESSOR: {
- Handle<Object> accessors = it->GetAccessors();
- if (!accessors->IsAccessorInfo()) {
- return it->isolate()->factory()->undefined_value();
- }
- MaybeHandle<Object> maybe_result =
- JSObject::GetPropertyWithAccessor(it->GetReceiver(), it->name(),
- it->GetHolder<JSObject>(),
- accessors);
- Handle<Object> result;
- if (!maybe_result.ToHandle(&result)) {
- result =
- handle(it->isolate()->pending_exception(), it->isolate());
- it->isolate()->clear_pending_exception();
- if (has_caught != NULL) *has_caught = true;
- }
- return result;
- }
- case LookupIterator::DATA:
- return it->GetDataValue();
+ case LookupIterator::ACCESSOR: {
+ Handle<Object> accessors = it->GetAccessors();
+ if (!accessors->IsAccessorInfo()) {
+ return it->isolate()->factory()->undefined_value();
}
+ MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithAccessor(
+ it->GetReceiver(), it->name(), it->GetHolder<JSObject>(),
+ accessors);
+ Handle<Object> result;
+ if (!maybe_result.ToHandle(&result)) {
+ result = handle(it->isolate()->pending_exception(), it->isolate());
+ it->isolate()->clear_pending_exception();
+ if (has_caught != NULL) *has_caught = true;
+ }
+ return result;
+ }
+
+ case LookupIterator::DATA:
+ return it->GetDataValue();
}
}
@@ -10983,8 +10977,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetPropertyDetails) {
if (!it.IsFound()) return isolate->heap()->undefined_value();
Handle<Object> maybe_pair;
- if (it.state() == LookupIterator::PROPERTY &&
- it.property_kind() == LookupIterator::ACCESSOR) {
+ if (it.state() == LookupIterator::ACCESSOR) {
maybe_pair = it.GetAccessors();
}
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698