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/base/compiler-specific.h" | 9 #include "src/base/compiler-specific.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 BytecodeRegisterAllocator* register_allocator() { | 352 BytecodeRegisterAllocator* register_allocator() { |
353 return ®ister_allocator_; | 353 return ®ister_allocator_; |
354 } | 354 } |
355 const BytecodeRegisterAllocator* register_allocator() const { | 355 const BytecodeRegisterAllocator* register_allocator() const { |
356 return ®ister_allocator_; | 356 return ®ister_allocator_; |
357 } | 357 } |
358 Zone* zone() const { return zone_; } | 358 Zone* zone() const { return zone_; } |
359 | 359 |
360 private: | 360 private: |
361 friend class BytecodeRegisterAllocator; | 361 friend class BytecodeRegisterAllocator; |
362 template <OperandType... operand_types> | 362 template <Bytecode bytecode, AccumulatorUse accumulator_use, |
| 363 OperandType... operand_types> |
363 friend class BytecodeNodeBuilder; | 364 friend class BytecodeNodeBuilder; |
364 | 365 |
365 // Returns the current source position for the given |bytecode|. | 366 // Returns the current source position for the given |bytecode|. |
366 INLINE(BytecodeSourceInfo CurrentSourcePosition(Bytecode bytecode)); | 367 INLINE(BytecodeSourceInfo CurrentSourcePosition(Bytecode bytecode)); |
367 | 368 |
368 #define DECLARE_BYTECODE_OUTPUT(Name, ...) \ | 369 #define DECLARE_BYTECODE_OUTPUT(Name, ...) \ |
369 template <typename... Operands> \ | 370 template <typename... Operands> \ |
370 INLINE(void Output##Name(Operands... operands)); \ | 371 INLINE(void Output##Name(Operands... operands)); \ |
371 template <typename... Operands> \ | 372 template <typename... Operands> \ |
372 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); | 373 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); |
373 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) | 374 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) |
374 #undef DECLARE_OPERAND_TYPE_INFO | 375 #undef DECLARE_OPERAND_TYPE_INFO |
375 | 376 |
376 bool RegisterIsValid(Register reg) const; | 377 bool RegisterIsValid(Register reg) const; |
377 bool RegisterListIsValid(RegisterList reg_list) const; | 378 bool RegisterListIsValid(RegisterList reg_list) const; |
378 | 379 |
379 // Set position for return. | 380 // Set position for return. |
380 void SetReturnPosition(); | 381 void SetReturnPosition(); |
381 | 382 |
382 // Gets a constant pool entry for the |object|. | 383 // Gets a constant pool entry for the |object|. |
383 size_t GetConstantPoolEntry(Handle<Object> object); | 384 size_t GetConstantPoolEntry(Handle<Object> object); |
384 | 385 |
385 // Not implemented as the illegal bytecode is used inside internally | 386 // Not implemented as the illegal bytecode is used inside internally |
386 // to indicate a bytecode field is not valid or an error has occured | 387 // to indicate a bytecode field is not valid or an error has occured |
387 // during bytecode generation. | 388 // during bytecode generation. |
388 BytecodeArrayBuilder& Illegal(); | 389 BytecodeArrayBuilder& Illegal(); |
389 | 390 |
390 void PrepareToOutputBytecode(Bytecode bytecode); | 391 template <Bytecode bytecode, AccumulatorUse accumulator_use> |
| 392 void PrepareToOutputBytecode(); |
391 | 393 |
392 void LeaveBasicBlock() { return_seen_in_block_ = false; } | 394 void LeaveBasicBlock() { return_seen_in_block_ = false; } |
393 | 395 |
394 BytecodeArrayWriter* bytecode_array_writer() { | 396 BytecodeArrayWriter* bytecode_array_writer() { |
395 return &bytecode_array_writer_; | 397 return &bytecode_array_writer_; |
396 } | 398 } |
397 BytecodePipelineStage* pipeline() { return pipeline_; } | 399 BytecodePipelineStage* pipeline() { return pipeline_; } |
398 ConstantArrayBuilder* constant_array_builder() { | 400 ConstantArrayBuilder* constant_array_builder() { |
399 return &constant_array_builder_; | 401 return &constant_array_builder_; |
400 } | 402 } |
(...skipping 22 matching lines...) Expand all Loading... |
423 static int const kNoFeedbackSlot = 0; | 425 static int const kNoFeedbackSlot = 0; |
424 | 426 |
425 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 427 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
426 }; | 428 }; |
427 | 429 |
428 } // namespace interpreter | 430 } // namespace interpreter |
429 } // namespace internal | 431 } // namespace internal |
430 } // namespace v8 | 432 } // namespace v8 |
431 | 433 |
432 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 434 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |