Chromium Code Reviews| 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 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
| 10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 return builder()->register_allocator(); | 229 return builder()->register_allocator(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 GlobalDeclarationsBuilder* globals_builder() { | 232 GlobalDeclarationsBuilder* globals_builder() { |
| 233 DCHECK_NOT_NULL(globals_builder_); | 233 DCHECK_NOT_NULL(globals_builder_); |
| 234 return globals_builder_; | 234 return globals_builder_; |
| 235 } | 235 } |
| 236 inline LanguageMode language_mode() const; | 236 inline LanguageMode language_mode() const; |
| 237 int feedback_index(FeedbackSlot slot) const; | 237 int feedback_index(FeedbackSlot slot) const; |
| 238 | 238 |
| 239 bool is_block_coverage() const; | |
| 240 static const int kNoCoverageArraySlot = -1; | |
| 241 int AllocateBlockCoverageSlot(SourceRange range) { | |
| 242 if (!is_block_coverage() || range.IsEmpty()) { | |
| 243 return kNoCoverageArraySlot; | |
| 244 } | |
| 245 const int slot = static_cast<int>(block_coverage_slots_.size()); | |
| 246 block_coverage_slots_.emplace_back(range); | |
| 247 return slot; | |
| 248 } | |
| 249 void IncBlockCounter(int coverage_array_slot) { | |
| 250 if (coverage_array_slot == kNoCoverageArraySlot) return; | |
| 251 DCHECK(is_block_coverage()); | |
| 252 builder()->IncBlockCounter(coverage_array_slot); | |
| 253 } | |
|
rmcilroy
2017/06/01 14:01:50
I still have this comment here which was unanswere
jgruber
2017/06/02 06:39:27
Sorry I missed that one. I'm happy to factor out i
| |
| 254 | |
| 239 Zone* zone_; | 255 Zone* zone_; |
| 240 BytecodeArrayBuilder* builder_; | 256 BytecodeArrayBuilder* builder_; |
| 241 CompilationInfo* info_; | 257 CompilationInfo* info_; |
| 242 const AstStringConstants* ast_string_constants_; | 258 const AstStringConstants* ast_string_constants_; |
| 243 DeclarationScope* closure_scope_; | 259 DeclarationScope* closure_scope_; |
| 244 Scope* current_scope_; | 260 Scope* current_scope_; |
| 245 | 261 |
| 246 GlobalDeclarationsBuilder* globals_builder_; | 262 GlobalDeclarationsBuilder* globals_builder_; |
| 247 ZoneVector<GlobalDeclarationsBuilder*> global_declarations_; | 263 ZoneVector<GlobalDeclarationsBuilder*> global_declarations_; |
| 248 ZoneVector<std::pair<FunctionLiteral*, size_t>> function_literals_; | 264 ZoneVector<std::pair<FunctionLiteral*, size_t>> function_literals_; |
| 249 ZoneVector<std::pair<NativeFunctionLiteral*, size_t>> | 265 ZoneVector<std::pair<NativeFunctionLiteral*, size_t>> |
| 250 native_function_literals_; | 266 native_function_literals_; |
| 251 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; | 267 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; |
| 252 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; | 268 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; |
| 253 | 269 |
| 270 // Contains source range information for allocated block coverage counter | |
| 271 // slots. Slot i covers range block_coverage_slots_[i]. | |
| 272 ZoneVector<SourceRange> block_coverage_slots_; | |
| 273 | |
| 254 ControlScope* execution_control_; | 274 ControlScope* execution_control_; |
| 255 ContextScope* execution_context_; | 275 ContextScope* execution_context_; |
| 256 ExpressionResultScope* execution_result_; | 276 ExpressionResultScope* execution_result_; |
| 257 | 277 |
| 258 BytecodeJumpTable* generator_jump_table_; | 278 BytecodeJumpTable* generator_jump_table_; |
| 259 Register generator_state_; | 279 Register generator_state_; |
| 260 int loop_depth_; | 280 int loop_depth_; |
| 261 }; | 281 }; |
| 262 | 282 |
| 263 } // namespace interpreter | 283 } // namespace interpreter |
| 264 } // namespace internal | 284 } // namespace internal |
| 265 } // namespace v8 | 285 } // namespace v8 |
| 266 | 286 |
| 267 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 287 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |