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 <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 Loading... |
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 732 } |
736 | 733 |
737 | 734 |
738 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 735 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
739 return info()->feedback_vector()->GetIndex(slot); | 736 return info()->feedback_vector()->GetIndex(slot); |
740 } | 737 } |
741 | 738 |
742 } // namespace interpreter | 739 } // namespace interpreter |
743 } // namespace internal | 740 } // namespace internal |
744 } // namespace v8 | 741 } // namespace v8 |
OLD | NEW |