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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 1945023003: [turbofan] Don't need any write barrier when storing maps from the root set. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | 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/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 if (field_type->Is(Type::BooleanOrNullOrUndefined()) || 726 if (field_type->Is(Type::BooleanOrNullOrUndefined()) ||
727 value_type->Is(Type::BooleanOrNullOrUndefined())) { 727 value_type->Is(Type::BooleanOrNullOrUndefined())) {
728 // Write barriers are not necessary when storing true, false, null or 728 // Write barriers are not necessary when storing true, false, null or
729 // undefined, because these special oddballs are always in the root set. 729 // undefined, because these special oddballs are always in the root set.
730 return kNoWriteBarrier; 730 return kNoWriteBarrier;
731 } 731 }
732 if (value_type->IsConstant() && 732 if (value_type->IsConstant() &&
733 value_type->AsConstant()->Value()->IsHeapObject()) { 733 value_type->AsConstant()->Value()->IsHeapObject()) {
734 Handle<HeapObject> value_object = 734 Handle<HeapObject> value_object =
735 Handle<HeapObject>::cast(value_type->AsConstant()->Value()); 735 Handle<HeapObject>::cast(value_type->AsConstant()->Value());
736 if (value_object->IsMap()) {
737 // Write barriers for storing maps are cheaper.
738 return kMapWriteBarrier;
739 }
740 RootIndexMap root_index_map(jsgraph_->isolate()); 736 RootIndexMap root_index_map(jsgraph_->isolate());
741 int root_index = root_index_map.Lookup(*value_object); 737 int root_index = root_index_map.Lookup(*value_object);
742 if (root_index != RootIndexMap::kInvalidRootIndex && 738 if (root_index != RootIndexMap::kInvalidRootIndex &&
743 jsgraph_->isolate()->heap()->RootIsImmortalImmovable(root_index)) { 739 jsgraph_->isolate()->heap()->RootIsImmortalImmovable(root_index)) {
744 // Write barriers are unnecessary for immortal immovable roots. 740 // Write barriers are unnecessary for immortal immovable roots.
745 return kNoWriteBarrier; 741 return kNoWriteBarrier;
746 } 742 }
743 if (value_object->IsMap()) {
744 // Write barriers for storing maps are cheaper.
745 return kMapWriteBarrier;
746 }
747 } 747 }
748 if (field_type->Is(Type::TaggedPointer()) || 748 if (field_type->Is(Type::TaggedPointer()) ||
749 value_type->Is(Type::TaggedPointer())) { 749 value_type->Is(Type::TaggedPointer())) {
750 // Write barriers for heap objects are cheaper. 750 // Write barriers for heap objects are cheaper.
751 return kPointerWriteBarrier; 751 return kPointerWriteBarrier;
752 } 752 }
753 NumberMatcher m(value); 753 NumberMatcher m(value);
754 if (m.HasValue()) { 754 if (m.HasValue()) {
755 if (IsSmiDouble(m.Value())) { 755 if (IsSmiDouble(m.Value())) {
756 // Storing a smi doesn't need a write barrier. 756 // Storing a smi doesn't need a write barrier.
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 2460 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
2461 Operator::kNoProperties); 2461 Operator::kNoProperties);
2462 to_number_operator_.set(common()->Call(desc)); 2462 to_number_operator_.set(common()->Call(desc));
2463 } 2463 }
2464 return to_number_operator_.get(); 2464 return to_number_operator_.get();
2465 } 2465 }
2466 2466
2467 } // namespace compiler 2467 } // namespace compiler
2468 } // namespace internal 2468 } // namespace internal
2469 } // namespace v8 2469 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698