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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 case Runtime::kInlineToPrimitive: | 79 case Runtime::kInlineToPrimitive: |
80 return ReduceToPrimitive(node); | 80 return ReduceToPrimitive(node); |
81 case Runtime::kInlineToString: | 81 case Runtime::kInlineToString: |
82 return ReduceToString(node); | 82 return ReduceToString(node); |
83 case Runtime::kInlineCall: | 83 case Runtime::kInlineCall: |
84 return ReduceCall(node); | 84 return ReduceCall(node); |
85 case Runtime::kInlineNewObject: | 85 case Runtime::kInlineNewObject: |
86 return ReduceNewObject(node); | 86 return ReduceNewObject(node); |
87 case Runtime::kInlineGetSuperConstructor: | 87 case Runtime::kInlineGetSuperConstructor: |
88 return ReduceGetSuperConstructor(node); | 88 return ReduceGetSuperConstructor(node); |
89 case Runtime::kInlineGetOrdinaryHasInstance: | |
90 return ReduceGetOrdinaryHasInstance(node); | |
91 default: | 89 default: |
92 break; | 90 break; |
93 } | 91 } |
94 return NoChange(); | 92 return NoChange(); |
95 } | 93 } |
96 | 94 |
97 | 95 |
98 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { | 96 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { |
99 Node* const value = NodeProperties::GetValueInput(node, 0); | 97 Node* const value = NodeProperties::GetValueInput(node, 0); |
100 Node* const done = NodeProperties::GetValueInput(node, 1); | 98 Node* const done = NodeProperties::GetValueInput(node, 1); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 Node* active_function = NodeProperties::GetValueInput(node, 0); | 402 Node* active_function = NodeProperties::GetValueInput(node, 0); |
405 Node* effect = NodeProperties::GetEffectInput(node); | 403 Node* effect = NodeProperties::GetEffectInput(node); |
406 Node* control = NodeProperties::GetControlInput(node); | 404 Node* control = NodeProperties::GetControlInput(node); |
407 Node* active_function_map = effect = | 405 Node* active_function_map = effect = |
408 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 406 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
409 active_function, effect, control); | 407 active_function, effect, control); |
410 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 408 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
411 active_function_map, effect, control); | 409 active_function_map, effect, control); |
412 } | 410 } |
413 | 411 |
414 Reduction JSIntrinsicLowering::ReduceGetOrdinaryHasInstance(Node* node) { | |
415 Node* effect = NodeProperties::GetEffectInput(node); | |
416 Node* context = NodeProperties::GetContextInput(node); | |
417 Node* native_context = effect = graph()->NewNode( | |
418 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | |
419 context, context, effect); | |
420 return Change(node, javascript()->LoadContext( | |
421 0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), | |
422 native_context, context, effect); | |
423 } | |
424 | |
425 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 412 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
426 Node* b) { | 413 Node* b) { |
427 RelaxControls(node); | 414 RelaxControls(node); |
428 node->ReplaceInput(0, a); | 415 node->ReplaceInput(0, a); |
429 node->ReplaceInput(1, b); | 416 node->ReplaceInput(1, b); |
430 node->TrimInputCount(2); | 417 node->TrimInputCount(2); |
431 NodeProperties::ChangeOp(node, op); | 418 NodeProperties::ChangeOp(node, op); |
432 return Changed(node); | 419 return Changed(node); |
433 } | 420 } |
434 | 421 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 477 } |
491 | 478 |
492 | 479 |
493 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 480 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
494 return jsgraph()->simplified(); | 481 return jsgraph()->simplified(); |
495 } | 482 } |
496 | 483 |
497 } // namespace compiler | 484 } // namespace compiler |
498 } // namespace internal | 485 } // namespace internal |
499 } // namespace v8 | 486 } // namespace v8 |
OLD | NEW |