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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 intptr_t try_index, | 1320 intptr_t try_index, |
1321 intptr_t slow_path_argument_count) { | 1321 intptr_t slow_path_argument_count) { |
1322 const String& name = String::Handle(zone(), ic_data.target_name()); | 1322 const String& name = String::Handle(zone(), ic_data.target_name()); |
1323 const Array& arguments_descriptor = | 1323 const Array& arguments_descriptor = |
1324 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1324 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
1325 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1325 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
1326 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1326 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
1327 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1327 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
1328 | 1328 |
1329 __ Comment("MegamorphicCall"); | 1329 __ Comment("MegamorphicCall"); |
| 1330 // Load receiver into T0, |
1330 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); | 1331 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
| 1332 Label done; |
| 1333 if (name.raw() == Symbols::hashCode().raw()) { |
| 1334 Label try_onebytestring, megamorphic_call; |
| 1335 __ Comment("Inlined get:hashCode for Smi and OneByteString"); |
| 1336 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 1337 __ bne(CMPRES1, ZR, &try_onebytestring); // Not Smi. |
| 1338 __ mov(V0, T0); |
| 1339 __ b(&done); |
| 1340 |
| 1341 __ Bind(&try_onebytestring); |
| 1342 __ LoadClassId(CMPRES1, T0); // Class ID check. |
| 1343 __ BranchNotEqual( |
| 1344 CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call); |
| 1345 |
| 1346 __ lw(V0, FieldAddress(T0, String::hash_offset())); |
| 1347 __ bne(V0, ZR, &done); |
| 1348 |
| 1349 __ Bind(&megamorphic_call); |
| 1350 __ Comment("Slow case: megamorphic call"); |
| 1351 } |
1331 __ LoadObject(S5, cache); | 1352 __ LoadObject(S5, cache); |
1332 if (FLAG_use_megamorphic_stub) { | 1353 if (FLAG_use_megamorphic_stub) { |
1333 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1354 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
1334 } else { | 1355 } else { |
1335 StubCode::EmitMegamorphicLookup(assembler()); | 1356 StubCode::EmitMegamorphicLookup(assembler()); |
1336 } | 1357 } |
1337 __ jalr(T1); | 1358 __ jalr(T1); |
1338 | 1359 |
| 1360 __ Bind(&done); |
1339 RecordSafepoint(locs, slow_path_argument_count); | 1361 RecordSafepoint(locs, slow_path_argument_count); |
1340 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1362 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1341 if (FLAG_precompiled_mode) { | 1363 if (FLAG_precompiled_mode) { |
1342 // Megamorphic calls may occur in slow path stubs. | 1364 // Megamorphic calls may occur in slow path stubs. |
1343 // If valid use try_index argument. | 1365 // If valid use try_index argument. |
1344 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1366 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
1345 try_index = CurrentTryIndex(); | 1367 try_index = CurrentTryIndex(); |
1346 } | 1368 } |
1347 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1369 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
1348 assembler()->CodeSize(), | 1370 assembler()->CodeSize(), |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 __ AddImmediate(SP, kDoubleSize); | 1962 __ AddImmediate(SP, kDoubleSize); |
1941 } | 1963 } |
1942 | 1964 |
1943 | 1965 |
1944 #undef __ | 1966 #undef __ |
1945 | 1967 |
1946 | 1968 |
1947 } // namespace dart | 1969 } // namespace dart |
1948 | 1970 |
1949 #endif // defined TARGET_ARCH_MIPS | 1971 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |