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

Side by Side Diff: src/lookup.cc

Issue 911713003: add transitions for global properties in ics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/lookup-inl.h" 10 #include "src/lookup-inl.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Can only be called when the receiver is a JSObject. JSProxy has to be 124 // Can only be called when the receiver is a JSObject. JSProxy has to be
125 // handled via a trap. Adding properties to primitive values is not 125 // handled via a trap. Adding properties to primitive values is not
126 // observable. 126 // observable.
127 Handle<JSObject> receiver = GetStoreTarget(); 127 Handle<JSObject> receiver = GetStoreTarget();
128 128
129 if (!isolate()->IsInternallyUsedPropertyName(name()) && 129 if (!isolate()->IsInternallyUsedPropertyName(name()) &&
130 !receiver->map()->is_extensible()) { 130 !receiver->map()->is_extensible()) {
131 return; 131 return;
132 } 132 }
133 133
134 transition_map_ = Map::TransitionToDataProperty( 134 auto transition = Map::TransitionToDataProperty(
135 handle(receiver->map(), isolate_), name_, value, attributes, store_mode); 135 handle(receiver->map(), isolate_), name_, value, attributes, store_mode);
136 state_ = TRANSITION; 136 state_ = TRANSITION;
137 transition_ = transition;
138
139 if (receiver->IsGlobalObject()) {
140 // Install a property cell.
141 InternalizeName();
142 auto cell = GlobalObject::EnsurePropertyCell(
143 Handle<GlobalObject>::cast(receiver), name());
144 DCHECK(cell->value()->IsTheHole());
145 transition_ = cell;
146 } else if (transition->GetBackPointer()->IsMap()) {
147 property_details_ = transition->GetLastDescriptorDetails();
148 has_property_ = true;
149 }
137 } 150 }
138 151
139 152
140 void LookupIterator::ApplyTransitionToDataProperty() { 153 void LookupIterator::ApplyTransitionToDataProperty() {
141 DCHECK_EQ(TRANSITION, state_); 154 DCHECK_EQ(TRANSITION, state_);
142 155
143 Handle<JSObject> receiver = GetStoreTarget(); 156 Handle<JSObject> receiver = GetStoreTarget();
157 if (receiver->IsGlobalObject()) return;
144 holder_ = receiver; 158 holder_ = receiver;
145 holder_map_ = transition_map_; 159 holder_map_ = transition_map();
146 JSObject::MigrateToMap(receiver, holder_map_); 160 JSObject::MigrateToMap(receiver, holder_map_);
147 ReloadPropertyInformation(); 161 ReloadPropertyInformation();
148 } 162 }
149 163
150 164
151 void LookupIterator::TransitionToAccessorProperty( 165 void LookupIterator::TransitionToAccessorProperty(
152 AccessorComponent component, Handle<Object> accessor, 166 AccessorComponent component, Handle<Object> accessor,
153 PropertyAttributes attributes) { 167 PropertyAttributes attributes) {
154 DCHECK(!accessor->IsNull()); 168 DCHECK(!accessor->IsNull());
155 // Can only be called when the receiver is a JSObject. JSProxy has to be 169 // Can only be called when the receiver is a JSObject. JSProxy has to be
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 351 }
338 return false; 352 return false;
339 } 353 }
340 354
341 355
342 void LookupIterator::InternalizeName() { 356 void LookupIterator::InternalizeName() {
343 if (name_->IsUniqueName()) return; 357 if (name_->IsUniqueName()) return;
344 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); 358 name_ = factory()->InternalizeString(Handle<String>::cast(name_));
345 } 359 }
346 } } // namespace v8::internal 360 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698