OLD | NEW |
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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 // Write barriers are only for stores of heap objects. | 1102 // Write barriers are only for stores of heap objects. |
1103 return kNoWriteBarrier; | 1103 return kNoWriteBarrier; |
1104 } | 1104 } |
1105 if (field_type->Is(Type::BooleanOrNullOrUndefined()) || | 1105 if (field_type->Is(Type::BooleanOrNullOrUndefined()) || |
1106 value_type->Is(Type::BooleanOrNullOrUndefined())) { | 1106 value_type->Is(Type::BooleanOrNullOrUndefined())) { |
1107 // Write barriers are not necessary when storing true, false, null or | 1107 // Write barriers are not necessary when storing true, false, null or |
1108 // undefined, because these special oddballs are always in the root set. | 1108 // undefined, because these special oddballs are always in the root set. |
1109 return kNoWriteBarrier; | 1109 return kNoWriteBarrier; |
1110 } | 1110 } |
1111 if (value_type->IsHeapConstant()) { | 1111 if (value_type->IsHeapConstant()) { |
1112 Handle<HeapObject> value_object = value_type->AsHeapConstant()->Value(); | 1112 Heap::RootListIndex root_index; |
1113 RootIndexMap root_index_map(jsgraph_->isolate()); | 1113 Heap* heap = jsgraph_->isolate()->heap(); |
1114 int root_index = root_index_map.Lookup(*value_object); | 1114 if (heap->IsRootHandle(value_type->AsHeapConstant()->Value(), |
1115 if (root_index != RootIndexMap::kInvalidRootIndex && | 1115 &root_index)) { |
1116 jsgraph_->isolate()->heap()->RootIsImmortalImmovable(root_index)) { | 1116 if (heap->RootIsImmortalImmovable(root_index)) { |
1117 // Write barriers are unnecessary for immortal immovable roots. | 1117 // Write barriers are unnecessary for immortal immovable roots. |
1118 return kNoWriteBarrier; | 1118 return kNoWriteBarrier; |
1119 } | 1119 } |
1120 if (value_object->IsMap()) { | |
1121 // Write barriers for storing maps are cheaper. | |
1122 return kMapWriteBarrier; | |
1123 } | 1120 } |
1124 } | 1121 } |
1125 if (field_representation == MachineRepresentation::kTaggedPointer || | 1122 if (field_representation == MachineRepresentation::kTaggedPointer || |
1126 value_representation == MachineRepresentation::kTaggedPointer) { | 1123 value_representation == MachineRepresentation::kTaggedPointer) { |
1127 // Write barriers for heap objects are cheaper. | 1124 // Write barriers for heap objects are cheaper. |
1128 return kPointerWriteBarrier; | 1125 return kPointerWriteBarrier; |
1129 } | 1126 } |
1130 NumberMatcher m(value); | 1127 NumberMatcher m(value); |
1131 if (m.HasValue()) { | 1128 if (m.HasValue()) { |
1132 if (IsSmiDouble(m.Value())) { | 1129 if (IsSmiDouble(m.Value())) { |
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3458 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3455 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3459 Operator::kNoProperties); | 3456 Operator::kNoProperties); |
3460 to_number_operator_.set(common()->Call(desc)); | 3457 to_number_operator_.set(common()->Call(desc)); |
3461 } | 3458 } |
3462 return to_number_operator_.get(); | 3459 return to_number_operator_.get(); |
3463 } | 3460 } |
3464 | 3461 |
3465 } // namespace compiler | 3462 } // namespace compiler |
3466 } // namespace internal | 3463 } // namespace internal |
3467 } // namespace v8 | 3464 } // namespace v8 |
OLD | NEW |