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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(JSShiftLeft, Token::SHL) | 73 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) |
74 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) | 74 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) |
75 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) | 75 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) |
76 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) | |
77 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) | 76 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) |
78 #undef REPLACE_BINARY_OP_IC_CALL | 77 #undef REPLACE_BINARY_OP_IC_CALL |
79 | 78 |
80 #define REPLACE_RUNTIME_CALL(op, fun) \ | 79 #define REPLACE_RUNTIME_CALL(op, fun) \ |
81 void JSGenericLowering::Lower##op(Node* node) { \ | 80 void JSGenericLowering::Lower##op(Node* node) { \ |
82 ReplaceWithRuntimeCall(node, fun); \ | 81 ReplaceWithRuntimeCall(node, fun); \ |
83 } | 82 } |
84 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 83 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
85 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 84 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
86 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) | 85 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) |
87 #undef REPLACE_RUNTIME_CALL | 86 #undef REPLACE_RUNTIME_CALL |
88 | 87 |
89 #define REPLACE_STUB_CALL(Name) \ | 88 #define REPLACE_STUB_CALL(Name) \ |
90 void JSGenericLowering::LowerJS##Name(Node* node) { \ | 89 void JSGenericLowering::LowerJS##Name(Node* node) { \ |
91 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ | 90 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
92 Callable callable = CodeFactory::Name(isolate()); \ | 91 Callable callable = CodeFactory::Name(isolate()); \ |
93 ReplaceWithStubCall(node, callable, flags); \ | 92 ReplaceWithStubCall(node, callable, flags); \ |
94 } | 93 } |
95 REPLACE_STUB_CALL(Add) | 94 REPLACE_STUB_CALL(Add) |
96 REPLACE_STUB_CALL(Subtract) | 95 REPLACE_STUB_CALL(Subtract) |
97 REPLACE_STUB_CALL(Multiply) | 96 REPLACE_STUB_CALL(Multiply) |
| 97 REPLACE_STUB_CALL(Divide) |
98 REPLACE_STUB_CALL(BitwiseAnd) | 98 REPLACE_STUB_CALL(BitwiseAnd) |
99 REPLACE_STUB_CALL(BitwiseOr) | 99 REPLACE_STUB_CALL(BitwiseOr) |
100 REPLACE_STUB_CALL(BitwiseXor) | 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) |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 746 } |
747 | 747 |
748 | 748 |
749 MachineOperatorBuilder* JSGenericLowering::machine() const { | 749 MachineOperatorBuilder* JSGenericLowering::machine() const { |
750 return jsgraph()->machine(); | 750 return jsgraph()->machine(); |
751 } | 751 } |
752 | 752 |
753 } // namespace compiler | 753 } // namespace compiler |
754 } // namespace internal | 754 } // namespace internal |
755 } // namespace v8 | 755 } // namespace v8 |
OLD | NEW |