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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2489513005: [Interpreter] Remove all Ldr style bytecodes and replace with Star lookahead. (Closed)
Patch Set: Created 4 years, 1 month 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/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-peephole-optimizer.cc » ('j') | 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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/bytecode-branch-analysis.h" 10 #include "src/compiler/bytecode-branch-analysis.h"
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 Node* node = 701 Node* node =
702 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 702 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
703 environment()->BindAccumulator(node); 703 environment()->BindAccumulator(node);
704 } 704 }
705 705
706 void BytecodeGraphBuilder::VisitLdaUndefined() { 706 void BytecodeGraphBuilder::VisitLdaUndefined() {
707 Node* node = jsgraph()->UndefinedConstant(); 707 Node* node = jsgraph()->UndefinedConstant();
708 environment()->BindAccumulator(node); 708 environment()->BindAccumulator(node);
709 } 709 }
710 710
711 void BytecodeGraphBuilder::VisitLdrUndefined() {
712 Node* node = jsgraph()->UndefinedConstant();
713 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node);
714 }
715
716 void BytecodeGraphBuilder::VisitLdaNull() { 711 void BytecodeGraphBuilder::VisitLdaNull() {
717 Node* node = jsgraph()->NullConstant(); 712 Node* node = jsgraph()->NullConstant();
718 environment()->BindAccumulator(node); 713 environment()->BindAccumulator(node);
719 } 714 }
720 715
721 void BytecodeGraphBuilder::VisitLdaTheHole() { 716 void BytecodeGraphBuilder::VisitLdaTheHole() {
722 Node* node = jsgraph()->TheHoleConstant(); 717 Node* node = jsgraph()->TheHoleConstant();
723 environment()->BindAccumulator(node); 718 environment()->BindAccumulator(node);
724 } 719 }
725 720
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 return NewNode(op, GetFunctionClosure()); 755 return NewNode(op, GetFunctionClosure());
761 } 756 }
762 757
763 void BytecodeGraphBuilder::VisitLdaGlobal() { 758 void BytecodeGraphBuilder::VisitLdaGlobal() {
764 PrepareEagerCheckpoint(); 759 PrepareEagerCheckpoint();
765 Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0), 760 Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0),
766 TypeofMode::NOT_INSIDE_TYPEOF); 761 TypeofMode::NOT_INSIDE_TYPEOF);
767 environment()->BindAccumulator(node, Environment::kAttachFrameState); 762 environment()->BindAccumulator(node, Environment::kAttachFrameState);
768 } 763 }
769 764
770 void BytecodeGraphBuilder::VisitLdrGlobal() {
771 PrepareEagerCheckpoint();
772 Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0),
773 TypeofMode::NOT_INSIDE_TYPEOF);
774 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), node,
775 Environment::kAttachFrameState);
776 }
777
778 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { 765 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
779 PrepareEagerCheckpoint(); 766 PrepareEagerCheckpoint();
780 Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0), 767 Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0),
781 TypeofMode::INSIDE_TYPEOF); 768 TypeofMode::INSIDE_TYPEOF);
782 environment()->BindAccumulator(node, Environment::kAttachFrameState); 769 environment()->BindAccumulator(node, Environment::kAttachFrameState);
783 } 770 }
784 771
785 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { 772 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) {
786 PrepareEagerCheckpoint(); 773 PrepareEagerCheckpoint();
787 Handle<Name> name = 774 Handle<Name> name =
788 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 775 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
789 VectorSlotPair feedback = 776 VectorSlotPair feedback =
790 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 777 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
791 Node* value = environment()->LookupAccumulator(); 778 Node* value = environment()->LookupAccumulator();
792 779
793 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); 780 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback);
794 Node* node = NewNode(op, value, GetFunctionClosure()); 781 Node* node = NewNode(op, value, GetFunctionClosure());
795 environment()->RecordAfterState(node, Environment::kAttachFrameState); 782 environment()->RecordAfterState(node, Environment::kAttachFrameState);
796 } 783 }
797 784
798 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { 785 void BytecodeGraphBuilder::VisitStaGlobalSloppy() {
799 BuildStoreGlobal(LanguageMode::SLOPPY); 786 BuildStoreGlobal(LanguageMode::SLOPPY);
800 } 787 }
801 788
802 void BytecodeGraphBuilder::VisitStaGlobalStrict() { 789 void BytecodeGraphBuilder::VisitStaGlobalStrict() {
803 BuildStoreGlobal(LanguageMode::STRICT); 790 BuildStoreGlobal(LanguageMode::STRICT);
804 } 791 }
805 792
806 Node* BytecodeGraphBuilder::BuildLoadContextSlot() { 793 void BytecodeGraphBuilder::VisitLdaContextSlot() {
807 // TODO(mythria): immutable flag is also set to false. This information is not 794 // TODO(mythria): immutable flag is also set to false. This information is not
808 // available in bytecode array. update this code when the implementation 795 // available in bytecode array. update this code when the implementation
809 // changes. 796 // changes.
810 const Operator* op = javascript()->LoadContext( 797 const Operator* op = javascript()->LoadContext(
811 bytecode_iterator().GetUnsignedImmediateOperand(2), 798 bytecode_iterator().GetUnsignedImmediateOperand(2),
812 bytecode_iterator().GetIndexOperand(1), false); 799 bytecode_iterator().GetIndexOperand(1), false);
813 Node* context = 800 Node* context =
814 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 801 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
815 return NewNode(op, context); 802 Node* node = NewNode(op, context);
803 environment()->BindAccumulator(node);
816 } 804 }
817 805
818 Node* BytecodeGraphBuilder::BuildLoadCurrentContextSlot() { 806 void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() {
819 // TODO(mythria): immutable flag is also set to false. This information is not 807 // TODO(mythria): immutable flag is also set to false. This information is not
820 // available in bytecode array. update this code when the implementation 808 // available in bytecode array. update this code when the implementation
821 // changes. 809 // changes.
822 const Operator* op = javascript()->LoadContext( 810 const Operator* op = javascript()->LoadContext(
823 0, bytecode_iterator().GetIndexOperand(0), false); 811 0, bytecode_iterator().GetIndexOperand(0), false);
824 Node* context = environment()->Context(); 812 Node* context = environment()->Context();
825 return NewNode(op, context); 813 Node* node = NewNode(op, context);
826 }
827
828 void BytecodeGraphBuilder::VisitLdaContextSlot() {
829 Node* node = BuildLoadContextSlot();
830 environment()->BindAccumulator(node); 814 environment()->BindAccumulator(node);
831 } 815 }
832 816
833 void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() {
834 Node* node = BuildLoadCurrentContextSlot();
835 environment()->BindAccumulator(node);
836 }
837
838 void BytecodeGraphBuilder::VisitLdrContextSlot() {
839 Node* node = BuildLoadContextSlot();
840 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node);
841 }
842
843 void BytecodeGraphBuilder::VisitLdrCurrentContextSlot() {
844 Node* node = BuildLoadCurrentContextSlot();
845 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), node);
846 }
847
848 void BytecodeGraphBuilder::VisitStaContextSlot() { 817 void BytecodeGraphBuilder::VisitStaContextSlot() {
849 const Operator* op = javascript()->StoreContext( 818 const Operator* op = javascript()->StoreContext(
850 bytecode_iterator().GetUnsignedImmediateOperand(2), 819 bytecode_iterator().GetUnsignedImmediateOperand(2),
851 bytecode_iterator().GetIndexOperand(1)); 820 bytecode_iterator().GetIndexOperand(1));
852 Node* context = 821 Node* context =
853 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 822 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
854 Node* value = environment()->LookupAccumulator(); 823 Node* value = environment()->LookupAccumulator();
855 NewNode(op, context, value); 824 NewNode(op, context, value);
856 } 825 }
857 826
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 source_positions_->set_current_position(it->source_position()); 2206 source_positions_->set_current_position(it->source_position());
2238 it->Advance(); 2207 it->Advance();
2239 } else { 2208 } else {
2240 DCHECK_GT(it->code_offset(), offset); 2209 DCHECK_GT(it->code_offset(), offset);
2241 } 2210 }
2242 } 2211 }
2243 2212
2244 } // namespace compiler 2213 } // namespace compiler
2245 } // namespace internal 2214 } // namespace internal
2246 } // namespace v8 2215 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-peephole-optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698