| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 Node* name = __ LoadConstantPoolEntry(constant_index); | 256 Node* name = __ LoadConstantPoolEntry(constant_index); |
| 257 Node* raw_slot = __ BytecodeOperandIdx(1); | 257 Node* raw_slot = __ BytecodeOperandIdx(1); |
| 258 Node* smi_slot = __ SmiTag(raw_slot); | 258 Node* smi_slot = __ SmiTag(raw_slot); |
| 259 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 259 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 260 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, | 260 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, |
| 261 name, smi_slot, type_feedback_vector); | 261 name, smi_slot, type_feedback_vector); |
| 262 __ SetAccumulator(result); | 262 __ SetAccumulator(result); |
| 263 __ Dispatch(); | 263 __ Dispatch(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 // LdaGlobal <name_index> <slot> |
| 267 // LdaGlobalSloppy <name_index> <slot> | |
| 268 // | 267 // |
| 269 // Load the global with name in constant pool entry <name_index> into the | 268 // Load the global with name in constant pool entry <name_index> into the |
| 270 // accumulator using FeedBackVector slot <slot> in sloppy mode. | 269 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
| 271 void Interpreter::DoLdaGlobalSloppy(InterpreterAssembler* assembler) { | 270 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| 272 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 271 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 273 SLOPPY, UNINITIALIZED); | 272 UNINITIALIZED); |
| 273 DoLoadGlobal(ic, assembler); |
| 274 } |
| 275 |
| 276 // LdaGlobalInsideTypeof <name_index> <slot> |
| 277 // |
| 278 // Load the global with name in constant pool entry <name_index> into the |
| 279 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
| 280 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
| 281 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, |
| 282 UNINITIALIZED); |
| 283 DoLoadGlobal(ic, assembler); |
| 284 } |
| 285 |
| 286 // LdaGlobalWide <name_index> <slot> |
| 287 // |
| 288 // Load the global with name in constant pool entry <name_index> into the |
| 289 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
| 290 void Interpreter::DoLdaGlobalWide(InterpreterAssembler* assembler) { |
| 291 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 292 UNINITIALIZED); |
| 293 DoLoadGlobal(ic, assembler); |
| 294 } |
| 295 |
| 296 // LdaGlobalInsideTypeofWide <name_index> <slot> |
| 297 // |
| 298 // Load the global with name in constant pool entry <name_index> into the |
| 299 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
| 300 void Interpreter::DoLdaGlobalInsideTypeofWide(InterpreterAssembler* assembler) { |
| 301 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, |
| 302 UNINITIALIZED); |
| 274 DoLoadGlobal(ic, assembler); | 303 DoLoadGlobal(ic, assembler); |
| 275 } | 304 } |
| 276 | 305 |
| 277 | 306 |
| 278 // LdaGlobalSloppy <name_index> <slot> | |
| 279 // | |
| 280 // Load the global with name in constant pool entry <name_index> into the | |
| 281 // accumulator using FeedBackVector slot <slot> in strict mode. | |
| 282 void Interpreter::DoLdaGlobalStrict(InterpreterAssembler* assembler) { | |
| 283 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 284 STRICT, UNINITIALIZED); | |
| 285 DoLoadGlobal(ic, assembler); | |
| 286 } | |
| 287 | |
| 288 | |
| 289 // LdaGlobalInsideTypeofSloppy <name_index> <slot> | |
| 290 // | |
| 291 // Load the global with name in constant pool entry <name_index> into the | |
| 292 // accumulator using FeedBackVector slot <slot> in sloppy mode. | |
| 293 void Interpreter::DoLdaGlobalInsideTypeofSloppy( | |
| 294 InterpreterAssembler* assembler) { | |
| 295 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | |
| 296 SLOPPY, UNINITIALIZED); | |
| 297 DoLoadGlobal(ic, assembler); | |
| 298 } | |
| 299 | |
| 300 | |
| 301 // LdaGlobalInsideTypeofStrict <name_index> <slot> | |
| 302 // | |
| 303 // Load the global with name in constant pool entry <name_index> into the | |
| 304 // accumulator using FeedBackVector slot <slot> in strict mode. | |
| 305 void Interpreter::DoLdaGlobalInsideTypeofStrict( | |
| 306 InterpreterAssembler* assembler) { | |
| 307 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | |
| 308 STRICT, UNINITIALIZED); | |
| 309 DoLoadGlobal(ic, assembler); | |
| 310 } | |
| 311 | |
| 312 | |
| 313 // LdaGlobalSloppyWide <name_index> <slot> | |
| 314 // | |
| 315 // Load the global with name in constant pool entry <name_index> into the | |
| 316 // accumulator using FeedBackVector slot <slot> in sloppy mode. | |
| 317 void Interpreter::DoLdaGlobalSloppyWide(InterpreterAssembler* assembler) { | |
| 318 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 319 SLOPPY, UNINITIALIZED); | |
| 320 DoLoadGlobal(ic, assembler); | |
| 321 } | |
| 322 | |
| 323 | |
| 324 // LdaGlobalSloppyWide <name_index> <slot> | |
| 325 // | |
| 326 // Load the global with name in constant pool entry <name_index> into the | |
| 327 // accumulator using FeedBackVector slot <slot> in strict mode. | |
| 328 void Interpreter::DoLdaGlobalStrictWide(InterpreterAssembler* assembler) { | |
| 329 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 330 STRICT, UNINITIALIZED); | |
| 331 DoLoadGlobal(ic, assembler); | |
| 332 } | |
| 333 | |
| 334 | |
| 335 // LdaGlobalInsideTypeofSloppyWide <name_index> <slot> | |
| 336 // | |
| 337 // Load the global with name in constant pool entry <name_index> into the | |
| 338 // accumulator using FeedBackVector slot <slot> in sloppy mode. | |
| 339 void Interpreter::DoLdaGlobalInsideTypeofSloppyWide( | |
| 340 InterpreterAssembler* assembler) { | |
| 341 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | |
| 342 SLOPPY, UNINITIALIZED); | |
| 343 DoLoadGlobal(ic, assembler); | |
| 344 } | |
| 345 | |
| 346 | |
| 347 // LdaGlobalInsideTypeofSloppyWide <name_index> <slot> | |
| 348 // | |
| 349 // Load the global with name in constant pool entry <name_index> into the | |
| 350 // accumulator using FeedBackVector slot <slot> in strict mode. | |
| 351 void Interpreter::DoLdaGlobalInsideTypeofStrictWide( | |
| 352 InterpreterAssembler* assembler) { | |
| 353 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | |
| 354 STRICT, UNINITIALIZED); | |
| 355 DoLoadGlobal(ic, assembler); | |
| 356 } | |
| 357 | |
| 358 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { | 307 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { |
| 359 // Get the global object. | 308 // Get the global object. |
| 360 Node* context = __ GetContext(); | 309 Node* context = __ GetContext(); |
| 361 Node* native_context = | 310 Node* native_context = |
| 362 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 311 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); |
| 363 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | 312 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); |
| 364 | 313 |
| 365 // Store the global via the StoreIC. | 314 // Store the global via the StoreIC. |
| 366 Node* code_target = __ HeapConstant(ic.code()); | 315 Node* code_target = __ HeapConstant(ic.code()); |
| 367 Node* constant_index = __ BytecodeOperandIdx(0); | 316 Node* constant_index = __ BytecodeOperandIdx(0); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 Node* raw_slot = __ BytecodeOperandIdx(2); | 517 Node* raw_slot = __ BytecodeOperandIdx(2); |
| 569 Node* smi_slot = __ SmiTag(raw_slot); | 518 Node* smi_slot = __ SmiTag(raw_slot); |
| 570 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 519 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 571 Node* context = __ GetContext(); | 520 Node* context = __ GetContext(); |
| 572 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, | 521 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, |
| 573 name, smi_slot, type_feedback_vector); | 522 name, smi_slot, type_feedback_vector); |
| 574 __ SetAccumulator(result); | 523 __ SetAccumulator(result); |
| 575 __ Dispatch(); | 524 __ Dispatch(); |
| 576 } | 525 } |
| 577 | 526 |
| 527 // LoadIC <object> <name_index> <slot> |
| 528 // |
| 529 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
| 530 // constant pool entry <name_index>. |
| 531 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { |
| 532 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 533 UNINITIALIZED); |
| 534 DoLoadIC(ic, assembler); |
| 535 } |
| 578 | 536 |
| 579 // LoadICSloppy <object> <name_index> <slot> | 537 // LoadICWide <object> <name_index> <slot> |
| 580 // | 538 // |
| 581 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and | 539 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
| 582 // the name at constant pool entry <name_index>. | 540 // constant pool entry <name_index>. |
| 583 void Interpreter::DoLoadICSloppy(InterpreterAssembler* assembler) { | 541 void Interpreter::DoLoadICWide(InterpreterAssembler* assembler) { |
| 584 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 542 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 585 SLOPPY, UNINITIALIZED); | 543 UNINITIALIZED); |
| 586 DoLoadIC(ic, assembler); | 544 DoLoadIC(ic, assembler); |
| 587 } | 545 } |
| 588 | 546 |
| 589 | 547 |
| 590 // LoadICStrict <object> <name_index> <slot> | |
| 591 // | |
| 592 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and | |
| 593 // the name at constant pool entry <name_index>. | |
| 594 void Interpreter::DoLoadICStrict(InterpreterAssembler* assembler) { | |
| 595 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 596 STRICT, UNINITIALIZED); | |
| 597 DoLoadIC(ic, assembler); | |
| 598 } | |
| 599 | |
| 600 | |
| 601 // LoadICSloppyWide <object> <name_index> <slot> | |
| 602 // | |
| 603 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and | |
| 604 // the name at constant pool entry <name_index>. | |
| 605 void Interpreter::DoLoadICSloppyWide(InterpreterAssembler* assembler) { | |
| 606 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 607 SLOPPY, UNINITIALIZED); | |
| 608 DoLoadIC(ic, assembler); | |
| 609 } | |
| 610 | |
| 611 | |
| 612 // LoadICStrictWide <object> <name_index> <slot> | |
| 613 // | |
| 614 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and | |
| 615 // the name at constant pool entry <name_index>. | |
| 616 void Interpreter::DoLoadICStrictWide(InterpreterAssembler* assembler) { | |
| 617 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
| 618 STRICT, UNINITIALIZED); | |
| 619 DoLoadIC(ic, assembler); | |
| 620 } | |
| 621 | |
| 622 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { | 548 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| 623 Node* code_target = __ HeapConstant(ic.code()); | 549 Node* code_target = __ HeapConstant(ic.code()); |
| 624 Node* reg_index = __ BytecodeOperandReg(0); | 550 Node* reg_index = __ BytecodeOperandReg(0); |
| 625 Node* object = __ LoadRegister(reg_index); | 551 Node* object = __ LoadRegister(reg_index); |
| 626 Node* name = __ GetAccumulator(); | 552 Node* name = __ GetAccumulator(); |
| 627 Node* raw_slot = __ BytecodeOperandIdx(1); | 553 Node* raw_slot = __ BytecodeOperandIdx(1); |
| 628 Node* smi_slot = __ SmiTag(raw_slot); | 554 Node* smi_slot = __ SmiTag(raw_slot); |
| 629 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 555 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 630 Node* context = __ GetContext(); | 556 Node* context = __ GetContext(); |
| 631 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, | 557 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, |
| 632 name, smi_slot, type_feedback_vector); | 558 name, smi_slot, type_feedback_vector); |
| 633 __ SetAccumulator(result); | 559 __ SetAccumulator(result); |
| 634 __ Dispatch(); | 560 __ Dispatch(); |
| 635 } | 561 } |
| 636 | 562 |
| 563 // KeyedLoadIC <object> <slot> |
| 564 // |
| 565 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
| 566 // in the accumulator. |
| 567 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { |
| 568 Callable ic = |
| 569 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); |
| 570 DoKeyedLoadIC(ic, assembler); |
| 571 } |
| 637 | 572 |
| 638 // KeyedLoadICSloppy <object> <slot> | 573 // KeyedLoadICWide <object> <slot> |
| 639 // | 574 // |
| 640 // Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | 575 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
| 641 // and the key in the accumulator. | 576 // in the accumulator. |
| 642 void Interpreter::DoKeyedLoadICSloppy(InterpreterAssembler* assembler) { | 577 void Interpreter::DoKeyedLoadICWide(InterpreterAssembler* assembler) { |
| 643 Callable ic = | 578 Callable ic = |
| 644 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 579 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); |
| 645 DoKeyedLoadIC(ic, assembler); | 580 DoKeyedLoadIC(ic, assembler); |
| 646 } | 581 } |
| 647 | 582 |
| 648 | 583 |
| 649 // KeyedLoadICStrict <object> <slot> | |
| 650 // | |
| 651 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | |
| 652 // and the key in the accumulator. | |
| 653 void Interpreter::DoKeyedLoadICStrict(InterpreterAssembler* assembler) { | |
| 654 Callable ic = | |
| 655 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | |
| 656 DoKeyedLoadIC(ic, assembler); | |
| 657 } | |
| 658 | |
| 659 | |
| 660 // KeyedLoadICSloppyWide <object> <slot> | |
| 661 // | |
| 662 // Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | |
| 663 // and the key in the accumulator. | |
| 664 void Interpreter::DoKeyedLoadICSloppyWide(InterpreterAssembler* assembler) { | |
| 665 Callable ic = | |
| 666 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | |
| 667 DoKeyedLoadIC(ic, assembler); | |
| 668 } | |
| 669 | |
| 670 | |
| 671 // KeyedLoadICStrictWide <object> <slot> | |
| 672 // | |
| 673 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | |
| 674 // and the key in the accumulator. | |
| 675 void Interpreter::DoKeyedLoadICStrictWide(InterpreterAssembler* assembler) { | |
| 676 Callable ic = | |
| 677 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | |
| 678 DoKeyedLoadIC(ic, assembler); | |
| 679 } | |
| 680 | |
| 681 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { | 584 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
| 682 Node* code_target = __ HeapConstant(ic.code()); | 585 Node* code_target = __ HeapConstant(ic.code()); |
| 683 Node* object_reg_index = __ BytecodeOperandReg(0); | 586 Node* object_reg_index = __ BytecodeOperandReg(0); |
| 684 Node* object = __ LoadRegister(object_reg_index); | 587 Node* object = __ LoadRegister(object_reg_index); |
| 685 Node* constant_index = __ BytecodeOperandIdx(1); | 588 Node* constant_index = __ BytecodeOperandIdx(1); |
| 686 Node* name = __ LoadConstantPoolEntry(constant_index); | 589 Node* name = __ LoadConstantPoolEntry(constant_index); |
| 687 Node* value = __ GetAccumulator(); | 590 Node* value = __ GetAccumulator(); |
| 688 Node* raw_slot = __ BytecodeOperandIdx(2); | 591 Node* raw_slot = __ BytecodeOperandIdx(2); |
| 689 Node* smi_slot = __ SmiTag(raw_slot); | 592 Node* smi_slot = __ SmiTag(raw_slot); |
| 690 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 593 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 Node* index = __ LoadRegister(index_reg); | 1793 Node* index = __ LoadRegister(index_reg); |
| 1891 Node* context = __ GetContext(); | 1794 Node* context = __ GetContext(); |
| 1892 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1795 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
| 1893 __ SetAccumulator(result); | 1796 __ SetAccumulator(result); |
| 1894 __ Dispatch(); | 1797 __ Dispatch(); |
| 1895 } | 1798 } |
| 1896 | 1799 |
| 1897 } // namespace interpreter | 1800 } // namespace interpreter |
| 1898 } // namespace internal | 1801 } // namespace internal |
| 1899 } // namespace v8 | 1802 } // namespace v8 |
| OLD | NEW |