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_WRITER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
7 | 7 |
8 #include "src/interpreter/bytecode-pipeline.h" | 8 #include "src/interpreter/bytecode-pipeline.h" |
9 #include "src/source-position-table.h" | 9 #include "src/source-position-table.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 Zone* zone, ConstantArrayBuilder* constant_array_builder, | 26 Zone* zone, ConstantArrayBuilder* constant_array_builder, |
27 SourcePositionTableBuilder::RecordingMode source_position_mode); | 27 SourcePositionTableBuilder::RecordingMode source_position_mode); |
28 virtual ~BytecodeArrayWriter(); | 28 virtual ~BytecodeArrayWriter(); |
29 | 29 |
30 // BytecodePipelineStage interface. | 30 // BytecodePipelineStage interface. |
31 void Write(BytecodeNode* node) override; | 31 void Write(BytecodeNode* node) override; |
32 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; | 32 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; |
33 void BindLabel(BytecodeLabel* label) override; | 33 void BindLabel(BytecodeLabel* label) override; |
34 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; | 34 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; |
35 Handle<BytecodeArray> ToBytecodeArray( | 35 Handle<BytecodeArray> ToBytecodeArray( |
36 Isolate* isolate, int fixed_register_count, int parameter_count, | 36 Isolate* isolate, int register_count, int parameter_count, |
37 Handle<FixedArray> handler_table) override; | 37 Handle<FixedArray> handler_table) override; |
38 | 38 |
39 private: | 39 private: |
40 // Maximum sized packed bytecode is comprised of a prefix bytecode, | 40 // Maximum sized packed bytecode is comprised of a prefix bytecode, |
41 // plus the actual bytecode, plus the maximum number of operands times | 41 // plus the actual bytecode, plus the maximum number of operands times |
42 // the maximum operand size. | 42 // the maximum operand size. |
43 static const size_t kMaxSizeOfPackedBytecode = | 43 static const size_t kMaxSizeOfPackedBytecode = |
44 2 * sizeof(Bytecode) + | 44 2 * sizeof(Bytecode) + |
45 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast); | 45 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast); |
46 | 46 |
(...skipping 15 matching lines...) Expand all Loading... |
62 void EmitJump(BytecodeNode* node, BytecodeLabel* label); | 62 void EmitJump(BytecodeNode* node, BytecodeLabel* label); |
63 void UpdateSourcePositionTable(const BytecodeNode* const node); | 63 void UpdateSourcePositionTable(const BytecodeNode* const node); |
64 | 64 |
65 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } | 65 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
66 SourcePositionTableBuilder* source_position_table_builder() { | 66 SourcePositionTableBuilder* source_position_table_builder() { |
67 return &source_position_table_builder_; | 67 return &source_position_table_builder_; |
68 } | 68 } |
69 ConstantArrayBuilder* constant_array_builder() { | 69 ConstantArrayBuilder* constant_array_builder() { |
70 return constant_array_builder_; | 70 return constant_array_builder_; |
71 } | 71 } |
72 int max_register_count() { return max_register_count_; } | |
73 | 72 |
74 ZoneVector<uint8_t> bytecodes_; | 73 ZoneVector<uint8_t> bytecodes_; |
75 int max_register_count_; | |
76 int unbound_jumps_; | 74 int unbound_jumps_; |
77 SourcePositionTableBuilder source_position_table_builder_; | 75 SourcePositionTableBuilder source_position_table_builder_; |
78 ConstantArrayBuilder* constant_array_builder_; | 76 ConstantArrayBuilder* constant_array_builder_; |
79 | 77 |
80 friend class BytecodeArrayWriterUnittest; | 78 friend class BytecodeArrayWriterUnittest; |
81 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); | 79 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); |
82 }; | 80 }; |
83 | 81 |
84 } // namespace interpreter | 82 } // namespace interpreter |
85 } // namespace internal | 83 } // namespace internal |
86 } // namespace v8 | 84 } // namespace v8 |
87 | 85 |
88 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ | 86 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
OLD | NEW |