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/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-generic-lowering.h" | 9 #include "src/compiler/js-generic-lowering.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 CallDescriptor* desc = | 324 CallDescriptor* desc = |
325 linkage()->GetStubCallDescriptor(d, 0, FlagsForNode(node)); | 325 linkage()->GetStubCallDescriptor(d, 0, FlagsForNode(node)); |
326 Node* stub_code = CodeConstant(stub.GetCode()); | 326 Node* stub_code = CodeConstant(stub.GetCode()); |
327 PatchInsertInput(node, 0, stub_code); | 327 PatchInsertInput(node, 0, stub_code); |
328 PatchOperator(node, common()->Call(desc)); | 328 PatchOperator(node, common()->Call(desc)); |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 void JSGenericLowering::LowerJSLoadContext(Node* node) { | 332 void JSGenericLowering::LowerJSLoadContext(Node* node) { |
333 const ContextAccess& access = ContextAccessOf(node->op()); | 333 const ContextAccess& access = ContextAccessOf(node->op()); |
334 // TODO(mstarzinger): Use simplified operators instead of machine operators | |
335 // here so that load/store optimization can be applied afterwards. | |
336 for (size_t i = 0; i < access.depth(); ++i) { | 334 for (size_t i = 0; i < access.depth(); ++i) { |
337 node->ReplaceInput( | 335 node->ReplaceInput( |
338 0, graph()->NewNode( | 336 0, graph()->NewNode( |
339 machine()->Load(kMachAnyTagged), | 337 machine()->Load(kMachAnyTagged), |
340 NodeProperties::GetValueInput(node, 0), | 338 NodeProperties::GetValueInput(node, 0), |
341 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), | 339 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
342 NodeProperties::GetEffectInput(node))); | 340 NodeProperties::GetEffectInput(node), graph()->start())); |
343 } | 341 } |
344 node->ReplaceInput( | 342 node->ReplaceInput( |
345 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index())))); | 343 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index())))); |
| 344 node->AppendInput(zone(), graph()->start()); |
346 PatchOperator(node, machine()->Load(kMachAnyTagged)); | 345 PatchOperator(node, machine()->Load(kMachAnyTagged)); |
347 } | 346 } |
348 | 347 |
349 | 348 |
350 void JSGenericLowering::LowerJSStoreContext(Node* node) { | 349 void JSGenericLowering::LowerJSStoreContext(Node* node) { |
351 const ContextAccess& access = ContextAccessOf(node->op()); | 350 const ContextAccess& access = ContextAccessOf(node->op()); |
352 // TODO(mstarzinger): Use simplified operators instead of machine operators | |
353 // here so that load/store optimization can be applied afterwards. | |
354 for (size_t i = 0; i < access.depth(); ++i) { | 351 for (size_t i = 0; i < access.depth(); ++i) { |
355 node->ReplaceInput( | 352 node->ReplaceInput( |
356 0, graph()->NewNode( | 353 0, graph()->NewNode( |
357 machine()->Load(kMachAnyTagged), | 354 machine()->Load(kMachAnyTagged), |
358 NodeProperties::GetValueInput(node, 0), | 355 NodeProperties::GetValueInput(node, 0), |
359 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), | 356 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
360 NodeProperties::GetEffectInput(node))); | 357 NodeProperties::GetEffectInput(node), graph()->start())); |
361 } | 358 } |
362 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 359 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
363 node->ReplaceInput( | 360 node->ReplaceInput( |
364 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index())))); | 361 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index())))); |
365 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, | 362 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, |
366 kFullWriteBarrier))); | 363 kFullWriteBarrier))); |
367 } | 364 } |
368 | 365 |
369 | 366 |
370 void JSGenericLowering::LowerJSCallConstruct(Node* node) { | 367 void JSGenericLowering::LowerJSCallConstruct(Node* node) { |
(...skipping 25 matching lines...) Expand all Loading... |
396 | 393 |
397 | 394 |
398 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 395 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
399 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 396 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
400 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 397 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
401 } | 398 } |
402 | 399 |
403 } // namespace compiler | 400 } // namespace compiler |
404 } // namespace internal | 401 } // namespace internal |
405 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |