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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Isolate* isolate() const { return isolate_; } | 106 Isolate* isolate() const { return isolate_; } |
107 | 107 |
108 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 108 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
109 static Bytecode BytecodeForCompareOperation(Token::Value op); | 109 static Bytecode BytecodeForCompareOperation(Token::Value op); |
110 static bool FitsInIdxOperand(int value); | 110 static bool FitsInIdxOperand(int value); |
111 static bool FitsInIdxOperand(size_t value); | 111 static bool FitsInIdxOperand(size_t value); |
112 static bool FitsInImm8Operand(int value); | 112 static bool FitsInImm8Operand(int value); |
113 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); | 113 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); |
114 | 114 |
115 template <size_t N> | 115 template <size_t N> |
116 INLINE(void Output(uint8_t(&bytes)[N])); | 116 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); |
117 void Output(Bytecode bytecode, uint8_t operand0, uint8_t operand1, | 117 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
118 uint8_t operand2); | 118 uint32_t operand2); |
119 void Output(Bytecode bytecode, uint8_t operand0, uint8_t operand1); | 119 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); |
120 void Output(Bytecode bytecode, uint8_t operand0); | 120 void Output(Bytecode bytecode, uint32_t operand0); |
121 void Output(Bytecode bytecode); | 121 void Output(Bytecode bytecode); |
| 122 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
| 123 BytecodeLabel* label); |
122 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, | 124 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, |
123 ZoneVector<uint8_t>::iterator jump_location); | 125 ZoneVector<uint8_t>::iterator jump_location); |
124 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, | |
125 BytecodeLabel* label); | |
126 | 126 |
127 void EnsureReturn(); | 127 void EnsureReturn(); |
128 | 128 |
129 bool OperandIsValid(Bytecode bytecode, int operand_index, | 129 bool OperandIsValid(Bytecode bytecode, int operand_index, |
130 uint8_t operand_value) const; | 130 uint32_t operand_value) const; |
131 bool LastBytecodeInSameBlock() const; | 131 bool LastBytecodeInSameBlock() const; |
132 | 132 |
133 size_t GetConstantPoolEntry(Handle<Object> object); | 133 size_t GetConstantPoolEntry(Handle<Object> object); |
134 | 134 |
135 // Scope helpers used by TemporaryRegisterScope | 135 // Scope helpers used by TemporaryRegisterScope |
136 int BorrowTemporaryRegister(); | 136 int BorrowTemporaryRegister(); |
137 void ReturnTemporaryRegister(int reg_index); | 137 void ReturnTemporaryRegister(int reg_index); |
138 | 138 |
139 Isolate* isolate_; | 139 Isolate* isolate_; |
140 Zone* zone_; | 140 Zone* zone_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 214 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
215 }; | 215 }; |
216 | 216 |
217 | 217 |
218 } // namespace interpreter | 218 } // namespace interpreter |
219 } // namespace internal | 219 } // namespace internal |
220 } // namespace v8 | 220 } // namespace v8 |
221 | 221 |
222 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 222 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |