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

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

Issue 1385623002: [Interpreter]: Add support for strict mode load / store ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc error 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 Node* raw_slot = __ BytecodeOperandIdx8(1); 212 Node* raw_slot = __ BytecodeOperandIdx8(1);
213 Node* smi_slot = __ SmiTag(raw_slot); 213 Node* smi_slot = __ SmiTag(raw_slot);
214 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 214 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
215 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot, 215 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot,
216 type_feedback_vector); 216 type_feedback_vector);
217 __ SetAccumulator(result); 217 __ SetAccumulator(result);
218 __ Dispatch(); 218 __ Dispatch();
219 } 219 }
220 220
221 221
222 // LoadIC <object> <slot> 222 // LoadICSloppy <object> <slot>
223 // 223 //
224 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name 224 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and
225 // in the accumulator. 225 // the name in the accumulator.
226 void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) { 226 void Interpreter::DoLoadICSloppy(compiler::InterpreterAssembler* assembler) {
227 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 227 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
228 SLOPPY, UNINITIALIZED); 228 SLOPPY, UNINITIALIZED);
229 DoPropertyLoadIC(ic, assembler); 229 DoPropertyLoadIC(ic, assembler);
230 } 230 }
231 231
232 232
233 // KeyedLoadIC <object> <slot> 233 // LoadICStrict <object> <slot>
234 // 234 //
235 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key 235 // Calls the strict mode LoadIC at FeedBackVector slot <slot> for <object> and
236 // in the accumulator. 236 // the name in the accumulator.
237 void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) { 237 void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) {
238 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
239 STRICT, UNINITIALIZED);
240 DoPropertyLoadIC(ic, assembler);
241 }
242
243
244 // KeyedLoadICSloppy <object> <slot>
245 //
246 // Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object>
247 // and the key in the accumulator.
248 void Interpreter::DoKeyedLoadICSloppy(
249 compiler::InterpreterAssembler* assembler) {
238 Callable ic = 250 Callable ic =
239 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 251 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
240 DoPropertyLoadIC(ic, assembler); 252 DoPropertyLoadIC(ic, assembler);
241 } 253 }
242 254
243 255
256 // KeyedLoadICStrict <object> <slot>
257 //
258 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object>
259 // and the key in the accumulator.
260 void Interpreter::DoKeyedLoadICStrict(
261 compiler::InterpreterAssembler* assembler) {
262 Callable ic =
263 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
264 DoPropertyLoadIC(ic, assembler);
265 }
266
267
244 void Interpreter::DoPropertyStoreIC(Callable ic, 268 void Interpreter::DoPropertyStoreIC(Callable ic,
245 compiler::InterpreterAssembler* assembler) { 269 compiler::InterpreterAssembler* assembler) {
246 Node* code_target = __ HeapConstant(ic.code()); 270 Node* code_target = __ HeapConstant(ic.code());
247 Node* object_reg_index = __ BytecodeOperandReg8(0); 271 Node* object_reg_index = __ BytecodeOperandReg8(0);
248 Node* object = __ LoadRegister(object_reg_index); 272 Node* object = __ LoadRegister(object_reg_index);
249 Node* name_reg_index = __ BytecodeOperandReg8(1); 273 Node* name_reg_index = __ BytecodeOperandReg8(1);
250 Node* name = __ LoadRegister(name_reg_index); 274 Node* name = __ LoadRegister(name_reg_index);
251 Node* value = __ GetAccumulator(); 275 Node* value = __ GetAccumulator();
252 Node* raw_slot = __ BytecodeOperandIdx8(2); 276 Node* raw_slot = __ BytecodeOperandIdx8(2);
253 Node* smi_slot = __ SmiTag(raw_slot); 277 Node* smi_slot = __ SmiTag(raw_slot);
254 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 278 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
255 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value, 279 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value,
256 smi_slot, type_feedback_vector); 280 smi_slot, type_feedback_vector);
257 __ SetAccumulator(result); 281 __ SetAccumulator(result);
258 __ Dispatch(); 282 __ Dispatch();
259 } 283 }
260 284
261 285
262 // StoreIC <object> <name> <slot> 286 // StoreICSloppy <object> <name> <slot>
263 // 287 //
264 // Calls the StoreIC at FeedBackVector slot <slot> for <object> and the name 288 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and
265 // <name> with the value in the accumulator. 289 // the name <name> with the value in the accumulator.
266 void Interpreter::DoStoreIC(compiler::InterpreterAssembler* assembler) { 290 void Interpreter::DoStoreICSloppy(compiler::InterpreterAssembler* assembler) {
267 Callable ic = 291 Callable ic =
268 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 292 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
269 DoPropertyStoreIC(ic, assembler); 293 DoPropertyStoreIC(ic, assembler);
270 } 294 }
271 295
272 296
273 // KeyedStoreIC <object> <key> <slot> 297 // StoreICStrict <object> <name> <slot>
274 // 298 //
275 // Calls the KeyStoreIC at FeedBackVector slot <slot> for <object> and the key 299 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and
276 // <key> with the value in the accumulator. 300 // the name <name> with the value in the accumulator.
277 void Interpreter::DoKeyedStoreIC(compiler::InterpreterAssembler* assembler) { 301 void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) {
302 Callable ic =
303 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
304 DoPropertyStoreIC(ic, assembler);
305 }
306
307
308 // KeyedStoreICSloppy <object> <key> <slot>
309 //
310 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
311 // and the key <key> with the value in the accumulator.
312 void Interpreter::DoKeyedStoreICSloppy(
313 compiler::InterpreterAssembler* assembler) {
278 Callable ic = 314 Callable ic =
279 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 315 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
280 DoPropertyStoreIC(ic, assembler); 316 DoPropertyStoreIC(ic, assembler);
281 } 317 }
282 318
283 319
320 // KeyedStoreICStore <object> <key> <slot>
321 //
322 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
323 // and the key <key> with the value in the accumulator.
324 void Interpreter::DoKeyedStoreICStrict(
325 compiler::InterpreterAssembler* assembler) {
326 Callable ic =
327 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
328 DoPropertyStoreIC(ic, assembler);
329 }
330
331
284 void Interpreter::DoBinaryOp(Runtime::FunctionId function_id, 332 void Interpreter::DoBinaryOp(Runtime::FunctionId function_id,
285 compiler::InterpreterAssembler* assembler) { 333 compiler::InterpreterAssembler* assembler) {
286 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized 334 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized
287 // operations, instead of calling builtins directly. 335 // operations, instead of calling builtins directly.
288 Node* reg_index = __ BytecodeOperandReg8(0); 336 Node* reg_index = __ BytecodeOperandReg8(0);
289 Node* lhs = __ LoadRegister(reg_index); 337 Node* lhs = __ LoadRegister(reg_index);
290 Node* rhs = __ GetAccumulator(); 338 Node* rhs = __ GetAccumulator();
291 Node* result = __ CallRuntime(function_id, lhs, rhs); 339 Node* result = __ CallRuntime(function_id, lhs, rhs);
292 __ SetAccumulator(result); 340 __ SetAccumulator(result);
293 __ Dispatch(); 341 __ Dispatch();
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // 615 //
568 // Return the value in the accumulator. 616 // Return the value in the accumulator.
569 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 617 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
570 __ Return(); 618 __ Return();
571 } 619 }
572 620
573 621
574 } // namespace interpreter 622 } // namespace interpreter
575 } // namespace internal 623 } // namespace internal
576 } // namespace v8 624 } // 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