Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 BytecodeArrayBuilder& CastAccumulatorToName(); | 173 BytecodeArrayBuilder& CastAccumulatorToName(); |
| 174 BytecodeArrayBuilder& CastAccumulatorToNumber(); | 174 BytecodeArrayBuilder& CastAccumulatorToNumber(); |
| 175 | 175 |
| 176 // Flow Control. | 176 // Flow Control. |
| 177 BytecodeArrayBuilder& Bind(BytecodeLabel* label); | 177 BytecodeArrayBuilder& Bind(BytecodeLabel* label); |
| 178 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); | 178 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); |
| 179 | 179 |
| 180 BytecodeArrayBuilder& Jump(BytecodeLabel* label); | 180 BytecodeArrayBuilder& Jump(BytecodeLabel* label); |
| 181 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); | 181 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); |
| 182 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); | 182 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); |
| 183 // TODO(mythria) The following two functions should be merged into | |
| 184 // JumpIfTrue/False. These bytecodes should be automatically chosen rather | |
| 185 // than explicitly using them. | |
| 186 BytecodeArrayBuilder& JumpIfToBooleanTrue(BytecodeLabel* label); | |
| 187 BytecodeArrayBuilder& JumpIfToBooleanFalse(BytecodeLabel* label); | |
| 188 | 183 |
| 189 BytecodeArrayBuilder& Throw(); | 184 BytecodeArrayBuilder& Throw(); |
| 190 BytecodeArrayBuilder& Return(); | 185 BytecodeArrayBuilder& Return(); |
| 191 | 186 |
| 192 BytecodeArrayBuilder& EnterBlock(); | 187 BytecodeArrayBuilder& EnterBlock(); |
| 193 BytecodeArrayBuilder& LeaveBlock(); | 188 BytecodeArrayBuilder& LeaveBlock(); |
| 194 | 189 |
| 195 // Accessors | 190 // Accessors |
| 196 Zone* zone() const { return zone_; } | 191 Zone* zone() const { return zone_; } |
| 197 | 192 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 211 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); | 206 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); |
| 212 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); | 207 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); |
| 213 static Bytecode BytecodeForDelete(LanguageMode language_mode); | 208 static Bytecode BytecodeForDelete(LanguageMode language_mode); |
| 214 | 209 |
| 215 static bool FitsInIdx8Operand(int value); | 210 static bool FitsInIdx8Operand(int value); |
| 216 static bool FitsInIdx8Operand(size_t value); | 211 static bool FitsInIdx8Operand(size_t value); |
| 217 static bool FitsInImm8Operand(int value); | 212 static bool FitsInImm8Operand(int value); |
| 218 static bool FitsInIdx16Operand(int value); | 213 static bool FitsInIdx16Operand(int value); |
| 219 | 214 |
| 220 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); | 215 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); |
| 216 static Bytecode GetJumpWithToBoolean(Bytecode jump); | |
| 221 | 217 |
| 222 template <size_t N> | 218 template <size_t N> |
| 223 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); | 219 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); |
| 224 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 220 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 225 uint32_t operand2); | 221 uint32_t operand2); |
| 226 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); | 222 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); |
| 227 void Output(Bytecode bytecode, uint32_t operand0); | 223 void Output(Bytecode bytecode, uint32_t operand0); |
| 228 void Output(Bytecode bytecode); | 224 void Output(Bytecode bytecode); |
| 229 | 225 |
| 230 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, | 226 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
| 231 BytecodeLabel* label); | 227 BytecodeLabel* label); |
| 232 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, | 228 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, |
| 233 ZoneVector<uint8_t>::iterator jump_location); | 229 ZoneVector<uint8_t>::iterator jump_location); |
| 234 | 230 |
| 235 void EnsureReturn(); | 231 void EnsureReturn(); |
| 236 | 232 |
| 237 bool OperandIsValid(Bytecode bytecode, int operand_index, | 233 bool OperandIsValid(Bytecode bytecode, int operand_index, |
| 238 uint32_t operand_value) const; | 234 uint32_t operand_value) const; |
| 239 bool LastBytecodeInSameBlock() const; | 235 bool LastBytecodeInSameBlock() const; |
| 240 | 236 |
| 237 bool IsAccumulatorBoolean(); | |
|
oth
2015/10/30 10:46:32
For readability I'd suggest changing the name to N
mythria
2015/10/30 11:44:47
Done.
| |
| 238 | |
| 241 int BorrowTemporaryRegister(); | 239 int BorrowTemporaryRegister(); |
| 242 void ReturnTemporaryRegister(int reg_index); | 240 void ReturnTemporaryRegister(int reg_index); |
| 243 int PrepareForConsecutiveTemporaryRegisters(size_t count); | 241 int PrepareForConsecutiveTemporaryRegisters(size_t count); |
| 244 void BorrowConsecutiveTemporaryRegister(int reg_index); | 242 void BorrowConsecutiveTemporaryRegister(int reg_index); |
| 245 bool TemporaryRegisterIsLive(Register reg) const; | 243 bool TemporaryRegisterIsLive(Register reg) const; |
| 246 | 244 |
| 247 Register first_temporary_register() const; | 245 Register first_temporary_register() const; |
| 248 Register last_temporary_register() const; | 246 Register last_temporary_register() const; |
| 249 | 247 |
| 250 Isolate* isolate_; | 248 Isolate* isolate_; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 | 333 |
| 336 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 334 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
| 337 }; | 335 }; |
| 338 | 336 |
| 339 | 337 |
| 340 } // namespace interpreter | 338 } // namespace interpreter |
| 341 } // namespace internal | 339 } // namespace internal |
| 342 } // namespace v8 | 340 } // namespace v8 |
| 343 | 341 |
| 344 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 342 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |