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

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

Issue 2336643002: [Interpreter] Move context chain search loop to handler (Closed)
Patch Set: Fix documentation nits Created 4 years, 3 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') | src/interpreter/interpreter-assembler.h » ('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 <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 513 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
514 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); 514 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT);
515 DoStaGlobal(ic, assembler); 515 DoStaGlobal(ic, assembler);
516 } 516 }
517 517
518 compiler::Node* Interpreter::BuildLoadContextSlot( 518 compiler::Node* Interpreter::BuildLoadContextSlot(
519 InterpreterAssembler* assembler) { 519 InterpreterAssembler* assembler) {
520 Node* reg_index = __ BytecodeOperandReg(0); 520 Node* reg_index = __ BytecodeOperandReg(0);
521 Node* context = __ LoadRegister(reg_index); 521 Node* context = __ LoadRegister(reg_index);
522 Node* slot_index = __ BytecodeOperandIdx(1); 522 Node* slot_index = __ BytecodeOperandIdx(1);
523 return __ LoadContextSlot(context, slot_index); 523 Node* depth = __ BytecodeOperandIdx(2);
524 Node* slot_context = __ GetContextAtDepth(context, depth);
525 return __ LoadContextSlot(slot_context, slot_index);
524 } 526 }
525 527
526 // LdaContextSlot <context> <slot_index> 528 // LdaContextSlot <context> <slot_index> <depth>
527 // 529 //
528 // Load the object in |slot_index| of |context| into the accumulator. 530 // Load the object in |slot_index| of the context at |depth| in the context
531 // chain starting at |context| into the accumulator.
529 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { 532 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
530 Node* result = BuildLoadContextSlot(assembler); 533 Node* result = BuildLoadContextSlot(assembler);
531 __ SetAccumulator(result); 534 __ SetAccumulator(result);
532 __ Dispatch(); 535 __ Dispatch();
533 } 536 }
534 537
535 // LdrContextSlot <context> <slot_index> <reg> 538 // LdrContextSlot <context> <slot_index> <depth> <reg>
536 // 539 //
537 // Load the object in <slot_index> of <context> into register <reg>. 540 // Load the object in |slot_index| of the context at |depth| in the context
541 // chain of |context| into register |reg|.
538 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) { 542 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) {
539 Node* result = BuildLoadContextSlot(assembler); 543 Node* result = BuildLoadContextSlot(assembler);
540 Node* destination = __ BytecodeOperandReg(2); 544 Node* destination = __ BytecodeOperandReg(3);
541 __ StoreRegister(result, destination); 545 __ StoreRegister(result, destination);
542 __ Dispatch(); 546 __ Dispatch();
543 } 547 }
544 548
545 // StaContextSlot <context> <slot_index> 549 // StaContextSlot <context> <slot_index> <depth>
546 // 550 //
547 // Stores the object in the accumulator into |slot_index| of |context|. 551 // Stores the object in the accumulator into |slot_index| of the context at
552 // |depth| in the context chain starting at |context|.
548 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { 553 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
549 Node* value = __ GetAccumulator(); 554 Node* value = __ GetAccumulator();
550 Node* reg_index = __ BytecodeOperandReg(0); 555 Node* reg_index = __ BytecodeOperandReg(0);
551 Node* context = __ LoadRegister(reg_index); 556 Node* context = __ LoadRegister(reg_index);
552 Node* slot_index = __ BytecodeOperandIdx(1); 557 Node* slot_index = __ BytecodeOperandIdx(1);
553 __ StoreContextSlot(context, slot_index, value); 558 Node* depth = __ BytecodeOperandIdx(2);
559 Node* slot_context = __ GetContextAtDepth(context, depth);
560 __ StoreContextSlot(slot_context, slot_index, value);
554 __ Dispatch(); 561 __ Dispatch();
555 } 562 }
556 563
557 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, 564 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id,
558 InterpreterAssembler* assembler) { 565 InterpreterAssembler* assembler) {
559 Node* index = __ BytecodeOperandIdx(0); 566 Node* index = __ BytecodeOperandIdx(0);
560 Node* name = __ LoadConstantPoolEntry(index); 567 Node* name = __ LoadConstantPoolEntry(index);
561 Node* context = __ GetContext(); 568 Node* context = __ GetContext();
562 Node* result = __ CallRuntime(function_id, context, name); 569 Node* result = __ CallRuntime(function_id, context, name);
563 __ SetAccumulator(result); 570 __ SetAccumulator(result);
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2463 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2457 __ SmiTag(new_state)); 2464 __ SmiTag(new_state));
2458 __ SetAccumulator(old_state); 2465 __ SetAccumulator(old_state);
2459 2466
2460 __ Dispatch(); 2467 __ Dispatch();
2461 } 2468 }
2462 2469
2463 } // namespace interpreter 2470 } // namespace interpreter
2464 } // namespace internal 2471 } // namespace internal
2465 } // namespace v8 2472 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698