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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); | 337 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); |
338 } | 338 } |
339 | 339 |
340 | 340 |
341 void JSGenericLowering::LowerJSLoadProperty(Node* node) { | 341 void JSGenericLowering::LowerJSLoadProperty(Node* node) { |
342 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 342 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
343 const LoadPropertyParameters& p = LoadPropertyParametersOf(node->op()); | 343 const LoadPropertyParameters& p = LoadPropertyParametersOf(node->op()); |
344 Callable callable = | 344 Callable callable = |
345 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); | 345 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); |
346 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 346 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
347 node->InsertInput(zone(), 3, jsgraph()->HeapConstant(p.feedback().vector())); | 347 ReplaceWithStubCall(node, callable, flags); |
348 ReplaceWithStubCall(node, callable, | |
349 CallDescriptor::kPatchableCallSite | flags); | |
350 } | 348 } |
351 | 349 |
352 | 350 |
353 void JSGenericLowering::LowerJSLoadNamed(Node* node) { | 351 void JSGenericLowering::LowerJSLoadNamed(Node* node) { |
354 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 352 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
355 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); | 353 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); |
356 Callable callable = CodeFactory::LoadICInOptimizedCode( | 354 Callable callable = CodeFactory::LoadICInOptimizedCode( |
357 isolate(), p.contextual_mode(), UNINITIALIZED); | 355 isolate(), p.contextual_mode(), UNINITIALIZED); |
358 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 356 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
359 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 357 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
360 node->InsertInput(zone(), 3, jsgraph()->HeapConstant(p.feedback().vector())); | 358 ReplaceWithStubCall(node, callable, flags); |
361 ReplaceWithStubCall(node, callable, | |
362 CallDescriptor::kPatchableCallSite | flags); | |
363 } | 359 } |
364 | 360 |
365 | 361 |
366 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 362 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
367 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 363 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
368 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 364 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
369 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 365 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
370 isolate(), language_mode, UNINITIALIZED); | 366 isolate(), language_mode, UNINITIALIZED); |
371 ReplaceWithStubCall(node, callable, | 367 ReplaceWithStubCall(node, callable, |
372 CallDescriptor::kPatchableCallSite | flags); | 368 CallDescriptor::kPatchableCallSite | flags); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 444 |
449 | 445 |
450 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) { | 446 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) { |
451 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op()); | 447 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op()); |
452 Runtime::FunctionId function_id = | 448 Runtime::FunctionId function_id = |
453 (access.mode() == CONTEXTUAL) ? Runtime::kLoadLookupSlot | 449 (access.mode() == CONTEXTUAL) ? Runtime::kLoadLookupSlot |
454 : Runtime::kLoadLookupSlotNoReferenceError; | 450 : Runtime::kLoadLookupSlotNoReferenceError; |
455 Node* projection = graph()->NewNode(common()->Projection(0), node); | 451 Node* projection = graph()->NewNode(common()->Projection(0), node); |
456 NodeProperties::ReplaceWithValue(node, projection, node, node); | 452 NodeProperties::ReplaceWithValue(node, projection, node, node); |
457 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); | 453 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
| 454 node->RemoveInput(NodeProperties::FirstValueIndex(node)); |
458 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); | 455 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); |
459 ReplaceWithRuntimeCall(node, function_id); | 456 ReplaceWithRuntimeCall(node, function_id); |
460 projection->ReplaceInput(0, node); | 457 projection->ReplaceInput(0, node); |
461 } | 458 } |
462 | 459 |
463 | 460 |
464 void JSGenericLowering::LowerJSLoadDynamicContext(Node* node) { | 461 void JSGenericLowering::LowerJSLoadDynamicContext(Node* node) { |
465 const DynamicContextAccess& access = DynamicContextAccessOf(node->op()); | 462 const DynamicContextAccess& access = DynamicContextAccessOf(node->op()); |
466 Node* projection = graph()->NewNode(common()->Projection(0), node); | 463 Node* projection = graph()->NewNode(common()->Projection(0), node); |
467 NodeProperties::ReplaceWithValue(node, projection, node, node); | 464 NodeProperties::ReplaceWithValue(node, projection, node, node); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 828 } |
832 | 829 |
833 | 830 |
834 MachineOperatorBuilder* JSGenericLowering::machine() const { | 831 MachineOperatorBuilder* JSGenericLowering::machine() const { |
835 return jsgraph()->machine(); | 832 return jsgraph()->machine(); |
836 } | 833 } |
837 | 834 |
838 } // namespace compiler | 835 } // namespace compiler |
839 } // namespace internal | 836 } // namespace internal |
840 } // namespace v8 | 837 } // namespace v8 |
OLD | NEW |