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

Side by Side Diff: src/lookup.cc

Issue 1148583002: Simplify GetProperty helpers to ease element support (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More comments 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/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 337 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(ExoticIndexState::kNotExotic != exotic_index_state_); 358 DCHECK(exotic_index_state_ != ExoticIndexState::kNotExotic);
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::kExotic) 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);
(...skipping 10 matching lines...) Expand all
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 { 383 bool LookupIterator::HasInterceptor(Map* map) const {
384 if (IsElement()) return map->has_indexed_interceptor(); 384 if (IsElement()) return map->has_indexed_interceptor();
385 return map->has_named_interceptor(); 385 return map->has_named_interceptor();
386 } 386 }
387 387
388 388
389 Handle<InterceptorInfo> LookupIterator::GetInterceptor() const {
390 DCHECK_EQ(INTERCEPTOR, state_);
391 Handle<JSObject> js_holder = Handle<JSObject>::cast(holder_);
392 if (IsElement()) return handle(js_holder->GetIndexedInterceptor(), isolate_);
393 return handle(js_holder->GetNamedInterceptor(), isolate_);
394 }
395
396
389 bool LookupIterator::SkipInterceptor(JSObject* holder) { 397 bool LookupIterator::SkipInterceptor(JSObject* holder) {
390 auto info = holder->GetNamedInterceptor(); 398 auto info = holder->GetNamedInterceptor();
391 // TODO(dcarney): check for symbol/can_intercept_symbols here as well. 399 // TODO(dcarney): check for symbol/can_intercept_symbols here as well.
392 if (info->non_masking()) { 400 if (info->non_masking()) {
393 switch (interceptor_state_) { 401 switch (interceptor_state_) {
394 case InterceptorState::kUninitialized: 402 case InterceptorState::kUninitialized:
395 interceptor_state_ = InterceptorState::kSkipNonMasking; 403 interceptor_state_ = InterceptorState::kSkipNonMasking;
396 // Fall through. 404 // Fall through.
397 case InterceptorState::kSkipNonMasking: 405 case InterceptorState::kSkipNonMasking:
398 return true; 406 return true;
399 case InterceptorState::kProcessNonMasking: 407 case InterceptorState::kProcessNonMasking:
400 return false; 408 return false;
401 } 409 }
402 } 410 }
403 return interceptor_state_ == InterceptorState::kProcessNonMasking; 411 return interceptor_state_ == InterceptorState::kProcessNonMasking;
404 } 412 }
405 } } // namespace v8::internal 413 } } // 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