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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1266713004: [Intepreter] Addition of BytecodeArrayBuilder and accumulator based bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweak BytecodeArray::Disassemble(). 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
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 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/interpreter-assembler.h" 8 #include "src/compiler/interpreter-assembler.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/interpreter/bytecode-generator.h"
10 #include "src/interpreter/bytecodes.h" 11 #include "src/interpreter/bytecodes.h"
11 #include "src/zone.h" 12 #include "src/zone.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 namespace interpreter { 16 namespace interpreter {
16 17
17 using compiler::Node; 18 using compiler::Node;
18 #define __ assembler-> 19 #define __ assembler->
19 20
(...skipping 17 matching lines...) Expand all
37 Do##Name(&assembler); \ 38 Do##Name(&assembler); \
38 Handle<Code> code = assembler.GenerateCode(); \ 39 Handle<Code> code = assembler.GenerateCode(); \
39 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ 40 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
40 } 41 }
41 BYTECODE_LIST(GENERATE_CODE) 42 BYTECODE_LIST(GENERATE_CODE)
42 #undef GENERATE_CODE 43 #undef GENERATE_CODE
43 } 44 }
44 } 45 }
45 46
46 47
48 // static
49 bool Interpreter::MakeBytecode(CompilationInfo* info) {
50 Handle<SharedFunctionInfo> shared_info =
51 Compiler::GetSharedFunctionInfo(info->function(), info->script(), info);
52 BytecodeGenerator generator(info->isolate(), info->zone());
53 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info);
54 bytecodes->Print();
rmcilroy 2015/07/30 10:12:25 nit - add a flag for printing the bytecodes (e.g.,
oth 2015/07/30 15:38:43 Done in the bytecode generation CL.
55
56 CHECK(shared_info->function_data()->IsUndefined());
57 shared_info->set_function_data(*bytecodes);
58 // info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline());
rmcilroy 2015/07/30 10:12:25 Just do this?
oth 2015/07/30 15:38:43 Other CL.
59 info->EnsureFeedbackVector();
60 return true;
61 }
62
63
47 // LoadLiteral0 <dst> 64 // LoadLiteral0 <dst>
48 // 65 //
49 // Load literal '0' into the destination register. 66 // Load literal '0' into the destination register.
50 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { 67 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) {
51 Node* register_index = __ BytecodeOperand(0); 68 Node* register_index = __ BytecodeOperand(0);
52 __ StoreRegister(__ NumberConstant(0), register_index); 69 __ StoreRegister(__ NumberConstant(0), register_index);
53 __ Dispatch(); 70 __ Dispatch();
54 } 71 }
55 72
56 73
57 // LoadSmi8 <dst>, <imm8> 74 // LoadSmi8 <dst>, <imm8>
58 // 75 //
59 // Load an 8-bit integer literal into destination register as a Smi. 76 // Load an 8-bit integer literal into destination register as a Smi.
60 void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) { 77 void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) {
61 // TODO(rmcilroy) Convert an 8-bit integer to a Smi. 78 // TODO(rmcilroy) Implement 8-bit integer to SMI promotion.
62 } 79 }
63 80
64 81
82 // LdaUndefined
83 //
84 // Load Undefined into the accumulator.
85 void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
86 // TODO(rmcilroy) Implement.
87 }
88
89
90 // LdaNull
91 //
92 // Load Null into the accumulator.
93 void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
94 // TODO(rmcilroy) Implement.
95 }
96
97
98 // LdaTheHole
99 //
100 // Load TheHole into the accumulator.
101 void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
102 // TODO(rmcilroy) Implement.
103 }
104
105
106 // LdaTrue
107 //
108 // Load True into the accumulator.
109 void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
110 // TODO(rmcilroy) Implement.
111 }
112
113
114 // LdaFalse
115 //
116 // Load False into the accumulator.
117 void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) {
118 // TODO(rmcilroy) Implement.
119 }
120
121
122 // Ldar <src>
123 //
124 // Load accumulator with value from register <src>.
125 void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) {
126 // TODO(rmcilroy) Implement.
127 }
128
129
130 // Stra <dst>
131 //
132 // Store accumulator to register <dst>.
133 void Interpreter::DoStra(compiler::InterpreterAssembler* assembler) {
134 // TODO(rmcilroy) Implement.
135 }
136
137
138 // Add <src>
139 //
140 // Add register <src> to accumulator.
141 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) {
142 // TODO(rmcilroy) Implement.
143 }
144
145
146 // Sub <src>
147 //
148 // Subtract register <src> from accumulator.
149 void Interpreter::DoSub(compiler::InterpreterAssembler* assembler) {
150 // TODO(rmcilroy) Implement.
151 }
152
153
154 // Mul <src>
155 //
156 // Multiply accumulator by register <src>.
157 void Interpreter::DoMul(compiler::InterpreterAssembler* assembler) {
158 // TODO(rmcilroy) Implement add register to accumulator.
159 }
160
161
162 // Div <src>
163 //
164 // Divide register <src> by accumulator.
165 void Interpreter::DoDiv(compiler::InterpreterAssembler* assembler) {
166 // TODO(rmcilroy) Implement.
167 }
168
169
65 // Return 170 // Return
66 // 171 //
67 // Return the value in register 0. 172 // Return the value in register 0.
68 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 173 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
69 // TODO(rmcilroy) Jump to exit trampoline. 174 // TODO(rmcilroy) Jump to exit trampoline.
70 } 175 }
71 176
72 177
73 } // namespace interpreter 178 } // namespace interpreter
74 } // namespace internal 179 } // namespace internal
75 } // namespace v8 180 } // namespace v8
OLDNEW
« src/interpreter/bytecodes.h ('K') | « src/interpreter/interpreter.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698