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

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

Issue 1634153002: [Interpreter] Adds support for const/let variables to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refactored VisitVariableAssignment. Created 4 years, 10 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
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/ast/prettyprinter.h" 7 #include "src/ast/prettyprinter.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/interpreter-assembler.h" 10 #include "src/compiler/interpreter-assembler.h"
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 1596
1597 // JumpIfNullConstantWide <idx16> 1597 // JumpIfNullConstantWide <idx16>
1598 // 1598 //
1599 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1599 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1600 // if the object referenced by the accumulator is the null constant. 1600 // if the object referenced by the accumulator is the null constant.
1601 void Interpreter::DoJumpIfNullConstantWide( 1601 void Interpreter::DoJumpIfNullConstantWide(
1602 compiler::InterpreterAssembler* assembler) { 1602 compiler::InterpreterAssembler* assembler) {
1603 DoJumpIfNullConstant(assembler); 1603 DoJumpIfNullConstant(assembler);
1604 } 1604 }
1605 1605
1606 1606 // JumpIfUndefined <imm8>
1607 // jumpifundefined <imm8>
1608 // 1607 //
1609 // Jump by number of bytes represented by an immediate operand if the object 1608 // Jump by number of bytes represented by an immediate operand if the object
1610 // referenced by the accumulator is the undefined constant. 1609 // referenced by the accumulator is the undefined constant.
1611 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) { 1610 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) {
1612 Node* accumulator = __ GetAccumulator(); 1611 Node* accumulator = __ GetAccumulator();
1613 Node* undefined_value = 1612 Node* undefined_value =
1614 __ HeapConstant(isolate_->factory()->undefined_value()); 1613 __ HeapConstant(isolate_->factory()->undefined_value());
1615 Node* relative_jump = __ BytecodeOperandImm(0); 1614 Node* relative_jump = __ BytecodeOperandImm(0);
1616 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 1615 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
1617 } 1616 }
(...skipping 17 matching lines...) Expand all
1635 1634
1636 // JumpIfUndefinedConstantWide <idx16> 1635 // JumpIfUndefinedConstantWide <idx16>
1637 // 1636 //
1638 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1637 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1639 // if the object referenced by the accumulator is the undefined constant. 1638 // if the object referenced by the accumulator is the undefined constant.
1640 void Interpreter::DoJumpIfUndefinedConstantWide( 1639 void Interpreter::DoJumpIfUndefinedConstantWide(
1641 compiler::InterpreterAssembler* assembler) { 1640 compiler::InterpreterAssembler* assembler) {
1642 DoJumpIfUndefinedConstant(assembler); 1641 DoJumpIfUndefinedConstant(assembler);
1643 } 1642 }
1644 1643
1644 // JumpIfHole <imm8>
1645 //
1646 // Jump by number of bytes represented by an immediate operand if the object
1647 // referenced by the accumulator is the hole.
1648 void Interpreter::DoJumpIfHole(compiler::InterpreterAssembler* assembler) {
1649 Node* accumulator = __ GetAccumulator();
1650 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1651 Node* relative_jump = __ BytecodeOperandImm(0);
1652 __ JumpIfWordEqual(accumulator, the_hole_value, relative_jump);
1653 }
1654
1655 // JumpIfNotHole <imm8>
1656 //
1657 // Jump by number of bytes represented by an immediate operand if the object
1658 // referenced by the accumulator is not the hole.
1659 void Interpreter::DoJumpIfNotHole(compiler::InterpreterAssembler* assembler) {
1660 Node* accumulator = __ GetAccumulator();
1661 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1662 Node* relative_jump = __ BytecodeOperandImm(0);
1663 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
1664 }
1645 1665
1646 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1666 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1647 compiler::InterpreterAssembler* assembler) { 1667 compiler::InterpreterAssembler* assembler) {
1648 Node* index = __ BytecodeOperandIdx(0); 1668 Node* index = __ BytecodeOperandIdx(0);
1649 Node* constant_elements = __ LoadConstantPoolEntry(index); 1669 Node* constant_elements = __ LoadConstantPoolEntry(index);
1650 Node* literal_index_raw = __ BytecodeOperandIdx(1); 1670 Node* literal_index_raw = __ BytecodeOperandIdx(1);
1651 Node* literal_index = __ SmiTag(literal_index_raw); 1671 Node* literal_index = __ SmiTag(literal_index_raw);
1652 Node* flags_raw = __ BytecodeOperandImm(2); 1672 Node* flags_raw = __ BytecodeOperandImm(2);
1653 Node* flags = __ SmiTag(flags_raw); 1673 Node* flags = __ SmiTag(flags_raw);
1654 Node* closure = __ LoadRegister(Register::function_closure()); 1674 Node* closure = __ LoadRegister(Register::function_closure());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 Node* index_reg = __ BytecodeOperandReg(0); 1906 Node* index_reg = __ BytecodeOperandReg(0);
1887 Node* index = __ LoadRegister(index_reg); 1907 Node* index = __ LoadRegister(index_reg);
1888 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1908 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1889 __ SetAccumulator(result); 1909 __ SetAccumulator(result);
1890 __ Dispatch(); 1910 __ Dispatch();
1891 } 1911 }
1892 1912
1893 } // namespace interpreter 1913 } // namespace interpreter
1894 } // namespace internal 1914 } // namespace internal
1895 } // namespace v8 1915 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698