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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
108 REPLACE_STUB_CALL(StrictNotEqual) | 108 REPLACE_STUB_CALL(StrictNotEqual) |
| 109 REPLACE_STUB_CALL(ToBoolean) |
| 110 REPLACE_STUB_CALL(ToInteger) |
| 111 REPLACE_STUB_CALL(ToLength) |
| 112 REPLACE_STUB_CALL(ToNumber) |
| 113 REPLACE_STUB_CALL(ToName) |
| 114 REPLACE_STUB_CALL(ToObject) |
| 115 REPLACE_STUB_CALL(ToString) |
109 #undef REPLACE_STUB_CALL | 116 #undef REPLACE_STUB_CALL |
110 | 117 |
111 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 118 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
112 CallDescriptor::Flags flags) { | 119 CallDescriptor::Flags flags) { |
113 Operator::Properties properties = node->op()->properties(); | 120 Operator::Properties properties = node->op()->properties(); |
114 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 121 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
115 isolate(), zone(), callable.descriptor(), 0, flags, properties); | 122 isolate(), zone(), callable.descriptor(), 0, flags, properties); |
116 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 123 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
117 node->InsertInput(zone(), 0, stub_code); | 124 node->InsertInput(zone(), 0, stub_code); |
118 NodeProperties::ChangeOp(node, common()->Call(desc)); | 125 NodeProperties::ChangeOp(node, common()->Call(desc)); |
(...skipping 18 matching lines...) Expand all Loading... |
137 } | 144 } |
138 | 145 |
139 | 146 |
140 void JSGenericLowering::LowerJSTypeOf(Node* node) { | 147 void JSGenericLowering::LowerJSTypeOf(Node* node) { |
141 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 148 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
142 Callable callable = CodeFactory::Typeof(isolate()); | 149 Callable callable = CodeFactory::Typeof(isolate()); |
143 ReplaceWithStubCall(node, callable, flags); | 150 ReplaceWithStubCall(node, callable, flags); |
144 } | 151 } |
145 | 152 |
146 | 153 |
147 void JSGenericLowering::LowerJSToBoolean(Node* node) { | |
148 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
149 Callable callable = CodeFactory::ToBoolean(isolate()); | |
150 ReplaceWithStubCall(node, callable, flags); | |
151 } | |
152 | |
153 | |
154 void JSGenericLowering::LowerJSToNumber(Node* node) { | |
155 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
156 Callable callable = CodeFactory::ToNumber(isolate()); | |
157 ReplaceWithStubCall(node, callable, flags); | |
158 } | |
159 | |
160 | |
161 void JSGenericLowering::LowerJSToString(Node* node) { | |
162 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
163 Callable callable = CodeFactory::ToString(isolate()); | |
164 ReplaceWithStubCall(node, callable, flags); | |
165 } | |
166 | |
167 | |
168 void JSGenericLowering::LowerJSToName(Node* node) { | |
169 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
170 Callable callable = CodeFactory::ToName(isolate()); | |
171 ReplaceWithStubCall(node, callable, flags); | |
172 } | |
173 | |
174 | |
175 void JSGenericLowering::LowerJSToObject(Node* node) { | |
176 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
177 Callable callable = CodeFactory::ToObject(isolate()); | |
178 ReplaceWithStubCall(node, callable, flags); | |
179 } | |
180 | |
181 | |
182 void JSGenericLowering::LowerJSLoadProperty(Node* node) { | 154 void JSGenericLowering::LowerJSLoadProperty(Node* node) { |
183 Node* closure = NodeProperties::GetValueInput(node, 2); | 155 Node* closure = NodeProperties::GetValueInput(node, 2); |
184 Node* effect = NodeProperties::GetEffectInput(node); | 156 Node* effect = NodeProperties::GetEffectInput(node); |
185 Node* control = NodeProperties::GetControlInput(node); | 157 Node* control = NodeProperties::GetControlInput(node); |
186 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 158 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
187 const PropertyAccess& p = PropertyAccessOf(node->op()); | 159 const PropertyAccess& p = PropertyAccessOf(node->op()); |
188 Callable callable = | 160 Callable callable = |
189 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); | 161 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); |
190 // Load the type feedback vector from the closure. | 162 // Load the type feedback vector from the closure. |
191 Node* shared_info = effect = graph()->NewNode( | 163 Node* shared_info = effect = graph()->NewNode( |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 746 } |
775 | 747 |
776 | 748 |
777 MachineOperatorBuilder* JSGenericLowering::machine() const { | 749 MachineOperatorBuilder* JSGenericLowering::machine() const { |
778 return jsgraph()->machine(); | 750 return jsgraph()->machine(); |
779 } | 751 } |
780 | 752 |
781 } // namespace compiler | 753 } // namespace compiler |
782 } // namespace internal | 754 } // namespace internal |
783 } // namespace v8 | 755 } // namespace v8 |
OLD | NEW |