Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2557593004: [ignition] desugar GetIterator() via bytecode rather than via AST (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 // if the object referenced by the accumulator is the undefined constant. 2120 // if the object referenced by the accumulator is the undefined constant.
2121 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) { 2121 void Interpreter::DoJumpIfUndefinedConstant(InterpreterAssembler* assembler) {
2122 Node* accumulator = __ GetAccumulator(); 2122 Node* accumulator = __ GetAccumulator();
2123 Node* undefined_value = 2123 Node* undefined_value =
2124 __ HeapConstant(isolate_->factory()->undefined_value()); 2124 __ HeapConstant(isolate_->factory()->undefined_value());
2125 Node* index = __ BytecodeOperandIdx(0); 2125 Node* index = __ BytecodeOperandIdx(0);
2126 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index); 2126 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index);
2127 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump); 2127 __ JumpIfWordEqual(accumulator, undefined_value, relative_jump);
2128 } 2128 }
2129 2129
2130 // JumpIfJSReceiverConstant <imm>
2131 //
2132 // Jump by number of bytes represented by an immediate operand if the object
2133 // referenced by the accumulator is a JSReceiver.
2134 void Interpreter::DoJumpIfJSReceiver(InterpreterAssembler* assembler) {
2135 Node* accumulator = __ GetAccumulator();
2136 Node* relative_jump = __ BytecodeOperandImm(0);
2137
2138 Label if_object(assembler), if_notobject(assembler, Label::kDeferred),
2139 if_notsmi(assembler);
2140 __ Branch(__ TaggedIsSmi(accumulator), &if_notobject, &if_notsmi);
2141
2142 __ Bind(&if_notsmi);
2143 __ Branch(__ IsJSReceiver(accumulator), &if_object, &if_notobject);
2144 __ Bind(&if_object);
2145 __ Jump(relative_jump);
2146 __ Bind(&if_notobject);
2147 __ Dispatch();
2148 }
2149
2150 // JumpIfJSReceiverConstant <idx>
2151 //
2152 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool if
2153 // the object referenced by the accumulator is a JSReceiver.
2154 void Interpreter::DoJumpIfJSReceiverConstant(InterpreterAssembler* assembler) {
2155 Node* accumulator = __ GetAccumulator();
2156 Node* index = __ BytecodeOperandIdx(0);
2157 Node* relative_jump = __ LoadAndUntagConstantPoolEntry(index);
2158
2159 Label if_object(assembler), if_notobject(assembler), 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
2165 __ Bind(&if_object);
2166 __ Jump(relative_jump);
2167 __ Bind(&if_notobject);
2168 __ Dispatch();
2169 }
2170
2130 // JumpIfNotHole <imm> 2171 // JumpIfNotHole <imm>
2131 // 2172 //
2132 // Jump by number of bytes represented by an immediate operand if the object 2173 // Jump by number of bytes represented by an immediate operand if the object
2133 // referenced by the accumulator is the hole. 2174 // referenced by the accumulator is the hole.
2134 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) { 2175 void Interpreter::DoJumpIfNotHole(InterpreterAssembler* assembler) {
2135 Node* accumulator = __ GetAccumulator(); 2176 Node* accumulator = __ GetAccumulator();
2136 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value()); 2177 Node* the_hole_value = __ HeapConstant(isolate_->factory()->the_hole_value());
2137 Node* relative_jump = __ BytecodeOperandImm(0); 2178 Node* relative_jump = __ BytecodeOperandImm(0);
2138 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump); 2179 __ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
2139 } 2180 }
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2844 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2804 __ SmiTag(new_state)); 2845 __ SmiTag(new_state));
2805 __ SetAccumulator(old_state); 2846 __ SetAccumulator(old_state);
2806 2847
2807 __ Dispatch(); 2848 __ Dispatch();
2808 } 2849 }
2809 2850
2810 } // namespace interpreter 2851 } // namespace interpreter
2811 } // namespace internal 2852 } // namespace internal
2812 } // namespace v8 2853 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698