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-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/graph-inl.h" | 7 #include "src/compiler/graph-inl.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 private: | 149 private: |
150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } |
151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } |
153 | 153 |
154 StrictMode strict_mode_; | 154 StrictMode strict_mode_; |
155 }; | 155 }; |
156 | 156 |
157 | 157 |
158 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, | 158 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, |
159 MachineOperatorBuilder* machine, | 159 MachineOperatorBuilder* machine) |
160 SourcePositionTable* source_positions) | 160 : info_(info), |
161 : LoweringBuilder(jsgraph->graph(), source_positions), | |
162 info_(info), | |
163 jsgraph_(jsgraph), | 161 jsgraph_(jsgraph), |
164 linkage_(new (jsgraph->zone()) Linkage(info)), | 162 linkage_(new (jsgraph->zone()) Linkage(info)), |
165 machine_(machine) {} | 163 machine_(machine) {} |
166 | 164 |
167 | 165 |
168 void JSGenericLowering::PatchOperator(Node* node, Operator* op) { | 166 void JSGenericLowering::PatchOperator(Node* node, Operator* op) { |
169 node->set_op(op); | 167 node->set_op(op); |
170 } | 168 } |
171 | 169 |
172 | 170 |
(...skipping 20 matching lines...) Expand all Loading... |
193 Node* JSGenericLowering::FunctionConstant(Handle<JSFunction> function) { | 191 Node* JSGenericLowering::FunctionConstant(Handle<JSFunction> function) { |
194 return jsgraph()->HeapConstant(function); | 192 return jsgraph()->HeapConstant(function); |
195 } | 193 } |
196 | 194 |
197 | 195 |
198 Node* JSGenericLowering::ExternalConstant(ExternalReference ref) { | 196 Node* JSGenericLowering::ExternalConstant(ExternalReference ref) { |
199 return jsgraph()->ExternalConstant(ref); | 197 return jsgraph()->ExternalConstant(ref); |
200 } | 198 } |
201 | 199 |
202 | 200 |
203 void JSGenericLowering::Lower(Node* node) { | 201 Reduction JSGenericLowering::Reduce(Node* node) { |
204 Node* replacement = NULL; | 202 Node* replacement = NULL; |
205 // Dispatch according to the opcode. | 203 // Dispatch according to the opcode. |
206 switch (node->opcode()) { | 204 switch (node->opcode()) { |
207 #define DECLARE_CASE(x) \ | 205 #define DECLARE_CASE(x) \ |
208 case IrOpcode::k##x: \ | 206 case IrOpcode::k##x: \ |
209 replacement = Lower##x(node); \ | 207 replacement = Lower##x(node); \ |
210 break; | 208 break; |
211 DECLARE_CASE(Branch) | 209 DECLARE_CASE(Branch) |
212 JS_OP_LIST(DECLARE_CASE) | 210 JS_OP_LIST(DECLARE_CASE) |
213 #undef DECLARE_CASE | 211 #undef DECLARE_CASE |
214 default: | 212 default: |
215 // Nothing to see. | 213 // Nothing to see. |
216 return; | 214 return NoChange(); |
217 } | 215 } |
218 | 216 DCHECK_EQ(node, replacement); |
219 // Nothing to do if lowering was done by patching the existing node. | 217 return Changed(replacement); |
220 if (replacement == node) return; | |
221 | |
222 // Iterate through uses of the original node and replace uses accordingly. | |
223 UNIMPLEMENTED(); | |
224 } | 218 } |
225 | 219 |
226 | 220 |
227 #define REPLACE_IC_STUB_CALL(op, StubDeclaration) \ | 221 #define REPLACE_IC_STUB_CALL(op, StubDeclaration) \ |
228 Node* JSGenericLowering::Lower##op(Node* node) { \ | 222 Node* JSGenericLowering::Lower##op(Node* node) { \ |
229 StubDeclaration; \ | 223 StubDeclaration; \ |
230 ReplaceWithICStubCall(node, &stub); \ | 224 ReplaceWithICStubCall(node, &stub); \ |
231 return node; \ | 225 return node; \ |
232 } | 226 } |
233 REPLACE_IC_STUB_CALL(JSBitwiseOr, BinaryOpICStub stub(isolate(), Token::BIT_OR)) | 227 REPLACE_IC_STUB_CALL(JSBitwiseOr, BinaryOpICStub stub(isolate(), Token::BIT_OR)) |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 535 |
542 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 536 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
543 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 537 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
544 int arity = OperatorProperties::GetValueInputCount(node->op()); | 538 int arity = OperatorProperties::GetValueInputCount(node->op()); |
545 ReplaceWithRuntimeCall(node, function, arity); | 539 ReplaceWithRuntimeCall(node, function, arity); |
546 return node; | 540 return node; |
547 } | 541 } |
548 } | 542 } |
549 } | 543 } |
550 } // namespace v8::internal::compiler | 544 } // namespace v8::internal::compiler |
OLD | NEW |