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 "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 // Exception handling. | 250 // Exception handling. |
251 BytecodeArrayBuilder& MarkHandler(int handler_id, bool will_catch); | 251 BytecodeArrayBuilder& MarkHandler(int handler_id, bool will_catch); |
252 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); | 252 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); |
253 BytecodeArrayBuilder& MarkTryEnd(int handler_id); | 253 BytecodeArrayBuilder& MarkTryEnd(int handler_id); |
254 | 254 |
255 // Creates a new handler table entry and returns a {hander_id} identifying the | 255 // Creates a new handler table entry and returns a {hander_id} identifying the |
256 // entry, so that it can be referenced by above exception handling support. | 256 // entry, so that it can be referenced by above exception handling support. |
257 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } | 257 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } |
258 | 258 |
| 259 void SetReturnPosition(FunctionLiteral* fun); |
259 void SetStatementPosition(Statement* stmt); | 260 void SetStatementPosition(Statement* stmt); |
260 void SetExpressionPosition(Expression* expr); | 261 void SetExpressionPosition(Expression* expr); |
261 | 262 |
262 // Accessors | 263 // Accessors |
263 Zone* zone() const { return zone_; } | 264 Zone* zone() const { return zone_; } |
264 TemporaryRegisterAllocator* temporary_register_allocator() { | 265 TemporaryRegisterAllocator* temporary_register_allocator() { |
265 return &temporary_allocator_; | 266 return &temporary_allocator_; |
266 } | 267 } |
267 const TemporaryRegisterAllocator* temporary_register_allocator() const { | 268 const TemporaryRegisterAllocator* temporary_register_allocator() const { |
268 return &temporary_allocator_; | 269 return &temporary_allocator_; |
269 } | 270 } |
270 | 271 |
| 272 void EnsureReturn(FunctionLiteral* literal); |
| 273 |
271 private: | 274 private: |
272 class PreviousBytecodeHelper; | 275 class PreviousBytecodeHelper; |
273 friend class BytecodeRegisterAllocator; | 276 friend class BytecodeRegisterAllocator; |
274 | 277 |
275 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 278 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
276 static Bytecode BytecodeForCountOperation(Token::Value op); | 279 static Bytecode BytecodeForCountOperation(Token::Value op); |
277 static Bytecode BytecodeForCompareOperation(Token::Value op); | 280 static Bytecode BytecodeForCompareOperation(Token::Value op); |
278 static Bytecode BytecodeForWideOperands(Bytecode bytecode); | 281 static Bytecode BytecodeForWideOperands(Bytecode bytecode); |
279 static Bytecode BytecodeForLoadIC(LanguageMode language_mode); | 282 static Bytecode BytecodeForLoadIC(LanguageMode language_mode); |
280 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode); | 283 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, | 320 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
318 BytecodeLabel* label); | 321 BytecodeLabel* label); |
319 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, | 322 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, |
320 const ZoneVector<uint8_t>::iterator& jump_location); | 323 const ZoneVector<uint8_t>::iterator& jump_location); |
321 void PatchIndirectJumpWith8BitOperand( | 324 void PatchIndirectJumpWith8BitOperand( |
322 const ZoneVector<uint8_t>::iterator& jump_location, int delta); | 325 const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
323 void PatchIndirectJumpWith16BitOperand( | 326 void PatchIndirectJumpWith16BitOperand( |
324 const ZoneVector<uint8_t>::iterator& jump_location, int delta); | 327 const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
325 | 328 |
326 void LeaveBasicBlock(); | 329 void LeaveBasicBlock(); |
327 void EnsureReturn(); | |
328 | 330 |
329 bool OperandIsValid(Bytecode bytecode, int operand_index, | 331 bool OperandIsValid(Bytecode bytecode, int operand_index, |
330 uint32_t operand_value) const; | 332 uint32_t operand_value) const; |
331 bool RegisterIsValid(Register reg, OperandType reg_type) const; | 333 bool RegisterIsValid(Register reg, OperandType reg_type) const; |
332 | 334 |
333 bool LastBytecodeInSameBlock() const; | 335 bool LastBytecodeInSameBlock() const; |
334 bool NeedToBooleanCast(); | 336 bool NeedToBooleanCast(); |
335 bool IsRegisterInAccumulator(Register reg); | 337 bool IsRegisterInAccumulator(Register reg); |
336 | 338 |
337 // Gets a constant pool entry for the |object|. | 339 // Gets a constant pool entry for the |object|. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 size_t offset_; | 415 size_t offset_; |
414 | 416 |
415 friend class BytecodeArrayBuilder; | 417 friend class BytecodeArrayBuilder; |
416 }; | 418 }; |
417 | 419 |
418 } // namespace interpreter | 420 } // namespace interpreter |
419 } // namespace internal | 421 } // namespace internal |
420 } // namespace v8 | 422 } // namespace v8 |
421 | 423 |
422 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 424 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |