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