| 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/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/interpreter/bytecode-flags.h" | 10 #include "src/interpreter/bytecode-flags.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 register_allocator_(nullptr), | 622 register_allocator_(nullptr), |
| 623 generator_resume_points_(info->literal()->yield_count(), info->zone()), | 623 generator_resume_points_(info->literal()->yield_count(), info->zone()), |
| 624 generator_state_(), | 624 generator_state_(), |
| 625 loop_depth_(0) { | 625 loop_depth_(0) { |
| 626 InitializeAstVisitor(isolate()->stack_guard()->real_climit()); | 626 InitializeAstVisitor(isolate()->stack_guard()->real_climit()); |
| 627 } | 627 } |
| 628 | 628 |
| 629 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() { | 629 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() { |
| 630 GenerateBytecode(); | 630 GenerateBytecode(); |
| 631 FinalizeBytecode(); | 631 FinalizeBytecode(); |
| 632 |
| 633 if (HasStackOverflow()) return Handle<BytecodeArray>(); |
| 634 |
| 632 return builder()->ToBytecodeArray(); | 635 return builder()->ToBytecodeArray(); |
| 633 } | 636 } |
| 634 | 637 |
| 635 void BytecodeGenerator::FinalizeBytecode() { | 638 void BytecodeGenerator::FinalizeBytecode() { |
| 636 // Build global declaration pair arrays. | 639 // Build global declaration pair arrays. |
| 637 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) { | 640 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) { |
| 638 Handle<FixedArray> declarations = | 641 Handle<FixedArray> declarations = |
| 639 globals_builder->AllocateDeclarationPairs(info()); | 642 globals_builder->AllocateDeclarationPairs(info()); |
| 640 if (declarations.is_null()) return SetStackOverflow(); | 643 if (declarations.is_null()) return SetStackOverflow(); |
| 641 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(), | 644 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(), |
| (...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 return execution_context()->scope()->language_mode(); | 3283 return execution_context()->scope()->language_mode(); |
| 3281 } | 3284 } |
| 3282 | 3285 |
| 3283 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3286 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 3284 return TypeFeedbackVector::GetIndex(slot); | 3287 return TypeFeedbackVector::GetIndex(slot); |
| 3285 } | 3288 } |
| 3286 | 3289 |
| 3287 } // namespace interpreter | 3290 } // namespace interpreter |
| 3288 } // namespace internal | 3291 } // namespace internal |
| 3289 } // namespace v8 | 3292 } // namespace v8 |
| OLD | NEW |