| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); | 363 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); |
| 364 Node* stub_code = CodeConstant(stub.GetCode()); | 364 Node* stub_code = CodeConstant(stub.GetCode()); |
| 365 PatchInsertInput(node, 0, stub_code); | 365 PatchInsertInput(node, 0, stub_code); |
| 366 PatchOperator(node, common()->Call(desc)); | 366 PatchOperator(node, common()->Call(desc)); |
| 367 return node; | 367 return node; |
| 368 } | 368 } |
| 369 | 369 |
| 370 | 370 |
| 371 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { | 371 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { |
| 372 ContextAccess access = OpParameter<ContextAccess>(node); | 372 ContextAccess access = OpParameter<ContextAccess>(node); |
| 373 PatchInsertInput(node, 1, SmiConstant(access.depth())); | 373 // TODO(mstarzinger): Use simplified operators instead of machine operators |
| 374 PatchInsertInput(node, 2, SmiConstant(access.index())); | 374 // here so that load/store optimization can be applied afterwards. |
| 375 ReplaceWithRuntimeCall(node, Runtime::kLoadContextRelative, 3); | 375 for (int i = 0; i < access.depth(); ++i) { |
| 376 node->ReplaceInput( |
| 377 0, graph()->NewNode( |
| 378 machine()->Load(kMachineTagged), |
| 379 NodeProperties::GetValueInput(node, 0), |
| 380 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
| 381 NodeProperties::GetEffectInput(node))); |
| 382 } |
| 383 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
| 384 PatchOperator(node, machine()->Load(kMachineTagged)); |
| 376 return node; | 385 return node; |
| 377 } | 386 } |
| 378 | 387 |
| 379 | 388 |
| 380 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { | 389 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { |
| 381 ContextAccess access = OpParameter<ContextAccess>(node); | 390 ContextAccess access = OpParameter<ContextAccess>(node); |
| 382 PatchInsertInput(node, 1, SmiConstant(access.depth())); | 391 PatchInsertInput(node, 1, SmiConstant(access.depth())); |
| 383 PatchInsertInput(node, 2, SmiConstant(access.index())); | 392 PatchInsertInput(node, 2, SmiConstant(access.index())); |
| 384 ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4); | 393 ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4); |
| 385 return node; | 394 return node; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 416 | 425 |
| 417 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 426 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
| 418 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 427 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
| 419 int arity = NodeProperties::GetValueInputCount(node); | 428 int arity = NodeProperties::GetValueInputCount(node); |
| 420 ReplaceWithRuntimeCall(node, function, arity); | 429 ReplaceWithRuntimeCall(node, function, arity); |
| 421 return node; | 430 return node; |
| 422 } | 431 } |
| 423 } | 432 } |
| 424 } | 433 } |
| 425 } // namespace v8::internal::compiler | 434 } // namespace v8::internal::compiler |
| OLD | NEW |