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

Unified Diff: src/lookup.cc

Issue 429053005: Avoid one repeated property lookup when computing load ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 5 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/lookup.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index d275890a3dc168eab9da03ebf91e0b491189e77f..d1516c05fcdf96d43b2a8453acb796c6aa168fd3 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -120,8 +120,9 @@ bool LookupIterator::HasProperty() {
return false;
}
} else {
- property_details_ = holder_map_->instance_descriptors()->GetDetails(
- number_);
+ // Can't use descriptor_number() yet because has_property_ is still false.
+ property_details_ =
+ holder_map_->instance_descriptors()->GetDetails(number_);
}
switch (property_details_.type()) {
@@ -146,9 +147,10 @@ bool LookupIterator::HasProperty() {
void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
ASSERT(has_property_);
- ASSERT(HolderIsReceiver());
+ ASSERT(HolderIsReceiverOrHiddenPrototype());
if (property_encoding_ == DICTIONARY) return;
- holder_map_ = Map::PrepareForDataProperty(holder_map_, number_, value);
+ holder_map_ =
+ Map::PrepareForDataProperty(holder_map_, descriptor_number(), value);
JSObject::MigrateToMap(GetHolder<JSObject>(), holder_map_);
// Reload property information.
if (holder_map_->is_dictionary_map()) {
@@ -163,7 +165,7 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
void LookupIterator::TransitionToDataProperty(
Handle<Object> value, PropertyAttributes attributes,
Object::StoreFromKeyed store_mode) {
- ASSERT(!has_property_ || !HolderIsReceiver());
+ ASSERT(!has_property_ || !HolderIsReceiverOrHiddenPrototype());
// Can only be called when the receiver is a JSObject. JSProxy has to be
// handled via a trap. Adding properties to primitive values is not
@@ -194,7 +196,7 @@ void LookupIterator::TransitionToDataProperty(
}
-bool LookupIterator::HolderIsReceiver() const {
+bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const {
ASSERT(has_property_ || state_ == INTERCEPTOR || state_ == JSPROXY);
DisallowHeapAllocation no_gc;
Handle<Object> receiver = GetReceiver();
@@ -228,8 +230,8 @@ Handle<Object> LookupIterator::FetchValue() const {
break;
case DESCRIPTOR:
if (property_details_.type() == v8::internal::FIELD) {
- FieldIndex field_index = FieldIndex::ForDescriptor(
- *holder_map_, number_);
+ FieldIndex field_index =
+ FieldIndex::ForDescriptor(*holder_map_, number_);
return JSObject::FastPropertyAt(
holder, property_details_.representation(), field_index);
}
@@ -239,6 +241,23 @@ Handle<Object> LookupIterator::FetchValue() const {
}
+FieldIndex LookupIterator::GetFieldIndex() const {
+ ASSERT_EQ(PROPERTY, state_);
+ int index =
+ holder_map()->instance_descriptors()->GetFieldIndex(descriptor_number());
+ bool is_double = representation().IsDouble();
+ return FieldIndex::ForPropertyIndex(*holder_map(), index, is_double);
+}
+
+
+Handle<PropertyCell> LookupIterator::GetPropertyCell() const {
+ Handle<JSObject> holder = GetHolder<JSObject>();
+ Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder);
+ Object* value = global->property_dictionary()->ValueAt(dictionary_entry());
+ return Handle<PropertyCell>(PropertyCell::cast(value));
+}
+
+
Handle<Object> LookupIterator::GetAccessors() const {
ASSERT(has_property_);
ASSERT_EQ(ACCESSOR, property_kind_);
@@ -262,13 +281,13 @@ void LookupIterator::WriteDataValue(Handle<Object> value) {
NameDictionary* property_dictionary = holder->property_dictionary();
if (holder->IsGlobalObject()) {
Handle<PropertyCell> cell(
- PropertyCell::cast(property_dictionary->ValueAt(number_)));
+ PropertyCell::cast(property_dictionary->ValueAt(dictionary_entry())));
PropertyCell::SetValueInferType(cell, value);
} else {
- property_dictionary->ValueAtPut(number_, *value);
+ property_dictionary->ValueAtPut(dictionary_entry(), *value);
}
} else if (property_details_.type() == v8::internal::FIELD) {
- holder->WriteToField(number_, *value);
+ holder->WriteToField(descriptor_number(), *value);
} else {
ASSERT_EQ(v8::internal::CONSTANT, property_details_.type());
}
« no previous file with comments | « src/lookup.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698