OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 __ mov(IP, ShifterOperand(R1)); // Stack pointer. | 1959 __ mov(IP, ShifterOperand(R1)); // Stack pointer. |
1960 __ mov(LR, ShifterOperand(R0)); // Program counter. | 1960 __ mov(LR, ShifterOperand(R0)); // Program counter. |
1961 __ mov(R0, ShifterOperand(R3)); // Exception object. | 1961 __ mov(R0, ShifterOperand(R3)); // Exception object. |
1962 __ ldr(R1, Address(SP, 0)); // StackTrace object. | 1962 __ ldr(R1, Address(SP, 0)); // StackTrace object. |
1963 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. | 1963 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. |
1964 __ mov(SP, ShifterOperand(IP)); // Stack pointer. | 1964 __ mov(SP, ShifterOperand(IP)); // Stack pointer. |
1965 __ bx(LR); // Jump to the exception handler code. | 1965 __ bx(LR); // Jump to the exception handler code. |
1966 } | 1966 } |
1967 | 1967 |
1968 | 1968 |
1969 // Implements equality operator when one of the arguments is null | |
1970 // (identity check) and updates ICData if necessary. | |
1971 // LR: return address. | |
1972 // R1: left argument. | |
1973 // R0: right argument. | |
1974 // R5: ICData. | |
1975 // R0: result. | |
1976 // TODO(srdjan): Move to VM stubs once Boolean objects become VM objects. | |
1977 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { | |
1978 __ EnterStubFrame(); | |
1979 static const intptr_t kNumArgsTested = 2; | |
1980 #if defined(DEBUG) | |
1981 { Label ok; | |
1982 __ ldr(IP, FieldAddress(R5, ICData::num_args_tested_offset())); | |
1983 __ cmp(IP, ShifterOperand(kNumArgsTested)); | |
1984 __ b(&ok, EQ); | |
1985 __ Stop("Incorrect ICData for equality"); | |
1986 __ Bind(&ok); | |
1987 } | |
1988 #endif // DEBUG | |
1989 // Check IC data, update if needed. | |
1990 // R5: IC data object (preserved). | |
1991 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); | |
1992 // R6: ic_data_array with check entries: classes and target functions. | |
1993 __ AddImmediate(R6, Array::data_offset() - kHeapObjectTag); | |
1994 // R6: points directly to the first ic data array element. | |
1995 | |
1996 Label get_class_id_as_smi, no_match, loop, found; | |
1997 __ Bind(&loop); | |
1998 // Check left. | |
1999 __ mov(R2, ShifterOperand(R1)); | |
2000 __ bl(&get_class_id_as_smi); | |
2001 __ ldr(R3, Address(R6, 0 * kWordSize)); | |
2002 __ cmp(R2, ShifterOperand(R3)); // Class id match? | |
2003 __ b(&no_match, NE); | |
2004 // Check right. | |
2005 __ mov(R2, ShifterOperand(R0)); | |
2006 __ bl(&get_class_id_as_smi); | |
2007 __ ldr(R3, Address(R6, 1 * kWordSize)); | |
2008 __ cmp(R2, ShifterOperand(R3)); // Class id match? | |
2009 __ b(&found, EQ); | |
2010 __ Bind(&no_match); | |
2011 // Next check group. | |
2012 __ AddImmediate(R6, kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)); | |
2013 __ CompareImmediate(R3, Smi::RawValue(kIllegalCid)); // Done? | |
2014 __ b(&loop, NE); | |
2015 Label update_ic_data; | |
2016 __ b(&update_ic_data); | |
2017 | |
2018 __ Bind(&found); | |
2019 const intptr_t count_offset = | |
2020 ICData::CountIndexFor(kNumArgsTested) * kWordSize; | |
2021 __ ldr(IP, Address(R6, count_offset)); | |
2022 __ adds(IP, IP, ShifterOperand(Smi::RawValue(1))); | |
2023 __ LoadImmediate(IP, Smi::RawValue(Smi::kMaxValue), VS); // If overflow. | |
2024 __ str(IP, Address(R6, count_offset)); | |
2025 | |
2026 Label compute_result; | |
2027 __ Bind(&compute_result); | |
2028 __ cmp(R0, ShifterOperand(R1)); | |
2029 __ LoadObject(R0, Bool::False(), NE); | |
2030 __ LoadObject(R0, Bool::True(), EQ); | |
2031 __ LeaveStubFrame(); | |
2032 __ Ret(); | |
2033 | |
2034 __ Bind(&get_class_id_as_smi); | |
2035 // Test if Smi -> load Smi class for comparison. | |
2036 __ tst(R2, ShifterOperand(kSmiTagMask)); | |
2037 __ mov(R2, ShifterOperand(Smi::RawValue(kSmiCid)), EQ); | |
2038 __ bx(LR, EQ); | |
2039 __ LoadClassId(R2, R2); | |
2040 __ SmiTag(R2); | |
2041 __ bx(LR); | |
2042 | |
2043 __ Bind(&update_ic_data); | |
2044 // R5: ICData | |
2045 __ PushList((1 << R0) | (1 << R1)); | |
2046 __ PushObject(Symbols::EqualOperator()); // Target's name. | |
2047 __ Push(R5); // ICData | |
2048 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4); // Clobbers R4, R5. | |
2049 __ Drop(2); | |
2050 __ PopList((1 << R0) | (1 << R1)); | |
2051 __ b(&compute_result); | |
2052 } | |
2053 | |
2054 | |
2055 // Calls to the runtime to optimize the given function. | 1969 // Calls to the runtime to optimize the given function. |
2056 // R6: function to be reoptimized. | 1970 // R6: function to be reoptimized. |
2057 // R4: argument descriptor (preserved). | 1971 // R4: argument descriptor (preserved). |
2058 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1972 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
2059 __ EnterStubFrame(); | 1973 __ EnterStubFrame(); |
2060 __ Push(R4); | 1974 __ Push(R4); |
2061 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); | 1975 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); |
2062 __ Push(IP); // Setup space on stack for return value. | 1976 __ Push(IP); // Setup space on stack for return value. |
2063 __ Push(R6); | 1977 __ Push(R6); |
2064 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); | 1978 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 __ ldr(left, Address(SP, 4 * kWordSize)); | 2105 __ ldr(left, Address(SP, 4 * kWordSize)); |
2192 __ ldr(right, Address(SP, 3 * kWordSize)); | 2106 __ ldr(right, Address(SP, 3 * kWordSize)); |
2193 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2194 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2108 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
2195 __ Ret(); | 2109 __ Ret(); |
2196 } | 2110 } |
2197 | 2111 |
2198 } // namespace dart | 2112 } // namespace dart |
2199 | 2113 |
2200 #endif // defined TARGET_ARCH_ARM | 2114 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |