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 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 // if the object referenced by the accumulator is the undefined constant. | 2140 // if the object referenced by the accumulator is the undefined constant. |
2141 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) { | 2141 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) { |
2142 Node* accumulator = __ GetAccumulator(); | 2142 Node* accumulator = __ GetAccumulator(); |
2143 Node* undefined_value = | 2143 Node* undefined_value = |
2144 __ HeapConstant(isolate_->factory()->undefined_value()); | 2144 __ HeapConstant(isolate_->factory()->undefined_value()); |
2145 Node* index = __ BytecodeOperandIdx(0); | 2145 Node* index = __ BytecodeOperandIdx(0); |
2146 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); | 2146 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); |
2147 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); | 2147 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); |
2148 } | 2148 } |
2149 | 2149 |
| 2150 // JumpIfJSReceiver <imm> |
| 2151 // |
| 2152 // Jump by number of bytes represented by an immediate operand if the object |
| 2153 // referenced by the accumulator is a JSReceiver. |
| 2154 void Interpreter::DoJumpIfJSReceiver(InterpreterAssembler* assembler) { |
| 2155 Node* accumulator = __ GetAccumulator(); |
| 2156 Node* relative_jump = __ BytecodeOperandImm(0); |
| 2157 |
| 2158 Label if_object(assembler), if_notobject(assembler, Label::kDeferred), |
| 2159 if_notsmi(assembler); |
| 2160 __ Branch(__ TaggedIsSmi(accumulator), &if_notobject, &if_notsmi); |
| 2161 |
| 2162 __ Bind(&if_notsmi); |
| 2163 __ Branch(__ IsJSReceiver(accumulator), &if_object, &if_notobject); |
| 2164 __ Bind(&if_object); |
| 2165 __ Jump(relative_jump); |
| 2166 |
| 2167 __ Bind(&if_notobject); |
| 2168 __ Dispatch(); |
| 2169 } |
| 2170 |
| 2171 // JumpIfJSReceiverConstant <idx> |
| 2172 // |
| 2173 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool if |
| 2174 // the object referenced by the accumulator is a JSReceiver. |
| 2175 void Interpreter::DoJumpIfJSReceiverConstant(InterpreterAssembler* assembler) { |
| 2176 Node* accumulator = __ GetAccumulator(); |
| 2177 Node* index = __ BytecodeOperandIdx(0); |
| 2178 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); |
| 2179 |
| 2180 Label if_object(assembler), if_notobject(assembler), if_notsmi(assembler); |
| 2181 __ Branch(__ TaggedIsSmi(accumulator), &if_notobject, &if_notsmi); |
| 2182 |
| 2183 __ Bind(&if_notsmi); |
| 2184 __ Branch(__ IsJSReceiver(accumulator), &if_object, &if_notobject); |
| 2185 |
| 2186 __ Bind(&if_object); |
| 2187 __ Jump(relative_jump); |
| 2188 |
| 2189 __ Bind(&if_notobject); |
| 2190 __ Dispatch(); |
| 2191 } |
| 2192 |
2150 // JumpIfNotHole <imm> | 2193 // JumpIfNotHole <imm> |
2151 // | 2194 // |
2152 // Jump by number of bytes represented by an immediate operand if the object | 2195 // Jump by number of bytes represented by an immediate operand if the object |
2153 // referenced by the accumulator is the hole. | 2196 // referenced by the accumulator is the hole. |
2154 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { | 2197 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { |
2155 Node* accumulator = __ GetAccumulator(); | 2198 Node* accumulator = __ GetAccumulator(); |
2156 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | 2199 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); |
2157 Node* relative_jump = __ BytecodeOperandImm(0); | 2200 Node* relative_jump = __ BytecodeOperandImm(0); |
2158 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); | 2201 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); |
2159 } | 2202 } |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2866 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2824 __ SmiTag(new_state)); | 2867 __ SmiTag(new_state)); |
2825 __ SetAccumulator(old_state); | 2868 __ SetAccumulator(old_state); |
2826 | 2869 |
2827 __ Dispatch(); | 2870 __ Dispatch(); |
2828 } | 2871 } |
2829 | 2872 |
2830 } // namespace interpreter | 2873 } // namespace interpreter |
2831 } // namespace internal | 2874 } // namespace internal |
2832 } // namespace v8 | 2875 } // namespace v8 |
OLD | NEW |