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

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

Issue 1524803003: [Interpreter] Add support for Load / Store to Lookup slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@init_eval_impl
Patch Set: Fixed nits. Created 5 years 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/interpreter.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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) { 416 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) {
417 Node* value = __ GetAccumulator(); 417 Node* value = __ GetAccumulator();
418 Node* reg_index = __ BytecodeOperandReg(0); 418 Node* reg_index = __ BytecodeOperandReg(0);
419 Node* context = __ LoadRegister(reg_index); 419 Node* context = __ LoadRegister(reg_index);
420 Node* slot_index = __ BytecodeOperandIdx(1); 420 Node* slot_index = __ BytecodeOperandIdx(1);
421 __ StoreContextSlot(context, slot_index, value); 421 __ StoreContextSlot(context, slot_index, value);
422 __ Dispatch(); 422 __ Dispatch();
423 } 423 }
424 424
425 425
426 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id,
427 compiler::InterpreterAssembler* assembler) {
428 Node* index = __ BytecodeOperandIdx(0);
429 Node* name = __ LoadConstantPoolEntry(index);
430 Node* context = __ GetContext();
431 Node* result_pair = __ CallRuntime(function_id, context, name);
432 Node* result = __ Projection(0, result_pair);
433 __ SetAccumulator(result);
434 __ Dispatch();
435 }
436
437
438 // LdaLookupSlot <name_index>
439 //
440 // Lookup the object with the name in constant pool entry |name_index|
441 // dynamically.
442 void Interpreter::DoLdaLookupSlot(compiler::InterpreterAssembler* assembler) {
443 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler);
444 }
445
446
447 // LdaLookupSlotInsideTypeof <name_index>
448 //
449 // Lookup the object with the name in constant pool entry |name_index|
450 // dynamically without causing a NoReferenceError.
451 void Interpreter::DoLdaLookupSlotInsideTypeof(
452 compiler::InterpreterAssembler* assembler) {
453 DoLoadLookupSlot(Runtime::kLoadLookupSlotNoReferenceError, assembler);
454 }
455
456
457 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode,
458 compiler::InterpreterAssembler* assembler) {
459 Node* value = __ GetAccumulator();
460 Node* index = __ BytecodeOperandIdx(0);
461 Node* name = __ LoadConstantPoolEntry(index);
462 Node* context = __ GetContext();
463 Node* language_mode_node = __ NumberConstant(language_mode);
464 Node* result = __ CallRuntime(Runtime::kStoreLookupSlot, value, context, name,
465 language_mode_node);
466 __ SetAccumulator(result);
467 __ Dispatch();
468 }
469
470
471 // StaLookupSlotSloppy <name_index>
472 //
473 // Store the object in accumulator to the object with the name in constant
474 // pool entry |name_index| in sloppy mode.
475 void Interpreter::DoStaLookupSlotSloppy(
476 compiler::InterpreterAssembler* assembler) {
477 DoStoreLookupSlot(LanguageMode::SLOPPY, assembler);
478 }
479
480
481 // StaLookupSlotStrict <name_index>
482 //
483 // Store the object in accumulator to the object with the name in constant
484 // pool entry |name_index| in strict mode.
485 void Interpreter::DoStaLookupSlotStrict(
486 compiler::InterpreterAssembler* assembler) {
487 DoStoreLookupSlot(LanguageMode::STRICT, assembler);
488 }
489
490
426 void Interpreter::DoLoadIC(Callable ic, 491 void Interpreter::DoLoadIC(Callable ic,
427 compiler::InterpreterAssembler* assembler) { 492 compiler::InterpreterAssembler* assembler) {
428 Node* code_target = __ HeapConstant(ic.code()); 493 Node* code_target = __ HeapConstant(ic.code());
429 Node* register_index = __ BytecodeOperandReg(0); 494 Node* register_index = __ BytecodeOperandReg(0);
430 Node* object = __ LoadRegister(register_index); 495 Node* object = __ LoadRegister(register_index);
431 Node* constant_index = __ BytecodeOperandIdx(1); 496 Node* constant_index = __ BytecodeOperandIdx(1);
432 Node* name = __ LoadConstantPoolEntry(constant_index); 497 Node* name = __ LoadConstantPoolEntry(constant_index);
433 Node* raw_slot = __ BytecodeOperandIdx(2); 498 Node* raw_slot = __ BytecodeOperandIdx(2);
434 Node* smi_slot = __ SmiTag(raw_slot); 499 Node* smi_slot = __ SmiTag(raw_slot);
435 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 500 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); 1562 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3);
1498 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); 1563 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length);
1499 __ SetAccumulator(result); 1564 __ SetAccumulator(result);
1500 __ Dispatch(); 1565 __ Dispatch();
1501 } 1566 }
1502 1567
1503 1568
1504 } // namespace interpreter 1569 } // namespace interpreter
1505 } // namespace internal 1570 } // namespace internal
1506 } // namespace v8 1571 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698