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/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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1022 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { | 1022 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { |
1023 PrepareEagerCheckpoint(); | 1023 PrepareEagerCheckpoint(); |
1024 Node* value = environment()->LookupAccumulator(); | 1024 Node* value = environment()->LookupAccumulator(); |
1025 Node* object = | 1025 Node* object = |
1026 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1026 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
1027 Handle<Name> name = | 1027 Handle<Name> name = |
1028 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 1028 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
1029 VectorSlotPair feedback = | 1029 VectorSlotPair feedback = |
1030 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 1030 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
1031 | 1031 |
1032 DCHECK_EQ(feedback.vector()->GetLanguageMode(feedback.slot()), language_mode); | |
mvstanton
2017/02/06 08:23:51
Nice assert to add, thx!
| |
1032 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); | 1033 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); |
1033 Node* node = NewNode(op, object, value); | 1034 Node* node = NewNode(op, object, value); |
1034 environment()->RecordAfterState(node, Environment::kAttachFrameState); | 1035 environment()->RecordAfterState(node, Environment::kAttachFrameState); |
1035 } | 1036 } |
1036 | 1037 |
1037 void BytecodeGraphBuilder::VisitStaNamedPropertySloppy() { | 1038 void BytecodeGraphBuilder::VisitStaNamedPropertySloppy() { |
1038 BuildNamedStore(LanguageMode::SLOPPY); | 1039 BuildNamedStore(LanguageMode::SLOPPY); |
1039 } | 1040 } |
1040 | 1041 |
1041 void BytecodeGraphBuilder::VisitStaNamedPropertyStrict() { | 1042 void BytecodeGraphBuilder::VisitStaNamedPropertyStrict() { |
1042 BuildNamedStore(LanguageMode::STRICT); | 1043 BuildNamedStore(LanguageMode::STRICT); |
1043 } | 1044 } |
1044 | 1045 |
1045 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { | 1046 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { |
1046 PrepareEagerCheckpoint(); | 1047 PrepareEagerCheckpoint(); |
1047 Node* value = environment()->LookupAccumulator(); | 1048 Node* value = environment()->LookupAccumulator(); |
1048 Node* object = | 1049 Node* object = |
1049 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1050 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
1050 Node* key = | 1051 Node* key = |
1051 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 1052 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
1052 VectorSlotPair feedback = | 1053 VectorSlotPair feedback = |
1053 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 1054 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
1054 | 1055 |
1056 DCHECK_EQ(feedback.vector()->GetLanguageMode(feedback.slot()), language_mode); | |
1055 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 1057 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
1056 Node* node = NewNode(op, object, key, value); | 1058 Node* node = NewNode(op, object, key, value); |
1057 environment()->RecordAfterState(node, Environment::kAttachFrameState); | 1059 environment()->RecordAfterState(node, Environment::kAttachFrameState); |
1058 } | 1060 } |
1059 | 1061 |
1060 void BytecodeGraphBuilder::VisitStaKeyedPropertySloppy() { | 1062 void BytecodeGraphBuilder::VisitStaKeyedPropertySloppy() { |
1061 BuildKeyedStore(LanguageMode::SLOPPY); | 1063 BuildKeyedStore(LanguageMode::SLOPPY); |
1062 } | 1064 } |
1063 | 1065 |
1064 void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() { | 1066 void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() { |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2300 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2302 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2301 it->Advance(); | 2303 it->Advance(); |
2302 } else { | 2304 } else { |
2303 DCHECK_GT(it->code_offset(), offset); | 2305 DCHECK_GT(it->code_offset(), offset); |
2304 } | 2306 } |
2305 } | 2307 } |
2306 | 2308 |
2307 } // namespace compiler | 2309 } // namespace compiler |
2308 } // namespace internal | 2310 } // namespace internal |
2309 } // namespace v8 | 2311 } // namespace v8 |
OLD | NEW |