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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 isolate(), p.language_mode(), UNINITIALIZED); | 318 isolate(), p.language_mode(), UNINITIALIZED); |
319 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 319 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
320 ReplaceWithStubCall(node, callable, flags); | 320 ReplaceWithStubCall(node, callable, flags); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void JSGenericLowering::LowerJSLoadNamed(Node* node) { | 324 void JSGenericLowering::LowerJSLoadNamed(Node* node) { |
325 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 325 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
326 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); | 326 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); |
327 Callable callable = CodeFactory::LoadICInOptimizedCode( | 327 Callable callable = CodeFactory::LoadICInOptimizedCode( |
328 isolate(), p.contextual_mode(), p.language_mode(), UNINITIALIZED); | 328 isolate(), p.typeof_mode(), p.language_mode(), UNINITIALIZED); |
329 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 329 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
330 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 330 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
331 ReplaceWithStubCall(node, callable, flags); | 331 ReplaceWithStubCall(node, callable, flags); |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 335 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
336 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 336 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
337 const LoadNamedParameters& p = LoadGlobalParametersOf(node->op()); | 337 const LoadNamedParameters& p = LoadGlobalParametersOf(node->op()); |
338 Callable callable = CodeFactory::LoadICInOptimizedCode( | 338 Callable callable = CodeFactory::LoadICInOptimizedCode( |
339 isolate(), p.contextual_mode(), SLOPPY, UNINITIALIZED); | 339 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); |
340 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 340 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
341 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 341 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
342 ReplaceWithStubCall(node, callable, flags); | 342 ReplaceWithStubCall(node, callable, flags); |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 346 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
347 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 347 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
348 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); | 348 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); |
349 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 349 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | 448 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( |
449 static_cast<int>(access.index())))); | 449 static_cast<int>(access.index())))); |
450 node->set_op( | 450 node->set_op( |
451 machine()->Store(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier))); | 451 machine()->Store(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier))); |
452 } | 452 } |
453 | 453 |
454 | 454 |
455 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) { | 455 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) { |
456 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op()); | 456 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op()); |
457 Runtime::FunctionId function_id = | 457 Runtime::FunctionId function_id = |
458 (access.mode() == CONTEXTUAL) ? Runtime::kLoadLookupSlot | 458 (access.typeof_mode() == NOT_INSIDE_TYPEOF) |
459 : Runtime::kLoadLookupSlotNoReferenceError; | 459 ? Runtime::kLoadLookupSlot |
| 460 : Runtime::kLoadLookupSlotNoReferenceError; |
460 Node* projection = graph()->NewNode(common()->Projection(0), node); | 461 Node* projection = graph()->NewNode(common()->Projection(0), node); |
461 NodeProperties::ReplaceUses(node, projection, node, node, node); | 462 NodeProperties::ReplaceUses(node, projection, node, node, node); |
462 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); | 463 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
463 node->RemoveInput(NodeProperties::FirstValueIndex(node)); | 464 node->RemoveInput(NodeProperties::FirstValueIndex(node)); |
464 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); | 465 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); |
465 ReplaceWithRuntimeCall(node, function_id); | 466 ReplaceWithRuntimeCall(node, function_id); |
466 projection->ReplaceInput(0, node); | 467 projection->ReplaceInput(0, node); |
467 } | 468 } |
468 | 469 |
469 | 470 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 810 } |
810 | 811 |
811 | 812 |
812 MachineOperatorBuilder* JSGenericLowering::machine() const { | 813 MachineOperatorBuilder* JSGenericLowering::machine() const { |
813 return jsgraph()->machine(); | 814 return jsgraph()->machine(); |
814 } | 815 } |
815 | 816 |
816 } // namespace compiler | 817 } // namespace compiler |
817 } // namespace internal | 818 } // namespace internal |
818 } // namespace v8 | 819 } // namespace v8 |
OLD | NEW |