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

Side by Side Diff: src/lookup.cc

Issue 1144883002: Start adding support for elements to the LookupIterator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/lookup-inl.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 140
141 void LookupIterator::PrepareTransitionToDataProperty( 141 void LookupIterator::PrepareTransitionToDataProperty(
142 Handle<Object> value, PropertyAttributes attributes, 142 Handle<Object> value, PropertyAttributes attributes,
143 Object::StoreFromKeyed store_mode) { 143 Object::StoreFromKeyed store_mode) {
144 if (state_ == TRANSITION) return; 144 if (state_ == TRANSITION) return;
145 DCHECK(state_ != LookupIterator::ACCESSOR || 145 DCHECK(state_ != LookupIterator::ACCESSOR ||
146 (GetAccessors()->IsAccessorInfo() && 146 (GetAccessors()->IsAccessorInfo() &&
147 AccessorInfo::cast(*GetAccessors())->is_special_data_property())); 147 AccessorInfo::cast(*GetAccessors())->is_special_data_property()));
148 DCHECK_NE(LookupIterator::INTEGER_INDEXED_EXOTIC, state_); 148 DCHECK_NE(INTEGER_INDEXED_EXOTIC, state_);
149 DCHECK(state_ == NOT_FOUND || !HolderIsReceiverOrHiddenPrototype()); 149 DCHECK(state_ == NOT_FOUND || !HolderIsReceiverOrHiddenPrototype());
150 // Can only be called when the receiver is a JSObject. JSProxy has to be 150 // Can only be called when the receiver is a JSObject. JSProxy has to be
151 // handled via a trap. Adding properties to primitive values is not 151 // handled via a trap. Adding properties to primitive values is not
152 // observable. 152 // observable.
153 Handle<JSObject> receiver = GetStoreTarget(); 153 Handle<JSObject> receiver = GetStoreTarget();
154 154
155 if (!isolate()->IsInternallyUsedPropertyName(name()) && 155 if (!isolate()->IsInternallyUsedPropertyName(name()) &&
156 !receiver->map()->is_extensible()) { 156 !receiver->map()->is_extensible()) {
157 return; 157 return;
158 } 158 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 } else if (property_details_.type() == v8::internal::DATA) { 349 } else if (property_details_.type() == v8::internal::DATA) {
350 holder->WriteToField(descriptor_number(), *value); 350 holder->WriteToField(descriptor_number(), *value);
351 } else { 351 } else {
352 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); 352 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
353 } 353 }
354 } 354 }
355 355
356 356
357 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) { 357 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) {
358 DCHECK(exotic_index_state_ != ExoticIndexState::kNoIndex); 358 DCHECK(ExoticIndexState::kNotExotic != exotic_index_state_);
359 // Currently typed arrays are the only such objects. 359 // Currently typed arrays are the only such objects.
360 if (!holder->IsJSTypedArray()) return false; 360 if (!holder->IsJSTypedArray()) return false;
361 if (exotic_index_state_ == ExoticIndexState::kIndex) return true; 361 if (exotic_index_state_ == ExoticIndexState::kExotic) return true;
362 DCHECK(exotic_index_state_ == ExoticIndexState::kUninitialized); 362 DCHECK(exotic_index_state_ == ExoticIndexState::kUninitialized);
363 bool result = false; 363 bool result = false;
364 // Compute and cache result. 364 // Compute and cache result.
365 if (name()->IsString()) { 365 if (name()->IsString()) {
366 Handle<String> name_string = Handle<String>::cast(name()); 366 Handle<String> name_string = Handle<String>::cast(name());
367 if (name_string->length() != 0) { 367 if (name_string->length() != 0) {
368 result = IsSpecialIndex(isolate_->unicode_cache(), *name_string); 368 result = IsSpecialIndex(isolate_->unicode_cache(), *name_string);
369 } 369 }
370 } 370 }
371 exotic_index_state_ = 371 exotic_index_state_ =
372 result ? ExoticIndexState::kIndex : ExoticIndexState::kNoIndex; 372 result ? ExoticIndexState::kExotic : ExoticIndexState::kNotExotic;
373 return result; 373 return result;
374 } 374 }
375 375
376 376
377 void LookupIterator::InternalizeName() { 377 void LookupIterator::InternalizeName() {
378 if (name_->IsUniqueName()) return; 378 if (name_->IsUniqueName()) return;
379 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); 379 name_ = factory()->InternalizeString(Handle<String>::cast(name_));
380 } 380 }
381 381
382 382
383 bool LookupIterator::HasInterceptor(Map* map) const {
384 if (IsElement()) return map->has_indexed_interceptor();
385 return map->has_named_interceptor();
386 }
387
388
383 bool LookupIterator::SkipInterceptor(JSObject* holder) { 389 bool LookupIterator::SkipInterceptor(JSObject* holder) {
384 auto info = holder->GetNamedInterceptor(); 390 auto info = holder->GetNamedInterceptor();
385 // TODO(dcarney): check for symbol/can_intercept_symbols here as well. 391 // TODO(dcarney): check for symbol/can_intercept_symbols here as well.
386 if (info->non_masking()) { 392 if (info->non_masking()) {
387 switch (interceptor_state_) { 393 switch (interceptor_state_) {
388 case InterceptorState::kUninitialized: 394 case InterceptorState::kUninitialized:
389 interceptor_state_ = InterceptorState::kSkipNonMasking; 395 interceptor_state_ = InterceptorState::kSkipNonMasking;
390 // Fall through. 396 // Fall through.
391 case InterceptorState::kSkipNonMasking: 397 case InterceptorState::kSkipNonMasking:
392 return true; 398 return true;
393 case InterceptorState::kProcessNonMasking: 399 case InterceptorState::kProcessNonMasking:
394 return false; 400 return false;
395 } 401 }
396 } 402 }
397 return interceptor_state_ == InterceptorState::kProcessNonMasking; 403 return interceptor_state_ == InterceptorState::kProcessNonMasking;
398 } 404 }
399 } } // namespace v8::internal 405 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lookup.h ('k') | src/lookup-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698