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/compiler/js-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 break; | 43 break; |
44 JS_OP_LIST(DECLARE_CASE) | 44 JS_OP_LIST(DECLARE_CASE) |
45 #undef DECLARE_CASE | 45 #undef DECLARE_CASE |
46 default: | 46 default: |
47 // Nothing to see. | 47 // Nothing to see. |
48 return NoChange(); | 48 return NoChange(); |
49 } | 49 } |
50 return Changed(node); | 50 return Changed(node); |
51 } | 51 } |
52 | 52 |
53 #define REPLACE_STUB_CALL(Name) \ | 53 #define REPLACE_STUB_CALL(Name) \ |
54 void JSGenericLowering::LowerJS##Name(Node* node) { \ | 54 void JSGenericLowering::LowerJS##Name(Node* node) { \ |
55 CallDescriptor::Flags flags = FrameStateFlagForCall(node); \ | 55 CallDescriptor::Flags flags = FrameStateFlagForCall(node); \ |
56 Callable callable = CodeFactory::Name(isolate()); \ | 56 Callable callable = Builtins::CallableFor(isolate(), Builtins::k##Name); \ |
57 ReplaceWithStubCall(node, callable, flags); \ | 57 ReplaceWithStubCall(node, callable, flags); \ |
58 } | 58 } |
59 REPLACE_STUB_CALL(Add) | 59 REPLACE_STUB_CALL(Add) |
60 REPLACE_STUB_CALL(Subtract) | 60 REPLACE_STUB_CALL(Subtract) |
61 REPLACE_STUB_CALL(Multiply) | 61 REPLACE_STUB_CALL(Multiply) |
62 REPLACE_STUB_CALL(Divide) | 62 REPLACE_STUB_CALL(Divide) |
63 REPLACE_STUB_CALL(Modulus) | 63 REPLACE_STUB_CALL(Modulus) |
64 REPLACE_STUB_CALL(BitwiseAnd) | 64 REPLACE_STUB_CALL(BitwiseAnd) |
65 REPLACE_STUB_CALL(BitwiseOr) | 65 REPLACE_STUB_CALL(BitwiseOr) |
66 REPLACE_STUB_CALL(BitwiseXor) | 66 REPLACE_STUB_CALL(BitwiseXor) |
67 REPLACE_STUB_CALL(ShiftLeft) | 67 REPLACE_STUB_CALL(ShiftLeft) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); | 122 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
123 Callable callable = CodeFactory::StrictEqual(isolate()); | 123 Callable callable = CodeFactory::StrictEqual(isolate()); |
124 node->RemoveInput(4); // control | 124 node->RemoveInput(4); // control |
125 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, | 125 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, |
126 Operator::kEliminatable); | 126 Operator::kEliminatable); |
127 } | 127 } |
128 | 128 |
129 void JSGenericLowering::LowerJSToBoolean(Node* node) { | 129 void JSGenericLowering::LowerJSToBoolean(Node* node) { |
130 // The ToBoolean conversion doesn't need the current context. | 130 // The ToBoolean conversion doesn't need the current context. |
131 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); | 131 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
132 Callable callable = CodeFactory::ToBoolean(isolate()); | 132 Callable callable = Builtins::CallableFor(isolate(), Builtins::kToBoolean); |
133 node->AppendInput(zone(), graph()->start()); | 133 node->AppendInput(zone(), graph()->start()); |
134 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, | 134 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, |
135 Operator::kEliminatable); | 135 Operator::kEliminatable); |
136 } | 136 } |
137 | 137 |
138 void JSGenericLowering::LowerJSClassOf(Node* node) { | 138 void JSGenericLowering::LowerJSClassOf(Node* node) { |
139 // The %_ClassOf intrinsic doesn't need the current context. | 139 // The %_ClassOf intrinsic doesn't need the current context. |
140 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); | 140 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
141 Callable callable = CodeFactory::ClassOf(isolate()); | 141 Callable callable = CodeFactory::ClassOf(isolate()); |
142 node->AppendInput(zone(), graph()->start()); | 142 node->AppendInput(zone(), graph()->start()); |
143 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, | 143 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, |
144 Operator::kEliminatable); | 144 Operator::kEliminatable); |
145 } | 145 } |
146 | 146 |
147 void JSGenericLowering::LowerJSTypeOf(Node* node) { | 147 void JSGenericLowering::LowerJSTypeOf(Node* node) { |
148 // The typeof operator doesn't need the current context. | 148 // The typeof operator doesn't need the current context. |
149 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); | 149 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
150 Callable callable = CodeFactory::Typeof(isolate()); | 150 Callable callable = Builtins::CallableFor(isolate(), Builtins::kTypeof); |
151 node->AppendInput(zone(), graph()->start()); | 151 node->AppendInput(zone(), graph()->start()); |
152 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, | 152 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, |
153 Operator::kEliminatable); | 153 Operator::kEliminatable); |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 void JSGenericLowering::LowerJSLoadProperty(Node* node) { | 157 void JSGenericLowering::LowerJSLoadProperty(Node* node) { |
158 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 158 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
159 const PropertyAccess& p = PropertyAccessOf(node->op()); | 159 const PropertyAccess& p = PropertyAccessOf(node->op()); |
160 Node* frame_state = NodeProperties::GetFrameStateInput(node); | 160 Node* frame_state = NodeProperties::GetFrameStateInput(node); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 753 } |
754 | 754 |
755 | 755 |
756 MachineOperatorBuilder* JSGenericLowering::machine() const { | 756 MachineOperatorBuilder* JSGenericLowering::machine() const { |
757 return jsgraph()->machine(); | 757 return jsgraph()->machine(); |
758 } | 758 } |
759 | 759 |
760 } // namespace compiler | 760 } // namespace compiler |
761 } // namespace internal | 761 } // namespace internal |
762 } // namespace v8 | 762 } // namespace v8 |
OLD | NEW |