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