| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 // Fall-through. | 59 // Fall-through. |
| 60 default: | 60 default: |
| 61 // Nothing to see. | 61 // Nothing to see. |
| 62 return NoChange(); | 62 return NoChange(); |
| 63 } | 63 } |
| 64 return Changed(node); | 64 return Changed(node); |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 #define REPLACE_BINARY_OP_IC_CALL(op, token) \ | 68 #define REPLACE_BINARY_OP_IC_CALL(op, token) \ |
| 69 void JSGenericLowering::Lower##op(Node* node) { \ | 69 void JSGenericLowering::Lower##op(Node* node) { \ |
| 70 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 70 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| 71 ReplaceWithStubCall( \ | 71 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC( \ |
| 72 node, CodeFactory::BinaryOpIC(isolate(), token, \ | 72 isolate(), token, \ |
| 73 OpParameter<LanguageMode>(node)), \ | 73 strength(OpParameter<LanguageMode>(node))), \ |
| 74 CallDescriptor::kPatchableCallSiteWithNop | flags); \ | 74 CallDescriptor::kPatchableCallSiteWithNop | flags); \ |
| 75 } | 75 } |
| 76 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) | 76 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) |
| 77 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) | 77 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) |
| 78 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND) | 78 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND) |
| 79 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) | 79 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) |
| 80 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) | 80 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) |
| 81 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) | 81 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) |
| 82 REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD) | 82 REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD) |
| 83 REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB) | 83 REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB) |
| 84 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) | 84 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 static CallDescriptor::Flags FlagsForNode(Node* node) { | 124 static CallDescriptor::Flags FlagsForNode(Node* node) { |
| 125 CallDescriptor::Flags result = CallDescriptor::kNoFlags; | 125 CallDescriptor::Flags result = CallDescriptor::kNoFlags; |
| 126 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { | 126 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { |
| 127 result |= CallDescriptor::kNeedsFrameState; | 127 result |= CallDescriptor::kNeedsFrameState; |
| 128 } | 128 } |
| 129 return result; | 129 return result; |
| 130 } | 130 } |
| 131 | 131 |
| 132 | 132 |
| 133 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { | 133 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { |
| 134 Callable callable = | 134 Callable callable = CodeFactory::CompareIC( |
| 135 CodeFactory::CompareIC(isolate(), token, OpParameter<LanguageMode>(node)); | 135 isolate(), token, strength(OpParameter<LanguageMode>(node))); |
| 136 | 136 |
| 137 // Create a new call node asking a CompareIC for help. | 137 // Create a new call node asking a CompareIC for help. |
| 138 NodeVector inputs(zone()); | 138 NodeVector inputs(zone()); |
| 139 inputs.reserve(node->InputCount() + 1); | 139 inputs.reserve(node->InputCount() + 1); |
| 140 inputs.push_back(jsgraph()->HeapConstant(callable.code())); | 140 inputs.push_back(jsgraph()->HeapConstant(callable.code())); |
| 141 inputs.push_back(NodeProperties::GetValueInput(node, 0)); | 141 inputs.push_back(NodeProperties::GetValueInput(node, 0)); |
| 142 inputs.push_back(NodeProperties::GetValueInput(node, 1)); | 142 inputs.push_back(NodeProperties::GetValueInput(node, 1)); |
| 143 inputs.push_back(NodeProperties::GetContextInput(node)); | 143 inputs.push_back(NodeProperties::GetContextInput(node)); |
| 144 if (node->op()->HasProperty(Operator::kPure)) { | 144 if (node->op()->HasProperty(Operator::kPure)) { |
| 145 // A pure (strict) comparison doesn't have an effect, control or frame | 145 // A pure (strict) comparison doesn't have an effect, control or frame |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 } | 831 } |
| 832 | 832 |
| 833 | 833 |
| 834 MachineOperatorBuilder* JSGenericLowering::machine() const { | 834 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 835 return jsgraph()->machine(); | 835 return jsgraph()->machine(); |
| 836 } | 836 } |
| 837 | 837 |
| 838 } // namespace compiler | 838 } // namespace compiler |
| 839 } // namespace internal | 839 } // namespace internal |
| 840 } // namespace v8 | 840 } // namespace v8 |
| OLD | NEW |