Chromium Code Reviews| Index: src/interpreter/bytecode-array-builder.h |
| diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2372a322932ebd5abb8d6de798d73211447ff0cc |
| --- /dev/null |
| +++ b/src/interpreter/bytecode-array-builder.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2015 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| +#define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "src/interpreter/bytecodes.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| + |
| +class Isolate; |
| + |
| +namespace interpreter { |
| + |
| +class BytecodeArrayBuilder { |
| + public: |
| + explicit BytecodeArrayBuilder(Isolate* isolate); |
| + Handle<BytecodeArray> ToBytecodeArray() const; |
| + |
| + void BinaryOperation(Token::Value binop, int reg); |
|
rmcilroy
2015/07/30 10:12:25
optional suggestion - is it worth returning "this"
oth
2015/07/30 15:38:42
Done.
|
| + void LoadLiteral(v8::internal::Smi* value); |
|
rmcilroy
2015/07/30 10:12:25
nit - add some section header comments (e.g., "Loa
oth
2015/07/30 15:38:42
Done.
|
| + void LoadUndefined(); |
| + void LoadNull(); |
| + void LoadTheHole(); |
| + void LoadTrue(); |
| + void LoadFalse(); |
| + void LoadAccumulatorWithRegister(int reg); |
| + void StoreAccumulatorInRegister(int reg); |
| + void Return(); |
| + |
| + int AllocateScratchRegister(); |
| + void FreeScratchRegister(int reg); |
| + |
| + void set_stack_slots(int slots); |
| + |
| + private: |
| + static Bytecode BytecodeFor(Token::Value op); |
| + void Output(Bytecode bytecode, uint8_t r0, uint8_t r1, uint8_t r2); |
| + void Output(Bytecode bytecode, uint8_t r0, uint8_t r1); |
| + void Output(Bytecode bytecode, uint8_t r0); |
| + void Output(Bytecode bytecode); |
| + |
| + Isolate* isolate_; |
| + std::vector<uint8_t> bytecodes_; |
| + |
| + int max_registers_; |
| + int scratch_register_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder); |
| +}; |
| + |
| +} // namespace interpreter |
| +} // namespace internal |
| +} // namespace v8 |
| + |
| +#endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |