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