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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); | 185 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); |
186 | 186 |
187 BytecodeArrayBuilder& Throw(); | 187 BytecodeArrayBuilder& Throw(); |
188 BytecodeArrayBuilder& Return(); | 188 BytecodeArrayBuilder& Return(); |
189 | 189 |
190 // Complex flow control. | 190 // Complex flow control. |
191 BytecodeArrayBuilder& ForInPrepare(Register receiver); | 191 BytecodeArrayBuilder& ForInPrepare(Register receiver); |
192 BytecodeArrayBuilder& ForInNext(Register for_in_state, Register index); | 192 BytecodeArrayBuilder& ForInNext(Register for_in_state, Register index); |
193 BytecodeArrayBuilder& ForInDone(Register for_in_state); | 193 BytecodeArrayBuilder& ForInDone(Register for_in_state); |
194 | 194 |
195 BytecodeArrayBuilder& EnterBlock(); | |
196 BytecodeArrayBuilder& LeaveBlock(); | |
197 | |
198 // Accessors | 195 // Accessors |
199 Zone* zone() const { return zone_; } | 196 Zone* zone() const { return zone_; } |
200 | 197 |
201 private: | 198 private: |
202 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } | 199 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
203 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } | 200 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } |
204 Isolate* isolate() const { return isolate_; } | 201 Isolate* isolate() const { return isolate_; } |
205 | 202 |
206 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 203 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
207 static Bytecode BytecodeForCountOperation(Token::Value op); | 204 static Bytecode BytecodeForCountOperation(Token::Value op); |
(...skipping 23 matching lines...) Expand all Loading... |
231 uint32_t operand2); | 228 uint32_t operand2); |
232 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); | 229 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); |
233 void Output(Bytecode bytecode, uint32_t operand0); | 230 void Output(Bytecode bytecode, uint32_t operand0); |
234 void Output(Bytecode bytecode); | 231 void Output(Bytecode bytecode); |
235 | 232 |
236 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, | 233 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
237 BytecodeLabel* label); | 234 BytecodeLabel* label); |
238 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, | 235 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, |
239 ZoneVector<uint8_t>::iterator jump_location); | 236 ZoneVector<uint8_t>::iterator jump_location); |
240 | 237 |
| 238 void LeaveBasicBlock(); |
241 void EnsureReturn(); | 239 void EnsureReturn(); |
242 | 240 |
243 bool OperandIsValid(Bytecode bytecode, int operand_index, | 241 bool OperandIsValid(Bytecode bytecode, int operand_index, |
244 uint32_t operand_value) const; | 242 uint32_t operand_value) const; |
245 bool LastBytecodeInSameBlock() const; | 243 bool LastBytecodeInSameBlock() const; |
246 | 244 |
247 bool NeedToBooleanCast(); | 245 bool NeedToBooleanCast(); |
248 | 246 |
249 int BorrowTemporaryRegister(); | 247 int BorrowTemporaryRegister(); |
250 void ReturnTemporaryRegister(int reg_index); | 248 void ReturnTemporaryRegister(int reg_index); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 342 |
345 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 343 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
346 }; | 344 }; |
347 | 345 |
348 | 346 |
349 } // namespace interpreter | 347 } // namespace interpreter |
350 } // namespace internal | 348 } // namespace internal |
351 } // namespace v8 | 349 } // namespace v8 |
352 | 350 |
353 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 351 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |