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 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 __ mov(IP, ShifterOperand(R1)); // Stack pointer. | 1951 __ mov(IP, ShifterOperand(R1)); // Stack pointer. |
1952 __ mov(LR, ShifterOperand(R0)); // Program counter. | 1952 __ mov(LR, ShifterOperand(R0)); // Program counter. |
1953 __ mov(R0, ShifterOperand(R3)); // Exception object. | 1953 __ mov(R0, ShifterOperand(R3)); // Exception object. |
1954 __ ldr(R1, Address(SP, 0)); // StackTrace object. | 1954 __ ldr(R1, Address(SP, 0)); // StackTrace object. |
1955 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. | 1955 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. |
1956 __ mov(SP, ShifterOperand(IP)); // Stack pointer. | 1956 __ mov(SP, ShifterOperand(IP)); // Stack pointer. |
1957 __ bx(LR); // Jump to the exception handler code. | 1957 __ bx(LR); // Jump to the exception handler code. |
1958 } | 1958 } |
1959 | 1959 |
1960 | 1960 |
1961 // Implements equality operator when one of the arguments is null | |
1962 // (identity check) and updates ICData if necessary. | |
1963 // LR: return address. | |
1964 // R1: left argument. | |
1965 // R0: right argument. | |
1966 // R5: ICData. | |
1967 // R0: result. | |
1968 // TODO(srdjan): Move to VM stubs once Boolean objects become VM objects. | |
1969 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { | |
1970 __ EnterStubFrame(); | |
1971 static const intptr_t kNumArgsTested = 2; | |
1972 #if defined(DEBUG) | |
1973 { Label ok; | |
1974 __ ldr(IP, FieldAddress(R5, ICData::num_args_tested_offset())); | |
1975 __ cmp(IP, ShifterOperand(kNumArgsTested)); | |
1976 __ b(&ok, EQ); | |
1977 __ Stop("Incorrect ICData for equality"); | |
1978 __ Bind(&ok); | |
1979 } | |
1980 #endif // DEBUG | |
1981 // Check IC data, update if needed. | |
1982 // R5: IC data object (preserved). | |
1983 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); | |
1984 // R6: ic_data_array with check entries: classes and target functions. | |
1985 __ AddImmediate(R6, Array::data_offset() - kHeapObjectTag); | |
1986 // R6: points directly to the first ic data array element. | |
1987 | |
1988 Label get_class_id_as_smi, no_match, loop, found; | |
1989 __ Bind(&loop); | |
1990 // Check left. | |
1991 __ mov(R2, ShifterOperand(R1)); | |
1992 __ bl(&get_class_id_as_smi); | |
1993 __ ldr(R3, Address(R6, 0 * kWordSize)); | |
1994 __ cmp(R2, ShifterOperand(R3)); // Class id match? | |
1995 __ b(&no_match, NE); | |
1996 // Check right. | |
1997 __ mov(R2, ShifterOperand(R0)); | |
1998 __ bl(&get_class_id_as_smi); | |
1999 __ ldr(R3, Address(R6, 1 * kWordSize)); | |
2000 __ cmp(R2, ShifterOperand(R3)); // Class id match? | |
2001 __ b(&found, EQ); | |
2002 __ Bind(&no_match); | |
2003 // Next check group. | |
2004 __ AddImmediate(R6, kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)); | |
2005 __ CompareImmediate(R3, Smi::RawValue(kIllegalCid)); // Done? | |
2006 __ b(&loop, NE); | |
2007 Label update_ic_data; | |
2008 __ b(&update_ic_data); | |
2009 | |
2010 __ Bind(&found); | |
2011 const intptr_t count_offset = | |
2012 ICData::CountIndexFor(kNumArgsTested) * kWordSize; | |
2013 __ ldr(IP, Address(R6, count_offset)); | |
2014 __ adds(IP, IP, ShifterOperand(Smi::RawValue(1))); | |
2015 __ LoadImmediate(IP, Smi::RawValue(Smi::kMaxValue), VS); // If overflow. | |
2016 __ str(IP, Address(R6, count_offset)); | |
2017 | |
2018 Label compute_result; | |
2019 __ Bind(&compute_result); | |
2020 __ cmp(R0, ShifterOperand(R1)); | |
2021 __ LoadObject(R0, Bool::False(), NE); | |
2022 __ LoadObject(R0, Bool::True(), EQ); | |
2023 __ LeaveStubFrame(); | |
2024 __ Ret(); | |
2025 | |
2026 __ Bind(&get_class_id_as_smi); | |
2027 // Test if Smi -> load Smi class for comparison. | |
2028 __ tst(R2, ShifterOperand(kSmiTagMask)); | |
2029 __ mov(R2, ShifterOperand(Smi::RawValue(kSmiCid)), EQ); | |
2030 __ bx(LR, EQ); | |
2031 __ LoadClassId(R2, R2); | |
2032 __ SmiTag(R2); | |
2033 __ bx(LR); | |
2034 | |
2035 __ Bind(&update_ic_data); | |
2036 // R5: ICData | |
2037 __ PushList((1 << R0) | (1 << R1)); | |
2038 __ PushObject(Symbols::EqualOperator()); // Target's name. | |
2039 __ Push(R5); // ICData | |
2040 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4); // Clobbers R4, R5. | |
2041 __ Drop(2); | |
2042 __ PopList((1 << R0) | (1 << R1)); | |
2043 __ b(&compute_result); | |
2044 } | |
2045 | |
2046 | |
2047 // Calls to the runtime to optimize the given function. | 1961 // Calls to the runtime to optimize the given function. |
2048 // R6: function to be reoptimized. | 1962 // R6: function to be reoptimized. |
2049 // R4: argument descriptor (preserved). | 1963 // R4: argument descriptor (preserved). |
2050 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1964 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
2051 __ EnterStubFrame(); | 1965 __ EnterStubFrame(); |
2052 __ Push(R4); | 1966 __ Push(R4); |
2053 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); | 1967 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); |
2054 __ Push(IP); // Setup space on stack for return value. | 1968 __ Push(IP); // Setup space on stack for return value. |
2055 __ Push(R6); | 1969 __ Push(R6); |
2056 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); | 1970 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 __ ldr(left, Address(SP, 4 * kWordSize)); | 2097 __ ldr(left, Address(SP, 4 * kWordSize)); |
2184 __ ldr(right, Address(SP, 3 * kWordSize)); | 2098 __ ldr(right, Address(SP, 3 * kWordSize)); |
2185 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2099 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2186 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2100 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
2187 __ Ret(); | 2101 __ Ret(); |
2188 } | 2102 } |
2189 | 2103 |
2190 } // namespace dart | 2104 } // namespace dart |
2191 | 2105 |
2192 #endif // defined TARGET_ARCH_ARM | 2106 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |