| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 | 308 |
| 309 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 309 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
| 310 Node* context = NodeProperties::GetContextInput(node); | 310 Node* context = NodeProperties::GetContextInput(node); |
| 311 Node* effect = NodeProperties::GetEffectInput(node); | 311 Node* effect = NodeProperties::GetEffectInput(node); |
| 312 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 312 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 313 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 313 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
| 314 Callable callable = CodeFactory::LoadICInOptimizedCode( | 314 Callable callable = CodeFactory::LoadICInOptimizedCode( |
| 315 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); | 315 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); |
| 316 // Load global object from the context. | 316 // Load global object from the context. |
| 317 Node* native_context = | 317 Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context, |
| 318 graph()->NewNode(machine()->Load(kMachAnyTagged), context, | 318 jsgraph()->IntPtrConstant(Context::SlotOffset( |
| 319 jsgraph()->IntPtrConstant( | 319 Context::GLOBAL_OBJECT_INDEX)), |
| 320 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | 320 effect, graph()->start()); |
| 321 effect, graph()->start()); | |
| 322 Node* global = graph()->NewNode( | |
| 323 machine()->Load(kMachAnyTagged), native_context, | |
| 324 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | |
| 325 effect, graph()->start()); | |
| 326 node->InsertInput(zone(), 0, global); | 321 node->InsertInput(zone(), 0, global); |
| 327 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 322 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 328 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 323 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
| 329 ReplaceWithStubCall(node, callable, flags); | 324 ReplaceWithStubCall(node, callable, flags); |
| 330 } | 325 } |
| 331 | 326 |
| 332 | 327 |
| 333 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 328 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
| 334 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 329 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 335 PropertyAccess const& p = PropertyAccessOf(node->op()); | 330 PropertyAccess const& p = PropertyAccessOf(node->op()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 357 | 352 |
| 358 | 353 |
| 359 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 354 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
| 360 Node* context = NodeProperties::GetContextInput(node); | 355 Node* context = NodeProperties::GetContextInput(node); |
| 361 Node* effect = NodeProperties::GetEffectInput(node); | 356 Node* effect = NodeProperties::GetEffectInput(node); |
| 362 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 357 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 363 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 358 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
| 364 Callable callable = CodeFactory::StoreICInOptimizedCode( | 359 Callable callable = CodeFactory::StoreICInOptimizedCode( |
| 365 isolate(), p.language_mode(), UNINITIALIZED); | 360 isolate(), p.language_mode(), UNINITIALIZED); |
| 366 // Load global object from the context. | 361 // Load global object from the context. |
| 367 Node* native_context = | 362 Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context, |
| 368 graph()->NewNode(machine()->Load(kMachAnyTagged), context, | 363 jsgraph()->IntPtrConstant(Context::SlotOffset( |
| 369 jsgraph()->IntPtrConstant( | 364 Context::GLOBAL_OBJECT_INDEX)), |
| 370 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | 365 effect, graph()->start()); |
| 371 effect, graph()->start()); | |
| 372 Node* global = graph()->NewNode( | |
| 373 machine()->Load(kMachAnyTagged), native_context, | |
| 374 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | |
| 375 effect, graph()->start()); | |
| 376 node->InsertInput(zone(), 0, global); | 366 node->InsertInput(zone(), 0, global); |
| 377 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 367 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 378 DCHECK(p.feedback().index() != -1); | 368 DCHECK(p.feedback().index() != -1); |
| 379 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 369 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
| 380 ReplaceWithStubCall(node, callable, | 370 ReplaceWithStubCall(node, callable, |
| 381 CallDescriptor::kPatchableCallSite | flags); | 371 CallDescriptor::kPatchableCallSite | flags); |
| 382 } | 372 } |
| 383 | 373 |
| 384 | 374 |
| 385 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 375 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 graph()->start())); | 422 graph()->start())); |
| 433 } | 423 } |
| 434 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 424 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
| 435 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | 425 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( |
| 436 static_cast<int>(access.index())))); | 426 static_cast<int>(access.index())))); |
| 437 NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation( | 427 NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation( |
| 438 kMachAnyTagged, kFullWriteBarrier))); | 428 kMachAnyTagged, kFullWriteBarrier))); |
| 439 } | 429 } |
| 440 | 430 |
| 441 | 431 |
| 432 void JSGenericLowering::LowerJSLoadNativeContext(Node* node) { |
| 433 node->ReplaceInput( |
| 434 1, jsgraph()->IntPtrConstant(JSGlobalObject::kNativeContextOffset - |
| 435 kHeapObjectTag)); |
| 436 node->AppendInput(zone(), graph()->start()); |
| 437 NodeProperties::ChangeOp(node, machine()->Load(kMachAnyTagged)); |
| 438 } |
| 439 |
| 440 |
| 442 void JSGenericLowering::LowerJSLoadDynamic(Node* node) { | 441 void JSGenericLowering::LowerJSLoadDynamic(Node* node) { |
| 443 const DynamicAccess& access = DynamicAccessOf(node->op()); | 442 const DynamicAccess& access = DynamicAccessOf(node->op()); |
| 444 Runtime::FunctionId function_id = | 443 Runtime::FunctionId function_id = |
| 445 (access.typeof_mode() == NOT_INSIDE_TYPEOF) | 444 (access.typeof_mode() == NOT_INSIDE_TYPEOF) |
| 446 ? Runtime::kLoadLookupSlot | 445 ? Runtime::kLoadLookupSlot |
| 447 : Runtime::kLoadLookupSlotNoReferenceError; | 446 : Runtime::kLoadLookupSlotNoReferenceError; |
| 448 Node* projection = graph()->NewNode(common()->Projection(0), node); | 447 Node* projection = graph()->NewNode(common()->Projection(0), node); |
| 449 NodeProperties::ReplaceUses(node, projection, node, node, node); | 448 NodeProperties::ReplaceUses(node, projection, node, node, node); |
| 450 node->RemoveInput(NodeProperties::FirstValueIndex(node)); | 449 node->RemoveInput(NodeProperties::FirstValueIndex(node)); |
| 451 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); | 450 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 } | 889 } |
| 891 | 890 |
| 892 | 891 |
| 893 MachineOperatorBuilder* JSGenericLowering::machine() const { | 892 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 894 return jsgraph()->machine(); | 893 return jsgraph()->machine(); |
| 895 } | 894 } |
| 896 | 895 |
| 897 } // namespace compiler | 896 } // namespace compiler |
| 898 } // namespace internal | 897 } // namespace internal |
| 899 } // namespace v8 | 898 } // namespace v8 |
| OLD | NEW |