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 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 Node* receiver_reg = __ BytecodeOperandReg(0); | 1713 Node* receiver_reg = __ BytecodeOperandReg(0); |
1714 Node* receiver = __ LoadRegister(receiver_reg); | 1714 Node* receiver = __ LoadRegister(receiver_reg); |
1715 Node* index_reg = __ BytecodeOperandReg(1); | 1715 Node* index_reg = __ BytecodeOperandReg(1); |
1716 Node* index = __ LoadRegister(index_reg); | 1716 Node* index = __ LoadRegister(index_reg); |
1717 Node* cache_type_reg = __ BytecodeOperandReg(2); | 1717 Node* cache_type_reg = __ BytecodeOperandReg(2); |
1718 Node* cache_type = __ LoadRegister(cache_type_reg); | 1718 Node* cache_type = __ LoadRegister(cache_type_reg); |
1719 Node* cache_array_reg = __ NextRegister(cache_type_reg); | 1719 Node* cache_array_reg = __ NextRegister(cache_type_reg); |
1720 Node* cache_array = __ LoadRegister(cache_array_reg); | 1720 Node* cache_array = __ LoadRegister(cache_array_reg); |
1721 | 1721 |
1722 // Load the next key from the enumeration array. | 1722 // Load the next key from the enumeration array. |
1723 Node* key = __ LoadFixedArrayElementSmiIndex(cache_array, index); | 1723 Node* key = __ LoadFixedArrayElement(cache_array, index, 0, |
| 1724 CodeStubAssembler::SMI_PARAMETERS); |
1724 | 1725 |
1725 // Check if we can use the for-in fast path potentially using the enum cache. | 1726 // Check if we can use the for-in fast path potentially using the enum cache. |
1726 Label if_fast(assembler), if_slow(assembler, Label::kDeferred); | 1727 Label if_fast(assembler), if_slow(assembler, Label::kDeferred); |
1727 Node* receiver_map = __ LoadObjectField(receiver, HeapObject::kMapOffset); | 1728 Node* receiver_map = __ LoadObjectField(receiver, HeapObject::kMapOffset); |
1728 Node* condition = __ WordEqual(receiver_map, cache_type); | 1729 Node* condition = __ WordEqual(receiver_map, cache_type); |
1729 __ BranchIf(condition, &if_fast, &if_slow); | 1730 __ BranchIf(condition, &if_fast, &if_slow); |
1730 __ Bind(&if_fast); | 1731 __ Bind(&if_fast); |
1731 { | 1732 { |
1732 // Enum cache in use for {receiver}, the {key} is definitely valid. | 1733 // Enum cache in use for {receiver}, the {key} is definitely valid. |
1733 __ SetAccumulator(key); | 1734 __ SetAccumulator(key); |
1734 __ Dispatch(); | 1735 __ Dispatch(); |
1735 } | 1736 } |
1736 __ Bind(&if_slow); | 1737 __ Bind(&if_slow); |
1737 { | 1738 { |
1738 // Record the fact that we hit the for-in slow path. | 1739 // Record the fact that we hit the for-in slow path. |
1739 Node* vector_index = __ BytecodeOperandIdx(3); | 1740 Node* vector_index = __ BytecodeOperandIdx(3); |
1740 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 1741 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
1741 Node* megamorphic_sentinel = | 1742 Node* megamorphic_sentinel = |
1742 __ HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate_)); | 1743 __ HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate_)); |
1743 __ StoreFixedArrayElementNoWriteBarrier(type_feedback_vector, vector_index, | 1744 __ StoreFixedArrayElement(type_feedback_vector, vector_index, |
1744 megamorphic_sentinel); | 1745 megamorphic_sentinel, SKIP_WRITE_BARRIER); |
1745 | 1746 |
1746 // Need to filter the {key} for the {receiver}. | 1747 // Need to filter the {key} for the {receiver}. |
1747 Node* context = __ GetContext(); | 1748 Node* context = __ GetContext(); |
1748 Node* result = | 1749 Node* result = |
1749 __ CallRuntime(Runtime::kForInFilter, context, receiver, key); | 1750 __ CallRuntime(Runtime::kForInFilter, context, receiver, key); |
1750 __ SetAccumulator(result); | 1751 __ SetAccumulator(result); |
1751 __ Dispatch(); | 1752 __ Dispatch(); |
1752 } | 1753 } |
1753 } | 1754 } |
1754 | 1755 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1856 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
1856 __ SmiTag(new_state)); | 1857 __ SmiTag(new_state)); |
1857 __ SetAccumulator(old_state); | 1858 __ SetAccumulator(old_state); |
1858 | 1859 |
1859 __ Dispatch(); | 1860 __ Dispatch(); |
1860 } | 1861 } |
1861 | 1862 |
1862 } // namespace interpreter | 1863 } // namespace interpreter |
1863 } // namespace internal | 1864 } // namespace internal |
1864 } // namespace v8 | 1865 } // namespace v8 |
OLD | NEW |