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

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: Rebased the patch. 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/cctest.status » ('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/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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 1598
1599 // JumpIfNullConstantWide <idx16> 1599 // JumpIfNullConstantWide <idx16>
1600 // 1600 //
1601 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1601 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1602 // if the object referenced by the accumulator is the null constant. 1602 // if the object referenced by the accumulator is the null constant.
1603 void Interpreter::DoJumpIfNullConstantWide( 1603 void Interpreter::DoJumpIfNullConstantWide(
1604 compiler::InterpreterAssembler* assembler) { 1604 compiler::InterpreterAssembler* assembler) {
1605 DoJumpIfNullConstant(assembler); 1605 DoJumpIfNullConstant(assembler);
1606 } 1606 }
1607 1607
1608 1608 // JumpIfUndefined <imm8>
1609 // jumpifundefined <imm8>
1610 // 1609 //
1611 // Jump by number of bytes represented by an immediate operand if the object 1610 // Jump by number of bytes represented by an immediate operand if the object
1612 // referenced by the accumulator is the undefined constant. 1611 // referenced by the accumulator is the undefined constant.
1613 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) { 1612 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) {
1614 Node* accumulator = __ GetAccumulator(); 1613 Node* accumulator = __ GetAccumulator();
1615 Node* undefined_value = 1614 Node* undefined_value =
1616 __ HeapConstant(isolate_->factory()->undefined_value()); 1615 __ HeapConstant(isolate_->factory()->undefined_value());
1617 Node* relative_jump = __ BytecodeOperandImm(0); 1616 Node* relative_jump = __ BytecodeOperandImm(0);
1618 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 1617 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
1619 } 1618 }
(...skipping 17 matching lines...) Expand all
1637 1636
1638 // JumpIfUndefinedConstantWide <idx16> 1637 // JumpIfUndefinedConstantWide <idx16>
1639 // 1638 //
1640 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool 1639 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool
1641 // if the object referenced by the accumulator is the undefined constant. 1640 // if the object referenced by the accumulator is the undefined constant.
1642 void Interpreter::DoJumpIfUndefinedConstantWide( 1641 void Interpreter::DoJumpIfUndefinedConstantWide(
1643 compiler::InterpreterAssembler* assembler) { 1642 compiler::InterpreterAssembler* assembler) {
1644 DoJumpIfUndefinedConstant(assembler); 1643 DoJumpIfUndefinedConstant(assembler);
1645 } 1644 }
1646 1645
1646 // JumpIfHole <imm8>
1647 //
1648 // Jump by number of bytes represented by an immediate operand if the object
1649 // referenced by the accumulator is the hole.
1650 void Interpreter::DoJumpIfHole(compiler::InterpreterAssembler* assembler) {
1651 Node* accumulator = __ GetAccumulator();
1652 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1653 Node* relative_jump = __ BytecodeOperandImm(0);
1654 __ JumpIfWordEqual(accumulator, the_hole_value, relative_jump);
1655 }
1656
1657 // JumpIfNotHole <imm8>
1658 //
1659 // Jump by number of bytes represented by an immediate operand if the object
1660 // referenced by the accumulator is not the hole.
1661 void Interpreter::DoJumpIfNotHole(compiler::InterpreterAssembler* assembler) {
1662 Node* accumulator = __ GetAccumulator();
1663 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
1664 Node* relative_jump = __ BytecodeOperandImm(0);
1665 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
1666 }
1647 1667
1648 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, 1668 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id,
1649 compiler::InterpreterAssembler* assembler) { 1669 compiler::InterpreterAssembler* assembler) {
1650 Node* index = __ BytecodeOperandIdx(0); 1670 Node* index = __ BytecodeOperandIdx(0);
1651 Node* constant_elements = __ LoadConstantPoolEntry(index); 1671 Node* constant_elements = __ LoadConstantPoolEntry(index);
1652 Node* literal_index_raw = __ BytecodeOperandIdx(1); 1672 Node* literal_index_raw = __ BytecodeOperandIdx(1);
1653 Node* literal_index = __ SmiTag(literal_index_raw); 1673 Node* literal_index = __ SmiTag(literal_index_raw);
1654 Node* flags_raw = __ BytecodeOperandImm(2); 1674 Node* flags_raw = __ BytecodeOperandImm(2);
1655 Node* flags = __ SmiTag(flags_raw); 1675 Node* flags = __ SmiTag(flags_raw);
1656 Node* closure = __ LoadRegister(Register::function_closure()); 1676 Node* closure = __ LoadRegister(Register::function_closure());
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 Node* index_reg = __ BytecodeOperandReg(0); 1934 Node* index_reg = __ BytecodeOperandReg(0);
1915 Node* index = __ LoadRegister(index_reg); 1935 Node* index = __ LoadRegister(index_reg);
1916 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1936 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1917 __ SetAccumulator(result); 1937 __ SetAccumulator(result);
1918 __ Dispatch(); 1938 __ Dispatch();
1919 } 1939 }
1920 1940
1921 } // namespace interpreter 1941 } // namespace interpreter
1922 } // namespace internal 1942 } // namespace internal
1923 } // namespace v8 1943 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698