| 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 <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 case Runtime::kInlineConstructDouble: | 38 case Runtime::kInlineConstructDouble: |
| 39 return ReduceConstructDouble(node); | 39 return ReduceConstructDouble(node); |
| 40 case Runtime::kInlineDateField: | 40 case Runtime::kInlineDateField: |
| 41 return ReduceDateField(node); | 41 return ReduceDateField(node); |
| 42 case Runtime::kInlineDeoptimizeNow: | 42 case Runtime::kInlineDeoptimizeNow: |
| 43 return ReduceDeoptimizeNow(node); | 43 return ReduceDeoptimizeNow(node); |
| 44 case Runtime::kInlineDoubleHi: | 44 case Runtime::kInlineDoubleHi: |
| 45 return ReduceDoubleHi(node); | 45 return ReduceDoubleHi(node); |
| 46 case Runtime::kInlineDoubleLo: | 46 case Runtime::kInlineDoubleLo: |
| 47 return ReduceDoubleLo(node); | 47 return ReduceDoubleLo(node); |
| 48 case Runtime::kInlineHeapObjectGetMap: | |
| 49 return ReduceHeapObjectGetMap(node); | |
| 50 case Runtime::kInlineIncrementStatsCounter: | 48 case Runtime::kInlineIncrementStatsCounter: |
| 51 return ReduceIncrementStatsCounter(node); | 49 return ReduceIncrementStatsCounter(node); |
| 52 case Runtime::kInlineIsArray: | 50 case Runtime::kInlineIsArray: |
| 53 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 51 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
| 54 case Runtime::kInlineIsDate: | 52 case Runtime::kInlineIsDate: |
| 55 return ReduceIsInstanceType(node, JS_DATE_TYPE); | 53 return ReduceIsInstanceType(node, JS_DATE_TYPE); |
| 56 case Runtime::kInlineIsTypedArray: | 54 case Runtime::kInlineIsTypedArray: |
| 57 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 55 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
| 58 case Runtime::kInlineIsFunction: | 56 case Runtime::kInlineIsFunction: |
| 59 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); | 57 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); |
| 60 case Runtime::kInlineIsRegExp: | 58 case Runtime::kInlineIsRegExp: |
| 61 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 59 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
| 62 case Runtime::kInlineIsJSReceiver: | 60 case Runtime::kInlineIsJSReceiver: |
| 63 return ReduceIsJSReceiver(node); | 61 return ReduceIsJSReceiver(node); |
| 64 case Runtime::kInlineIsSmi: | 62 case Runtime::kInlineIsSmi: |
| 65 return ReduceIsSmi(node); | 63 return ReduceIsSmi(node); |
| 66 case Runtime::kInlineJSValueGetValue: | 64 case Runtime::kInlineJSValueGetValue: |
| 67 return ReduceJSValueGetValue(node); | 65 return ReduceJSValueGetValue(node); |
| 68 case Runtime::kInlineMapGetInstanceType: | |
| 69 return ReduceMapGetInstanceType(node); | |
| 70 case Runtime::kInlineMathClz32: | 66 case Runtime::kInlineMathClz32: |
| 71 return ReduceMathClz32(node); | 67 return ReduceMathClz32(node); |
| 72 case Runtime::kInlineMathFloor: | 68 case Runtime::kInlineMathFloor: |
| 73 return ReduceMathFloor(node); | 69 return ReduceMathFloor(node); |
| 74 case Runtime::kInlineMathSqrt: | 70 case Runtime::kInlineMathSqrt: |
| 75 return ReduceMathSqrt(node); | 71 return ReduceMathSqrt(node); |
| 76 case Runtime::kInlineValueOf: | 72 case Runtime::kInlineValueOf: |
| 77 return ReduceValueOf(node); | 73 return ReduceValueOf(node); |
| 78 case Runtime::kInlineIsMinusZero: | 74 case Runtime::kInlineIsMinusZero: |
| 79 return ReduceIsMinusZero(node); | 75 return ReduceIsMinusZero(node); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) { | 168 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) { |
| 173 return Change(node, machine()->Float64ExtractHighWord32()); | 169 return Change(node, machine()->Float64ExtractHighWord32()); |
| 174 } | 170 } |
| 175 | 171 |
| 176 | 172 |
| 177 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { | 173 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { |
| 178 return Change(node, machine()->Float64ExtractLowWord32()); | 174 return Change(node, machine()->Float64ExtractLowWord32()); |
| 179 } | 175 } |
| 180 | 176 |
| 181 | 177 |
| 182 Reduction JSIntrinsicLowering::ReduceHeapObjectGetMap(Node* node) { | |
| 183 Node* value = NodeProperties::GetValueInput(node, 0); | |
| 184 Node* effect = NodeProperties::GetEffectInput(node); | |
| 185 Node* control = NodeProperties::GetControlInput(node); | |
| 186 return Change(node, simplified()->LoadField(AccessBuilder::ForMap()), value, | |
| 187 effect, control); | |
| 188 } | |
| 189 | |
| 190 | |
| 191 Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) { | 178 Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) { |
| 192 if (!FLAG_native_code_counters) return ChangeToUndefined(node); | 179 if (!FLAG_native_code_counters) return ChangeToUndefined(node); |
| 193 HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0)); | 180 HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0)); |
| 194 if (!m.HasValue() || !m.Value()->IsString()) { | 181 if (!m.HasValue() || !m.Value()->IsString()) { |
| 195 return ChangeToUndefined(node); | 182 return ChangeToUndefined(node); |
| 196 } | 183 } |
| 197 base::SmartArrayPointer<char> name = | 184 base::SmartArrayPointer<char> name = |
| 198 Handle<String>::cast(m.Value())->ToCString(); | 185 Handle<String>::cast(m.Value())->ToCString(); |
| 199 StatsCounter counter(jsgraph()->isolate(), name.get()); | 186 StatsCounter counter(jsgraph()->isolate(), name.get()); |
| 200 if (!counter.Enabled()) return ChangeToUndefined(node); | 187 if (!counter.Enabled()) return ChangeToUndefined(node); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 290 |
| 304 Reduction JSIntrinsicLowering::ReduceJSValueGetValue(Node* node) { | 291 Reduction JSIntrinsicLowering::ReduceJSValueGetValue(Node* node) { |
| 305 Node* value = NodeProperties::GetValueInput(node, 0); | 292 Node* value = NodeProperties::GetValueInput(node, 0); |
| 306 Node* effect = NodeProperties::GetEffectInput(node); | 293 Node* effect = NodeProperties::GetEffectInput(node); |
| 307 Node* control = NodeProperties::GetControlInput(node); | 294 Node* control = NodeProperties::GetControlInput(node); |
| 308 return Change(node, simplified()->LoadField(AccessBuilder::ForValue()), value, | 295 return Change(node, simplified()->LoadField(AccessBuilder::ForValue()), value, |
| 309 effect, control); | 296 effect, control); |
| 310 } | 297 } |
| 311 | 298 |
| 312 | 299 |
| 313 Reduction JSIntrinsicLowering::ReduceMapGetInstanceType(Node* node) { | |
| 314 Node* value = NodeProperties::GetValueInput(node, 0); | |
| 315 Node* effect = NodeProperties::GetEffectInput(node); | |
| 316 Node* control = NodeProperties::GetControlInput(node); | |
| 317 return Change(node, | |
| 318 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), | |
| 319 value, effect, control); | |
| 320 } | |
| 321 | |
| 322 | |
| 323 Reduction JSIntrinsicLowering::ReduceMathClz32(Node* node) { | 300 Reduction JSIntrinsicLowering::ReduceMathClz32(Node* node) { |
| 324 return Change(node, machine()->Word32Clz()); | 301 return Change(node, machine()->Word32Clz()); |
| 325 } | 302 } |
| 326 | 303 |
| 327 | 304 |
| 328 Reduction JSIntrinsicLowering::ReduceMathFloor(Node* node) { | 305 Reduction JSIntrinsicLowering::ReduceMathFloor(Node* node) { |
| 329 if (!machine()->Float64RoundDown().IsSupported()) return NoChange(); | 306 if (!machine()->Float64RoundDown().IsSupported()) return NoChange(); |
| 330 return Change(node, machine()->Float64RoundDown().op()); | 307 return Change(node, machine()->Float64RoundDown().op()); |
| 331 } | 308 } |
| 332 | 309 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 679 } |
| 703 | 680 |
| 704 | 681 |
| 705 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 682 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 706 return jsgraph()->simplified(); | 683 return jsgraph()->simplified(); |
| 707 } | 684 } |
| 708 | 685 |
| 709 } // namespace compiler | 686 } // namespace compiler |
| 710 } // namespace internal | 687 } // namespace internal |
| 711 } // namespace v8 | 688 } // namespace v8 |
| OLD | NEW |