| 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/zone-containers.h" | 12 #include "src/zone-containers.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 class Isolate; | 17 class Isolate; |
| 17 | 18 |
| 18 namespace interpreter { | 19 namespace interpreter { |
| 19 | 20 |
| 20 class BytecodeLabel; | 21 class BytecodeLabel; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 BytecodeArrayBuilder& Throw(); | 219 BytecodeArrayBuilder& Throw(); |
| 219 BytecodeArrayBuilder& Return(); | 220 BytecodeArrayBuilder& Return(); |
| 220 | 221 |
| 221 // Complex flow control. | 222 // Complex flow control. |
| 222 BytecodeArrayBuilder& ForInPrepare(Register cache_info_triple); | 223 BytecodeArrayBuilder& ForInPrepare(Register cache_info_triple); |
| 223 BytecodeArrayBuilder& ForInDone(Register index, Register cache_length); | 224 BytecodeArrayBuilder& ForInDone(Register index, Register cache_length); |
| 224 BytecodeArrayBuilder& ForInNext(Register receiver, Register index, | 225 BytecodeArrayBuilder& ForInNext(Register receiver, Register index, |
| 225 Register cache_type_array_pair); | 226 Register cache_type_array_pair); |
| 226 BytecodeArrayBuilder& ForInStep(Register index); | 227 BytecodeArrayBuilder& ForInStep(Register index); |
| 227 | 228 |
| 229 // Exception handling. |
| 230 BytecodeArrayBuilder& MarkHandler(int handler_id, bool will_catch); |
| 231 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); |
| 232 BytecodeArrayBuilder& MarkTryEnd(int handler_id); |
| 233 |
| 234 // Creates a new handler table entry and returns a {hander_id} identifying the |
| 235 // entry, so that it can be referenced by above exception handling support. |
| 236 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } |
| 237 |
| 228 // Accessors | 238 // Accessors |
| 229 Zone* zone() const { return zone_; } | 239 Zone* zone() const { return zone_; } |
| 230 | 240 |
| 231 private: | 241 private: |
| 232 class PreviousBytecodeHelper; | 242 class PreviousBytecodeHelper; |
| 233 friend class BytecodeRegisterAllocator; | 243 friend class BytecodeRegisterAllocator; |
| 234 | 244 |
| 235 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 245 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
| 236 static Bytecode BytecodeForCountOperation(Token::Value op); | 246 static Bytecode BytecodeForCountOperation(Token::Value op); |
| 237 static Bytecode BytecodeForCompareOperation(Token::Value op); | 247 static Bytecode BytecodeForCompareOperation(Token::Value op); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 318 |
| 309 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } | 319 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
| 310 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } | 320 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } |
| 311 Isolate* isolate() const { return isolate_; } | 321 Isolate* isolate() const { return isolate_; } |
| 312 ConstantArrayBuilder* constant_array_builder() { | 322 ConstantArrayBuilder* constant_array_builder() { |
| 313 return &constant_array_builder_; | 323 return &constant_array_builder_; |
| 314 } | 324 } |
| 315 const ConstantArrayBuilder* constant_array_builder() const { | 325 const ConstantArrayBuilder* constant_array_builder() const { |
| 316 return &constant_array_builder_; | 326 return &constant_array_builder_; |
| 317 } | 327 } |
| 328 HandlerTableBuilder* handler_table_builder() { |
| 329 return &handler_table_builder_; |
| 330 } |
| 318 | 331 |
| 319 Isolate* isolate_; | 332 Isolate* isolate_; |
| 320 Zone* zone_; | 333 Zone* zone_; |
| 321 ZoneVector<uint8_t> bytecodes_; | 334 ZoneVector<uint8_t> bytecodes_; |
| 322 bool bytecode_generated_; | 335 bool bytecode_generated_; |
| 323 ConstantArrayBuilder constant_array_builder_; | 336 ConstantArrayBuilder constant_array_builder_; |
| 337 HandlerTableBuilder handler_table_builder_; |
| 324 size_t last_block_end_; | 338 size_t last_block_end_; |
| 325 size_t last_bytecode_start_; | 339 size_t last_bytecode_start_; |
| 326 bool exit_seen_in_block_; | 340 bool exit_seen_in_block_; |
| 327 int unbound_jumps_; | 341 int unbound_jumps_; |
| 328 | 342 |
| 329 int parameter_count_; | 343 int parameter_count_; |
| 330 int local_register_count_; | 344 int local_register_count_; |
| 331 int context_register_count_; | 345 int context_register_count_; |
| 332 int temporary_register_count_; | 346 int temporary_register_count_; |
| 333 ZoneSet<int> free_temporaries_; | 347 ZoneSet<int> free_temporaries_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 size_t offset_; | 388 size_t offset_; |
| 375 | 389 |
| 376 friend class BytecodeArrayBuilder; | 390 friend class BytecodeArrayBuilder; |
| 377 }; | 391 }; |
| 378 | 392 |
| 379 } // namespace interpreter | 393 } // namespace interpreter |
| 380 } // namespace internal | 394 } // namespace internal |
| 381 } // namespace v8 | 395 } // namespace v8 |
| 382 | 396 |
| 383 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 397 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |