| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 return Changed(node); | 64 return Changed(node); |
| 65 } | 65 } |
| 66 | 66 |
| 67 #define REPLACE_BINARY_OP_IC_CALL(Op, token) \ | 67 #define REPLACE_BINARY_OP_IC_CALL(Op, token) \ |
| 68 void JSGenericLowering::Lower##Op(Node* node) { \ | 68 void JSGenericLowering::Lower##Op(Node* node) { \ |
| 69 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 69 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| 70 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \ | 70 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \ |
| 71 CallDescriptor::kPatchableCallSiteWithNop | flags); \ | 71 CallDescriptor::kPatchableCallSiteWithNop | flags); \ |
| 72 } | 72 } |
| 73 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) | |
| 74 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) | |
| 75 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND) | |
| 76 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) | 73 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) |
| 77 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) | 74 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) |
| 78 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) | 75 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) |
| 79 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) | 76 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) |
| 80 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) | 77 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) |
| 81 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) | 78 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) |
| 82 #undef REPLACE_BINARY_OP_IC_CALL | 79 #undef REPLACE_BINARY_OP_IC_CALL |
| 83 | 80 |
| 84 #define REPLACE_RUNTIME_CALL(op, fun) \ | 81 #define REPLACE_RUNTIME_CALL(op, fun) \ |
| 85 void JSGenericLowering::Lower##op(Node* node) { \ | 82 void JSGenericLowering::Lower##op(Node* node) { \ |
| 86 ReplaceWithRuntimeCall(node, fun); \ | 83 ReplaceWithRuntimeCall(node, fun); \ |
| 87 } | 84 } |
| 88 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 85 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
| 89 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 86 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
| 90 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) | 87 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) |
| 91 #undef REPLACE_RUNTIME_CALL | 88 #undef REPLACE_RUNTIME_CALL |
| 92 | 89 |
| 93 #define REPLACE_STUB_CALL(Name) \ | 90 #define REPLACE_STUB_CALL(Name) \ |
| 94 void JSGenericLowering::LowerJS##Name(Node* node) { \ | 91 void JSGenericLowering::LowerJS##Name(Node* node) { \ |
| 95 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 92 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| 96 Callable callable = CodeFactory::Name(isolate()); \ | 93 Callable callable = CodeFactory::Name(isolate()); \ |
| 97 ReplaceWithStubCall(node, callable, flags); \ | 94 ReplaceWithStubCall(node, callable, flags); \ |
| 98 } | 95 } |
| 99 REPLACE_STUB_CALL(Add) | 96 REPLACE_STUB_CALL(Add) |
| 100 REPLACE_STUB_CALL(Subtract) | 97 REPLACE_STUB_CALL(Subtract) |
| 98 REPLACE_STUB_CALL(BitwiseAnd) |
| 99 REPLACE_STUB_CALL(BitwiseOr) |
| 100 REPLACE_STUB_CALL(BitwiseXor) |
| 101 REPLACE_STUB_CALL(LessThan) | 101 REPLACE_STUB_CALL(LessThan) |
| 102 REPLACE_STUB_CALL(LessThanOrEqual) | 102 REPLACE_STUB_CALL(LessThanOrEqual) |
| 103 REPLACE_STUB_CALL(GreaterThan) | 103 REPLACE_STUB_CALL(GreaterThan) |
| 104 REPLACE_STUB_CALL(GreaterThanOrEqual) | 104 REPLACE_STUB_CALL(GreaterThanOrEqual) |
| 105 REPLACE_STUB_CALL(Equal) | 105 REPLACE_STUB_CALL(Equal) |
| 106 REPLACE_STUB_CALL(NotEqual) | 106 REPLACE_STUB_CALL(NotEqual) |
| 107 REPLACE_STUB_CALL(StrictEqual) | 107 REPLACE_STUB_CALL(StrictEqual) |
| 108 REPLACE_STUB_CALL(StrictNotEqual) | 108 REPLACE_STUB_CALL(StrictNotEqual) |
| 109 #undef REPLACE_STUB_CALL | 109 #undef REPLACE_STUB_CALL |
| 110 | 110 |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 774 } |
| 775 | 775 |
| 776 | 776 |
| 777 MachineOperatorBuilder* JSGenericLowering::machine() const { | 777 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 778 return jsgraph()->machine(); | 778 return jsgraph()->machine(); |
| 779 } | 779 } |
| 780 | 780 |
| 781 } // namespace compiler | 781 } // namespace compiler |
| 782 } // namespace internal | 782 } // namespace internal |
| 783 } // namespace v8 | 783 } // namespace v8 |
| OLD | NEW |