Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2019313003: IC: Eliminate initialization_state as a factor in IC installation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed compile error. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <fstream> 7 #include <fstream>
8 8
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 403 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
404 return __ CallStub(ic.descriptor(), code_target, context, global, name, 404 return __ CallStub(ic.descriptor(), code_target, context, global, name,
405 smi_slot, type_feedback_vector); 405 smi_slot, type_feedback_vector);
406 } 406 }
407 407
408 // LdaGlobal <name_index> <slot> 408 // LdaGlobal <name_index> <slot>
409 // 409 //
410 // Load the global with name in constant pool entry <name_index> into the 410 // Load the global with name in constant pool entry <name_index> into the
411 // accumulator using FeedBackVector slot <slot> outside of a typeof. 411 // accumulator using FeedBackVector slot <slot> outside of a typeof.
412 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { 412 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) {
413 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 413 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF);
414 UNINITIALIZED);
415 Node* result = BuildLoadGlobal(ic, assembler); 414 Node* result = BuildLoadGlobal(ic, assembler);
416 __ SetAccumulator(result); 415 __ SetAccumulator(result);
417 __ Dispatch(); 416 __ Dispatch();
418 } 417 }
419 418
420 // LdrGlobal <name_index> <slot> <reg> 419 // LdrGlobal <name_index> <slot> <reg>
421 // 420 //
422 // Load the global with name in constant pool entry <name_index> into 421 // Load the global with name in constant pool entry <name_index> into
423 // register <reg> using FeedBackVector slot <slot> outside of a typeof. 422 // register <reg> using FeedBackVector slot <slot> outside of a typeof.
424 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { 423 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) {
425 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 424 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF);
426 UNINITIALIZED);
427 Node* result = BuildLoadGlobal(ic, assembler); 425 Node* result = BuildLoadGlobal(ic, assembler);
428 Node* destination = __ BytecodeOperandReg(2); 426 Node* destination = __ BytecodeOperandReg(2);
429 __ StoreRegister(result, destination); 427 __ StoreRegister(result, destination);
430 __ Dispatch(); 428 __ Dispatch();
431 } 429 }
432 430
433 // LdaGlobalInsideTypeof <name_index> <slot> 431 // LdaGlobalInsideTypeof <name_index> <slot>
434 // 432 //
435 // Load the global with name in constant pool entry <name_index> into the 433 // Load the global with name in constant pool entry <name_index> into the
436 // accumulator using FeedBackVector slot <slot> inside of a typeof. 434 // accumulator using FeedBackVector slot <slot> inside of a typeof.
437 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { 435 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
438 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, 436 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF);
439 UNINITIALIZED);
440 Node* result = BuildLoadGlobal(ic, assembler); 437 Node* result = BuildLoadGlobal(ic, assembler);
441 __ SetAccumulator(result); 438 __ SetAccumulator(result);
442 __ Dispatch(); 439 __ Dispatch();
443 } 440 }
444 441
445 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { 442 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
446 // Get the global object. 443 // Get the global object.
447 Node* context = __ GetContext(); 444 Node* context = __ GetContext();
448 Node* native_context = 445 Node* native_context =
449 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 446 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
(...skipping 10 matching lines...) Expand all
460 __ CallStub(ic.descriptor(), code_target, context, global, name, value, 457 __ CallStub(ic.descriptor(), code_target, context, global, name, value,
461 smi_slot, type_feedback_vector); 458 smi_slot, type_feedback_vector);
462 __ Dispatch(); 459 __ Dispatch();
463 } 460 }
464 461
465 // StaGlobalSloppy <name_index> <slot> 462 // StaGlobalSloppy <name_index> <slot>
466 // 463 //
467 // Store the value in the accumulator into the global with name in constant pool 464 // Store the value in the accumulator into the global with name in constant pool
468 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. 465 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode.
469 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { 466 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) {
470 Callable ic = 467 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY);
471 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
472 DoStaGlobal(ic, assembler); 468 DoStaGlobal(ic, assembler);
473 } 469 }
474 470
475 // StaGlobalStrict <name_index> <slot> 471 // StaGlobalStrict <name_index> <slot>
476 // 472 //
477 // Store the value in the accumulator into the global with name in constant pool 473 // Store the value in the accumulator into the global with name in constant pool
478 // entry <name_index> using FeedBackVector slot <slot> in strict mode. 474 // entry <name_index> using FeedBackVector slot <slot> in strict mode.
479 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 475 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
480 Callable ic = 476 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT);
481 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
482 DoStaGlobal(ic, assembler); 477 DoStaGlobal(ic, assembler);
483 } 478 }
484 479
485 compiler::Node* Interpreter::BuildLoadContextSlot( 480 compiler::Node* Interpreter::BuildLoadContextSlot(
486 InterpreterAssembler* assembler) { 481 InterpreterAssembler* assembler) {
487 Node* reg_index = __ BytecodeOperandReg(0); 482 Node* reg_index = __ BytecodeOperandReg(0);
488 Node* context = __ LoadRegister(reg_index); 483 Node* context = __ LoadRegister(reg_index);
489 Node* slot_index = __ BytecodeOperandIdx(1); 484 Node* slot_index = __ BytecodeOperandIdx(1);
490 return __ LoadContextSlot(context, slot_index); 485 return __ LoadContextSlot(context, slot_index);
491 } 486 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 Node* context = __ GetContext(); 585 Node* context = __ GetContext();
591 return __ CallStub(ic.descriptor(), code_target, context, object, name, 586 return __ CallStub(ic.descriptor(), code_target, context, object, name,
592 smi_slot, type_feedback_vector); 587 smi_slot, type_feedback_vector);
593 } 588 }
594 589
595 // LdaNamedProperty <object> <name_index> <slot> 590 // LdaNamedProperty <object> <name_index> <slot>
596 // 591 //
597 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at 592 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
598 // constant pool entry <name_index>. 593 // constant pool entry <name_index>.
599 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { 594 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
600 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 595 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF);
601 UNINITIALIZED);
602 Node* result = BuildLoadNamedProperty(ic, assembler); 596 Node* result = BuildLoadNamedProperty(ic, assembler);
603 __ SetAccumulator(result); 597 __ SetAccumulator(result);
604 __ Dispatch(); 598 __ Dispatch();
605 } 599 }
606 600
607 // LdrNamedProperty <object> <name_index> <slot> <reg> 601 // LdrNamedProperty <object> <name_index> <slot> <reg>
608 // 602 //
609 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at 603 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
610 // constant pool entry <name_index> and puts the result into register <reg>. 604 // constant pool entry <name_index> and puts the result into register <reg>.
611 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { 605 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
612 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 606 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF);
613 UNINITIALIZED);
614 Node* result = BuildLoadNamedProperty(ic, assembler); 607 Node* result = BuildLoadNamedProperty(ic, assembler);
615 Node* destination = __ BytecodeOperandReg(3); 608 Node* destination = __ BytecodeOperandReg(3);
616 __ StoreRegister(result, destination); 609 __ StoreRegister(result, destination);
617 __ Dispatch(); 610 __ Dispatch();
618 } 611 }
619 612
620 Node* Interpreter::BuildLoadKeyedProperty(Callable ic, 613 Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
621 InterpreterAssembler* assembler) { 614 InterpreterAssembler* assembler) {
622 Node* code_target = __ HeapConstant(ic.code()); 615 Node* code_target = __ HeapConstant(ic.code());
623 Node* reg_index = __ BytecodeOperandReg(0); 616 Node* reg_index = __ BytecodeOperandReg(0);
624 Node* object = __ LoadRegister(reg_index); 617 Node* object = __ LoadRegister(reg_index);
625 Node* name = __ GetAccumulator(); 618 Node* name = __ GetAccumulator();
626 Node* raw_slot = __ BytecodeOperandIdx(1); 619 Node* raw_slot = __ BytecodeOperandIdx(1);
627 Node* smi_slot = __ SmiTag(raw_slot); 620 Node* smi_slot = __ SmiTag(raw_slot);
628 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 621 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
629 Node* context = __ GetContext(); 622 Node* context = __ GetContext();
630 return __ CallStub(ic.descriptor(), code_target, context, object, name, 623 return __ CallStub(ic.descriptor(), code_target, context, object, name,
631 smi_slot, type_feedback_vector); 624 smi_slot, type_feedback_vector);
632 } 625 }
633 626
634 // KeyedLoadIC <object> <slot> 627 // KeyedLoadIC <object> <slot>
635 // 628 //
636 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key 629 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
637 // in the accumulator. 630 // in the accumulator.
638 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { 631 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
639 Callable ic = 632 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
640 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
641 Node* result = BuildLoadKeyedProperty(ic, assembler); 633 Node* result = BuildLoadKeyedProperty(ic, assembler);
642 __ SetAccumulator(result); 634 __ SetAccumulator(result);
643 __ Dispatch(); 635 __ Dispatch();
644 } 636 }
645 637
646 // LdrKeyedProperty <object> <slot> <reg> 638 // LdrKeyedProperty <object> <slot> <reg>
647 // 639 //
648 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key 640 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
649 // in the accumulator and puts the result in register <reg>. 641 // in the accumulator and puts the result in register <reg>.
650 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { 642 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
651 Callable ic = 643 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
652 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
653 Node* result = BuildLoadKeyedProperty(ic, assembler); 644 Node* result = BuildLoadKeyedProperty(ic, assembler);
654 Node* destination = __ BytecodeOperandReg(2); 645 Node* destination = __ BytecodeOperandReg(2);
655 __ StoreRegister(result, destination); 646 __ StoreRegister(result, destination);
656 __ Dispatch(); 647 __ Dispatch();
657 } 648 }
658 649
659 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { 650 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
660 Node* code_target = __ HeapConstant(ic.code()); 651 Node* code_target = __ HeapConstant(ic.code());
661 Node* object_reg_index = __ BytecodeOperandReg(0); 652 Node* object_reg_index = __ BytecodeOperandReg(0);
662 Node* object = __ LoadRegister(object_reg_index); 653 Node* object = __ LoadRegister(object_reg_index);
663 Node* constant_index = __ BytecodeOperandIdx(1); 654 Node* constant_index = __ BytecodeOperandIdx(1);
664 Node* name = __ LoadConstantPoolEntry(constant_index); 655 Node* name = __ LoadConstantPoolEntry(constant_index);
665 Node* value = __ GetAccumulator(); 656 Node* value = __ GetAccumulator();
666 Node* raw_slot = __ BytecodeOperandIdx(2); 657 Node* raw_slot = __ BytecodeOperandIdx(2);
667 Node* smi_slot = __ SmiTag(raw_slot); 658 Node* smi_slot = __ SmiTag(raw_slot);
668 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 659 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
669 Node* context = __ GetContext(); 660 Node* context = __ GetContext();
670 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 661 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
671 smi_slot, type_feedback_vector); 662 smi_slot, type_feedback_vector);
672 __ Dispatch(); 663 __ Dispatch();
673 } 664 }
674 665
675 // StaNamedPropertySloppy <object> <name_index> <slot> 666 // StaNamedPropertySloppy <object> <name_index> <slot>
676 // 667 //
677 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and 668 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and
678 // the name in constant pool entry <name_index> with the value in the 669 // the name in constant pool entry <name_index> with the value in the
679 // accumulator. 670 // accumulator.
680 void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) { 671 void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) {
681 Callable ic = 672 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY);
682 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
683 DoStoreIC(ic, assembler); 673 DoStoreIC(ic, assembler);
684 } 674 }
685 675
686 // StaNamedPropertyStrict <object> <name_index> <slot> 676 // StaNamedPropertyStrict <object> <name_index> <slot>
687 // 677 //
688 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and 678 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and
689 // the name in constant pool entry <name_index> with the value in the 679 // the name in constant pool entry <name_index> with the value in the
690 // accumulator. 680 // accumulator.
691 void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) { 681 void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) {
692 Callable ic = 682 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT);
693 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
694 DoStoreIC(ic, assembler); 683 DoStoreIC(ic, assembler);
695 } 684 }
696 685
697 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { 686 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
698 Node* code_target = __ HeapConstant(ic.code()); 687 Node* code_target = __ HeapConstant(ic.code());
699 Node* object_reg_index = __ BytecodeOperandReg(0); 688 Node* object_reg_index = __ BytecodeOperandReg(0);
700 Node* object = __ LoadRegister(object_reg_index); 689 Node* object = __ LoadRegister(object_reg_index);
701 Node* name_reg_index = __ BytecodeOperandReg(1); 690 Node* name_reg_index = __ BytecodeOperandReg(1);
702 Node* name = __ LoadRegister(name_reg_index); 691 Node* name = __ LoadRegister(name_reg_index);
703 Node* value = __ GetAccumulator(); 692 Node* value = __ GetAccumulator();
704 Node* raw_slot = __ BytecodeOperandIdx(2); 693 Node* raw_slot = __ BytecodeOperandIdx(2);
705 Node* smi_slot = __ SmiTag(raw_slot); 694 Node* smi_slot = __ SmiTag(raw_slot);
706 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 695 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
707 Node* context = __ GetContext(); 696 Node* context = __ GetContext();
708 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 697 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
709 smi_slot, type_feedback_vector); 698 smi_slot, type_feedback_vector);
710 __ Dispatch(); 699 __ Dispatch();
711 } 700 }
712 701
713 // StaKeyedPropertySloppy <object> <key> <slot> 702 // StaKeyedPropertySloppy <object> <key> <slot>
714 // 703 //
715 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> 704 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
716 // and the key <key> with the value in the accumulator. 705 // and the key <key> with the value in the accumulator.
717 void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) { 706 void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) {
718 Callable ic = 707 Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY);
719 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
720 DoKeyedStoreIC(ic, assembler); 708 DoKeyedStoreIC(ic, assembler);
721 } 709 }
722 710
723 // StaKeyedPropertyStrict <object> <key> <slot> 711 // StaKeyedPropertyStrict <object> <key> <slot>
724 // 712 //
725 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> 713 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
726 // and the key <key> with the value in the accumulator. 714 // and the key <key> with the value in the accumulator.
727 void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) { 715 void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) {
728 Callable ic = 716 Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT);
729 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
730 DoKeyedStoreIC(ic, assembler); 717 DoKeyedStoreIC(ic, assembler);
731 } 718 }
732 719
733 // PushContext <context> 720 // PushContext <context>
734 // 721 //
735 // Saves the current context in <context>, and pushes the accumulator as the 722 // Saves the current context in <context>, and pushes the accumulator as the
736 // new current context. 723 // new current context.
737 void Interpreter::DoPushContext(InterpreterAssembler* assembler) { 724 void Interpreter::DoPushContext(InterpreterAssembler* assembler) {
738 Node* reg_index = __ BytecodeOperandReg(0); 725 Node* reg_index = __ BytecodeOperandReg(0);
739 Node* new_context = __ GetAccumulator(); 726 Node* new_context = __ GetAccumulator();
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1822 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1836 __ SmiTag(new_state)); 1823 __ SmiTag(new_state));
1837 __ SetAccumulator(old_state); 1824 __ SetAccumulator(old_state);
1838 1825
1839 __ Dispatch(); 1826 __ Dispatch();
1840 } 1827 }
1841 1828
1842 } // namespace interpreter 1829 } // namespace interpreter
1843 } // namespace internal 1830 } // namespace internal
1844 } // namespace v8 1831 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698