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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 NodeProperties::GetEffectInput(node))); | 381 NodeProperties::GetEffectInput(node))); |
382 } | 382 } |
383 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 383 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
384 PatchOperator(node, machine()->Load(kMachineTagged)); | 384 PatchOperator(node, machine()->Load(kMachineTagged)); |
385 return node; | 385 return node; |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { | 389 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { |
390 ContextAccess access = OpParameter<ContextAccess>(node); | 390 ContextAccess access = OpParameter<ContextAccess>(node); |
391 PatchInsertInput(node, 1, SmiConstant(access.depth())); | 391 // TODO(mstarzinger): Use simplified operators instead of machine operators |
392 PatchInsertInput(node, 2, SmiConstant(access.index())); | 392 // here so that load/store optimization can be applied afterwards. |
393 ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4); | 393 for (int i = 0; i < access.depth(); ++i) { |
| 394 node->ReplaceInput( |
| 395 0, graph()->NewNode( |
| 396 machine()->Load(kMachineTagged), |
| 397 NodeProperties::GetValueInput(node, 0), |
| 398 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
| 399 NodeProperties::GetEffectInput(node))); |
| 400 } |
| 401 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
| 402 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
| 403 PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier)); |
394 return node; | 404 return node; |
395 } | 405 } |
396 | 406 |
397 | 407 |
398 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { | 408 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { |
399 int arity = OpParameter<int>(node); | 409 int arity = OpParameter<int>(node); |
400 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); | 410 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); |
401 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 411 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); |
402 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, arity); | 412 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, arity); |
403 Node* stub_code = CodeConstant(stub.GetCode()); | 413 Node* stub_code = CodeConstant(stub.GetCode()); |
(...skipping 21 matching lines...) Expand all Loading... |
425 | 435 |
426 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 436 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
427 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 437 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
428 int arity = NodeProperties::GetValueInputCount(node); | 438 int arity = NodeProperties::GetValueInputCount(node); |
429 ReplaceWithRuntimeCall(node, function, arity); | 439 ReplaceWithRuntimeCall(node, function, arity); |
430 return node; | 440 return node; |
431 } | 441 } |
432 } | 442 } |
433 } | 443 } |
434 } // namespace v8::internal::compiler | 444 } // namespace v8::internal::compiler |
OLD | NEW |