| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 if (count > 1) { | 21 if (count > 1) { |
| 22 int index = NodeProperties::FirstFrameStateIndex(node) + 1; | 22 int index = NodeProperties::FirstFrameStateIndex(node) + 1; |
| 23 do { | 23 do { |
| 24 node->RemoveInput(index); | 24 node->RemoveInput(index); |
| 25 } while (--count > 1); | 25 } while (--count > 1); |
| 26 } | 26 } |
| 27 return count > 0 ? CallDescriptor::kNeedsFrameState | 27 return count > 0 ? CallDescriptor::kNeedsFrameState |
| 28 : CallDescriptor::kNoFlags; | 28 : CallDescriptor::kNoFlags; |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 JSGenericLowering::JSGenericLowering(JSGraph* jsgraph) : jsgraph_(jsgraph) {} |
| 32 JSGenericLowering::JSGenericLowering(bool is_typing_enabled, JSGraph* jsgraph) | |
| 33 : is_typing_enabled_(is_typing_enabled), jsgraph_(jsgraph) {} | |
| 34 | |
| 35 | 32 |
| 36 JSGenericLowering::~JSGenericLowering() {} | 33 JSGenericLowering::~JSGenericLowering() {} |
| 37 | 34 |
| 38 | 35 |
| 39 Reduction JSGenericLowering::Reduce(Node* node) { | 36 Reduction JSGenericLowering::Reduce(Node* node) { |
| 40 switch (node->opcode()) { | 37 switch (node->opcode()) { |
| 41 #define DECLARE_CASE(x) \ | 38 #define DECLARE_CASE(x) \ |
| 42 case IrOpcode::k##x: \ | 39 case IrOpcode::k##x: \ |
| 43 Lower##x(node); \ | 40 Lower##x(node); \ |
| 44 break; | 41 break; |
| 45 JS_OP_LIST(DECLARE_CASE) | 42 JS_OP_LIST(DECLARE_CASE) |
| 46 #undef DECLARE_CASE | 43 #undef DECLARE_CASE |
| 47 case IrOpcode::kBranch: | |
| 48 case IrOpcode::kDeoptimizeIf: | |
| 49 case IrOpcode::kDeoptimizeUnless: | |
| 50 // TODO(mstarzinger): If typing is enabled then simplified lowering will | |
| 51 // have inserted the correct ChangeBoolToBit, otherwise we need to perform | |
| 52 // poor-man's representation inference here and insert manual change. | |
| 53 if (!is_typing_enabled_) { | |
| 54 Node* condition = node->InputAt(0); | |
| 55 Node* test = graph()->NewNode(machine()->WordEqual(), condition, | |
| 56 jsgraph()->TrueConstant()); | |
| 57 node->ReplaceInput(0, test); | |
| 58 } | |
| 59 // Fall-through. | |
| 60 default: | 44 default: |
| 61 // Nothing to see. | 45 // Nothing to see. |
| 62 return NoChange(); | 46 return NoChange(); |
| 63 } | 47 } |
| 64 return Changed(node); | 48 return Changed(node); |
| 65 } | 49 } |
| 66 | 50 |
| 67 #define REPLACE_BINARY_OP_IC_CALL(Op, token) \ | 51 #define REPLACE_BINARY_OP_IC_CALL(Op, token) \ |
| 68 void JSGenericLowering::Lower##Op(Node* node) { \ | 52 void JSGenericLowering::Lower##Op(Node* node) { \ |
| 69 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 53 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 730 } |
| 747 | 731 |
| 748 | 732 |
| 749 MachineOperatorBuilder* JSGenericLowering::machine() const { | 733 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 750 return jsgraph()->machine(); | 734 return jsgraph()->machine(); |
| 751 } | 735 } |
| 752 | 736 |
| 753 } // namespace compiler | 737 } // namespace compiler |
| 754 } // namespace internal | 738 } // namespace internal |
| 755 } // namespace v8 | 739 } // namespace v8 |
| OLD | NEW |