| 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" |
| 11 #include "src/type-info.h" | 11 #include "src/type-info.h" |
| 12 | 12 |
| 13 #include "src/compiler/access-builder.h" | 13 #include "src/compiler/access-builder.h" |
| 14 #include "src/compiler/common-operator.h" | 14 #include "src/compiler/common-operator.h" |
| 15 #include "src/compiler/node-aux-data.h" | 15 #include "src/compiler/node-aux-data.h" |
| 16 #include "src/compiler/node-matchers.h" | 16 #include "src/compiler/node-matchers.h" |
| 17 #include "src/compiler/simplified-operator.h" | 17 #include "src/compiler/simplified-operator.h" |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 namespace compiler { | 21 namespace compiler { |
| 22 | 22 |
| 23 enum LoadOrStore { LOAD, STORE }; | 23 enum LoadOrStore { LOAD, STORE }; |
| 24 | 24 |
| 25 #define EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT false |
| 26 |
| 25 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone) | 27 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone) |
| 26 : map_(TypeFeedbackIdMap::key_compare(), | 28 : map_(TypeFeedbackIdMap::key_compare(), |
| 27 TypeFeedbackIdMap::allocator_type(zone)) {} | 29 TypeFeedbackIdMap::allocator_type(zone)) {} |
| 28 | 30 |
| 29 | 31 |
| 30 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) { | 32 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) { |
| 31 map_.insert(std::make_pair(node->id(), id)); | 33 map_.insert(std::make_pair(node->id(), id)); |
| 32 } | 34 } |
| 33 | 35 |
| 34 | 36 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 135 |
| 134 // TODO(turbofan): handle out of object properties. | 136 // TODO(turbofan): handle out of object properties. |
| 135 return false; | 137 return false; |
| 136 } | 138 } |
| 137 | 139 |
| 138 | 140 |
| 139 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { | 141 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { |
| 140 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); | 142 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed); |
| 141 // TODO(turbofan): type feedback currently requires deoptimization. | 143 // TODO(turbofan): type feedback currently requires deoptimization. |
| 142 if (!FLAG_turbo_deoptimization) return NoChange(); | 144 if (!FLAG_turbo_deoptimization) return NoChange(); |
| 145 // TODO(titzer): deopt locations are wrong for property accesses |
| 146 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); |
| 143 | 147 |
| 144 // TODO(turbofan): handle vector-based type feedback. | 148 // TODO(turbofan): handle vector-based type feedback. |
| 145 TypeFeedbackId id = js_type_feedback_->find(node); | 149 TypeFeedbackId id = js_type_feedback_->find(node); |
| 146 if (id.IsNone() || oracle()->LoadInlineCacheState(id) == UNINITIALIZED) { | 150 if (id.IsNone() || oracle()->LoadInlineCacheState(id) == UNINITIALIZED) { |
| 147 return NoChange(); | 151 return NoChange(); |
| 148 } | 152 } |
| 149 | 153 |
| 150 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); | 154 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); |
| 151 SmallMapList maps; | 155 SmallMapList maps; |
| 152 Handle<Name> name = p.name().handle(); | 156 Handle<Name> name = p.name().handle(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 189 |
| 186 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) { | 190 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) { |
| 187 return NoChange(); | 191 return NoChange(); |
| 188 } | 192 } |
| 189 | 193 |
| 190 | 194 |
| 191 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { | 195 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { |
| 192 DCHECK(node->opcode() == IrOpcode::kJSStoreNamed); | 196 DCHECK(node->opcode() == IrOpcode::kJSStoreNamed); |
| 193 // TODO(turbofan): type feedback currently requires deoptimization. | 197 // TODO(turbofan): type feedback currently requires deoptimization. |
| 194 if (!FLAG_turbo_deoptimization) return NoChange(); | 198 if (!FLAG_turbo_deoptimization) return NoChange(); |
| 199 // TODO(titzer): deopt locations are wrong for property accesses |
| 200 if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange(); |
| 195 | 201 |
| 196 TypeFeedbackId id = js_type_feedback_->find(node); | 202 TypeFeedbackId id = js_type_feedback_->find(node); |
| 197 if (id.IsNone() || oracle()->StoreIsUninitialized(id)) return NoChange(); | 203 if (id.IsNone() || oracle()->StoreIsUninitialized(id)) return NoChange(); |
| 198 | 204 |
| 199 const StoreNamedParameters& p = StoreNamedParametersOf(node->op()); | 205 const StoreNamedParameters& p = StoreNamedParametersOf(node->op()); |
| 200 SmallMapList maps; | 206 SmallMapList maps; |
| 201 Handle<Name> name = p.name().handle(); | 207 Handle<Name> name = p.name().handle(); |
| 202 Node* receiver = node->InputAt(0); | 208 Node* receiver = node->InputAt(0); |
| 203 Node* effect = NodeProperties::GetEffectInput(node); | 209 Node* effect = NodeProperties::GetEffectInput(node); |
| 204 GatherReceiverTypes(receiver, effect, id, name, &maps); | 210 GatherReceiverTypes(receiver, effect, id, name, &maps); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // TODO(turbofan): filter maps by initial receiver map if known | 282 // TODO(turbofan): filter maps by initial receiver map if known |
| 277 // TODO(turbofan): filter maps by native context (if specializing) | 283 // TODO(turbofan): filter maps by native context (if specializing) |
| 278 // TODO(turbofan): filter maps by effect chain | 284 // TODO(turbofan): filter maps by effect chain |
| 279 oracle()->PropertyReceiverTypes(id, name, maps); | 285 oracle()->PropertyReceiverTypes(id, name, maps); |
| 280 } | 286 } |
| 281 | 287 |
| 282 | 288 |
| 283 } // namespace compiler | 289 } // namespace compiler |
| 284 } // namespace internal | 290 } // namespace internal |
| 285 } // namespace v8 | 291 } // namespace v8 |
| OLD | NEW |