| 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/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 case Runtime::kInlineTwoByteSeqStringGetChar: | 79 case Runtime::kInlineTwoByteSeqStringGetChar: |
| 80 return ReduceSeqStringGetChar(node, String::TWO_BYTE_ENCODING); | 80 return ReduceSeqStringGetChar(node, String::TWO_BYTE_ENCODING); |
| 81 case Runtime::kInlineTwoByteSeqStringSetChar: | 81 case Runtime::kInlineTwoByteSeqStringSetChar: |
| 82 return ReduceSeqStringSetChar(node, String::TWO_BYTE_ENCODING); | 82 return ReduceSeqStringSetChar(node, String::TWO_BYTE_ENCODING); |
| 83 case Runtime::kInlineUnlikely: | 83 case Runtime::kInlineUnlikely: |
| 84 return ReduceUnLikely(node, BranchHint::kFalse); | 84 return ReduceUnLikely(node, BranchHint::kFalse); |
| 85 case Runtime::kInlineValueOf: | 85 case Runtime::kInlineValueOf: |
| 86 return ReduceValueOf(node); | 86 return ReduceValueOf(node); |
| 87 case Runtime::kInlineIsMinusZero: | 87 case Runtime::kInlineIsMinusZero: |
| 88 return ReduceIsMinusZero(node); | 88 return ReduceIsMinusZero(node); |
| 89 case Runtime::kInlineFixedArrayGet: |
| 90 return ReduceFixedArrayGet(node); |
| 89 case Runtime::kInlineFixedArraySet: | 91 case Runtime::kInlineFixedArraySet: |
| 90 return ReduceFixedArraySet(node); | 92 return ReduceFixedArraySet(node); |
| 91 case Runtime::kInlineGetTypeFeedbackVector: | 93 case Runtime::kInlineGetTypeFeedbackVector: |
| 92 return ReduceGetTypeFeedbackVector(node); | 94 return ReduceGetTypeFeedbackVector(node); |
| 93 case Runtime::kInlineGetCallerJSFunction: | 95 case Runtime::kInlineGetCallerJSFunction: |
| 94 return ReduceGetCallerJSFunction(node); | 96 return ReduceGetCallerJSFunction(node); |
| 95 case Runtime::kInlineThrowNotDateError: | 97 case Runtime::kInlineThrowNotDateError: |
| 96 return ReduceThrowNotDateError(node); | 98 return ReduceThrowNotDateError(node); |
| 97 case Runtime::kInlineCallFunction: | 99 case Runtime::kInlineCallFunction: |
| 98 return ReduceCallFunction(node); | 100 return ReduceCallFunction(node); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 442 |
| 441 ReplaceWithValue(node, node, effect); | 443 ReplaceWithValue(node, node, effect); |
| 442 | 444 |
| 443 Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2); | 445 Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2); |
| 444 | 446 |
| 445 return Change(node, machine()->Word32Equal(), and_result, | 447 return Change(node, machine()->Word32Equal(), and_result, |
| 446 jsgraph()->Int32Constant(1)); | 448 jsgraph()->Int32Constant(1)); |
| 447 } | 449 } |
| 448 | 450 |
| 449 | 451 |
| 452 Reduction JSIntrinsicLowering::ReduceFixedArrayGet(Node* node) { |
| 453 Node* base = node->InputAt(0); |
| 454 Node* index = node->InputAt(1); |
| 455 Node* effect = NodeProperties::GetEffectInput(node); |
| 456 Node* control = NodeProperties::GetControlInput(node); |
| 457 return Change( |
| 458 node, simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), |
| 459 base, index, effect, control); |
| 460 } |
| 461 |
| 462 |
| 450 Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) { | 463 Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) { |
| 451 Node* base = node->InputAt(0); | 464 Node* base = node->InputAt(0); |
| 452 Node* index = node->InputAt(1); | 465 Node* index = node->InputAt(1); |
| 453 Node* value = node->InputAt(2); | 466 Node* value = node->InputAt(2); |
| 454 Node* effect = NodeProperties::GetEffectInput(node); | 467 Node* effect = NodeProperties::GetEffectInput(node); |
| 455 Node* control = NodeProperties::GetControlInput(node); | 468 Node* control = NodeProperties::GetControlInput(node); |
| 456 Node* store = (graph()->NewNode( | 469 Node* store = (graph()->NewNode( |
| 457 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, | 470 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, |
| 458 index, value, effect, control)); | 471 index, value, effect, control)); |
| 459 ReplaceWithValue(node, value, store); | 472 ReplaceWithValue(node, value, store); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 node->set_op(op); | 559 node->set_op(op); |
| 547 node->ReplaceInput(0, a); | 560 node->ReplaceInput(0, a); |
| 548 node->ReplaceInput(1, b); | 561 node->ReplaceInput(1, b); |
| 549 node->ReplaceInput(2, c); | 562 node->ReplaceInput(2, c); |
| 550 node->TrimInputCount(3); | 563 node->TrimInputCount(3); |
| 551 RelaxControls(node); | 564 RelaxControls(node); |
| 552 return Changed(node); | 565 return Changed(node); |
| 553 } | 566 } |
| 554 | 567 |
| 555 | 568 |
| 569 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
| 570 Node* b, Node* c, Node* d) { |
| 571 node->set_op(op); |
| 572 node->ReplaceInput(0, a); |
| 573 node->ReplaceInput(1, b); |
| 574 node->ReplaceInput(2, c); |
| 575 node->ReplaceInput(3, d); |
| 576 node->TrimInputCount(4); |
| 577 RelaxControls(node); |
| 578 return Changed(node); |
| 579 } |
| 580 |
| 581 |
| 556 Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) { | 582 Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) { |
| 557 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect); | 583 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect); |
| 558 return Changed(node); | 584 return Changed(node); |
| 559 } | 585 } |
| 560 | 586 |
| 561 | 587 |
| 562 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } | 588 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } |
| 563 | 589 |
| 564 | 590 |
| 565 CommonOperatorBuilder* JSIntrinsicLowering::common() const { | 591 CommonOperatorBuilder* JSIntrinsicLowering::common() const { |
| 566 return jsgraph()->common(); | 592 return jsgraph()->common(); |
| 567 } | 593 } |
| 568 | 594 |
| 569 JSOperatorBuilder* JSIntrinsicLowering::javascript() const { | 595 JSOperatorBuilder* JSIntrinsicLowering::javascript() const { |
| 570 return jsgraph_->javascript(); | 596 return jsgraph_->javascript(); |
| 571 } | 597 } |
| 572 | 598 |
| 573 | 599 |
| 574 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 600 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
| 575 return jsgraph()->machine(); | 601 return jsgraph()->machine(); |
| 576 } | 602 } |
| 577 | 603 |
| 578 } // namespace compiler | 604 } // namespace compiler |
| 579 } // namespace internal | 605 } // namespace internal |
| 580 } // namespace v8 | 606 } // namespace v8 |
| OLD | NEW |