| 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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 Node* cache_type_reg = __ BytecodeOperandReg(2); | 1990 Node* cache_type_reg = __ BytecodeOperandReg(2); |
| 1991 Node* cache_type = __ LoadRegister(cache_type_reg); | 1991 Node* cache_type = __ LoadRegister(cache_type_reg); |
| 1992 Node* cache_array_reg = __ NextRegister(cache_type_reg); | 1992 Node* cache_array_reg = __ NextRegister(cache_type_reg); |
| 1993 Node* cache_array = __ LoadRegister(cache_array_reg); | 1993 Node* cache_array = __ LoadRegister(cache_array_reg); |
| 1994 | 1994 |
| 1995 // Load the next key from the enumeration array. | 1995 // Load the next key from the enumeration array. |
| 1996 Node* key = __ LoadFixedArrayElement(cache_array, index, 0, | 1996 Node* key = __ LoadFixedArrayElement(cache_array, index, 0, |
| 1997 CodeStubAssembler::SMI_PARAMETERS); | 1997 CodeStubAssembler::SMI_PARAMETERS); |
| 1998 | 1998 |
| 1999 // Check if we can use the for-in fast path potentially using the enum cache. | 1999 // Check if we can use the for-in fast path potentially using the enum cache. |
| 2000 Label if_fast(assembler), if_slow(assembler, Label::kDeferred); | 2000 Label if_fast(assembler), if_slow(assembler); |
| 2001 Node* receiver_map = __ LoadObjectField(receiver, HeapObject::kMapOffset); | 2001 Node* receiver_map = __ LoadObjectField(receiver, HeapObject::kMapOffset); |
| 2002 __ BranchIfWordEqual(receiver_map, cache_type, &if_fast, &if_slow); | 2002 __ BranchIfWordEqual(receiver_map, cache_type, &if_fast, &if_slow); |
| 2003 __ Bind(&if_fast); | 2003 __ Bind(&if_fast); |
| 2004 { | 2004 { |
| 2005 // Enum cache in use for {receiver}, the {key} is definitely valid. | 2005 // Enum cache in use for {receiver}, the {key} is definitely valid. |
| 2006 __ SetAccumulator(key); | 2006 __ SetAccumulator(key); |
| 2007 __ Dispatch(); | 2007 __ Dispatch(); |
| 2008 } | 2008 } |
| 2009 __ Bind(&if_slow); | 2009 __ Bind(&if_slow); |
| 2010 { | 2010 { |
| 2011 // Record the fact that we hit the for-in slow path. | 2011 // Record the fact that we hit the for-in slow path. |
| 2012 Node* vector_index = __ BytecodeOperandIdx(3); | 2012 Node* vector_index = __ BytecodeOperandIdx(3); |
| 2013 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 2013 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 2014 Node* megamorphic_sentinel = | 2014 Node* megamorphic_sentinel = |
| 2015 __ HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate_)); | 2015 __ HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate_)); |
| 2016 __ StoreFixedArrayElement(type_feedback_vector, vector_index, | 2016 __ StoreFixedArrayElement(type_feedback_vector, vector_index, |
| 2017 megamorphic_sentinel, SKIP_WRITE_BARRIER); | 2017 megamorphic_sentinel, SKIP_WRITE_BARRIER); |
| 2018 | 2018 |
| 2019 // Need to filter the {key} for the {receiver}. | 2019 // Need to filter the {key} for the {receiver}. |
| 2020 Node* context = __ GetContext(); | 2020 Node* context = __ GetContext(); |
| 2021 Callable callable = CodeFactory::ForInFilter(assembler->isolate()); | 2021 Node* result = ForInFilterStub::Generate(assembler, key, receiver, context); |
| 2022 Node* result = __ CallStub(callable, context, key, receiver); | |
| 2023 __ SetAccumulator(result); | 2022 __ SetAccumulator(result); |
| 2024 __ Dispatch(); | 2023 __ Dispatch(); |
| 2025 } | 2024 } |
| 2026 } | 2025 } |
| 2027 | 2026 |
| 2028 // ForInDone <index> <cache_length> | 2027 // ForInDone <index> <cache_length> |
| 2029 // | 2028 // |
| 2030 // Returns true if the end of the enumerable properties has been reached. | 2029 // Returns true if the end of the enumerable properties has been reached. |
| 2031 void Interpreter::DoForInDone(InterpreterAssembler* assembler) { | 2030 void Interpreter::DoForInDone(InterpreterAssembler* assembler) { |
| 2032 Node* index_reg = __ BytecodeOperandReg(0); | 2031 Node* index_reg = __ BytecodeOperandReg(0); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2150 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2152 __ SmiTag(new_state)); | 2151 __ SmiTag(new_state)); |
| 2153 __ SetAccumulator(old_state); | 2152 __ SetAccumulator(old_state); |
| 2154 | 2153 |
| 2155 __ Dispatch(); | 2154 __ Dispatch(); |
| 2156 } | 2155 } |
| 2157 | 2156 |
| 2158 } // namespace interpreter | 2157 } // namespace interpreter |
| 2159 } // namespace internal | 2158 } // namespace internal |
| 2160 } // namespace v8 | 2159 } // namespace v8 |
| OLD | NEW |