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-lowering.h" | 5 #include "src/compiler/js-type-feedback-lowering.h" |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 Node* receiver = NodeProperties::GetValueInput(node, 0); | 36 Node* receiver = NodeProperties::GetValueInput(node, 0); |
37 Type* receiver_type = NodeProperties::GetBounds(receiver).upper; | 37 Type* receiver_type = NodeProperties::GetBounds(receiver).upper; |
38 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | 38 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); |
39 Node* effect = NodeProperties::GetEffectInput(node); | 39 Node* effect = NodeProperties::GetEffectInput(node); |
40 Node* control = NodeProperties::GetControlInput(node); | 40 Node* control = NodeProperties::GetControlInput(node); |
41 // We need to make optimistic assumptions to continue. | 41 // We need to make optimistic assumptions to continue. |
42 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | 42 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); |
43 LoadNamedParameters const& p = LoadNamedParametersOf(node->op()); | 43 LoadNamedParameters const& p = LoadNamedParametersOf(node->op()); |
44 Handle<TypeFeedbackVector> vector; | 44 Handle<TypeFeedbackVector> vector; |
45 if (!p.feedback().vector().ToHandle(&vector)) return NoChange(); | 45 if (!p.feedback().vector().ToHandle(&vector)) return NoChange(); |
46 if (p.name().handle().is_identical_to(factory()->length_string())) { | 46 if (p.name().is_identical_to(factory()->length_string())) { |
47 LoadICNexus nexus(vector, p.feedback().slot()); | 47 LoadICNexus nexus(vector, p.feedback().slot()); |
48 MapHandleList maps; | 48 MapHandleList maps; |
49 if (nexus.ExtractMaps(&maps) > 0) { | 49 if (nexus.ExtractMaps(&maps) > 0) { |
50 for (Handle<Map> map : maps) { | 50 for (Handle<Map> map : maps) { |
51 if (map->instance_type() >= FIRST_NONSTRING_TYPE) return NoChange(); | 51 if (map->instance_type() >= FIRST_NONSTRING_TYPE) return NoChange(); |
52 } | 52 } |
53 // Optimistic optimization for "length" property of strings. | 53 // Optimistic optimization for "length" property of strings. |
54 if (receiver_type->Maybe(Type::TaggedSigned())) { | 54 if (receiver_type->Maybe(Type::TaggedSigned())) { |
55 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), receiver); | 55 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), receiver); |
56 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 56 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 MachineOperatorBuilder* JSTypeFeedbackLowering::machine() const { | 112 MachineOperatorBuilder* JSTypeFeedbackLowering::machine() const { |
113 return jsgraph()->machine(); | 113 return jsgraph()->machine(); |
114 } | 114 } |
115 | 115 |
116 } // namespace compiler | 116 } // namespace compiler |
117 } // namespace internal | 117 } // namespace internal |
118 } // namespace v8 | 118 } // namespace v8 |
OLD | NEW |