| 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 29 matching lines...) Expand all Loading... |
| 40 Lower##x(node); \ | 40 Lower##x(node); \ |
| 41 break; | 41 break; |
| 42 JS_OP_LIST(DECLARE_CASE) | 42 JS_OP_LIST(DECLARE_CASE) |
| 43 #undef DECLARE_CASE | 43 #undef DECLARE_CASE |
| 44 default: | 44 default: |
| 45 // Nothing to see. | 45 // Nothing to see. |
| 46 return NoChange(); | 46 return NoChange(); |
| 47 } | 47 } |
| 48 return Changed(node); | 48 return Changed(node); |
| 49 } | 49 } |
| 50 | |
| 51 #define REPLACE_BINARY_OP_IC_CALL(Op, token) \ | |
| 52 void JSGenericLowering::Lower##Op(Node* node) { \ | |
| 53 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | |
| 54 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \ | |
| 55 CallDescriptor::kPatchableCallSiteWithNop | flags); \ | |
| 56 } | |
| 57 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) | |
| 58 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) | |
| 59 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) | |
| 60 #undef REPLACE_BINARY_OP_IC_CALL | |
| 61 | |
| 62 #define REPLACE_RUNTIME_CALL(op, fun) \ | 50 #define REPLACE_RUNTIME_CALL(op, fun) \ |
| 63 void JSGenericLowering::Lower##op(Node* node) { \ | 51 void JSGenericLowering::Lower##op(Node* node) { \ |
| 64 ReplaceWithRuntimeCall(node, fun); \ | 52 ReplaceWithRuntimeCall(node, fun); \ |
| 65 } | 53 } |
| 66 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 54 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
| 67 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 55 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
| 68 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) | 56 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) |
| 69 #undef REPLACE_RUNTIME_CALL | 57 #undef REPLACE_RUNTIME_CALL |
| 70 | 58 |
| 71 #define REPLACE_STUB_CALL(Name) \ | 59 #define REPLACE_STUB_CALL(Name) \ |
| 72 void JSGenericLowering::LowerJS##Name(Node* node) { \ | 60 void JSGenericLowering::LowerJS##Name(Node* node) { \ |
| 73 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 61 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| 74 Callable callable = CodeFactory::Name(isolate()); \ | 62 Callable callable = CodeFactory::Name(isolate()); \ |
| 75 ReplaceWithStubCall(node, callable, flags); \ | 63 ReplaceWithStubCall(node, callable, flags); \ |
| 76 } | 64 } |
| 77 REPLACE_STUB_CALL(Add) | 65 REPLACE_STUB_CALL(Add) |
| 78 REPLACE_STUB_CALL(Subtract) | 66 REPLACE_STUB_CALL(Subtract) |
| 79 REPLACE_STUB_CALL(Multiply) | 67 REPLACE_STUB_CALL(Multiply) |
| 80 REPLACE_STUB_CALL(Divide) | 68 REPLACE_STUB_CALL(Divide) |
| 81 REPLACE_STUB_CALL(Modulus) | 69 REPLACE_STUB_CALL(Modulus) |
| 82 REPLACE_STUB_CALL(BitwiseAnd) | 70 REPLACE_STUB_CALL(BitwiseAnd) |
| 83 REPLACE_STUB_CALL(BitwiseOr) | 71 REPLACE_STUB_CALL(BitwiseOr) |
| 84 REPLACE_STUB_CALL(BitwiseXor) | 72 REPLACE_STUB_CALL(BitwiseXor) |
| 73 REPLACE_STUB_CALL(ShiftLeft) |
| 74 REPLACE_STUB_CALL(ShiftRight) |
| 75 REPLACE_STUB_CALL(ShiftRightLogical) |
| 85 REPLACE_STUB_CALL(LessThan) | 76 REPLACE_STUB_CALL(LessThan) |
| 86 REPLACE_STUB_CALL(LessThanOrEqual) | 77 REPLACE_STUB_CALL(LessThanOrEqual) |
| 87 REPLACE_STUB_CALL(GreaterThan) | 78 REPLACE_STUB_CALL(GreaterThan) |
| 88 REPLACE_STUB_CALL(GreaterThanOrEqual) | 79 REPLACE_STUB_CALL(GreaterThanOrEqual) |
| 89 REPLACE_STUB_CALL(Equal) | 80 REPLACE_STUB_CALL(Equal) |
| 90 REPLACE_STUB_CALL(NotEqual) | 81 REPLACE_STUB_CALL(NotEqual) |
| 91 REPLACE_STUB_CALL(ToInteger) | 82 REPLACE_STUB_CALL(ToInteger) |
| 92 REPLACE_STUB_CALL(ToLength) | 83 REPLACE_STUB_CALL(ToLength) |
| 93 REPLACE_STUB_CALL(ToNumber) | 84 REPLACE_STUB_CALL(ToNumber) |
| 94 REPLACE_STUB_CALL(ToName) | 85 REPLACE_STUB_CALL(ToName) |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 744 } |
| 754 | 745 |
| 755 | 746 |
| 756 MachineOperatorBuilder* JSGenericLowering::machine() const { | 747 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 757 return jsgraph()->machine(); | 748 return jsgraph()->machine(); |
| 758 } | 749 } |
| 759 | 750 |
| 760 } // namespace compiler | 751 } // namespace compiler |
| 761 } // namespace internal | 752 } // namespace internal |
| 762 } // namespace v8 | 753 } // namespace v8 |
| OLD | NEW |