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

Unified Diff: src/lookup.cc

Issue 1697153002: [runtime] Add fast path to update LookupIterator in simple cases (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.h ('k') | no next file » | 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 58d9633b4b4ae06bb79ba4003444385394bfe3bc..cd463adca266d02d74a13e1bf2a46565e17979bc 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -166,18 +166,32 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
ElementsKind to = value->OptimalElementsKind();
if (IsHoleyElementsKind(kind)) to = GetHoleyElementsKind(to);
to = GetMoreGeneralElementsKind(kind, to);
- JSObject::TransitionElementsKind(holder, to);
- holder_map_ = handle(holder->map(), isolate_);
+
+ if (kind != to) {
+ JSObject::TransitionElementsKind(holder, to);
+ holder_map_ = handle(holder->map(), isolate_);
+ }
// Copy the backing store if it is copy-on-write.
if (IsFastSmiOrObjectElementsKind(to)) {
JSObject::EnsureWritableFastElements(holder);
}
+ if (kind == to) return;
+
} else {
if (holder_map_->is_dictionary_map()) return;
holder_map_ =
Map::PrepareForDataProperty(holder_map_, descriptor_number(), value);
+
+ if (holder->map() == *holder_map_) {
+ // Update the property details if the representation was None.
+ if (representation().IsNone()) {
+ property_details_ = holder_map_->instance_descriptors()->GetDetails(
+ descriptor_number());
+ }
+ return;
+ }
}
JSObject::MigrateToMap(holder, holder_map_);
@@ -263,9 +277,19 @@ void LookupIterator::ApplyTransitionToDataProperty() {
Handle<JSObject> receiver = GetStoreTarget();
if (receiver->IsJSGlobalObject()) return;
holder_ = receiver;
- holder_map_ = transition_map();
+ Handle<Map> transition = transition_map();
+ bool simple_transition = transition->GetBackPointer() == receiver->map();
+ holder_map_ = transition;
JSObject::MigrateToMap(receiver, holder_map_);
- ReloadPropertyInformation();
+
+ if (simple_transition) {
+ int number = transition->LastAdded();
+ number_ = static_cast<uint32_t>(number);
+ property_details_ = transition->GetLastDescriptorDetails();
+ state_ = DATA;
+ } else {
+ ReloadPropertyInformation();
+ }
}
« no previous file with comments | « src/lookup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698