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 18 matching lines...) Expand all Loading... |
29 // BytecodePipelineStage interface. | 29 // BytecodePipelineStage interface. |
30 void Write(BytecodeNode* node) override; | 30 void Write(BytecodeNode* node) override; |
31 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; | 31 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; |
32 void BindLabel(BytecodeLabel* label) override; | 32 void BindLabel(BytecodeLabel* label) override; |
33 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; | 33 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; |
34 Handle<BytecodeArray> ToBytecodeArray( | 34 Handle<BytecodeArray> ToBytecodeArray( |
35 int fixed_register_count, int parameter_count, | 35 int fixed_register_count, int parameter_count, |
36 Handle<FixedArray> handler_table) override; | 36 Handle<FixedArray> handler_table) override; |
37 | 37 |
38 private: | 38 private: |
| 39 // Maximum sized packed bytecode is comprised of a prefix bytecode, |
| 40 // plus the actual bytecode, plus the maximum number of operands times |
| 41 // the maximum operand size. |
| 42 static const size_t kMaxSizeOfPackedBytecode = |
| 43 2 * sizeof(Bytecode) + |
| 44 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast); |
| 45 |
39 // Constants that act as placeholders for jump operands to be | 46 // Constants that act as placeholders for jump operands to be |
40 // patched. These have operand sizes that match the sizes of | 47 // patched. These have operand sizes that match the sizes of |
41 // reserved constant pool entries. | 48 // reserved constant pool entries. |
42 const uint32_t k8BitJumpPlaceholder = 0x7f; | 49 const uint32_t k8BitJumpPlaceholder = 0x7f; |
43 const uint32_t k16BitJumpPlaceholder = | 50 const uint32_t k16BitJumpPlaceholder = |
44 k8BitJumpPlaceholder | (k8BitJumpPlaceholder << 8); | 51 k8BitJumpPlaceholder | (k8BitJumpPlaceholder << 8); |
45 const uint32_t k32BitJumpPlaceholder = | 52 const uint32_t k32BitJumpPlaceholder = |
46 k16BitJumpPlaceholder | (k16BitJumpPlaceholder << 16); | 53 k16BitJumpPlaceholder | (k16BitJumpPlaceholder << 16); |
47 | 54 |
48 void PatchJump(size_t jump_target, size_t jump_location); | 55 void PatchJump(size_t jump_target, size_t jump_location); |
(...skipping 24 matching lines...) Expand all Loading... |
73 | 80 |
74 friend class BytecodeArrayWriterUnittest; | 81 friend class BytecodeArrayWriterUnittest; |
75 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); | 82 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); |
76 }; | 83 }; |
77 | 84 |
78 } // namespace interpreter | 85 } // namespace interpreter |
79 } // namespace internal | 86 } // namespace internal |
80 } // namespace v8 | 87 } // namespace v8 |
81 | 88 |
82 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ | 89 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
OLD | NEW |