Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: src/interpreter/bytecode-array-builder.h

Issue 1266713004: [Intepreter] Addition of BytecodeArrayBuilder and accumulator based bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move generator to a separate CL and patch set 1 comments. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7
8 #include <vector>
9
10 #include "src/ast.h"
11 #include "src/interpreter/bytecodes.h"
12
13 namespace v8 {
14 namespace internal {
15
16 class Isolate;
17
18 namespace interpreter {
19
20 class BytecodeArrayBuilder {
21 public:
22 explicit BytecodeArrayBuilder(Isolate* isolate);
23 Handle<BytecodeArray> ToBytecodeArray();
24
25 // Set number of locals required for bytecode.
rmcilroy 2015/07/31 09:56:19 s/for bytecode/by bytecode array/
oth 2015/07/31 11:20:59 Done.
26 void set_locals_count(int number_of_locals);
27
28 // Allocate temporary register used during expression evaluation.
29 int AllocateTemporaryRegister();
30
31 // Free temporary register used during expression evaluation.
32 void FreeTemporaryRegister(int reg);
33
34 // ===========================================================================
35 // ====================== Constant loads to accumulator ======================
36 // ===========================================================================
rmcilroy 2015/07/31 09:56:19 nit - this type of header format isn't very common
oth 2015/07/31 11:20:59 Done. It's copied compiler/code-generator.h.
37
38 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value);
39 BytecodeArrayBuilder& LoadUndefined();
40 BytecodeArrayBuilder& LoadNull();
41 BytecodeArrayBuilder& LoadTheHole();
42 BytecodeArrayBuilder& LoadTrue();
43 BytecodeArrayBuilder& LoadFalse();
44
45 // ===========================================================================
46 // ====================== Register-accumulator transfers =====================
47 // ===========================================================================
48
49 BytecodeArrayBuilder& LoadAccumulatorWithRegister(int reg);
50 BytecodeArrayBuilder& StoreAccumulatorInRegister(int reg);
51
52 // ===========================================================================
53 // ================================ Operators ================================
54 // ===========================================================================
55
56 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, int reg);
57
58 // ===========================================================================
59 // ============================== Flow Control ===============================
60 // ===========================================================================
61
62 BytecodeArrayBuilder& Return();
63
64 private:
65 static Bytecode BytecodeForBinaryOperation(Token::Value op);
66 void Output(Bytecode bytecode, uint8_t r0, uint8_t r1, uint8_t r2);
67 void Output(Bytecode bytecode, uint8_t r0, uint8_t r1);
68 void Output(Bytecode bytecode, uint8_t r0);
69 void Output(Bytecode bytecode);
70
71 Isolate* isolate_;
72 std::vector<uint8_t> bytecodes_;
73 bool bytecode_generated_;
74
75 int local_register_count_;
76 int temporary_register_count_;
77 int temporary_register_next_;
78 DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder);
79 };
80
81 } // namespace interpreter
82 } // namespace internal
83 } // namespace v8
84
85 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.cc » ('j') | src/interpreter/bytecode-array-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698