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/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 ->LoadLiteral(Smi::FromInt(entry->module_request)) | 900 ->LoadLiteral(Smi::FromInt(entry->module_request)) |
901 .StoreAccumulatorInRegister(module_request) | 901 .StoreAccumulatorInRegister(module_request) |
902 .CallRuntime(Runtime::kGetModuleNamespace, module_request); | 902 .CallRuntime(Runtime::kGetModuleNamespace, module_request); |
903 Variable* var = scope()->LookupLocal(entry->local_name); | 903 Variable* var = scope()->LookupLocal(entry->local_name); |
904 DCHECK_NOT_NULL(var); | 904 DCHECK_NOT_NULL(var); |
905 BuildVariableAssignment(var, Token::INIT, FeedbackVectorSlot::Invalid(), | 905 BuildVariableAssignment(var, Token::INIT, FeedbackVectorSlot::Invalid(), |
906 HoleCheckMode::kElided); | 906 HoleCheckMode::kElided); |
907 } | 907 } |
908 } | 908 } |
909 | 909 |
910 void BytecodeGenerator::VisitDeclarations( | 910 void BytecodeGenerator::VisitDeclarations(Declaration::List* declarations) { |
911 ZoneList<Declaration*>* declarations) { | |
912 RegisterAllocationScope register_scope(this); | 911 RegisterAllocationScope register_scope(this); |
913 DCHECK(globals_builder()->empty()); | 912 DCHECK(globals_builder()->empty()); |
914 for (int i = 0; i < declarations->length(); i++) { | 913 for (Declaration* decl : *declarations) { |
915 RegisterAllocationScope register_scope(this); | 914 RegisterAllocationScope register_scope(this); |
916 Visit(declarations->at(i)); | 915 Visit(decl); |
917 } | 916 } |
918 if (globals_builder()->empty()) return; | 917 if (globals_builder()->empty()) return; |
919 | 918 |
920 globals_builder()->set_constant_pool_entry( | 919 globals_builder()->set_constant_pool_entry( |
921 builder()->AllocateConstantPoolEntry()); | 920 builder()->AllocateConstantPoolEntry()); |
922 int encoded_flags = info()->GetDeclareGlobalsFlags(); | 921 int encoded_flags = info()->GetDeclareGlobalsFlags(); |
923 | 922 |
924 // Emit code to declare globals. | 923 // Emit code to declare globals. |
925 RegisterList args = register_allocator()->NewRegisterList(3); | 924 RegisterList args = register_allocator()->NewRegisterList(3); |
926 builder() | 925 builder() |
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 } | 3216 } |
3218 | 3217 |
3219 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3218 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3220 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3219 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3221 : Runtime::kStoreKeyedToSuper_Sloppy; | 3220 : Runtime::kStoreKeyedToSuper_Sloppy; |
3222 } | 3221 } |
3223 | 3222 |
3224 } // namespace interpreter | 3223 } // namespace interpreter |
3225 } // namespace internal | 3224 } // namespace internal |
3226 } // namespace v8 | 3225 } // namespace v8 |
OLD | NEW |