| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 case IrOpcode::kJSLoadNamed: | 54 case IrOpcode::kJSLoadNamed: |
| 55 return ReduceJSLoadNamed(node); | 55 return ReduceJSLoadNamed(node); |
| 56 case IrOpcode::kJSStoreNamed: | 56 case IrOpcode::kJSStoreNamed: |
| 57 return ReduceJSStoreNamed(node); | 57 return ReduceJSStoreNamed(node); |
| 58 case IrOpcode::kJSStoreProperty: { | 58 case IrOpcode::kJSStoreProperty: { |
| 59 HeapObjectMatcher<Name> match(node->InputAt(1)); | 59 HeapObjectMatcher<Name> match(node->InputAt(1)); |
| 60 if (match.HasValue() && match.Value().handle()->IsName()) { | 60 if (match.HasValue() && match.Value().handle()->IsName()) { |
| 61 // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v). | 61 // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v). |
| 62 Unique<Name> name = match.Value(); | 62 Unique<Name> name = match.Value(); |
| 63 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 63 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
| 64 if (FLAG_turbo_deoptimization) { | 64 // StoreProperty has 2 frame state inputs, but StoreNamed only 1. |
| 65 // StoreProperty has 2 frame state inputs, but StoreNamed only 1. | 65 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 66 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); | 66 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
| 67 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); | |
| 68 } | |
| 69 node->set_op( | 67 node->set_op( |
| 70 jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED)); | 68 jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED)); |
| 71 node->RemoveInput(1); | 69 node->RemoveInput(1); |
| 72 return ReduceJSStoreNamed(node); | 70 return ReduceJSStoreNamed(node); |
| 73 } | 71 } |
| 74 return ReduceJSStoreProperty(node); | 72 return ReduceJSStoreProperty(node); |
| 75 } | 73 } |
| 76 default: | 74 default: |
| 77 break; | 75 break; |
| 78 } | 76 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return true; | 139 return true; |
| 142 } | 140 } |
| 143 | 141 |
| 144 // TODO(turbofan): handle out of object properties. | 142 // TODO(turbofan): handle out of object properties. |
| 145 return false; | 143 return false; |
| 146 } | 144 } |
| 147 | 145 |
| 148 | 146 |
| 149 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { | 147 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { |
| 150 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); | 148 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); |
| 151 // TODO(turbofan): type feedback currently requires deoptimization. | |
| 152 if (!FLAG_turbo_deoptimization) return NoChange(); | |
| 153 // TODO(titzer): deopt locations are wrong for property accesses | 149 // TODO(titzer): deopt locations are wrong for property accesses |
| 154 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); | 150 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); |
| 155 | 151 |
| 156 // TODO(turbofan): handle vector-based type feedback. | 152 // TODO(turbofan): handle vector-based type feedback. |
| 157 TypeFeedbackId id = js_type_feedback_->find(node); | 153 TypeFeedbackId id = js_type_feedback_->find(node); |
| 158 if (id.IsNone() || oracle()->LoadInlineCacheState(id) == UNINITIALIZED) { | 154 if (id.IsNone() || oracle()->LoadInlineCacheState(id) == UNINITIALIZED) { |
| 159 return NoChange(); | 155 return NoChange(); |
| 160 } | 156 } |
| 161 | 157 |
| 162 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); | 158 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 191 } |
| 196 | 192 |
| 197 | 193 |
| 198 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) { | 194 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) { |
| 199 return NoChange(); | 195 return NoChange(); |
| 200 } | 196 } |
| 201 | 197 |
| 202 | 198 |
| 203 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { | 199 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { |
| 204 DCHECK(node->opcode() == IrOpcode::kJSStoreNamed); | 200 DCHECK(node->opcode() == IrOpcode::kJSStoreNamed); |
| 205 // TODO(turbofan): type feedback currently requires deoptimization. | |
| 206 if (!FLAG_turbo_deoptimization) return NoChange(); | |
| 207 // TODO(titzer): deopt locations are wrong for property accesses | 201 // TODO(titzer): deopt locations are wrong for property accesses |
| 208 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); | 202 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); |
| 209 | 203 |
| 210 TypeFeedbackId id = js_type_feedback_->find(node); | 204 TypeFeedbackId id = js_type_feedback_->find(node); |
| 211 if (id.IsNone() || oracle()->StoreIsUninitialized(id)) return NoChange(); | 205 if (id.IsNone() || oracle()->StoreIsUninitialized(id)) return NoChange(); |
| 212 | 206 |
| 213 const StoreNamedParameters& p = StoreNamedParametersOf(node->op()); | 207 const StoreNamedParameters& p = StoreNamedParametersOf(node->op()); |
| 214 SmallMapList maps; | 208 SmallMapList maps; |
| 215 Handle<Name> name = p.name().handle(); | 209 Handle<Name> name = p.name().handle(); |
| 216 Node* receiver = node->InputAt(0); | 210 Node* receiver = node->InputAt(0); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // TODO(turbofan): filter maps by initial receiver map if known | 284 // TODO(turbofan): filter maps by initial receiver map if known |
| 291 // TODO(turbofan): filter maps by native context (if specializing) | 285 // TODO(turbofan): filter maps by native context (if specializing) |
| 292 // TODO(turbofan): filter maps by effect chain | 286 // TODO(turbofan): filter maps by effect chain |
| 293 oracle()->PropertyReceiverTypes(id, name, maps); | 287 oracle()->PropertyReceiverTypes(id, name, maps); |
| 294 } | 288 } |
| 295 | 289 |
| 296 | 290 |
| 297 } // namespace compiler | 291 } // namespace compiler |
| 298 } // namespace internal | 292 } // namespace internal |
| 299 } // namespace v8 | 293 } // namespace v8 |
| OLD | NEW |