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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (result is receiver).
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 ASSERT(Smi::New(0) == 0);
1338 __ cmp(R0, Operand(0));
1339
1340 __ b(&done, NE); // Return if already computed.
1341 __ mov(R0, Operand(R9)); // Restore receiver in R0.
1342
1343 __ Bind(&megamorphic_call);
1344 __ Comment("Slow case: megamorphic call");
1345 }
1323 __ LoadObject(R9, cache); 1346 __ LoadObject(R9, cache);
1324 if (FLAG_use_megamorphic_stub) { 1347 if (FLAG_use_megamorphic_stub) {
1325 __ BranchLink(*StubCode::MegamorphicLookup_entry()); 1348 __ BranchLink(*StubCode::MegamorphicLookup_entry());
1326 } else { 1349 } else {
1327 StubCode::EmitMegamorphicLookup(assembler()); 1350 StubCode::EmitMegamorphicLookup(assembler());
1328 } 1351 }
1329 __ blx(R1); 1352 __ blx(R1);
1330 1353
1354 __ Bind(&done);
1331 RecordSafepoint(locs, slow_path_argument_count); 1355 RecordSafepoint(locs, slow_path_argument_count);
1332 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1356 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1333 if (FLAG_precompiled_mode) { 1357 if (FLAG_precompiled_mode) {
1334 // Megamorphic calls may occur in slow path stubs. 1358 // Megamorphic calls may occur in slow path stubs.
1335 // If valid use try_index argument. 1359 // If valid use try_index argument.
1336 if (try_index == CatchClauseNode::kInvalidTryIndex) { 1360 if (try_index == CatchClauseNode::kInvalidTryIndex) {
1337 try_index = CurrentTryIndex(); 1361 try_index = CurrentTryIndex();
1338 } 1362 }
1339 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, 1363 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther,
1340 assembler()->CodeSize(), 1364 assembler()->CodeSize(),
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 DRegister dreg = EvenDRegisterOf(reg); 2000 DRegister dreg = EvenDRegisterOf(reg);
1977 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 2001 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1978 } 2002 }
1979 2003
1980 2004
1981 #undef __ 2005 #undef __
1982 2006
1983 } // namespace dart 2007 } // namespace dart
1984 2008
1985 #endif // defined TARGET_ARCH_ARM 2009 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698