OLD | NEW |
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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 580 } |
581 | 581 |
582 // LdaLookupSlotInsideTypeof <name_index> | 582 // LdaLookupSlotInsideTypeof <name_index> |
583 // | 583 // |
584 // Lookup the object with the name in constant pool entry |name_index| | 584 // Lookup the object with the name in constant pool entry |name_index| |
585 // dynamically without causing a NoReferenceError. | 585 // dynamically without causing a NoReferenceError. |
586 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { | 586 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { |
587 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); | 587 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
588 } | 588 } |
589 | 589 |
| 590 void Interpreter::DoLdaLookupContextSlot(Runtime::FunctionId function_id, |
| 591 InterpreterAssembler* assembler) { |
| 592 Node* context = __ GetContext(); |
| 593 Node* name_index = __ BytecodeOperandIdx(0); |
| 594 Node* slot_index = __ BytecodeOperandIdx(1); |
| 595 Node* depth = __ BytecodeOperandUImm(2); |
| 596 |
| 597 Label slowpath(assembler, Label::kDeferred); |
| 598 |
| 599 // Check for context extensions to allow the fast path |
| 600 __ GotoIfHasContextExtensionUpToDepth(context, depth, &slowpath); |
| 601 |
| 602 // Fast path does a normal load context |
| 603 { |
| 604 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 605 Node* result = __ LoadContextSlot(slot_context, slot_index); |
| 606 __ SetAccumulator(result); |
| 607 __ Dispatch(); |
| 608 } |
| 609 |
| 610 // Slow path when we have to call out to the runtime |
| 611 __ Bind(&slowpath); |
| 612 { |
| 613 Node* name = __ LoadConstantPoolEntry(name_index); |
| 614 Node* result = __ CallRuntime(function_id, context, name); |
| 615 __ SetAccumulator(result); |
| 616 __ Dispatch(); |
| 617 } |
| 618 } |
| 619 |
| 620 // LdaLookupSlot <name_index> |
| 621 // |
| 622 // Lookup the object with the name in constant pool entry |name_index| |
| 623 // dynamically. |
| 624 void Interpreter::DoLdaLookupContextSlot(InterpreterAssembler* assembler) { |
| 625 DoLdaLookupContextSlot(Runtime::kLoadLookupSlot, assembler); |
| 626 } |
| 627 |
| 628 // LdaLookupSlotInsideTypeof <name_index> |
| 629 // |
| 630 // Lookup the object with the name in constant pool entry |name_index| |
| 631 // dynamically without causing a NoReferenceError. |
| 632 void Interpreter::DoLdaLookupContextSlotInsideTypeof( |
| 633 InterpreterAssembler* assembler) { |
| 634 DoLdaLookupContextSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
| 635 } |
| 636 |
590 void Interpreter::DoStaLookupSlot(LanguageMode language_mode, | 637 void Interpreter::DoStaLookupSlot(LanguageMode language_mode, |
591 InterpreterAssembler* assembler) { | 638 InterpreterAssembler* assembler) { |
592 Node* value = __ GetAccumulator(); | 639 Node* value = __ GetAccumulator(); |
593 Node* index = __ BytecodeOperandIdx(0); | 640 Node* index = __ BytecodeOperandIdx(0); |
594 Node* name = __ LoadConstantPoolEntry(index); | 641 Node* name = __ LoadConstantPoolEntry(index); |
595 Node* context = __ GetContext(); | 642 Node* context = __ GetContext(); |
596 Node* result = __ CallRuntime(is_strict(language_mode) | 643 Node* result = __ CallRuntime(is_strict(language_mode) |
597 ? Runtime::kStoreLookupSlot_Strict | 644 ? Runtime::kStoreLookupSlot_Strict |
598 : Runtime::kStoreLookupSlot_Sloppy, | 645 : Runtime::kStoreLookupSlot_Sloppy, |
599 context, name, value); | 646 context, name, value); |
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2513 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2467 __ SmiTag(new_state)); | 2514 __ SmiTag(new_state)); |
2468 __ SetAccumulator(old_state); | 2515 __ SetAccumulator(old_state); |
2469 | 2516 |
2470 __ Dispatch(); | 2517 __ Dispatch(); |
2471 } | 2518 } |
2472 | 2519 |
2473 } // namespace interpreter | 2520 } // namespace interpreter |
2474 } // namespace internal | 2521 } // namespace internal |
2475 } // namespace v8 | 2522 } // namespace v8 |
OLD | NEW |