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 "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1567 | 1567 |
1568 // JumpIfNullConstantWide <idx16> | 1568 // JumpIfNullConstantWide <idx16> |
1569 // | 1569 // |
1570 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool | 1570 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool |
1571 // if the object referenced by the accumulator is the null constant. | 1571 // if the object referenced by the accumulator is the null constant. |
1572 void Interpreter::DoJumpIfNullConstantWide( | 1572 void Interpreter::DoJumpIfNullConstantWide( |
1573 compiler::InterpreterAssembler* assembler) { | 1573 compiler::InterpreterAssembler* assembler) { |
1574 DoJumpIfNullConstant(assembler); | 1574 DoJumpIfNullConstant(assembler); |
1575 } | 1575 } |
1576 | 1576 |
1577 | 1577 // JumpIfUndefined <imm8> |
1578 // jumpifundefined <imm8> | |
1579 // | 1578 // |
1580 // Jump by number of bytes represented by an immediate operand if the object | 1579 // Jump by number of bytes represented by an immediate operand if the object |
1581 // referenced by the accumulator is the undefined constant. | 1580 // referenced by the accumulator is the undefined constant. |
1582 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) { | 1581 void Interpreter::DoJumpIfUndefined(compiler::InterpreterAssembler* assembler) { |
1583 Node* accumulator = __ GetAccumulator(); | 1582 Node* accumulator = __ GetAccumulator(); |
1584 Node* undefined_value = | 1583 Node* undefined_value = |
1585 __ HeapConstant(isolate_->factory()->undefined_value()); | 1584 __ HeapConstant(isolate_->factory()->undefined_value()); |
1586 Node* relative_jump = __ BytecodeOperandImm(0); | 1585 Node* relative_jump = __ BytecodeOperandImm(0); |
1587 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); | 1586 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); |
1588 } | 1587 } |
(...skipping 17 matching lines...) Expand all Loading... | |
1606 | 1605 |
1607 // JumpIfUndefinedConstantWide <idx16> | 1606 // JumpIfUndefinedConstantWide <idx16> |
1608 // | 1607 // |
1609 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool | 1608 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool |
1610 // if the object referenced by the accumulator is the undefined constant. | 1609 // if the object referenced by the accumulator is the undefined constant. |
1611 void Interpreter::DoJumpIfUndefinedConstantWide( | 1610 void Interpreter::DoJumpIfUndefinedConstantWide( |
1612 compiler::InterpreterAssembler* assembler) { | 1611 compiler::InterpreterAssembler* assembler) { |
1613 DoJumpIfUndefinedConstant(assembler); | 1612 DoJumpIfUndefinedConstant(assembler); |
1614 } | 1613 } |
1615 | 1614 |
1615 // JumpIfHole <imm8> | |
1616 // | |
1617 // Jump by number of bytes represented by an immediate operand if the object | |
1618 // referenced by the accumulator is the hole. | |
1619 void Interpreter::DoJumpIfHole(compiler::InterpreterAssembler* assembler) { | |
1620 Node* accumulator = __ GetAccumulator(); | |
1621 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | |
1622 Node* relative_jump = __ BytecodeOperandImm(0); | |
1623 __ JumpIfWordEqual(accumulator, the_hole_value, relative_jump); | |
1624 } | |
1625 | |
1626 // JumpIfHole <imm8> | |
1627 // | |
1628 // Jump by number of bytes represented by an immediate operand if the object | |
1629 // referenced by the accumulator is not the hole. | |
1630 void Interpreter::DoJumpIfNotHole(compiler::InterpreterAssembler* assembler) { | |
1631 // TODO(mythria): Implement with wordNotEquals. | |
rmcilroy
2016/01/26 14:37:28
Any reason not to do that now?
mythria
2016/02/01 10:02:18
Done.
| |
1632 Node* accumulator = __ GetAccumulator(); | |
1633 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | |
1634 Node* result = __ CallRuntime(Runtime::kInterpreterStrictEquals, accumulator, | |
1635 the_hole_value); | |
1636 Node* false_value = __ BooleanConstant(false); | |
1637 Node* relative_jump = __ BytecodeOperandImm(0); | |
1638 __ JumpIfWordEqual(result, false_value, relative_jump); | |
1639 } | |
1616 | 1640 |
1617 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, | 1641 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, |
1618 compiler::InterpreterAssembler* assembler) { | 1642 compiler::InterpreterAssembler* assembler) { |
1619 Node* index = __ BytecodeOperandIdx(0); | 1643 Node* index = __ BytecodeOperandIdx(0); |
1620 Node* constant_elements = __ LoadConstantPoolEntry(index); | 1644 Node* constant_elements = __ LoadConstantPoolEntry(index); |
1621 Node* literal_index_raw = __ BytecodeOperandIdx(1); | 1645 Node* literal_index_raw = __ BytecodeOperandIdx(1); |
1622 Node* literal_index = __ SmiTag(literal_index_raw); | 1646 Node* literal_index = __ SmiTag(literal_index_raw); |
1623 Node* flags_raw = __ BytecodeOperandImm(2); | 1647 Node* flags_raw = __ BytecodeOperandImm(2); |
1624 Node* flags = __ SmiTag(flags_raw); | 1648 Node* flags = __ SmiTag(flags_raw); |
1625 Node* closure = __ LoadRegister(Register::function_closure()); | 1649 Node* closure = __ LoadRegister(Register::function_closure()); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 Node* index_reg = __ BytecodeOperandReg(0); | 1881 Node* index_reg = __ BytecodeOperandReg(0); |
1858 Node* index = __ LoadRegister(index_reg); | 1882 Node* index = __ LoadRegister(index_reg); |
1859 Node* result = __ CallRuntime(Runtime::kForInStep, index); | 1883 Node* result = __ CallRuntime(Runtime::kForInStep, index); |
1860 __ SetAccumulator(result); | 1884 __ SetAccumulator(result); |
1861 __ Dispatch(); | 1885 __ Dispatch(); |
1862 } | 1886 } |
1863 | 1887 |
1864 } // namespace interpreter | 1888 } // namespace interpreter |
1865 } // namespace internal | 1889 } // namespace internal |
1866 } // namespace v8 | 1890 } // namespace v8 |
OLD | NEW |