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/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/factory.h" | 10 #include "src/factory.h" |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 | 1573 |
1574 // JumpIfUndefinedConstantWide <idx16> | 1574 // JumpIfUndefinedConstantWide <idx16> |
1575 // | 1575 // |
1576 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool | 1576 // Jump by number of bytes in the Smi in the |idx16| entry in the constant pool |
1577 // if the object referenced by the accumulator is the undefined constant. | 1577 // if the object referenced by the accumulator is the undefined constant. |
1578 void Interpreter::DoJumpIfUndefinedConstantWide( | 1578 void Interpreter::DoJumpIfUndefinedConstantWide( |
1579 InterpreterAssembler* assembler) { | 1579 InterpreterAssembler* assembler) { |
1580 DoJumpIfUndefinedConstant(assembler); | 1580 DoJumpIfUndefinedConstant(assembler); |
1581 } | 1581 } |
1582 | 1582 |
1583 // JumpIfHole <imm8> | |
1584 // | |
1585 // Jump by number of bytes represented by an immediate operand if the object | |
1586 // referenced by the accumulator is the hole. | |
1587 void Interpreter::DoJumpIfHole(InterpreterAssembler* assembler) { | |
1588 Node* accumulator = __ GetAccumulator(); | |
1589 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | |
1590 Node* relative_jump = __ BytecodeOperandImm(0); | |
1591 __ JumpIfWordEqual(accumulator, the_hole_value, relative_jump); | |
1592 } | |
1593 | |
1594 // JumpIfNotHole <imm8> | 1583 // JumpIfNotHole <imm8> |
1595 // | 1584 // |
1596 // Jump by number of bytes represented by an immediate operand if the object | 1585 // Jump by number of bytes represented by an immediate operand if the object |
1597 // referenced by the accumulator is not the hole. | 1586 // referenced by the accumulator is the hole. |
1598 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { | 1587 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { |
1599 Node* accumulator = __ GetAccumulator(); | 1588 Node* accumulator = __ GetAccumulator(); |
1600 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | 1589 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); |
1601 Node* relative_jump = __ BytecodeOperandImm(0); | 1590 Node* relative_jump = __ BytecodeOperandImm(0); |
1602 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); | 1591 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); |
1603 } | 1592 } |
1604 | 1593 |
| 1594 // JumpIfNotHoleConstant <idx8> |
| 1595 // |
| 1596 // Jump by number of bytes in the Smi in the |idx8| entry in the constant pool |
| 1597 // if the object referenced by the accumulator is the hole constant. |
| 1598 void Interpreter::DoJumpIfNotHoleConstant(InterpreterAssembler* assembler) { |
| 1599 Node* accumulator = __ GetAccumulator(); |
| 1600 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); |
| 1601 Node* index = __ BytecodeOperandIdx(0); |
| 1602 Node* constant = __ LoadConstantPoolEntry(index); |
| 1603 Node* relative_jump = __ SmiUntag(constant); |
| 1604 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); |
| 1605 } |
| 1606 |
| 1607 // JumpIfNotHoleConstantWide <idx16> |
| 1608 // |
| 1609 // 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 hole constant. |
| 1611 void Interpreter::DoJumpIfNotHoleConstantWide(InterpreterAssembler* assembler) { |
| 1612 DoJumpIfNotHoleConstant(assembler); |
| 1613 } |
| 1614 |
1605 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, | 1615 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, |
1606 InterpreterAssembler* assembler) { | 1616 InterpreterAssembler* assembler) { |
1607 Node* index = __ BytecodeOperandIdx(0); | 1617 Node* index = __ BytecodeOperandIdx(0); |
1608 Node* constant_elements = __ LoadConstantPoolEntry(index); | 1618 Node* constant_elements = __ LoadConstantPoolEntry(index); |
1609 Node* literal_index_raw = __ BytecodeOperandIdx(1); | 1619 Node* literal_index_raw = __ BytecodeOperandIdx(1); |
1610 Node* literal_index = __ SmiTag(literal_index_raw); | 1620 Node* literal_index = __ SmiTag(literal_index_raw); |
1611 Node* flags_raw = __ BytecodeOperandImm(2); | 1621 Node* flags_raw = __ BytecodeOperandImm(2); |
1612 Node* flags = __ SmiTag(flags_raw); | 1622 Node* flags = __ SmiTag(flags_raw); |
1613 Node* closure = __ LoadRegister(Register::function_closure()); | 1623 Node* closure = __ LoadRegister(Register::function_closure()); |
1614 Node* context = __ GetContext(); | 1624 Node* context = __ GetContext(); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 Node* index = __ LoadRegister(index_reg); | 1887 Node* index = __ LoadRegister(index_reg); |
1878 Node* context = __ GetContext(); | 1888 Node* context = __ GetContext(); |
1879 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1889 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
1880 __ SetAccumulator(result); | 1890 __ SetAccumulator(result); |
1881 __ Dispatch(); | 1891 __ Dispatch(); |
1882 } | 1892 } |
1883 | 1893 |
1884 } // namespace interpreter | 1894 } // namespace interpreter |
1885 } // namespace internal | 1895 } // namespace internal |
1886 } // namespace v8 | 1896 } // namespace v8 |
OLD | NEW |