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