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-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-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 13 matching lines...) Expand all Loading... |
24 case Runtime::kDeoptimizeNow: | 24 case Runtime::kDeoptimizeNow: |
25 return ReduceDeoptimizeNow(node); | 25 return ReduceDeoptimizeNow(node); |
26 case Runtime::kInlineIsSmi: | 26 case Runtime::kInlineIsSmi: |
27 return ReduceInlineIsSmi(node); | 27 return ReduceInlineIsSmi(node); |
28 case Runtime::kInlineIsNonNegativeSmi: | 28 case Runtime::kInlineIsNonNegativeSmi: |
29 return ReduceInlineIsNonNegativeSmi(node); | 29 return ReduceInlineIsNonNegativeSmi(node); |
30 case Runtime::kInlineIsArray: | 30 case Runtime::kInlineIsArray: |
31 return ReduceInlineIsInstanceType(node, JS_ARRAY_TYPE); | 31 return ReduceInlineIsInstanceType(node, JS_ARRAY_TYPE); |
32 case Runtime::kInlineIsFunction: | 32 case Runtime::kInlineIsFunction: |
33 return ReduceInlineIsInstanceType(node, JS_FUNCTION_TYPE); | 33 return ReduceInlineIsInstanceType(node, JS_FUNCTION_TYPE); |
34 case Runtime::kInlineOptimizedConstructDouble: | 34 case Runtime::kInlineConstructDouble: |
35 return ReduceInlineOptimizedConstructDouble(node); | 35 return ReduceInlineConstructDouble(node); |
36 case Runtime::kInlineOptimizedDoubleLo: | 36 case Runtime::kInlineDoubleLo: |
37 return ReduceInlineOptimizedDoubleLo(node); | 37 return ReduceInlineDoubleLo(node); |
38 case Runtime::kInlineOptimizedDoubleHi: | 38 case Runtime::kInlineDoubleHi: |
39 return ReduceInlineOptimizedDoubleHi(node); | 39 return ReduceInlineDoubleHi(node); |
40 case Runtime::kInlineIsRegExp: | 40 case Runtime::kInlineIsRegExp: |
41 return ReduceInlineIsInstanceType(node, JS_REGEXP_TYPE); | 41 return ReduceInlineIsInstanceType(node, JS_REGEXP_TYPE); |
42 case Runtime::kInlineValueOf: | 42 case Runtime::kInlineValueOf: |
43 return ReduceInlineValueOf(node); | 43 return ReduceInlineValueOf(node); |
44 default: | 44 default: |
45 break; | 45 break; |
46 } | 46 } |
47 return NoChange(); | 47 return NoChange(); |
48 } | 48 } |
49 | 49 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Reduction JSIntrinsicLowering::ReduceInlineIsSmi(Node* node) { | 91 Reduction JSIntrinsicLowering::ReduceInlineIsSmi(Node* node) { |
92 return Change(node, simplified()->ObjectIsSmi()); | 92 return Change(node, simplified()->ObjectIsSmi()); |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 Reduction JSIntrinsicLowering::ReduceInlineIsNonNegativeSmi(Node* node) { | 96 Reduction JSIntrinsicLowering::ReduceInlineIsNonNegativeSmi(Node* node) { |
97 return Change(node, simplified()->ObjectIsNonNegativeSmi()); | 97 return Change(node, simplified()->ObjectIsNonNegativeSmi()); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 Reduction JSIntrinsicLowering::ReduceInlineOptimizedConstructDouble( | 101 Reduction JSIntrinsicLowering::ReduceInlineConstructDouble(Node* node) { |
102 Node* node) { | |
103 Node* high = NodeProperties::GetValueInput(node, 0); | 102 Node* high = NodeProperties::GetValueInput(node, 0); |
104 Node* low = NodeProperties::GetValueInput(node, 1); | 103 Node* low = NodeProperties::GetValueInput(node, 1); |
105 Node* value = | 104 Node* value = |
106 graph()->NewNode(machine()->Float64InsertHighWord32(), | 105 graph()->NewNode(machine()->Float64InsertHighWord32(), |
107 graph()->NewNode(machine()->Float64InsertLowWord32(), | 106 graph()->NewNode(machine()->Float64InsertLowWord32(), |
108 jsgraph()->Constant(0), low), | 107 jsgraph()->Constant(0), low), |
109 high); | 108 high); |
110 NodeProperties::ReplaceWithValue(node, value); | 109 NodeProperties::ReplaceWithValue(node, value); |
111 return Replace(value); | 110 return Replace(value); |
112 } | 111 } |
113 | 112 |
114 | 113 |
115 Reduction JSIntrinsicLowering::ReduceInlineOptimizedDoubleLo(Node* node) { | 114 Reduction JSIntrinsicLowering::ReduceInlineDoubleLo(Node* node) { |
116 return Change(node, machine()->Float64ExtractLowWord32()); | 115 return Change(node, machine()->Float64ExtractLowWord32()); |
117 } | 116 } |
118 | 117 |
119 | 118 |
120 Reduction JSIntrinsicLowering::ReduceInlineOptimizedDoubleHi(Node* node) { | 119 Reduction JSIntrinsicLowering::ReduceInlineDoubleHi(Node* node) { |
121 return Change(node, machine()->Float64ExtractHighWord32()); | 120 return Change(node, machine()->Float64ExtractHighWord32()); |
122 } | 121 } |
123 | 122 |
124 | 123 |
125 Reduction JSIntrinsicLowering::ReduceInlineIsInstanceType( | 124 Reduction JSIntrinsicLowering::ReduceInlineIsInstanceType( |
126 Node* node, InstanceType instance_type) { | 125 Node* node, InstanceType instance_type) { |
127 // if (%_IsSmi(value)) { | 126 // if (%_IsSmi(value)) { |
128 // return false; | 127 // return false; |
129 // } else { | 128 // } else { |
130 // return %_GetInstanceType(%_GetMap(value)) == instance_type; | 129 // return %_GetInstanceType(%_GetMap(value)) == instance_type; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 254 } |
256 | 255 |
257 | 256 |
258 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 257 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
259 return jsgraph()->machine(); | 258 return jsgraph()->machine(); |
260 } | 259 } |
261 | 260 |
262 } // namespace compiler | 261 } // namespace compiler |
263 } // namespace internal | 262 } // namespace internal |
264 } // namespace v8 | 263 } // namespace v8 |
OLD | NEW |