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

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

Issue 1294793002: [Interpreter] Add implementations for load immediate bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@interpreter_accum
Patch Set: Rebased 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
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bytecode-generator.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Handle<FixedArray> handler_table) { 82 Handle<FixedArray> handler_table) {
83 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1); 83 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1);
84 return handler_table->get(0) != isolate_->heap()->undefined_value(); 84 return handler_table->get(0) != isolate_->heap()->undefined_value();
85 } 85 }
86 86
87 87
88 // LdaZero 88 // LdaZero
89 // 89 //
90 // Load literal '0' into the accumulator. 90 // Load literal '0' into the accumulator.
91 void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) { 91 void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) {
92 // TODO(rmcilroy) Implement. 92 Node* zero_value = __ NumberConstant(0.0);
93 __ SetAccumulator(zero_value);
93 __ Dispatch(); 94 __ Dispatch();
94 } 95 }
95 96
96 97
97 // LdaSmi8 <imm8> 98 // LdaSmi8 <imm8>
98 // 99 //
99 // Load an 8-bit integer literal into the accumulator as a Smi. 100 // Load an 8-bit integer literal into the accumulator as a Smi.
100 void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) { 101 void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) {
101 // TODO(rmcilroy) Implement 8-bit integer to SMI promotion. 102 Node* raw_int = __ BytecodeOperandImm8(0);
103 Node* smi_int = __ SmiTag(raw_int);
104 __ SetAccumulator(smi_int);
102 __ Dispatch(); 105 __ Dispatch();
103 } 106 }
104 107
105 108
106 // LdaUndefined 109 // LdaUndefined
107 // 110 //
108 // Load Undefined into the accumulator. 111 // Load Undefined into the accumulator.
109 void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) { 112 void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
110 // TODO(rmcilroy) Implement. 113 Node* undefined_value = __ HeapConstant(Unique<HeapObject>::CreateImmovable(
114 isolate_->factory()->undefined_value()));
115 __ SetAccumulator(undefined_value);
111 __ Dispatch(); 116 __ Dispatch();
112 } 117 }
113 118
114 119
115 // LdaNull 120 // LdaNull
116 // 121 //
117 // Load Null into the accumulator. 122 // Load Null into the accumulator.
118 void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) { 123 void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
119 // TODO(rmcilroy) Implement. 124 Node* null_value = __ HeapConstant(
125 Unique<HeapObject>::CreateImmovable(isolate_->factory()->null_value()));
126 __ SetAccumulator(null_value);
120 __ Dispatch(); 127 __ Dispatch();
121 } 128 }
122 129
123 130
124 // LdaTheHole 131 // LdaTheHole
125 // 132 //
126 // Load TheHole into the accumulator. 133 // Load TheHole into the accumulator.
127 void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) { 134 void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
128 // TODO(rmcilroy) Implement. 135 Node* the_hole_value = __ HeapConstant(Unique<HeapObject>::CreateImmovable(
136 isolate_->factory()->the_hole_value()));
137 __ SetAccumulator(the_hole_value);
129 __ Dispatch(); 138 __ Dispatch();
130 } 139 }
131 140
132 141
133 // LdaTrue 142 // LdaTrue
134 // 143 //
135 // Load True into the accumulator. 144 // Load True into the accumulator.
136 void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) { 145 void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
137 // TODO(rmcilroy) Implement. 146 Node* true_value = __ HeapConstant(
147 Unique<HeapObject>::CreateImmovable(isolate_->factory()->true_value()));
148 __ SetAccumulator(true_value);
138 __ Dispatch(); 149 __ Dispatch();
139 } 150 }
140 151
141 152
142 // LdaFalse 153 // LdaFalse
143 // 154 //
144 // Load False into the accumulator. 155 // Load False into the accumulator.
145 void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) { 156 void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) {
146 // TODO(rmcilroy) Implement. 157 Node* false_value = __ HeapConstant(
158 Unique<HeapObject>::CreateImmovable(isolate_->factory()->false_value()));
159 __ SetAccumulator(false_value);
147 __ Dispatch(); 160 __ Dispatch();
148 } 161 }
149 162
150 163
151 // Ldar <src> 164 // Ldar <src>
152 // 165 //
153 // Load accumulator with value from register <src>. 166 // Load accumulator with value from register <src>.
154 void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) { 167 void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) {
155 // TODO(rmcilroy) Implement. 168 Node* value = __ LoadRegister(__ BytecodeOperandReg(0));
169 __ SetAccumulator(value);
156 __ Dispatch(); 170 __ Dispatch();
157 } 171 }
158 172
159 173
160 // Star <dst> 174 // Star <dst>
161 // 175 //
162 // Store accumulator to register <dst>. 176 // Store accumulator to register <dst>.
163 void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) { 177 void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) {
164 // TODO(rmcilroy) Implement. 178 Node* reg_index = __ BytecodeOperandReg(0);
179 Node* accumulator = __ GetAccumulator();
180 __ StoreRegister(accumulator, reg_index);
165 __ Dispatch(); 181 __ Dispatch();
166 } 182 }
167 183
168 184
169 // Add <src> 185 // Add <src>
170 // 186 //
171 // Add register <src> to accumulator. 187 // Add register <src> to accumulator.
172 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) { 188 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) {
173 // TODO(rmcilroy) Implement. 189 // TODO(rmcilroy) Implement.
174 __ Dispatch(); 190 __ Dispatch();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // 222 //
207 // Return the value in register 0. 223 // Return the value in register 0.
208 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 224 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
209 __ Return(); 225 __ Return();
210 } 226 }
211 227
212 228
213 } // namespace interpreter 229 } // namespace interpreter
214 } // namespace internal 230 } // namespace internal
215 } // namespace v8 231 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698