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