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 <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 } | 1930 } |
1931 | 1931 |
1932 // TestInstanceOf <src> | 1932 // TestInstanceOf <src> |
1933 // | 1933 // |
1934 // Test if the object referenced by the <src> register is an an instance of type | 1934 // Test if the object referenced by the <src> register is an an instance of type |
1935 // referenced by the accumulator. | 1935 // referenced by the accumulator. |
1936 void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) { | 1936 void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) { |
1937 DoCompareOp(Token::INSTANCEOF, assembler); | 1937 DoCompareOp(Token::INSTANCEOF, assembler); |
1938 } | 1938 } |
1939 | 1939 |
| 1940 // TestUndetectable <src> |
| 1941 // |
| 1942 // Test if the value in the <src> register equals to Null/Undefined. This is |
| 1943 // done by checking undetectable bit on the map of the object. |
| 1944 void Interpreter::DoTestUndetectable(InterpreterAssembler* assembler) { |
| 1945 Node* reg_index = __ BytecodeOperandReg(0); |
| 1946 Node* object = __ LoadRegister(reg_index); |
| 1947 |
| 1948 Label not_equal(assembler), end(assembler); |
| 1949 // If the object is an Smi then return false. |
| 1950 __ GotoIf(__ TaggedIsSmi(object), ¬_equal); |
| 1951 |
| 1952 // If it is a HeapObject, load the map and check for undetectable bit. |
| 1953 Node* map = __ LoadMap(object); |
| 1954 Node* map_bitfield = __ LoadMapBitField(map); |
| 1955 Node* map_undetectable = |
| 1956 __ Word32And(map_bitfield, __ Int32Constant(1 << Map::kIsUndetectable)); |
| 1957 __ GotoIf(__ Word32Equal(map_undetectable, __ Int32Constant(0)), ¬_equal); |
| 1958 |
| 1959 __ SetAccumulator(__ BooleanConstant(true)); |
| 1960 __ Goto(&end); |
| 1961 |
| 1962 __ Bind(¬_equal); |
| 1963 { |
| 1964 __ SetAccumulator(__ BooleanConstant(false)); |
| 1965 __ Goto(&end); |
| 1966 } |
| 1967 |
| 1968 __ Bind(&end); |
| 1969 __ Dispatch(); |
| 1970 } |
| 1971 |
1940 // Jump <imm> | 1972 // Jump <imm> |
1941 // | 1973 // |
1942 // Jump by number of bytes represented by the immediate operand |imm|. | 1974 // Jump by number of bytes represented by the immediate operand |imm|. |
1943 void Interpreter::DoJump(InterpreterAssembler* assembler) { | 1975 void Interpreter::DoJump(InterpreterAssembler* assembler) { |
1944 Node* relative_jump = __ BytecodeOperandImm(0); | 1976 Node* relative_jump = __ BytecodeOperandImm(0); |
1945 __ Jump(relative_jump); | 1977 __ Jump(relative_jump); |
1946 } | 1978 } |
1947 | 1979 |
1948 // JumpConstant <idx> | 1980 // JumpConstant <idx> |
1949 // | 1981 // |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2822 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2791 __ SmiTag(new_state)); | 2823 __ SmiTag(new_state)); |
2792 __ SetAccumulator(old_state); | 2824 __ SetAccumulator(old_state); |
2793 | 2825 |
2794 __ Dispatch(); | 2826 __ Dispatch(); |
2795 } | 2827 } |
2796 | 2828 |
2797 } // namespace interpreter | 2829 } // namespace interpreter |
2798 } // namespace internal | 2830 } // namespace internal |
2799 } // namespace v8 | 2831 } // namespace v8 |
OLD | NEW |