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

Unified Diff: src/lookup.cc

Issue 1702443002: [runtime] Minor tweaks to LookupIterator for performance (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment 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') | src/objects.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 cd463adca266d02d74a13e1bf2a46565e17979bc..8dec50280e6fe0324458b7153c597198f425c919 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -122,9 +122,10 @@ Handle<Map> LookupIterator::GetReceiverMap() const {
Handle<JSObject> LookupIterator::GetStoreTarget() const {
if (receiver_->IsJSGlobalProxy()) {
- PrototypeIterator iter(isolate(), Handle<JSGlobalProxy>::cast(receiver_));
- if (iter.IsAtEnd()) return Handle<JSGlobalProxy>::cast(receiver_);
- return PrototypeIterator::GetCurrent<JSGlobalObject>(iter);
+ Object* prototype = JSGlobalProxy::cast(*receiver_)->map()->prototype();
+ if (!prototype->IsNull()) {
+ return handle(JSGlobalObject::cast(prototype), isolate_);
+ }
}
return Handle<JSObject>::cast(receiver_);
}
@@ -232,25 +233,18 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
#endif
}
-
+// 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 observable.
void LookupIterator::PrepareTransitionToDataProperty(
- Handle<Object> value, PropertyAttributes attributes,
- Object::StoreFromKeyed store_mode) {
+ Handle<JSObject> receiver, Handle<Object> value,
+ PropertyAttributes attributes, Object::StoreFromKeyed store_mode) {
+ DCHECK(receiver.is_identical_to(GetStoreTarget()));
if (state_ == TRANSITION) return;
DCHECK(state_ != LookupIterator::ACCESSOR ||
(GetAccessors()->IsAccessorInfo() &&
AccessorInfo::cast(*GetAccessors())->is_special_data_property()));
DCHECK_NE(INTEGER_INDEXED_EXOTIC, state_);
DCHECK(state_ == NOT_FOUND || !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
- // observable.
- Handle<JSObject> receiver = GetStoreTarget();
-
- if (!isolate()->IsInternallyUsedPropertyName(name()) &&
- !receiver->map()->is_extensible()) {
- return;
- }
auto transition = Map::TransitionToDataProperty(
handle(receiver->map(), isolate_), name_, value, attributes, store_mode);
@@ -270,11 +264,11 @@ void LookupIterator::PrepareTransitionToDataProperty(
}
}
-
-void LookupIterator::ApplyTransitionToDataProperty() {
+void LookupIterator::ApplyTransitionToDataProperty(Handle<JSObject> receiver) {
DCHECK_EQ(TRANSITION, state_);
- Handle<JSObject> receiver = GetStoreTarget();
+ DCHECK(receiver.is_identical_to(GetStoreTarget()));
+
if (receiver->IsJSGlobalObject()) return;
holder_ = receiver;
Handle<Map> transition = transition_map();
« no previous file with comments | « src/lookup.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698