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

Side by Side Diff: src/lookup.cc

Issue 1409123003: [runtime] Avoid @@isConcatSpreadable lookup for fast path Array.prototype.concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merging with master Created 4 years, 7 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.cc » ('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/lookup.h" 5 #include "src/lookup.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/elements.h" 9 #include "src/elements.h"
10 #include "src/field-type.h" 10 #include "src/field-type.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 template <bool is_element> 153 template <bool is_element>
154 void LookupIterator::ReloadPropertyInformation() { 154 void LookupIterator::ReloadPropertyInformation() {
155 state_ = BEFORE_PROPERTY; 155 state_ = BEFORE_PROPERTY;
156 interceptor_state_ = InterceptorState::kUninitialized; 156 interceptor_state_ = InterceptorState::kUninitialized;
157 state_ = LookupInHolder<is_element>(holder_->map(), *holder_); 157 state_ = LookupInHolder<is_element>(holder_->map(), *holder_);
158 DCHECK(IsFound() || !holder_->HasFastProperties()); 158 DCHECK(IsFound() || !holder_->HasFastProperties());
159 } 159 }
160 160
161 bool LookupIterator::HolderIsInContextIndex(uint32_t index) const {
162 DisallowHeapAllocation no_gc;
163
164 Object* context = heap()->native_contexts_list();
165 while (!context->IsUndefined()) {
166 Context* current_context = Context::cast(context);
167 if (current_context->get(index) == *holder_) {
168 return true;
169 }
170 context = current_context->get(Context::NEXT_CONTEXT_LINK);
171 }
172 return false;
173 }
174
175 void LookupIterator::InternalUpdateProtector() { 161 void LookupIterator::InternalUpdateProtector() {
176 if (isolate_->bootstrapper()->IsActive()) return; 162 if (isolate_->bootstrapper()->IsActive()) return;
177 if (!isolate_->IsArraySpeciesLookupChainIntact()) return;
178 163
179 if (*name_ == heap()->constructor_string()) { 164 if (*name_ == heap()->constructor_string()) {
165 if (!isolate_->IsArraySpeciesLookupChainIntact()) return;
180 // Setting the constructor property could change an instance's @@species 166 // Setting the constructor property could change an instance's @@species
181 if (holder_->IsJSArray()) { 167 if (holder_->IsJSArray()) {
182 isolate_->CountUsage( 168 isolate_->CountUsage(
183 v8::Isolate::UseCounterFeature::kArrayInstanceConstructorModified); 169 v8::Isolate::UseCounterFeature::kArrayInstanceConstructorModified);
184 isolate_->InvalidateArraySpeciesProtector(); 170 isolate_->InvalidateArraySpeciesProtector();
185 } else if (holder_->map()->is_prototype_map()) { 171 } else if (holder_->map()->is_prototype_map()) {
172 DisallowHeapAllocation no_gc;
186 // Setting the constructor of Array.prototype of any realm also needs 173 // Setting the constructor of Array.prototype of any realm also needs
187 // to invalidate the species protector 174 // to invalidate the species protector
188 if (HolderIsInContextIndex(Context::INITIAL_ARRAY_PROTOTYPE_INDEX)) { 175 if (isolate_->IsInAnyContext(*holder_,
176 Context::INITIAL_ARRAY_PROTOTYPE_INDEX)) {
189 isolate_->CountUsage(v8::Isolate::UseCounterFeature:: 177 isolate_->CountUsage(v8::Isolate::UseCounterFeature::
190 kArrayPrototypeConstructorModified); 178 kArrayPrototypeConstructorModified);
191 isolate_->InvalidateArraySpeciesProtector(); 179 isolate_->InvalidateArraySpeciesProtector();
192 } 180 }
193 } 181 }
194 } else if (*name_ == heap()->species_symbol()) { 182 } else if (*name_ == heap()->species_symbol()) {
183 if (!isolate_->IsArraySpeciesLookupChainIntact()) return;
195 // Setting the Symbol.species property of any Array constructor invalidates 184 // Setting the Symbol.species property of any Array constructor invalidates
196 // the species protector 185 // the species protector
197 if (HolderIsInContextIndex(Context::ARRAY_FUNCTION_INDEX)) { 186 if (isolate_->IsInAnyContext(*holder_, Context::ARRAY_FUNCTION_INDEX)) {
198 isolate_->CountUsage( 187 isolate_->CountUsage(
199 v8::Isolate::UseCounterFeature::kArraySpeciesModified); 188 v8::Isolate::UseCounterFeature::kArraySpeciesModified);
200 isolate_->InvalidateArraySpeciesProtector(); 189 isolate_->InvalidateArraySpeciesProtector();
201 } 190 }
191 } else if (*name_ == heap()->is_concat_spreadable_symbol()) {
192 if (!isolate_->IsIsConcatSpreadableLookupChainIntact()) return;
193 isolate_->InvalidateIsConcatSpreadableProtector();
202 } 194 }
203 } 195 }
204 196
205 void LookupIterator::PrepareForDataProperty(Handle<Object> value) { 197 void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
206 DCHECK(state_ == DATA || state_ == ACCESSOR); 198 DCHECK(state_ == DATA || state_ == ACCESSOR);
207 DCHECK(HolderIsReceiverOrHiddenPrototype()); 199 DCHECK(HolderIsReceiverOrHiddenPrototype());
208 200
209 Handle<JSObject> holder = GetHolder<JSObject>(); 201 Handle<JSObject> holder = GetHolder<JSObject>();
210 202
211 if (IsElement()) { 203 if (IsElement()) {
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 case v8::internal::kAccessor: 760 case v8::internal::kAccessor:
769 return ACCESSOR; 761 return ACCESSOR;
770 } 762 }
771 763
772 UNREACHABLE(); 764 UNREACHABLE();
773 return state_; 765 return state_;
774 } 766 }
775 767
776 } // namespace internal 768 } // namespace internal
777 } // namespace v8 769 } // namespace v8
OLDNEW
« 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