Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.cc

Issue 1921893002: Faster code for megamorphic calls fo get:hashCode for Smi and OneByteString (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 intptr_t try_index, 1293 intptr_t try_index,
1294 intptr_t slow_path_argument_count) { 1294 intptr_t slow_path_argument_count) {
1295 const String& name = String::Handle(zone(), ic_data.target_name()); 1295 const String& name = String::Handle(zone(), ic_data.target_name());
1296 const Array& arguments_descriptor = 1296 const Array& arguments_descriptor =
1297 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); 1297 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1298 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); 1298 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
1299 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), 1299 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1300 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); 1300 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1301 1301
1302 __ Comment("MegamorphicCall"); 1302 __ Comment("MegamorphicCall");
1303 // Load receiver into R0.
1303 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); 1304 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize);
1305 Label done;
1306 if (name.raw() == Symbols::hashCode().raw()) {
1307 Label megamorphic_call;
1308 __ Comment("Inlined get:hashCode for Smi and OneByteString");
1309 __ tsti(R0, Immediate(kSmiTagMask));
1310 __ b(&done, EQ); // Is Smi.
1311
1312 __ CompareClassId(R0, kOneByteStringCid);
1313 __ b(&megamorphic_call, NE);
1314
1315 // Use R5 (cache for megamorphic call) as scratch.
1316 __ mov(R5, R0); // Preserve receiver in R5, result in R0.
1317 __ ldr(R0, FieldAddress(R0, String::hash_offset()));
1318 __ CompareRegisters(R0, ZR);
1319 __ b(&done, NE);
1320 __ mov(R0, R5); // Restore receiver in R0,
1321
1322 __ Bind(&megamorphic_call);
1323 __ Comment("Slow case: megamorphic call");
1324 }
1325
1304 __ LoadObject(R5, cache); 1326 __ LoadObject(R5, cache);
1305 if (FLAG_use_megamorphic_stub) { 1327 if (FLAG_use_megamorphic_stub) {
1306 __ BranchLink(*StubCode::MegamorphicLookup_entry()); 1328 __ BranchLink(*StubCode::MegamorphicLookup_entry());
1307 } else { 1329 } else {
1308 StubCode::EmitMegamorphicLookup(assembler()); 1330 StubCode::EmitMegamorphicLookup(assembler());
1309 } 1331 }
1310 __ blr(R1); 1332 __ blr(R1);
1311 1333
1334 __ Bind(&done);
1312 RecordSafepoint(locs, slow_path_argument_count); 1335 RecordSafepoint(locs, slow_path_argument_count);
1313 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1336 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1314 if (FLAG_precompiled_mode) { 1337 if (FLAG_precompiled_mode) {
1315 // Megamorphic calls may occur in slow path stubs. 1338 // Megamorphic calls may occur in slow path stubs.
1316 // If valid use try_index argument. 1339 // If valid use try_index argument.
1317 if (try_index == CatchClauseNode::kInvalidTryIndex) { 1340 if (try_index == CatchClauseNode::kInvalidTryIndex) {
1318 try_index = CurrentTryIndex(); 1341 try_index = CurrentTryIndex();
1319 } 1342 }
1320 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, 1343 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther,
1321 assembler()->CodeSize(), 1344 assembler()->CodeSize(),
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1936 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1914 __ PopDouble(reg); 1937 __ PopDouble(reg);
1915 } 1938 }
1916 1939
1917 1940
1918 #undef __ 1941 #undef __
1919 1942
1920 } // namespace dart 1943 } // namespace dart
1921 1944
1922 #endif // defined TARGET_ARCH_ARM64 1945 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698