| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); | 467 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); |
| 468 Node* stub_code = CodeConstant(stub.GetCode()); | 468 Node* stub_code = CodeConstant(stub.GetCode()); |
| 469 PatchInsertInput(node, 0, stub_code); | 469 PatchInsertInput(node, 0, stub_code); |
| 470 PatchOperator(node, common()->Call(desc)); | 470 PatchOperator(node, common()->Call(desc)); |
| 471 return node; | 471 return node; |
| 472 } | 472 } |
| 473 | 473 |
| 474 | 474 |
| 475 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { | 475 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { |
| 476 ContextAccess access = OpParameter<ContextAccess>(node); | 476 ContextAccess access = OpParameter<ContextAccess>(node); |
| 477 // TODO(mstarzinger): Use simplified operators instead of machine operators | |
| 478 // here so that load/store optimization can be applied afterwards. | |
| 479 for (int i = 0; i < access.depth(); ++i) { | 477 for (int i = 0; i < access.depth(); ++i) { |
| 480 node->ReplaceInput( | 478 node->ReplaceInput( |
| 481 0, graph()->NewNode( | 479 0, graph()->NewNode( |
| 482 machine()->Load(kMachineTagged), | 480 machine()->Load(kMachineTagged), |
| 483 NodeProperties::GetValueInput(node, 0), | 481 NodeProperties::GetValueInput(node, 0), |
| 484 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), | 482 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
| 485 NodeProperties::GetEffectInput(node))); | 483 NodeProperties::GetEffectInput(node))); |
| 486 } | 484 } |
| 487 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 485 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
| 488 PatchOperator(node, machine()->Load(kMachineTagged)); | 486 PatchOperator(node, machine()->Load(kMachineTagged)); |
| 489 return node; | 487 return node; |
| 490 } | 488 } |
| 491 | 489 |
| 492 | 490 |
| 493 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { | 491 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { |
| 494 ContextAccess access = OpParameter<ContextAccess>(node); | 492 ContextAccess access = OpParameter<ContextAccess>(node); |
| 495 // TODO(mstarzinger): Use simplified operators instead of machine operators | |
| 496 // here so that load/store optimization can be applied afterwards. | |
| 497 for (int i = 0; i < access.depth(); ++i) { | 493 for (int i = 0; i < access.depth(); ++i) { |
| 498 node->ReplaceInput( | 494 node->ReplaceInput( |
| 499 0, graph()->NewNode( | 495 0, graph()->NewNode( |
| 500 machine()->Load(kMachineTagged), | 496 machine()->Load(kMachineTagged), |
| 501 NodeProperties::GetValueInput(node, 0), | 497 NodeProperties::GetValueInput(node, 0), |
| 502 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), | 498 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
| 503 NodeProperties::GetEffectInput(node))); | 499 NodeProperties::GetEffectInput(node))); |
| 504 } | 500 } |
| 505 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 501 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
| 506 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 502 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 537 |
| 542 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 538 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
| 543 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 539 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
| 544 int arity = OperatorProperties::GetValueInputCount(node->op()); | 540 int arity = OperatorProperties::GetValueInputCount(node->op()); |
| 545 ReplaceWithRuntimeCall(node, function, arity); | 541 ReplaceWithRuntimeCall(node, function, arity); |
| 546 return node; | 542 return node; |
| 547 } | 543 } |
| 548 } | 544 } |
| 549 } | 545 } |
| 550 } // namespace v8::internal::compiler | 546 } // namespace v8::internal::compiler |
| OLD | NEW |