| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 337 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
| 338 if (p.slot_index() >= 0) { | 338 if (p.slot_index() >= 0) { |
| 339 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0); | 339 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0); |
| 340 Node* script_context = node->InputAt(0); | 340 Node* script_context = node->InputAt(0); |
| 341 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); | 341 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); |
| 342 node->ReplaceInput(1, jsgraph()->HeapConstant(p.name())); | 342 node->ReplaceInput(1, script_context); // Set new context... |
| 343 node->ReplaceInput(2, script_context); // Set new context... | 343 node->RemoveInput(2); |
| 344 node->RemoveInput(3); // ...instead of old one. | 344 node->RemoveInput(2); // ...instead of old one. |
| 345 ReplaceWithStubCall(node, callable, flags); | 345 ReplaceWithStubCall(node, callable, flags); |
| 346 | 346 |
| 347 } else { | 347 } else { |
| 348 Callable callable = CodeFactory::LoadICInOptimizedCode( | 348 Callable callable = CodeFactory::LoadICInOptimizedCode( |
| 349 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); | 349 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); |
| 350 node->RemoveInput(0); // script context | 350 node->RemoveInput(0); // script context |
| 351 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 351 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 352 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 352 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
| 353 ReplaceWithStubCall(node, callable, flags); | 353 ReplaceWithStubCall(node, callable, flags); |
| 354 } | 354 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 396 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
| 397 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 397 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 398 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 398 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
| 399 if (p.slot_index() >= 0) { | 399 if (p.slot_index() >= 0) { |
| 400 Callable callable = | 400 Callable callable = |
| 401 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode()); | 401 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode()); |
| 402 Node* script_context = node->InputAt(0); | 402 Node* script_context = node->InputAt(0); |
| 403 Node* value = node->InputAt(2); | 403 Node* value = node->InputAt(2); |
| 404 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); | 404 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); |
| 405 node->ReplaceInput(1, jsgraph()->HeapConstant(p.name())); | 405 node->ReplaceInput(1, value); |
| 406 node->ReplaceInput(2, value); | 406 node->ReplaceInput(2, script_context); // Set new context... |
| 407 node->ReplaceInput(3, script_context); // Set new context... | 407 node->RemoveInput(3); |
| 408 node->RemoveInput(4); // ...instead of old one. | 408 node->RemoveInput(3); // ...instead of old one. |
| 409 ReplaceWithStubCall(node, callable, flags); | 409 ReplaceWithStubCall(node, callable, flags); |
| 410 | 410 |
| 411 } else { | 411 } else { |
| 412 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode()); | 412 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode()); |
| 413 node->RemoveInput(0); // script context | 413 node->RemoveInput(0); // script context |
| 414 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 414 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 415 if (FLAG_vector_stores) { | 415 if (FLAG_vector_stores) { |
| 416 DCHECK(p.feedback().index() != -1); | 416 DCHECK(p.feedback().index() != -1); |
| 417 node->InsertInput(zone(), 3, | 417 node->InsertInput(zone(), 3, |
| 418 jsgraph()->SmiConstant(p.feedback().index())); | 418 jsgraph()->SmiConstant(p.feedback().index())); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 845 } |
| 846 | 846 |
| 847 | 847 |
| 848 MachineOperatorBuilder* JSGenericLowering::machine() const { | 848 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 849 return jsgraph()->machine(); | 849 return jsgraph()->machine(); |
| 850 } | 850 } |
| 851 | 851 |
| 852 } // namespace compiler | 852 } // namespace compiler |
| 853 } // namespace internal | 853 } // namespace internal |
| 854 } // namespace v8 | 854 } // namespace v8 |
| OLD | NEW |