| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 Callable callable = CodeFactory::LoadICInOptimizedCode( | 327 Callable callable = CodeFactory::LoadICInOptimizedCode( |
| 328 isolate(), p.contextual_mode(), p.language_mode(), UNINITIALIZED); | 328 isolate(), p.contextual_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 LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
| 338 Callable callable = CodeFactory::LoadICInOptimizedCode( | 338 if (p.slot_index() >= 0) { |
| 339 isolate(), p.contextual_mode(), SLOPPY, UNINITIALIZED); | 339 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0); |
| 340 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 340 Node* script_context = node->InputAt(0); |
| 341 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 341 node->ReplaceInput(0, jsgraph()->SmiConstant(0)); |
| 342 ReplaceWithStubCall(node, callable, flags); | 342 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index())); |
| 343 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name())); |
| 344 node->ReplaceInput(3, script_context); // Replace old context. |
| 345 ReplaceWithStubCall(node, callable, flags); |
| 346 |
| 347 } else { |
| 348 Callable callable = CodeFactory::LoadICInOptimizedCode( |
| 349 isolate(), p.contextual_mode(), SLOPPY, UNINITIALIZED); |
| 350 node->RemoveInput(0); // script context |
| 351 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 352 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
| 353 ReplaceWithStubCall(node, callable, flags); |
| 354 } |
| 343 } | 355 } |
| 344 | 356 |
| 345 | 357 |
| 346 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 358 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
| 347 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 359 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 348 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); | 360 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); |
| 349 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 361 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
| 350 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 362 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
| 351 isolate(), language_mode, UNINITIALIZED); | 363 isolate(), language_mode, UNINITIALIZED); |
| 352 if (FLAG_vector_stores) { | 364 if (FLAG_vector_stores) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 372 } else { | 384 } else { |
| 373 node->RemoveInput(3); | 385 node->RemoveInput(3); |
| 374 } | 386 } |
| 375 ReplaceWithStubCall(node, callable, | 387 ReplaceWithStubCall(node, callable, |
| 376 CallDescriptor::kPatchableCallSite | flags); | 388 CallDescriptor::kPatchableCallSite | flags); |
| 377 } | 389 } |
| 378 | 390 |
| 379 | 391 |
| 380 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 392 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
| 381 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 393 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 382 const StoreNamedParameters& p = StoreGlobalParametersOf(node->op()); | 394 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
| 383 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode()); | 395 if (p.slot_index() >= 0) { |
| 384 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 396 Callable callable = |
| 385 if (FLAG_vector_stores) { | 397 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode()); |
| 386 DCHECK(p.feedback().index() != -1); | 398 Node* script_context = node->InputAt(0); |
| 387 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 399 Node* value = node->InputAt(2); |
| 400 node->ReplaceInput(0, jsgraph()->SmiConstant(0)); |
| 401 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index())); |
| 402 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name())); |
| 403 node->ReplaceInput(3, value); |
| 404 node->ReplaceInput(4, script_context); // Replace old context. |
| 405 ReplaceWithStubCall(node, callable, flags); |
| 406 |
| 388 } else { | 407 } else { |
| 389 node->RemoveInput(3); | 408 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode()); |
| 409 node->RemoveInput(0); // script context |
| 410 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 411 if (FLAG_vector_stores) { |
| 412 DCHECK(p.feedback().index() != -1); |
| 413 node->InsertInput(zone(), 3, |
| 414 jsgraph()->SmiConstant(p.feedback().index())); |
| 415 } else { |
| 416 node->RemoveInput(3); |
| 417 } |
| 418 ReplaceWithStubCall(node, callable, |
| 419 CallDescriptor::kPatchableCallSite | flags); |
| 390 } | 420 } |
| 391 ReplaceWithStubCall(node, callable, | |
| 392 CallDescriptor::kPatchableCallSite | flags); | |
| 393 } | 421 } |
| 394 | 422 |
| 395 | 423 |
| 396 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 424 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
| 397 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 425 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
| 398 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); | 426 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); |
| 399 node->InsertInput(zone(), 4, jsgraph()->SmiConstant(language_mode)); | 427 node->InsertInput(zone(), 4, jsgraph()->SmiConstant(language_mode)); |
| 400 } | 428 } |
| 401 | 429 |
| 402 | 430 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 837 } |
| 810 | 838 |
| 811 | 839 |
| 812 MachineOperatorBuilder* JSGenericLowering::machine() const { | 840 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 813 return jsgraph()->machine(); | 841 return jsgraph()->machine(); |
| 814 } | 842 } |
| 815 | 843 |
| 816 } // namespace compiler | 844 } // namespace compiler |
| 817 } // namespace internal | 845 } // namespace internal |
| 818 } // namespace v8 | 846 } // namespace v8 |
| OLD | NEW |