OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 Heap::RootListIndex index) { | 1861 Heap::RootListIndex index) { |
1862 ASSERT(!obj.is(ip)); | 1862 ASSERT(!obj.is(ip)); |
1863 LoadRoot(ip, index); | 1863 LoadRoot(ip, index); |
1864 cmp(obj, ip); | 1864 cmp(obj, ip); |
1865 } | 1865 } |
1866 | 1866 |
1867 | 1867 |
1868 void MacroAssembler::CheckFastElements(Register map, | 1868 void MacroAssembler::CheckFastElements(Register map, |
1869 Register scratch, | 1869 Register scratch, |
1870 Label* fail) { | 1870 Label* fail) { |
1871 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 1871 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
1872 STATIC_ASSERT(FAST_ELEMENTS == 1); | 1872 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 1873 STATIC_ASSERT(FAST_ELEMENTS == 2); |
| 1874 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
1873 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | 1875 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
1874 cmp(scratch, Operand(Map::kMaximumBitField2FastElementValue)); | 1876 cmp(scratch, Operand(Map::kMaximumBitField2FastHoleyElementValue)); |
1875 b(hi, fail); | 1877 b(hi, fail); |
1876 } | 1878 } |
1877 | 1879 |
1878 | 1880 |
1879 void MacroAssembler::CheckFastObjectElements(Register map, | 1881 void MacroAssembler::CheckFastObjectElements(Register map, |
1880 Register scratch, | 1882 Register scratch, |
1881 Label* fail) { | 1883 Label* fail) { |
1882 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 1884 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
1883 STATIC_ASSERT(FAST_ELEMENTS == 1); | 1885 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 1886 STATIC_ASSERT(FAST_ELEMENTS == 2); |
| 1887 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
1884 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | 1888 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
1885 cmp(scratch, Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); | 1889 cmp(scratch, Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
1886 b(ls, fail); | 1890 b(ls, fail); |
1887 cmp(scratch, Operand(Map::kMaximumBitField2FastElementValue)); | 1891 cmp(scratch, Operand(Map::kMaximumBitField2FastHoleyElementValue)); |
1888 b(hi, fail); | 1892 b(hi, fail); |
1889 } | 1893 } |
1890 | 1894 |
1891 | 1895 |
1892 void MacroAssembler::CheckFastSmiOnlyElements(Register map, | 1896 void MacroAssembler::CheckFastSmiElements(Register map, |
1893 Register scratch, | 1897 Register scratch, |
1894 Label* fail) { | 1898 Label* fail) { |
1895 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 1899 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
| 1900 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
1896 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | 1901 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
1897 cmp(scratch, Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); | 1902 cmp(scratch, Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
1898 b(hi, fail); | 1903 b(hi, fail); |
1899 } | 1904 } |
1900 | 1905 |
1901 | 1906 |
1902 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, | 1907 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, |
1903 Register key_reg, | 1908 Register key_reg, |
1904 Register receiver_reg, | 1909 Register receiver_reg, |
1905 Register elements_reg, | 1910 Register elements_reg, |
1906 Register scratch1, | 1911 Register scratch1, |
1907 Register scratch2, | 1912 Register scratch2, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 | 1995 |
1991 | 1996 |
1992 void MacroAssembler::CompareMap(Register obj, | 1997 void MacroAssembler::CompareMap(Register obj, |
1993 Register scratch, | 1998 Register scratch, |
1994 Handle<Map> map, | 1999 Handle<Map> map, |
1995 Label* early_success, | 2000 Label* early_success, |
1996 CompareMapMode mode) { | 2001 CompareMapMode mode) { |
1997 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 2002 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
1998 cmp(scratch, Operand(map)); | 2003 cmp(scratch, Operand(map)); |
1999 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { | 2004 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { |
2000 Map* transitioned_fast_element_map( | 2005 ElementsKind kind = map->elements_kind(); |
2001 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL)); | 2006 if (IsFastElementsKind(kind)) { |
2002 ASSERT(transitioned_fast_element_map == NULL || | 2007 bool packed = IsFastPackedElementsKind(kind); |
2003 map->elements_kind() != FAST_ELEMENTS); | 2008 Map* current_map = *map; |
2004 if (transitioned_fast_element_map != NULL) { | 2009 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { |
2005 b(eq, early_success); | 2010 kind = GetNextMoreGeneralFastElementsKind(kind, packed); |
2006 cmp(scratch, Operand(Handle<Map>(transitioned_fast_element_map))); | 2011 current_map = current_map->LookupElementsTransitionMap(kind, NULL); |
2007 } | 2012 if (!current_map) break; |
2008 | 2013 b(eq, early_success); |
2009 Map* transitioned_double_map( | 2014 cmp(scratch, Operand(Handle<Map>(current_map))); |
2010 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL)); | 2015 } |
2011 ASSERT(transitioned_double_map == NULL || | |
2012 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS); | |
2013 if (transitioned_double_map != NULL) { | |
2014 b(eq, early_success); | |
2015 cmp(scratch, Operand(Handle<Map>(transitioned_double_map))); | |
2016 } | 2016 } |
2017 } | 2017 } |
2018 } | 2018 } |
2019 | 2019 |
2020 | 2020 |
2021 void MacroAssembler::CheckMap(Register obj, | 2021 void MacroAssembler::CheckMap(Register obj, |
2022 Register scratch, | 2022 Register scratch, |
2023 Handle<Map> map, | 2023 Handle<Map> map, |
2024 Label* fail, | 2024 Label* fail, |
2025 SmiCheckType smi_check_type, | 2025 SmiCheckType smi_check_type, |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 ElementsKind expected_kind, | 2858 ElementsKind expected_kind, |
2859 ElementsKind transitioned_kind, | 2859 ElementsKind transitioned_kind, |
2860 Register map_in_out, | 2860 Register map_in_out, |
2861 Register scratch, | 2861 Register scratch, |
2862 Label* no_map_match) { | 2862 Label* no_map_match) { |
2863 // Load the global or builtins object from the current context. | 2863 // Load the global or builtins object from the current context. |
2864 ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2864 ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2865 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 2865 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
2866 | 2866 |
2867 // Check that the function's map is the same as the expected cached map. | 2867 // Check that the function's map is the same as the expected cached map. |
2868 int expected_index = | 2868 ldr(scratch, |
2869 Context::GetContextMapIndexFromElementsKind(expected_kind); | 2869 MemOperand(scratch, |
2870 ldr(ip, MemOperand(scratch, Context::SlotOffset(expected_index))); | 2870 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
2871 cmp(map_in_out, ip); | 2871 size_t offset = expected_kind * kPointerSize + |
| 2872 FixedArrayBase::kHeaderSize; |
| 2873 cmp(map_in_out, scratch); |
2872 b(ne, no_map_match); | 2874 b(ne, no_map_match); |
2873 | 2875 |
2874 // Use the transitioned cached map. | 2876 // Use the transitioned cached map. |
2875 int trans_index = | 2877 offset = transitioned_kind * kPointerSize + |
2876 Context::GetContextMapIndexFromElementsKind(transitioned_kind); | 2878 FixedArrayBase::kHeaderSize; |
2877 ldr(map_in_out, MemOperand(scratch, Context::SlotOffset(trans_index))); | 2879 ldr(map_in_out, FieldMemOperand(scratch, offset)); |
2878 } | 2880 } |
2879 | 2881 |
2880 | 2882 |
2881 void MacroAssembler::LoadInitialArrayMap( | 2883 void MacroAssembler::LoadInitialArrayMap( |
2882 Register function_in, Register scratch, Register map_out) { | 2884 Register function_in, Register scratch, |
| 2885 Register map_out, bool can_have_holes) { |
2883 ASSERT(!function_in.is(map_out)); | 2886 ASSERT(!function_in.is(map_out)); |
2884 Label done; | 2887 Label done; |
2885 ldr(map_out, FieldMemOperand(function_in, | 2888 ldr(map_out, FieldMemOperand(function_in, |
2886 JSFunction::kPrototypeOrInitialMapOffset)); | 2889 JSFunction::kPrototypeOrInitialMapOffset)); |
2887 if (!FLAG_smi_only_arrays) { | 2890 if (!FLAG_smi_only_arrays) { |
2888 LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, | 2891 ElementsKind kind = can_have_holes ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; |
2889 FAST_ELEMENTS, | 2892 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 2893 kind, |
2890 map_out, | 2894 map_out, |
2891 scratch, | 2895 scratch, |
2892 &done); | 2896 &done); |
| 2897 } else if (can_have_holes) { |
| 2898 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 2899 FAST_HOLEY_SMI_ELEMENTS, |
| 2900 map_out, |
| 2901 scratch, |
| 2902 &done); |
2893 } | 2903 } |
2894 bind(&done); | 2904 bind(&done); |
2895 } | 2905 } |
2896 | 2906 |
2897 | 2907 |
2898 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2908 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2899 // Load the global or builtins object from the current context. | 2909 // Load the global or builtins object from the current context. |
2900 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2910 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2901 // Load the global context from the global or builtins object. | 2911 // Load the global context from the global or builtins object. |
2902 ldr(function, FieldMemOperand(function, | 2912 ldr(function, FieldMemOperand(function, |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3769 void CodePatcher::EmitCondition(Condition cond) { | 3779 void CodePatcher::EmitCondition(Condition cond) { |
3770 Instr instr = Assembler::instr_at(masm_.pc_); | 3780 Instr instr = Assembler::instr_at(masm_.pc_); |
3771 instr = (instr & ~kCondMask) | cond; | 3781 instr = (instr & ~kCondMask) | cond; |
3772 masm_.emit(instr); | 3782 masm_.emit(instr); |
3773 } | 3783 } |
3774 | 3784 |
3775 | 3785 |
3776 } } // namespace v8::internal | 3786 } } // namespace v8::internal |
3777 | 3787 |
3778 #endif // V8_TARGET_ARCH_ARM | 3788 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |