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 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2088 // if the object referenced by the accumulator is the undefined constant. | 2088 // if the object referenced by the accumulator is the undefined constant. |
2089 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) { | 2089 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) { |
2090 Node* accumulator = __ GetAccumulator(); | 2090 Node* accumulator = __ GetAccumulator(); |
2091 Node* undefined_value = | 2091 Node* undefined_value = |
2092 __ HeapConstant(isolate_->factory()->undefined_value()); | 2092 __ HeapConstant(isolate_->factory()->undefined_value()); |
2093 Node* index = __ BytecodeOperandIdx(0); | 2093 Node* index = __ BytecodeOperandIdx(0); |
2094 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); | 2094 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); |
2095 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); | 2095 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); |
2096 } | 2096 } |
2097 | 2097 |
2098 // JumpIfJSReceiverConstant <imm> | |
neis
2016/12/07 10:17:27
s/Constant//
caitp
2016/12/07 14:49:41
Oop, done
| |
2099 // | |
2100 // Jump by number of bytes represented by an immediate operand if the object | |
2101 // referenced by the accumulator is a JSReceiver. | |
2102 void Interpreter::DoJumpIfJSReceiver(InterpreterAssembler* assembler) { | |
2103 Node* accumulator = __ GetAccumulator(); | |
2104 Node* relative_jump = __ BytecodeOperandImm(0); | |
2105 | |
2106 Label if_object(assembler), if_notobject(assembler, Label::kDeferred), | |
2107 if_notsmi(assembler); | |
2108 __ Branch(__ TaggedIsSmi(accumulator), &if_notobject, &if_notsmi); | |
2109 | |
2110 __ Bind(&if_notsmi); | |
2111 __ Branch(__ IsJSReceiver(accumulator), &if_object, &if_notobject); | |
2112 __ Bind(&if_object); | |
2113 __ Jump(relative_jump); | |
2114 __ Bind(&if_notobject); | |
rmcilroy
2016/12/06 15:02:28
nit - add a newline above this bind
| |
2115 __ Dispatch(); | |
2116 } | |
2117 | |
2118 // JumpIfJSReceiverConstant <idx> | |
2119 // | |
2120 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool if | |
2121 // the object referenced by the accumulator is a JSReceiver. | |
2122 void Interpreter::DoJumpIfJSReceiverConstant(InterpreterAssembler* assembler) { | |
2123 Node* accumulator = __ GetAccumulator(); | |
2124 Node* index = __ BytecodeOperandIdx(0); | |
2125 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); | |
2126 | |
2127 Label if_object(assembler), if_notobject(assembler), if_notsmi(assembler); | |
2128 __ Branch(__ TaggedIsSmi(accumulator), &if_notobject, &if_notsmi); | |
2129 | |
2130 __ Bind(&if_notsmi); | |
2131 __ Branch(__ IsJSReceiver(accumulator), &if_object, &if_notobject); | |
2132 | |
2133 __ Bind(&if_object); | |
2134 __ Jump(relative_jump); | |
2135 __ Bind(&if_notobject); | |
rmcilroy
2016/12/06 15:02:28
ditto
| |
2136 __ Dispatch(); | |
2137 } | |
2138 | |
2098 // JumpIfNotHole <imm> | 2139 // JumpIfNotHole <imm> |
2099 // | 2140 // |
2100 // Jump by number of bytes represented by an immediate operand if the object | 2141 // Jump by number of bytes represented by an immediate operand if the object |
2101 // referenced by the accumulator is the hole. | 2142 // referenced by the accumulator is the hole. |
2102 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { | 2143 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { |
2103 Node* accumulator = __ GetAccumulator(); | 2144 Node* accumulator = __ GetAccumulator(); |
2104 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); | 2145 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); |
2105 Node* relative_jump = __ BytecodeOperandImm(0); | 2146 Node* relative_jump = __ BytecodeOperandImm(0); |
2106 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); | 2147 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); |
2107 } | 2148 } |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2771 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2812 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2772 __ SmiTag(new_state)); | 2813 __ SmiTag(new_state)); |
2773 __ SetAccumulator(old_state); | 2814 __ SetAccumulator(old_state); |
2774 | 2815 |
2775 __ Dispatch(); | 2816 __ Dispatch(); |
2776 } | 2817 } |
2777 | 2818 |
2778 } // namespace interpreter | 2819 } // namespace interpreter |
2779 } // namespace internal | 2820 } // namespace internal |
2780 } // namespace v8 | 2821 } // namespace v8 |
OLD | NEW |