| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE(JSLessThanOrEqual, Token::LTE) | 108 REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE(JSLessThanOrEqual, Token::LTE) |
| 109 REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE(JSGreaterThanOrEqual, Token::GTE) | 109 REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE(JSGreaterThanOrEqual, Token::GTE) |
| 110 #undef REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE | 110 #undef REPLACE_COMPARE_IC_CALL_WITH_LANGUAGE_MODE |
| 111 | 111 |
| 112 | 112 |
| 113 #define REPLACE_RUNTIME_CALL(op, fun) \ | 113 #define REPLACE_RUNTIME_CALL(op, fun) \ |
| 114 void JSGenericLowering::Lower##op(Node* node) { \ | 114 void JSGenericLowering::Lower##op(Node* node) { \ |
| 115 ReplaceWithRuntimeCall(node, fun); \ | 115 ReplaceWithRuntimeCall(node, fun); \ |
| 116 } | 116 } |
| 117 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) | 117 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) |
| 118 REPLACE_RUNTIME_CALL(JSCreateArguments, Runtime::kNewArguments) | |
| 119 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) | 118 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) |
| 120 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 119 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
| 121 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) | 120 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) |
| 122 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 121 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
| 123 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kNewScriptContext) | 122 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kNewScriptContext) |
| 124 #undef REPLACE_RUNTIME | 123 #undef REPLACE_RUNTIME |
| 125 | 124 |
| 126 | 125 |
| 127 #define REPLACE_UNIMPLEMENTED(op) \ | 126 #define REPLACE_UNIMPLEMENTED(op) \ |
| 128 void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); } | 127 void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 void JSGenericLowering::LowerJSLoadDynamicContext(Node* node) { | 482 void JSGenericLowering::LowerJSLoadDynamicContext(Node* node) { |
| 484 const DynamicContextAccess& access = DynamicContextAccessOf(node->op()); | 483 const DynamicContextAccess& access = DynamicContextAccessOf(node->op()); |
| 485 Node* projection = graph()->NewNode(common()->Projection(0), node); | 484 Node* projection = graph()->NewNode(common()->Projection(0), node); |
| 486 NodeProperties::ReplaceUses(node, projection, node, node, node); | 485 NodeProperties::ReplaceUses(node, projection, node, node, node); |
| 487 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); | 486 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); |
| 488 ReplaceWithRuntimeCall(node, Runtime::kLoadLookupSlot); | 487 ReplaceWithRuntimeCall(node, Runtime::kLoadLookupSlot); |
| 489 projection->ReplaceInput(0, node); | 488 projection->ReplaceInput(0, node); |
| 490 } | 489 } |
| 491 | 490 |
| 492 | 491 |
| 492 void JSGenericLowering::LowerJSCreateArguments(Node* node) { |
| 493 const CreateArgumentsParameters& p = CreateArgumentsParametersOf(node->op()); |
| 494 switch (p.type()) { |
| 495 case CreateArgumentsParameters::kMappedArguments: |
| 496 ReplaceWithRuntimeCall(node, Runtime::kNewSloppyArguments_Generic); |
| 497 break; |
| 498 case CreateArgumentsParameters::kUnmappedArguments: |
| 499 ReplaceWithRuntimeCall(node, Runtime::kNewStrictArguments_Generic); |
| 500 break; |
| 501 case CreateArgumentsParameters::kRestArray: |
| 502 UNIMPLEMENTED(); |
| 503 break; |
| 504 } |
| 505 } |
| 506 |
| 507 |
| 493 void JSGenericLowering::LowerJSCreateClosure(Node* node) { | 508 void JSGenericLowering::LowerJSCreateClosure(Node* node) { |
| 494 CreateClosureParameters p = CreateClosureParametersOf(node->op()); | 509 CreateClosureParameters p = CreateClosureParametersOf(node->op()); |
| 495 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.shared_info())); | 510 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.shared_info())); |
| 496 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) | 511 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) |
| 497 ? Runtime::kNewClosure_Tenured | 512 ? Runtime::kNewClosure_Tenured |
| 498 : Runtime::kNewClosure); | 513 : Runtime::kNewClosure); |
| 499 } | 514 } |
| 500 | 515 |
| 501 | 516 |
| 502 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { | 517 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } | 841 } |
| 827 | 842 |
| 828 | 843 |
| 829 MachineOperatorBuilder* JSGenericLowering::machine() const { | 844 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 830 return jsgraph()->machine(); | 845 return jsgraph()->machine(); |
| 831 } | 846 } |
| 832 | 847 |
| 833 } // namespace compiler | 848 } // namespace compiler |
| 834 } // namespace internal | 849 } // namespace internal |
| 835 } // namespace v8 | 850 } // namespace v8 |
| OLD | NEW |