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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 1372293005: [Interpreter] Support top-level code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 2 months 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
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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 100
101 BytecodeGenerator::~BytecodeGenerator() {} 101 BytecodeGenerator::~BytecodeGenerator() {}
102 102
103 103
104 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) { 104 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
105 set_info(info); 105 set_info(info);
106 set_scope(info->scope()); 106 set_scope(info->scope());
107 107
108 // This a temporary guard (oth).
109 DCHECK(scope()->is_function_scope());
110
111 builder()->set_parameter_count(info->num_parameters_including_this()); 108 builder()->set_parameter_count(info->num_parameters_including_this());
112 builder()->set_locals_count(scope()->num_stack_slots()); 109 builder()->set_locals_count(scope()->num_stack_slots());
113 110
114 // Visit implicit declaration of the function name. 111 // Visit implicit declaration of the function name.
115 if (scope()->is_function_scope() && scope()->function() != NULL) { 112 if (scope()->is_function_scope() && scope()->function() != NULL) {
116 VisitVariableDeclaration(scope()->function()); 113 VisitVariableDeclaration(scope()->function());
117 } 114 }
118 115
119 // Visit declarations within the function scope. 116 // Visit declarations within the function scope.
120 VisitDeclarations(scope()->declarations()); 117 VisitDeclarations(scope()->declarations());
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 676 }
680 677
681 678
682 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 679 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
683 return info()->feedback_vector()->GetIndex(slot); 680 return info()->feedback_vector()->GetIndex(slot);
684 } 681 }
685 682
686 } // namespace interpreter 683 } // namespace interpreter
687 } // namespace internal 684 } // namespace internal
688 } // namespace v8 685 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698