| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 8832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8843 Variable var_map_index(this, MachineType::PointerRepresentation()); | 8843 Variable var_map_index(this, MachineType::PointerRepresentation()); |
| 8844 Variable var_array_map(this, MachineRepresentation::kTagged); | 8844 Variable var_array_map(this, MachineRepresentation::kTagged); |
| 8845 | 8845 |
| 8846 Label return_result(this); | 8846 Label return_result(this); |
| 8847 Label allocate_iterator(this); | 8847 Label allocate_iterator(this); |
| 8848 | 8848 |
| 8849 if (mode == IterationKind::kKeys) { | 8849 if (mode == IterationKind::kKeys) { |
| 8850 // There are only two key iterator maps, branch depending on whether or not | 8850 // There are only two key iterator maps, branch depending on whether or not |
| 8851 // the receiver is a TypedArray or not. | 8851 // the receiver is a TypedArray or not. |
| 8852 | 8852 |
| 8853 Label if_isarray(this), if_istypedarray(this), if_isgeneric(this); | 8853 Label if_istypedarray(this), if_isgeneric(this); |
| 8854 Label* kInstanceTypeHandlers[] = {&if_isarray, &if_istypedarray}; | |
| 8855 | 8854 |
| 8856 static int32_t kInstanceType[] = {JS_ARRAY_TYPE, JS_TYPED_ARRAY_TYPE}; | 8855 Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), |
| 8856 &if_istypedarray, &if_isgeneric); |
| 8857 | 8857 |
| 8858 Switch(array_type, &if_isgeneric, kInstanceType, kInstanceTypeHandlers, | 8858 Bind(&if_isgeneric); |
| 8859 arraysize(kInstanceType)); | 8859 { |
| 8860 Label if_isfast(this), if_isslow(this); |
| 8861 BranchIfFastJSArray(array, context, &if_isfast, &if_isslow); |
| 8860 | 8862 |
| 8861 Bind(&if_isarray); | 8863 Bind(&if_isfast); |
| 8862 { | 8864 { |
| 8863 var_map_index.Bind( | 8865 var_map_index.Bind( |
| 8864 IntPtrConstant(Context::FAST_ARRAY_KEY_ITERATOR_MAP_INDEX)); | 8866 IntPtrConstant(Context::FAST_ARRAY_KEY_ITERATOR_MAP_INDEX)); |
| 8865 var_array_map.Bind(array_map); | 8867 var_array_map.Bind(array_map); |
| 8866 Goto(&allocate_iterator); | 8868 Goto(&allocate_iterator); |
| 8869 } |
| 8870 |
| 8871 Bind(&if_isslow); |
| 8872 { |
| 8873 var_map_index.Bind( |
| 8874 IntPtrConstant(Context::GENERIC_ARRAY_KEY_ITERATOR_MAP_INDEX)); |
| 8875 var_array_map.Bind(UndefinedConstant()); |
| 8876 Goto(&allocate_iterator); |
| 8877 } |
| 8867 } | 8878 } |
| 8868 | 8879 |
| 8869 Bind(&if_istypedarray); | 8880 Bind(&if_istypedarray); |
| 8870 { | 8881 { |
| 8871 var_map_index.Bind( | 8882 var_map_index.Bind( |
| 8872 IntPtrConstant(Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX)); | 8883 IntPtrConstant(Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX)); |
| 8873 var_array_map.Bind(UndefinedConstant()); | 8884 var_array_map.Bind(UndefinedConstant()); |
| 8874 Goto(&allocate_iterator); | 8885 Goto(&allocate_iterator); |
| 8875 } | 8886 } |
| 8876 | |
| 8877 Bind(&if_isgeneric); | |
| 8878 { | |
| 8879 var_map_index.Bind( | |
| 8880 IntPtrConstant(Context::GENERIC_ARRAY_KEY_ITERATOR_MAP_INDEX)); | |
| 8881 var_array_map.Bind(UndefinedConstant()); | |
| 8882 Goto(&allocate_iterator); | |
| 8883 } | |
| 8884 } else { | 8887 } else { |
| 8885 Label if_istypedarray(this), if_isgeneric(this); | 8888 Label if_istypedarray(this), if_isgeneric(this); |
| 8886 Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), | 8889 Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), |
| 8887 &if_istypedarray, &if_isgeneric); | 8890 &if_istypedarray, &if_isgeneric); |
| 8888 | 8891 |
| 8889 Bind(&if_isgeneric); | 8892 Bind(&if_isgeneric); |
| 8890 { | 8893 { |
| 8891 Label if_isfast(this), if_isslow(this); | 8894 Label if_isfast(this), if_isslow(this); |
| 8892 BranchIfFastJSArray(array, context, &if_isfast, &if_isslow); | 8895 BranchIfFastJSArray(array, context, &if_isfast, &if_isslow); |
| 8893 | 8896 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9100 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == (FAST_ELEMENTS | 1)); | 9103 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == (FAST_ELEMENTS | 1)); |
| 9101 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == (FAST_DOUBLE_ELEMENTS | 1)); | 9104 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == (FAST_DOUBLE_ELEMENTS | 1)); |
| 9102 | 9105 |
| 9103 // Check prototype chain if receiver does not have packed elements. | 9106 // Check prototype chain if receiver does not have packed elements. |
| 9104 Node* holey_elements = Word32And(elements_kind, Int32Constant(1)); | 9107 Node* holey_elements = Word32And(elements_kind, Int32Constant(1)); |
| 9105 return Word32Equal(holey_elements, Int32Constant(1)); | 9108 return Word32Equal(holey_elements, Int32Constant(1)); |
| 9106 } | 9109 } |
| 9107 | 9110 |
| 9108 } // namespace internal | 9111 } // namespace internal |
| 9109 } // namespace v8 | 9112 } // namespace v8 |
| OLD | NEW |