OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-type-feedback.h" | 5 #include "src/compiler/js-type-feedback.h" |
6 | 6 |
7 #include "src/property-details.h" | 7 #include "src/property-details.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 enum LoadOrStore { LOAD, STORE }; | 26 enum LoadOrStore { LOAD, STORE }; |
27 | 27 |
28 // TODO(turbofan): fix deoptimization problems | 28 // TODO(turbofan): fix deoptimization problems |
29 #define ENABLE_FAST_PROPERTY_LOADS false | 29 #define ENABLE_FAST_PROPERTY_LOADS false |
30 #define ENABLE_FAST_PROPERTY_STORES false | 30 #define ENABLE_FAST_PROPERTY_STORES false |
31 | 31 |
32 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone) | 32 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone) |
33 : type_feedback_id_map_(TypeFeedbackIdMap::key_compare(), | 33 : type_feedback_id_map_(TypeFeedbackIdMap::key_compare(), |
34 TypeFeedbackIdMap::allocator_type(zone)), | 34 TypeFeedbackIdMap::allocator_type(zone)), |
35 feedback_vector_ic_slot_map_(TypeFeedbackIdMap::key_compare(), | 35 feedback_vector_slot_map_(TypeFeedbackIdMap::key_compare(), |
36 TypeFeedbackIdMap::allocator_type(zone)) {} | 36 TypeFeedbackIdMap::allocator_type(zone)) {} |
37 | 37 |
38 | 38 |
39 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) { | 39 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) { |
40 type_feedback_id_map_.insert(std::make_pair(node->id(), id)); | 40 type_feedback_id_map_.insert(std::make_pair(node->id(), id)); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 void JSTypeFeedbackTable::Record(Node* node, FeedbackVectorICSlot slot) { | 44 void JSTypeFeedbackTable::Record(Node* node, FeedbackVectorSlot slot) { |
45 feedback_vector_ic_slot_map_.insert(std::make_pair(node->id(), slot)); | 45 feedback_vector_slot_map_.insert(std::make_pair(node->id(), slot)); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) { | 49 Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) { |
50 switch (node->opcode()) { | 50 switch (node->opcode()) { |
51 case IrOpcode::kJSLoadProperty: | 51 case IrOpcode::kJSLoadProperty: |
52 return ReduceJSLoadProperty(node); | 52 return ReduceJSLoadProperty(node); |
53 case IrOpcode::kJSLoadNamed: | 53 case IrOpcode::kJSLoadNamed: |
54 return ReduceJSLoadNamed(node); | 54 return ReduceJSLoadNamed(node); |
55 case IrOpcode::kJSLoadGlobal: | 55 case IrOpcode::kJSLoadGlobal: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { | 142 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { |
143 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); | 143 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); |
144 if (mode() != kDeoptimizationEnabled) return NoChange(); | 144 if (mode() != kDeoptimizationEnabled) return NoChange(); |
145 Node* frame_state_before = GetFrameStateBefore(node); | 145 Node* frame_state_before = GetFrameStateBefore(node); |
146 if (frame_state_before == nullptr) return NoChange(); | 146 if (frame_state_before == nullptr) return NoChange(); |
147 | 147 |
148 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); | 148 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); |
149 SmallMapList maps; | 149 SmallMapList maps; |
150 | 150 |
151 FeedbackVectorICSlot slot = js_type_feedback_->FindFeedbackVectorICSlot(node); | 151 FeedbackVectorSlot slot = js_type_feedback_->FindFeedbackVectorSlot(node); |
152 if (slot.IsInvalid() || | 152 if (slot.IsInvalid() || |
153 oracle()->LoadInlineCacheState(slot) == UNINITIALIZED) { | 153 oracle()->LoadInlineCacheState(slot) == UNINITIALIZED) { |
154 // No type feedback ids or the load is uninitialized. | 154 // No type feedback ids or the load is uninitialized. |
155 return NoChange(); | 155 return NoChange(); |
156 } | 156 } |
157 oracle()->PropertyReceiverTypes(slot, p.name(), &maps); | 157 oracle()->PropertyReceiverTypes(slot, p.name(), &maps); |
158 | 158 |
159 Node* receiver = node->InputAt(0); | 159 Node* receiver = node->InputAt(0); |
160 Node* effect = NodeProperties::GetEffectInput(node); | 160 Node* effect = NodeProperties::GetEffectInput(node); |
161 | 161 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 BailoutId id = OpParameter<FrameStateInfo>(node).bailout_id(); | 355 BailoutId id = OpParameter<FrameStateInfo>(node).bailout_id(); |
356 if (id != BailoutId::None()) return frame_state; | 356 if (id != BailoutId::None()) return frame_state; |
357 } | 357 } |
358 } | 358 } |
359 return nullptr; | 359 return nullptr; |
360 } | 360 } |
361 | 361 |
362 } // namespace compiler | 362 } // namespace compiler |
363 } // namespace internal | 363 } // namespace internal |
364 } // namespace v8 | 364 } // namespace v8 |
OLD | NEW |