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 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 | 2253 |
2254 // Need to filter the {key} for the {receiver}. | 2254 // Need to filter the {key} for the {receiver}. |
2255 Node* context = __ GetContext(); | 2255 Node* context = __ GetContext(); |
2256 Callable callable = CodeFactory::ForInFilter(assembler->isolate()); | 2256 Callable callable = CodeFactory::ForInFilter(assembler->isolate()); |
2257 Node* result = __ CallStub(callable, context, key, receiver); | 2257 Node* result = __ CallStub(callable, context, key, receiver); |
2258 __ SetAccumulator(result); | 2258 __ SetAccumulator(result); |
2259 __ Dispatch(); | 2259 __ Dispatch(); |
2260 } | 2260 } |
2261 } | 2261 } |
2262 | 2262 |
2263 // ForInDone <index> <cache_length> | 2263 // ForInContinue <index> <cache_length> |
2264 // | 2264 // |
2265 // Returns true if the end of the enumerable properties has been reached. | 2265 // Returns false if the end of the enumerable properties has been reached. |
2266 void Interpreter::DoForInDone(InterpreterAssembler* assembler) { | 2266 void Interpreter::DoForInContinue(InterpreterAssembler* assembler) { |
2267 Node* index_reg = __ BytecodeOperandReg(0); | 2267 Node* index_reg = __ BytecodeOperandReg(0); |
2268 Node* index = __ LoadRegister(index_reg); | 2268 Node* index = __ LoadRegister(index_reg); |
2269 Node* cache_length_reg = __ BytecodeOperandReg(1); | 2269 Node* cache_length_reg = __ BytecodeOperandReg(1); |
2270 Node* cache_length = __ LoadRegister(cache_length_reg); | 2270 Node* cache_length = __ LoadRegister(cache_length_reg); |
2271 | 2271 |
2272 // Check if {index} is at {cache_length} already. | 2272 // Check if {index} is at {cache_length} already. |
2273 Label if_true(assembler), if_false(assembler), end(assembler); | 2273 Label if_true(assembler), if_false(assembler), end(assembler); |
2274 __ BranchIfWordEqual(index, cache_length, &if_true, &if_false); | 2274 __ BranchIfWordEqual(index, cache_length, &if_true, &if_false); |
2275 __ Bind(&if_true); | 2275 __ Bind(&if_true); |
2276 { | 2276 { |
| 2277 __ SetAccumulator(__ BooleanConstant(false)); |
| 2278 __ Goto(&end); |
| 2279 } |
| 2280 __ Bind(&if_false); |
| 2281 { |
2277 __ SetAccumulator(__ BooleanConstant(true)); | 2282 __ SetAccumulator(__ BooleanConstant(true)); |
2278 __ Goto(&end); | 2283 __ Goto(&end); |
2279 } | 2284 } |
2280 __ Bind(&if_false); | |
2281 { | |
2282 __ SetAccumulator(__ BooleanConstant(false)); | |
2283 __ Goto(&end); | |
2284 } | |
2285 __ Bind(&end); | 2285 __ Bind(&end); |
2286 __ Dispatch(); | 2286 __ Dispatch(); |
2287 } | 2287 } |
2288 | 2288 |
2289 // ForInStep <index> | 2289 // ForInStep <index> |
2290 // | 2290 // |
2291 // Increments the loop counter in register |index| and stores the result | 2291 // Increments the loop counter in register |index| and stores the result |
2292 // in the accumulator. | 2292 // in the accumulator. |
2293 void Interpreter::DoForInStep(InterpreterAssembler* assembler) { | 2293 void Interpreter::DoForInStep(InterpreterAssembler* assembler) { |
2294 Node* index_reg = __ BytecodeOperandReg(0); | 2294 Node* index_reg = __ BytecodeOperandReg(0); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2386 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2387 __ SmiTag(new_state)); | 2387 __ SmiTag(new_state)); |
2388 __ SetAccumulator(old_state); | 2388 __ SetAccumulator(old_state); |
2389 | 2389 |
2390 __ Dispatch(); | 2390 __ Dispatch(); |
2391 } | 2391 } |
2392 | 2392 |
2393 } // namespace interpreter | 2393 } // namespace interpreter |
2394 } // namespace internal | 2394 } // namespace internal |
2395 } // namespace v8 | 2395 } // namespace v8 |
OLD | NEW |