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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1312 intptr_t try_index, | 1312 intptr_t try_index, |
1313 intptr_t slow_path_argument_count) { | 1313 intptr_t slow_path_argument_count) { |
1314 const String& name = String::Handle(zone(), ic_data.target_name()); | 1314 const String& name = String::Handle(zone(), ic_data.target_name()); |
1315 const Array& arguments_descriptor = | 1315 const Array& arguments_descriptor = |
1316 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1316 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
1317 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1317 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
1318 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1318 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
1319 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1319 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
1320 | 1320 |
1321 __ Comment("MegamorphicCall"); | 1321 __ Comment("MegamorphicCall"); |
1322 // Load receiver into R0. | |
1322 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); | 1323 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); |
1324 Label done; | |
1325 if (name.raw() == Symbols::hashCode().raw()) { | |
1326 Label megamorphic_call; | |
1327 __ Comment("Inlined get:hashCode for Smi and OneByteString"); | |
1328 __ tst(R0, Operand(kSmiTagMask)); | |
1329 __ b(&done, EQ); // Is Smi. | |
rmacnak
2016/04/25 22:47:10
// Is Smi (result is receiver).
srdjan
2016/04/25 23:44:49
Done.
| |
1330 | |
1331 // Use R9 (cache for megamorphic call) as scratch. | |
1332 __ CompareClassId(R0, kOneByteStringCid, R9); | |
1333 __ b(&megamorphic_call, NE); | |
1334 | |
1335 __ mov(R9, Operand(R0)); // Preserve receiver in R9. | |
1336 __ ldr(R0, FieldAddress(R0, String::hash_offset())); | |
1337 __ cmp(R0, Operand(0)); | |
rmacnak
2016/04/25 22:47:10
ASSERT(Smi::New(0) == 0);
srdjan
2016/04/25 23:44:49
Done.
| |
1338 __ b(&done, NE); // Return if already computed. | |
1339 __ mov(R0, Operand(R9)); // Restore receiver in R0. | |
1340 | |
1341 __ Bind(&megamorphic_call); | |
1342 __ Comment("Slow case: megamorphic call"); | |
1343 } | |
1323 __ LoadObject(R9, cache); | 1344 __ LoadObject(R9, cache); |
1324 if (FLAG_use_megamorphic_stub) { | 1345 if (FLAG_use_megamorphic_stub) { |
1325 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1346 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
1326 } else { | 1347 } else { |
1327 StubCode::EmitMegamorphicLookup(assembler()); | 1348 StubCode::EmitMegamorphicLookup(assembler()); |
1328 } | 1349 } |
1329 __ blx(R1); | 1350 __ blx(R1); |
1330 | 1351 |
1352 __ Bind(&done); | |
1331 RecordSafepoint(locs, slow_path_argument_count); | 1353 RecordSafepoint(locs, slow_path_argument_count); |
1332 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1354 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1333 if (FLAG_precompiled_mode) { | 1355 if (FLAG_precompiled_mode) { |
1334 // Megamorphic calls may occur in slow path stubs. | 1356 // Megamorphic calls may occur in slow path stubs. |
1335 // If valid use try_index argument. | 1357 // If valid use try_index argument. |
1336 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1358 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
1337 try_index = CurrentTryIndex(); | 1359 try_index = CurrentTryIndex(); |
1338 } | 1360 } |
1339 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1361 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
1340 assembler()->CodeSize(), | 1362 assembler()->CodeSize(), |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1976 DRegister dreg = EvenDRegisterOf(reg); | 1998 DRegister dreg = EvenDRegisterOf(reg); |
1977 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1999 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1978 } | 2000 } |
1979 | 2001 |
1980 | 2002 |
1981 #undef __ | 2003 #undef __ |
1982 | 2004 |
1983 } // namespace dart | 2005 } // namespace dart |
1984 | 2006 |
1985 #endif // defined TARGET_ARCH_ARM | 2007 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |