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_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
11 #include "src/interpreter/constant-array-builder.h" | 11 #include "src/interpreter/constant-array-builder.h" |
12 #include "src/interpreter/handler-table-builder.h" | 12 #include "src/interpreter/handler-table-builder.h" |
13 #include "src/interpreter/register-translator.h" | 13 #include "src/interpreter/register-translator.h" |
| 14 #include "src/interpreter/source-position-table.h" |
14 #include "src/zone-containers.h" | 15 #include "src/zone-containers.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 class Isolate; | 20 class Isolate; |
20 | 21 |
21 namespace interpreter { | 22 namespace interpreter { |
22 | 23 |
23 class BytecodeLabel; | 24 class BytecodeLabel; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 246 |
246 // Exception handling. | 247 // Exception handling. |
247 BytecodeArrayBuilder& MarkHandler(int handler_id, bool will_catch); | 248 BytecodeArrayBuilder& MarkHandler(int handler_id, bool will_catch); |
248 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); | 249 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); |
249 BytecodeArrayBuilder& MarkTryEnd(int handler_id); | 250 BytecodeArrayBuilder& MarkTryEnd(int handler_id); |
250 | 251 |
251 // Creates a new handler table entry and returns a {hander_id} identifying the | 252 // Creates a new handler table entry and returns a {hander_id} identifying the |
252 // entry, so that it can be referenced by above exception handling support. | 253 // entry, so that it can be referenced by above exception handling support. |
253 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } | 254 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } |
254 | 255 |
| 256 void SetStatementPosition(Statement* stmt); |
| 257 void SetExpressionPosition(Expression* expr); |
| 258 |
255 // Accessors | 259 // Accessors |
256 Zone* zone() const { return zone_; } | 260 Zone* zone() const { return zone_; } |
257 TemporaryRegisterAllocator* temporary_register_allocator() { | 261 TemporaryRegisterAllocator* temporary_register_allocator() { |
258 return &temporary_allocator_; | 262 return &temporary_allocator_; |
259 } | 263 } |
260 const TemporaryRegisterAllocator* temporary_register_allocator() const { | 264 const TemporaryRegisterAllocator* temporary_register_allocator() const { |
261 return &temporary_allocator_; | 265 return &temporary_allocator_; |
262 } | 266 } |
263 | 267 |
264 private: | 268 private: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 Isolate* isolate() const { return isolate_; } | 339 Isolate* isolate() const { return isolate_; } |
336 ConstantArrayBuilder* constant_array_builder() { | 340 ConstantArrayBuilder* constant_array_builder() { |
337 return &constant_array_builder_; | 341 return &constant_array_builder_; |
338 } | 342 } |
339 const ConstantArrayBuilder* constant_array_builder() const { | 343 const ConstantArrayBuilder* constant_array_builder() const { |
340 return &constant_array_builder_; | 344 return &constant_array_builder_; |
341 } | 345 } |
342 HandlerTableBuilder* handler_table_builder() { | 346 HandlerTableBuilder* handler_table_builder() { |
343 return &handler_table_builder_; | 347 return &handler_table_builder_; |
344 } | 348 } |
| 349 SourcePositionTableBuilder* source_position_table_builder() { |
| 350 return &source_position_table_builder_; |
| 351 } |
345 RegisterTranslator* register_translator() { return ®ister_translator_; } | 352 RegisterTranslator* register_translator() { return ®ister_translator_; } |
346 | 353 |
347 Isolate* isolate_; | 354 Isolate* isolate_; |
348 Zone* zone_; | 355 Zone* zone_; |
349 ZoneVector<uint8_t> bytecodes_; | 356 ZoneVector<uint8_t> bytecodes_; |
350 bool bytecode_generated_; | 357 bool bytecode_generated_; |
351 ConstantArrayBuilder constant_array_builder_; | 358 ConstantArrayBuilder constant_array_builder_; |
352 HandlerTableBuilder handler_table_builder_; | 359 HandlerTableBuilder handler_table_builder_; |
| 360 SourcePositionTableBuilder source_position_table_builder_; |
353 size_t last_block_end_; | 361 size_t last_block_end_; |
354 size_t last_bytecode_start_; | 362 size_t last_bytecode_start_; |
355 bool exit_seen_in_block_; | 363 bool exit_seen_in_block_; |
356 int unbound_jumps_; | 364 int unbound_jumps_; |
357 int parameter_count_; | 365 int parameter_count_; |
358 int local_register_count_; | 366 int local_register_count_; |
359 int context_register_count_; | 367 int context_register_count_; |
360 TemporaryRegisterAllocator temporary_allocator_; | 368 TemporaryRegisterAllocator temporary_allocator_; |
361 RegisterTranslator register_translator_; | 369 RegisterTranslator register_translator_; |
362 | 370 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 size_t offset_; | 410 size_t offset_; |
403 | 411 |
404 friend class BytecodeArrayBuilder; | 412 friend class BytecodeArrayBuilder; |
405 }; | 413 }; |
406 | 414 |
407 } // namespace interpreter | 415 } // namespace interpreter |
408 } // namespace internal | 416 } // namespace internal |
409 } // namespace v8 | 417 } // namespace v8 |
410 | 418 |
411 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 419 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |