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

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

Issue 1378523005: [Interpreter] Add support for global declarations and load/store of global variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_toplevel
Patch Set: Fix test Created 5 years, 2 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/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.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/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/interpreter-assembler.h" 9 #include "src/compiler/interpreter-assembler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Load the global at |slot_index| into the accumulator. 189 // Load the global at |slot_index| into the accumulator.
190 void Interpreter::DoLdaGlobal(compiler::InterpreterAssembler* assembler) { 190 void Interpreter::DoLdaGlobal(compiler::InterpreterAssembler* assembler) {
191 Node* slot_index = __ BytecodeOperandIdx8(0); 191 Node* slot_index = __ BytecodeOperandIdx8(0);
192 Node* smi_slot_index = __ SmiTag(slot_index); 192 Node* smi_slot_index = __ SmiTag(slot_index);
193 Node* result = __ CallRuntime(Runtime::kLoadGlobalViaContext, smi_slot_index); 193 Node* result = __ CallRuntime(Runtime::kLoadGlobalViaContext, smi_slot_index);
194 __ SetAccumulator(result); 194 __ SetAccumulator(result);
195 __ Dispatch(); 195 __ Dispatch();
196 } 196 }
197 197
198 198
199 // StaGlobal <slot_index>
200 //
201 // Store the global at |slot_index| with the value in the the accumulator.
202 void Interpreter::DoStaGlobal(compiler::InterpreterAssembler* assembler) {
203 Node* slot_index = __ BytecodeOperandIdx8(0);
204 Node* smi_slot_index = __ SmiTag(slot_index);
205 Node* value = __ GetAccumulator();
206 __ CallRuntime(Runtime::kStoreGlobalViaContext_Sloppy, smi_slot_index, value);
207 __ Dispatch();
208 }
209
210
211 // LdaContextSlot <context> <slot_index>
212 //
213 // Load the object in |slot_index| of |context| into the accumulator.
214 void Interpreter::DoLdaContextSlot(compiler::InterpreterAssembler* assembler) {
215 Node* reg_index = __ BytecodeOperandReg8(0);
216 Node* context = __ LoadRegister(reg_index);
217 Node* slot_index = __ BytecodeOperandIdx8(1);
218 Node* result = __ LoadContextSlot(context, slot_index);
219 __ SetAccumulator(result);
220 __ Dispatch();
221 }
222
223
199 void Interpreter::DoPropertyLoadIC(Callable ic, 224 void Interpreter::DoPropertyLoadIC(Callable ic,
200 compiler::InterpreterAssembler* assembler) { 225 compiler::InterpreterAssembler* assembler) {
201 Node* code_target = __ HeapConstant(ic.code()); 226 Node* code_target = __ HeapConstant(ic.code());
202 Node* reg_index = __ BytecodeOperandReg8(0); 227 Node* reg_index = __ BytecodeOperandReg8(0);
203 Node* object = __ LoadRegister(reg_index); 228 Node* object = __ LoadRegister(reg_index);
204 Node* name = __ GetAccumulator(); 229 Node* name = __ GetAccumulator();
205 Node* raw_slot = __ BytecodeOperandIdx8(1); 230 Node* raw_slot = __ BytecodeOperandIdx8(1);
206 Node* smi_slot = __ SmiTag(raw_slot); 231 Node* smi_slot = __ SmiTag(raw_slot);
207 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 232 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
208 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot, 233 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot,
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // 633 //
609 // Return the value in the accumulator. 634 // Return the value in the accumulator.
610 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 635 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
611 __ Return(); 636 __ Return();
612 } 637 }
613 638
614 639
615 } // namespace interpreter 640 } // namespace interpreter
616 } // namespace internal 641 } // namespace internal
617 } // namespace v8 642 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698