| 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 // Constants that act as placeholders for jump operands to be |
| 38 // patched. These have operand sizes that match the sizes of |
| 39 // reserved constant pool entries. |
| 40 const uint32_t k8BitJumpPlaceholder = 0x7f; |
| 41 const uint32_t k16BitJumpPlaceholder = |
| 42 k8BitJumpPlaceholder | (k8BitJumpPlaceholder << 8); |
| 43 const uint32_t k32BitJumpPlaceholder = |
| 44 k16BitJumpPlaceholder | (k16BitJumpPlaceholder << 16); |
| 45 |
| 37 void PatchJump(size_t jump_target, size_t jump_location); | 46 void PatchJump(size_t jump_target, size_t jump_location); |
| 38 void PatchJumpWith8BitOperand(size_t jump_location, int delta); | 47 void PatchJumpWith8BitOperand(size_t jump_location, int delta); |
| 39 void PatchJumpWith16BitOperand(size_t jump_location, int delta); | 48 void PatchJumpWith16BitOperand(size_t jump_location, int delta); |
| 40 void PatchJumpWith32BitOperand(size_t jump_location, int delta); | 49 void PatchJumpWith32BitOperand(size_t jump_location, int delta); |
| 41 | 50 |
| 42 void EmitBytecode(const BytecodeNode* const node); | 51 void EmitBytecode(const BytecodeNode* const node); |
| 43 void EmitJump(BytecodeNode* node, BytecodeLabel* label); | 52 void EmitJump(BytecodeNode* node, BytecodeLabel* label); |
| 44 void UpdateSourcePositionTable(const BytecodeNode* const node); | 53 void UpdateSourcePositionTable(const BytecodeNode* const node); |
| 45 | 54 |
| 46 Isolate* isolate() { return isolate_; } | 55 Isolate* isolate() { return isolate_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 62 | 71 |
| 63 friend class BytecodeArrayWriterUnittest; | 72 friend class BytecodeArrayWriterUnittest; |
| 64 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); | 73 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); |
| 65 }; | 74 }; |
| 66 | 75 |
| 67 } // namespace interpreter | 76 } // namespace interpreter |
| 68 } // namespace internal | 77 } // namespace internal |
| 69 } // namespace v8 | 78 } // namespace v8 |
| 70 | 79 |
| 71 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ | 80 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
| OLD | NEW |