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

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

Issue 2529463002: [Turbofan]: generic lowering can use a constant vector (Closed)
Patch Set: Add verifier code. Created 4 years 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/ast-graph-builder.cc ('k') | src/compiler/js-generic-lowering.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/compiler-source-position-table.h" 10 #include "src/compiler/compiler-source-position-table.h"
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value); 736 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value);
737 } 737 }
738 738
739 Node* BytecodeGraphBuilder::BuildLoadGlobal(Handle<Name> name, 739 Node* BytecodeGraphBuilder::BuildLoadGlobal(Handle<Name> name,
740 uint32_t feedback_slot_index, 740 uint32_t feedback_slot_index,
741 TypeofMode typeof_mode) { 741 TypeofMode typeof_mode) {
742 VectorSlotPair feedback = CreateVectorSlotPair(feedback_slot_index); 742 VectorSlotPair feedback = CreateVectorSlotPair(feedback_slot_index);
743 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, 743 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
744 feedback_vector()->GetKind(feedback.slot())); 744 feedback_vector()->GetKind(feedback.slot()));
745 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 745 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
746 return NewNode(op, GetFunctionClosure()); 746 return NewNode(op);
747 } 747 }
748 748
749 void BytecodeGraphBuilder::VisitLdaGlobal() { 749 void BytecodeGraphBuilder::VisitLdaGlobal() {
750 PrepareEagerCheckpoint(); 750 PrepareEagerCheckpoint();
751 Handle<Name> name = 751 Handle<Name> name =
752 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 752 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
753 uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1); 753 uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
754 Node* node = 754 Node* node =
755 BuildLoadGlobal(name, feedback_slot_index, TypeofMode::NOT_INSIDE_TYPEOF); 755 BuildLoadGlobal(name, feedback_slot_index, TypeofMode::NOT_INSIDE_TYPEOF);
756 environment()->BindAccumulator(node, Environment::kAttachFrameState); 756 environment()->BindAccumulator(node, Environment::kAttachFrameState);
(...skipping 11 matching lines...) Expand all
768 768
769 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { 769 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) {
770 PrepareEagerCheckpoint(); 770 PrepareEagerCheckpoint();
771 Handle<Name> name = 771 Handle<Name> name =
772 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 772 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
773 VectorSlotPair feedback = 773 VectorSlotPair feedback =
774 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 774 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
775 Node* value = environment()->LookupAccumulator(); 775 Node* value = environment()->LookupAccumulator();
776 776
777 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); 777 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback);
778 Node* node = NewNode(op, value, GetFunctionClosure()); 778 Node* node = NewNode(op, value);
779 environment()->RecordAfterState(node, Environment::kAttachFrameState); 779 environment()->RecordAfterState(node, Environment::kAttachFrameState);
780 } 780 }
781 781
782 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { 782 void BytecodeGraphBuilder::VisitStaGlobalSloppy() {
783 BuildStoreGlobal(LanguageMode::SLOPPY); 783 BuildStoreGlobal(LanguageMode::SLOPPY);
784 } 784 }
785 785
786 void BytecodeGraphBuilder::VisitStaGlobalStrict() { 786 void BytecodeGraphBuilder::VisitStaGlobalStrict() {
787 BuildStoreGlobal(LanguageMode::STRICT); 787 BuildStoreGlobal(LanguageMode::STRICT);
788 } 788 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 void BytecodeGraphBuilder::VisitLdaNamedProperty() { 1030 void BytecodeGraphBuilder::VisitLdaNamedProperty() {
1031 PrepareEagerCheckpoint(); 1031 PrepareEagerCheckpoint();
1032 Node* object = 1032 Node* object =
1033 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1033 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1034 Handle<Name> name = 1034 Handle<Name> name =
1035 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 1035 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
1036 VectorSlotPair feedback = 1036 VectorSlotPair feedback =
1037 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 1037 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
1038 1038
1039 const Operator* op = javascript()->LoadNamed(name, feedback); 1039 const Operator* op = javascript()->LoadNamed(name, feedback);
1040 Node* node = NewNode(op, object, GetFunctionClosure()); 1040 Node* node = NewNode(op, object);
1041 environment()->BindAccumulator(node, Environment::kAttachFrameState); 1041 environment()->BindAccumulator(node, Environment::kAttachFrameState);
1042 } 1042 }
1043 1043
1044 void BytecodeGraphBuilder::VisitLdaKeyedProperty() { 1044 void BytecodeGraphBuilder::VisitLdaKeyedProperty() {
1045 PrepareEagerCheckpoint(); 1045 PrepareEagerCheckpoint();
1046 Node* key = environment()->LookupAccumulator(); 1046 Node* key = environment()->LookupAccumulator();
1047 Node* object = 1047 Node* object =
1048 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1048 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1049 VectorSlotPair feedback = 1049 VectorSlotPair feedback =
1050 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 1050 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
1051 1051
1052 const Operator* op = javascript()->LoadProperty(feedback); 1052 const Operator* op = javascript()->LoadProperty(feedback);
1053 Node* node = NewNode(op, object, key, GetFunctionClosure()); 1053 Node* node = NewNode(op, object, key);
1054 environment()->BindAccumulator(node, Environment::kAttachFrameState); 1054 environment()->BindAccumulator(node, Environment::kAttachFrameState);
1055 } 1055 }
1056 1056
1057 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { 1057 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) {
1058 PrepareEagerCheckpoint(); 1058 PrepareEagerCheckpoint();
1059 Node* value = environment()->LookupAccumulator(); 1059 Node* value = environment()->LookupAccumulator();
1060 Node* object = 1060 Node* object =
1061 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1061 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1062 Handle<Name> name = 1062 Handle<Name> name =
1063 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 1063 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
1064 VectorSlotPair feedback = 1064 VectorSlotPair feedback =
1065 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 1065 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
1066 1066
1067 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); 1067 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback);
1068 Node* node = NewNode(op, object, value, GetFunctionClosure()); 1068 Node* node = NewNode(op, object, value);
1069 environment()->RecordAfterState(node, Environment::kAttachFrameState); 1069 environment()->RecordAfterState(node, Environment::kAttachFrameState);
1070 } 1070 }
1071 1071
1072 void BytecodeGraphBuilder::VisitStaNamedPropertySloppy() { 1072 void BytecodeGraphBuilder::VisitStaNamedPropertySloppy() {
1073 BuildNamedStore(LanguageMode::SLOPPY); 1073 BuildNamedStore(LanguageMode::SLOPPY);
1074 } 1074 }
1075 1075
1076 void BytecodeGraphBuilder::VisitStaNamedPropertyStrict() { 1076 void BytecodeGraphBuilder::VisitStaNamedPropertyStrict() {
1077 BuildNamedStore(LanguageMode::STRICT); 1077 BuildNamedStore(LanguageMode::STRICT);
1078 } 1078 }
1079 1079
1080 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { 1080 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) {
1081 PrepareEagerCheckpoint(); 1081 PrepareEagerCheckpoint();
1082 Node* value = environment()->LookupAccumulator(); 1082 Node* value = environment()->LookupAccumulator();
1083 Node* object = 1083 Node* object =
1084 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1084 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1085 Node* key = 1085 Node* key =
1086 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 1086 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1087 VectorSlotPair feedback = 1087 VectorSlotPair feedback =
1088 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 1088 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
1089 1089
1090 const Operator* op = javascript()->StoreProperty(language_mode, feedback); 1090 const Operator* op = javascript()->StoreProperty(language_mode, feedback);
1091 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); 1091 Node* node = NewNode(op, object, key, value);
1092 environment()->RecordAfterState(node, Environment::kAttachFrameState); 1092 environment()->RecordAfterState(node, Environment::kAttachFrameState);
1093 } 1093 }
1094 1094
1095 void BytecodeGraphBuilder::VisitStaKeyedPropertySloppy() { 1095 void BytecodeGraphBuilder::VisitStaKeyedPropertySloppy() {
1096 BuildKeyedStore(LanguageMode::SLOPPY); 1096 BuildKeyedStore(LanguageMode::SLOPPY);
1097 } 1097 }
1098 1098
1099 void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() { 1099 void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() {
1100 BuildKeyedStore(LanguageMode::STRICT); 1100 BuildKeyedStore(LanguageMode::STRICT);
1101 } 1101 }
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 it->source_position().ScriptOffset(), start_position_.InliningId())); 2226 it->source_position().ScriptOffset(), start_position_.InliningId()));
2227 it->Advance(); 2227 it->Advance();
2228 } else { 2228 } else {
2229 DCHECK_GT(it->code_offset(), offset); 2229 DCHECK_GT(it->code_offset(), offset);
2230 } 2230 }
2231 } 2231 }
2232 2232
2233 } // namespace compiler 2233 } // namespace compiler
2234 } // namespace internal 2234 } // namespace internal
2235 } // namespace v8 2235 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698