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

Side by Side Diff: src/lookup.cc

Issue 1178503004: Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 6 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 413
414 414
415 Handle<Object> LookupIterator::GetDataValue() const { 415 Handle<Object> LookupIterator::GetDataValue() const {
416 DCHECK_EQ(DATA, state_); 416 DCHECK_EQ(DATA, state_);
417 Handle<Object> value = FetchValue(); 417 Handle<Object> value = FetchValue();
418 return value; 418 return value;
419 } 419 }
420 420
421 421
422 Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) { 422 void LookupIterator::WriteDataValue(Handle<Object> value) {
423 DCHECK_EQ(DATA, state_); 423 DCHECK_EQ(DATA, state_);
424 Handle<JSObject> holder = GetHolder<JSObject>(); 424 Handle<JSObject> holder = GetHolder<JSObject>();
425 if (IsElement()) { 425 if (IsElement()) {
426 ElementsAccessor* accessor = holder->GetElementsAccessor(); 426 ElementsAccessor* accessor = holder->GetElementsAccessor();
427 return accessor->Set(holder, index_, value); 427 accessor->Set(holder, index_, value);
428 } else if (holder->IsGlobalObject()) { 428 } else if (holder->IsGlobalObject()) {
429 Handle<GlobalDictionary> property_dictionary = 429 Handle<GlobalDictionary> property_dictionary =
430 handle(holder->global_dictionary()); 430 handle(holder->global_dictionary());
431 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, 431 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value,
432 property_details_); 432 property_details_);
433 } else if (holder_map_->is_dictionary_map()) { 433 } else if (holder_map_->is_dictionary_map()) {
434 Handle<NameDictionary> property_dictionary = 434 Handle<NameDictionary> property_dictionary =
435 handle(holder->property_dictionary()); 435 handle(holder->property_dictionary());
436 property_dictionary->ValueAtPut(dictionary_entry(), *value); 436 property_dictionary->ValueAtPut(dictionary_entry(), *value);
437 } else if (property_details_.type() == v8::internal::DATA) { 437 } else if (property_details_.type() == v8::internal::DATA) {
438 holder->WriteToField(descriptor_number(), *value); 438 holder->WriteToField(descriptor_number(), *value);
439 } else { 439 } else {
440 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); 440 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
441 } 441 }
442 return value;
443 } 442 }
444 443
445 444
446 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) { 445 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) {
447 DCHECK(exotic_index_state_ != ExoticIndexState::kNotExotic); 446 DCHECK(exotic_index_state_ != ExoticIndexState::kNotExotic);
448 // Currently typed arrays are the only such objects. 447 // Currently typed arrays are the only such objects.
449 if (!holder->IsJSTypedArray()) return false; 448 if (!holder->IsJSTypedArray()) return false;
450 if (exotic_index_state_ == ExoticIndexState::kExotic) return true; 449 if (exotic_index_state_ == ExoticIndexState::kExotic) return true;
451 if (!InternalHolderIsReceiverOrHiddenPrototype()) { 450 if (!InternalHolderIsReceiverOrHiddenPrototype()) {
452 exotic_index_state_ = ExoticIndexState::kNotExotic; 451 exotic_index_state_ = ExoticIndexState::kNotExotic;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 case InterceptorState::kSkipNonMasking: 503 case InterceptorState::kSkipNonMasking:
505 return true; 504 return true;
506 case InterceptorState::kProcessNonMasking: 505 case InterceptorState::kProcessNonMasking:
507 return false; 506 return false;
508 } 507 }
509 } 508 }
510 return interceptor_state_ == InterceptorState::kProcessNonMasking; 509 return interceptor_state_ == InterceptorState::kProcessNonMasking;
511 } 510 }
512 } // namespace internal 511 } // namespace internal
513 } // namespace v8 512 } // namespace v8
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