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

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

Issue 1406183002: [Interpreter] Add support for strict mode global stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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.h ('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> 199 // StaGlobalSloppy <slot_index>
200 // 200 //
201 // Store the global at |slot_index| with the value in the the accumulator. 201 // Store the global at |slot_index| with the value in the the accumulator in
202 void Interpreter::DoStaGlobal(compiler::InterpreterAssembler* assembler) { 202 // sloppy mode.
203 void Interpreter::DoStaGlobalSloppy(compiler::InterpreterAssembler* assembler) {
203 Node* slot_index = __ BytecodeOperandIdx8(0); 204 Node* slot_index = __ BytecodeOperandIdx8(0);
204 Node* smi_slot_index = __ SmiTag(slot_index); 205 Node* smi_slot_index = __ SmiTag(slot_index);
205 Node* value = __ GetAccumulator(); 206 Node* value = __ GetAccumulator();
206 __ CallRuntime(Runtime::kStoreGlobalViaContext_Sloppy, smi_slot_index, value); 207 __ CallRuntime(Runtime::kStoreGlobalViaContext_Sloppy, smi_slot_index, value);
207 __ Dispatch(); 208 __ Dispatch();
208 } 209 }
209 210
210 211
212 // StaGlobalStrict <slot_index>
213 //
214 // Store the global at |slot_index| with the value in the the accumulator in
215 // strict mode.
216 void Interpreter::DoStaGlobalStrict(compiler::InterpreterAssembler* assembler) {
217 Node* slot_index = __ BytecodeOperandIdx8(0);
218 Node* smi_slot_index = __ SmiTag(slot_index);
219 Node* value = __ GetAccumulator();
220 __ CallRuntime(Runtime::kStoreGlobalViaContext_Strict, smi_slot_index, value);
221 __ Dispatch();
222 }
223
224
211 // LdaContextSlot <context> <slot_index> 225 // LdaContextSlot <context> <slot_index>
212 // 226 //
213 // Load the object in |slot_index| of |context| into the accumulator. 227 // Load the object in |slot_index| of |context| into the accumulator.
214 void Interpreter::DoLdaContextSlot(compiler::InterpreterAssembler* assembler) { 228 void Interpreter::DoLdaContextSlot(compiler::InterpreterAssembler* assembler) {
215 Node* reg_index = __ BytecodeOperandReg8(0); 229 Node* reg_index = __ BytecodeOperandReg8(0);
216 Node* context = __ LoadRegister(reg_index); 230 Node* context = __ LoadRegister(reg_index);
217 Node* slot_index = __ BytecodeOperandIdx8(1); 231 Node* slot_index = __ BytecodeOperandIdx8(1);
218 Node* result = __ LoadContextSlot(context, slot_index); 232 Node* result = __ LoadContextSlot(context, slot_index);
219 __ SetAccumulator(result); 233 __ SetAccumulator(result);
220 __ Dispatch(); 234 __ Dispatch();
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // 859 //
846 // Return the value in the accumulator. 860 // Return the value in the accumulator.
847 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 861 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
848 __ Return(); 862 __ Return();
849 } 863 }
850 864
851 865
852 } // namespace interpreter 866 } // namespace interpreter
853 } // namespace internal 867 } // namespace internal
854 } // namespace v8 868 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698