| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) | 82 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) |
| 83 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) | 83 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) |
| 84 #undef REPLACE_BINARY_OP_IC_CALL | 84 #undef REPLACE_BINARY_OP_IC_CALL |
| 85 | 85 |
| 86 #define REPLACE_RUNTIME_CALL(op, fun) \ | 86 #define REPLACE_RUNTIME_CALL(op, fun) \ |
| 87 void JSGenericLowering::Lower##op(Node* node) { \ | 87 void JSGenericLowering::Lower##op(Node* node) { \ |
| 88 ReplaceWithRuntimeCall(node, fun); \ | 88 ReplaceWithRuntimeCall(node, fun); \ |
| 89 } | 89 } |
| 90 REPLACE_RUNTIME_CALL(JSEqual, Runtime::kEqual) | 90 REPLACE_RUNTIME_CALL(JSEqual, Runtime::kEqual) |
| 91 REPLACE_RUNTIME_CALL(JSNotEqual, Runtime::kNotEqual) | 91 REPLACE_RUNTIME_CALL(JSNotEqual, Runtime::kNotEqual) |
| 92 REPLACE_RUNTIME_CALL(JSStrictEqual, Runtime::kStrictEqual) | |
| 93 REPLACE_RUNTIME_CALL(JSStrictNotEqual, Runtime::kStrictNotEqual) | 92 REPLACE_RUNTIME_CALL(JSStrictNotEqual, Runtime::kStrictNotEqual) |
| 94 REPLACE_RUNTIME_CALL(JSLessThan, Runtime::kLessThan) | 93 REPLACE_RUNTIME_CALL(JSLessThan, Runtime::kLessThan) |
| 95 REPLACE_RUNTIME_CALL(JSGreaterThan, Runtime::kGreaterThan) | 94 REPLACE_RUNTIME_CALL(JSGreaterThan, Runtime::kGreaterThan) |
| 96 REPLACE_RUNTIME_CALL(JSLessThanOrEqual, Runtime::kLessThanOrEqual) | 95 REPLACE_RUNTIME_CALL(JSLessThanOrEqual, Runtime::kLessThanOrEqual) |
| 97 REPLACE_RUNTIME_CALL(JSGreaterThanOrEqual, Runtime::kGreaterThanOrEqual) | 96 REPLACE_RUNTIME_CALL(JSGreaterThanOrEqual, Runtime::kGreaterThanOrEqual) |
| 98 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 97 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
| 99 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 98 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
| 100 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) | 99 REPLACE_RUNTIME_CALL(JSConvertReceiver, Runtime::kConvertReceiver) |
| 101 #undef REPLACE_RUNTIME_CALL | 100 #undef REPLACE_RUNTIME_CALL |
| 102 | 101 |
| 102 #define REPLACE_STUB_CALL(Op, Stub) \ |
| 103 void JSGenericLowering::Lower##Op(Node* node) { \ |
| 104 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ |
| 105 Callable callable = CodeFactory::Stub(isolate()); \ |
| 106 ReplaceWithStubCall(node, callable, flags); \ |
| 107 } |
| 108 REPLACE_STUB_CALL(JSStrictEqual, StrictEqual) |
| 109 #undef REPLACE_STUB_CALL |
| 110 |
| 103 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 111 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
| 104 CallDescriptor::Flags flags) { | 112 CallDescriptor::Flags flags) { |
| 105 Operator::Properties properties = node->op()->properties(); | 113 Operator::Properties properties = node->op()->properties(); |
| 106 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 114 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 107 isolate(), zone(), callable.descriptor(), 0, flags, properties); | 115 isolate(), zone(), callable.descriptor(), 0, flags, properties); |
| 108 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 116 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 109 node->InsertInput(zone(), 0, stub_code); | 117 node->InsertInput(zone(), 0, stub_code); |
| 110 NodeProperties::ChangeOp(node, common()->Call(desc)); | 118 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 111 } | 119 } |
| 112 | 120 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } | 776 } |
| 769 | 777 |
| 770 | 778 |
| 771 MachineOperatorBuilder* JSGenericLowering::machine() const { | 779 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 772 return jsgraph()->machine(); | 780 return jsgraph()->machine(); |
| 773 } | 781 } |
| 774 | 782 |
| 775 } // namespace compiler | 783 } // namespace compiler |
| 776 } // namespace internal | 784 } // namespace internal |
| 777 } // namespace v8 | 785 } // namespace v8 |
| OLD | NEW |