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

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: Fixed rebase errors. 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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 1600
1601 // JumpIfNullConstantWide <idx16> 1601 // JumpIfNullConstantWide <idx16>
1602 // 1602 //
1603 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1603 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1604 // if the object referenced by the accumulator is the null constant. 1604 // if the object referenced by the accumulator is the null constant.
1605 void Interpreter::DoJumpIfNullConstantWide( 1605 void Interpreter::DoJumpIfNullConstantWide(
1606 compiler::InterpreterAssembler* assembler) { 1606 compiler::InterpreterAssembler* assembler) {
1607 DoJumpIfNullConstant(assembler); 1607 DoJumpIfNullConstant(assembler);
1608 } 1608 }
1609 1609
1610 1610 // JumpIfUndefined <imm8>
1611 // jumpifundefined <imm8>
1612 // 1611 //
1613 // Jump by number of bytes represented by an immediate operand if the object 1612 // Jump by number of bytes represented by an immediate operand if the object
1614 // referenced by the accumulator is the undefined constant. 1613 // referenced by the accumulator is the undefined constant.
1615 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) { 1614 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) {
1616 Node* accumulator = __ GetAccumulator(); 1615 Node* accumulator = __ GetAccumulator();
1617 Node* undefined_value = 1616 Node* undefined_value =
1618 __ HeapConstant(isolate_->factory()->undefined_value()); 1617 __ HeapConstant(isolate_->factory()->undefined_value());
1619 Node* relative_jump = __ BytecodeOperandImm(0); 1618 Node* relative_jump = __ BytecodeOperandImm(0);
1620 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 1619 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
1621 } 1620 }
(...skipping 17 matching lines...) Expand all
1639 1638
1640 // JumpIfUndefinedConstantWide <idx16> 1639 // JumpIfUndefinedConstantWide <idx16>
1641 // 1640 //
1642 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1641 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1643 // if the object referenced by the accumulator is the undefined constant. 1642 // if the object referenced by the accumulator is the undefined constant.
1644 void Interpreter::DoJumpIfUndefinedConstantWide( 1643 void Interpreter::DoJumpIfUndefinedConstantWide(
1645 compiler::InterpreterAssembler* assembler) { 1644 compiler::InterpreterAssembler* assembler) {
1646 DoJumpIfUndefinedConstant(assembler); 1645 DoJumpIfUndefinedConstant(assembler);
1647 } 1646 }
1648 1647
1648 // JumpIfHole <imm8>
1649 //
1650 // Jump by number of bytes represented by an immediate operand if the object
1651 // referenced by the accumulator is the hole.
1652 void Interpreter::DoJumpIfHole(compiler::InterpreterAssembler* assembler) {
1653 Node* accumulator = __ GetAccumulator();
1654 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1655 Node* relative_jump = __ BytecodeOperandImm(0);
1656 __ JumpIfWordEqual(accumulator, the_hole_value, relative_jump);
1657 }
1658
1659 // JumpIfNotHole <imm8>
1660 //
1661 // Jump by number of bytes represented by an immediate operand if the object
1662 // referenced by the accumulator is not the hole.
1663 void Interpreter::DoJumpIfNotHole(compiler::InterpreterAssembler* assembler) {
1664 Node* accumulator = __ GetAccumulator();
1665 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1666 Node* relative_jump = __ BytecodeOperandImm(0);
1667 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
1668 }
1649 1669
1650 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1670 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1651 compiler::InterpreterAssembler* assembler) { 1671 compiler::InterpreterAssembler* assembler) {
1652 Node* index = __ BytecodeOperandIdx(0); 1672 Node* index = __ BytecodeOperandIdx(0);
1653 Node* constant_elements = __ LoadConstantPoolEntry(index); 1673 Node* constant_elements = __ LoadConstantPoolEntry(index);
1654 Node* literal_index_raw = __ BytecodeOperandIdx(1); 1674 Node* literal_index_raw = __ BytecodeOperandIdx(1);
1655 Node* literal_index = __ SmiTag(literal_index_raw); 1675 Node* literal_index = __ SmiTag(literal_index_raw);
1656 Node* flags_raw = __ BytecodeOperandImm(2); 1676 Node* flags_raw = __ BytecodeOperandImm(2);
1657 Node* flags = __ SmiTag(flags_raw); 1677 Node* flags = __ SmiTag(flags_raw);
1658 Node* closure = __ LoadRegister(Register::function_closure()); 1678 Node* closure = __ LoadRegister(Register::function_closure());
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 Node* index_reg = __ BytecodeOperandReg(0); 1923 Node* index_reg = __ BytecodeOperandReg(0);
1904 Node* index = __ LoadRegister(index_reg); 1924 Node* index = __ LoadRegister(index_reg);
1905 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1925 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1906 __ SetAccumulator(result); 1926 __ SetAccumulator(result);
1907 __ Dispatch(); 1927 __ Dispatch();
1908 } 1928 }
1909 1929
1910 } // namespace interpreter 1930 } // namespace interpreter
1911 } // namespace internal 1931 } // namespace internal
1912 } // namespace v8 1932 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698