OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 Label ok, fail; | 1929 Label ok, fail; |
1930 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); | 1930 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); |
1931 b(&ok); | 1931 b(&ok); |
1932 bind(&fail); | 1932 bind(&fail); |
1933 Abort("Global functions must have initial map"); | 1933 Abort("Global functions must have initial map"); |
1934 bind(&ok); | 1934 bind(&ok); |
1935 } | 1935 } |
1936 } | 1936 } |
1937 | 1937 |
1938 | 1938 |
| 1939 void MacroAssembler::JumpIfSmi(Register reg, Label* on_smi) { |
| 1940 STATIC_ASSERT(kSmiTag == 0); |
| 1941 tst(reg, Operand(kSmiTagMask)); |
| 1942 b(eq, on_smi); |
| 1943 } |
| 1944 |
| 1945 |
| 1946 void MacroAssembler::JumpIfNotSmi(Register reg, Label* on_not_smi) { |
| 1947 STATIC_ASSERT(kSmiTag == 0); |
| 1948 tst(reg, Operand(kSmiTagMask)); |
| 1949 b(ne, on_not_smi); |
| 1950 } |
| 1951 |
| 1952 |
1939 void MacroAssembler::JumpIfNotBothSmi(Register reg1, | 1953 void MacroAssembler::JumpIfNotBothSmi(Register reg1, |
1940 Register reg2, | 1954 Register reg2, |
1941 Label* on_not_both_smi) { | 1955 Label* on_not_both_smi) { |
1942 ASSERT_EQ(0, kSmiTag); | 1956 STATIC_ASSERT(kSmiTag == 0); |
1943 tst(reg1, Operand(kSmiTagMask)); | 1957 tst(reg1, Operand(kSmiTagMask)); |
1944 tst(reg2, Operand(kSmiTagMask), eq); | 1958 tst(reg2, Operand(kSmiTagMask), eq); |
1945 b(ne, on_not_both_smi); | 1959 b(ne, on_not_both_smi); |
1946 } | 1960 } |
1947 | 1961 |
1948 | 1962 |
1949 void MacroAssembler::JumpIfEitherSmi(Register reg1, | 1963 void MacroAssembler::JumpIfEitherSmi(Register reg1, |
1950 Register reg2, | 1964 Register reg2, |
1951 Label* on_either_smi) { | 1965 Label* on_either_smi) { |
1952 ASSERT_EQ(0, kSmiTag); | 1966 STATIC_ASSERT(kSmiTag == 0); |
1953 tst(reg1, Operand(kSmiTagMask)); | 1967 tst(reg1, Operand(kSmiTagMask)); |
1954 tst(reg2, Operand(kSmiTagMask), ne); | 1968 tst(reg2, Operand(kSmiTagMask), ne); |
1955 b(eq, on_either_smi); | 1969 b(eq, on_either_smi); |
1956 } | 1970 } |
1957 | 1971 |
1958 | 1972 |
1959 void MacroAssembler::AbortIfSmi(Register object) { | 1973 void MacroAssembler::AbortIfSmi(Register object) { |
1960 ASSERT_EQ(0, kSmiTag); | 1974 STATIC_ASSERT(kSmiTag == 0); |
1961 tst(object, Operand(kSmiTagMask)); | 1975 tst(object, Operand(kSmiTagMask)); |
1962 Assert(ne, "Operand is a smi"); | 1976 Assert(ne, "Operand is a smi"); |
1963 } | 1977 } |
1964 | 1978 |
1965 | 1979 |
1966 void MacroAssembler::AbortIfNotSmi(Register object) { | 1980 void MacroAssembler::AbortIfNotSmi(Register object) { |
1967 ASSERT_EQ(0, kSmiTag); | 1981 STATIC_ASSERT(kSmiTag == 0); |
1968 tst(object, Operand(kSmiTagMask)); | 1982 tst(object, Operand(kSmiTagMask)); |
1969 Assert(eq, "Operand is not smi"); | 1983 Assert(eq, "Operand is not smi"); |
1970 } | 1984 } |
1971 | 1985 |
1972 | 1986 |
| 1987 void MacroAssembler::JumpIfNotHeapNumber(Register object, |
| 1988 Register heap_number_map, |
| 1989 Register scratch, |
| 1990 Label* on_not_heap_number) { |
| 1991 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 1992 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
| 1993 cmp(scratch, heap_number_map); |
| 1994 b(ne, on_not_heap_number); |
| 1995 } |
| 1996 |
| 1997 |
1973 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings( | 1998 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings( |
1974 Register first, | 1999 Register first, |
1975 Register second, | 2000 Register second, |
1976 Register scratch1, | 2001 Register scratch1, |
1977 Register scratch2, | 2002 Register scratch2, |
1978 Label* failure) { | 2003 Label* failure) { |
1979 // Test that both first and second are sequential ASCII strings. | 2004 // Test that both first and second are sequential ASCII strings. |
1980 // Assume that they are non-smis. | 2005 // Assume that they are non-smis. |
1981 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); | 2006 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); |
1982 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); | 2007 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); |
1983 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 2008 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
1984 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); | 2009 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); |
1985 | 2010 |
1986 JumpIfBothInstanceTypesAreNotSequentialAscii(scratch1, | 2011 JumpIfBothInstanceTypesAreNotSequentialAscii(scratch1, |
1987 scratch2, | 2012 scratch2, |
1988 scratch1, | 2013 scratch1, |
1989 scratch2, | 2014 scratch2, |
1990 failure); | 2015 failure); |
1991 } | 2016 } |
1992 | 2017 |
1993 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, | 2018 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, |
1994 Register second, | 2019 Register second, |
1995 Register scratch1, | 2020 Register scratch1, |
1996 Register scratch2, | 2021 Register scratch2, |
1997 Label* failure) { | 2022 Label* failure) { |
1998 // Check that neither is a smi. | 2023 // Check that neither is a smi. |
1999 ASSERT_EQ(0, kSmiTag); | 2024 STATIC_ASSERT(kSmiTag == 0); |
2000 and_(scratch1, first, Operand(second)); | 2025 and_(scratch1, first, Operand(second)); |
2001 tst(scratch1, Operand(kSmiTagMask)); | 2026 tst(scratch1, Operand(kSmiTagMask)); |
2002 b(eq, failure); | 2027 b(eq, failure); |
2003 JumpIfNonSmisNotBothSequentialAsciiStrings(first, | 2028 JumpIfNonSmisNotBothSequentialAsciiStrings(first, |
2004 second, | 2029 second, |
2005 scratch1, | 2030 scratch1, |
2006 scratch2, | 2031 scratch2, |
2007 failure); | 2032 failure); |
2008 } | 2033 } |
2009 | 2034 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 | 2270 |
2246 void CodePatcher::Emit(Address addr) { | 2271 void CodePatcher::Emit(Address addr) { |
2247 masm()->emit(reinterpret_cast<Instr>(addr)); | 2272 masm()->emit(reinterpret_cast<Instr>(addr)); |
2248 } | 2273 } |
2249 #endif // ENABLE_DEBUGGER_SUPPORT | 2274 #endif // ENABLE_DEBUGGER_SUPPORT |
2250 | 2275 |
2251 | 2276 |
2252 } } // namespace v8::internal | 2277 } } // namespace v8::internal |
2253 | 2278 |
2254 #endif // V8_TARGET_ARCH_ARM | 2279 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |