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

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

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 4 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 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 __ ldr(R0, FieldAddress(R0, String::hash_offset())); 1307 __ ldr(R0, FieldAddress(R0, String::hash_offset()));
1308 __ CompareRegisters(R0, ZR); 1308 __ CompareRegisters(R0, ZR);
1309 __ b(&done, NE); 1309 __ b(&done, NE);
1310 __ mov(R0, R5); // Restore receiver in R0, 1310 __ mov(R0, R5); // Restore receiver in R0,
1311 1311
1312 __ Bind(&megamorphic_call); 1312 __ Bind(&megamorphic_call);
1313 __ Comment("Slow case: megamorphic call"); 1313 __ Comment("Slow case: megamorphic call");
1314 } 1314 }
1315 1315
1316 __ LoadObject(R5, cache); 1316 __ LoadObject(R5, cache);
1317 __ ldr(LR, Address(THR, Thread::megamorphic_lookup_entry_point_offset())); 1317 __ ldr(LR, Address(THR, Thread::megamorphic_lookup_checked_entry_offset()));
1318 __ blr(LR); 1318 __ blr(LR);
1319 __ blr(R1);
1320 1319
1321 __ Bind(&done); 1320 __ Bind(&done);
1322 RecordSafepoint(locs, slow_path_argument_count); 1321 RecordSafepoint(locs, slow_path_argument_count);
1323 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1322 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1324 if (FLAG_precompiled_mode) { 1323 if (FLAG_precompiled_mode) {
1325 // Megamorphic calls may occur in slow path stubs. 1324 // Megamorphic calls may occur in slow path stubs.
1326 // If valid use try_index argument. 1325 // If valid use try_index argument.
1327 if (try_index == CatchClauseNode::kInvalidTryIndex) { 1326 if (try_index == CatchClauseNode::kInvalidTryIndex) {
1328 try_index = CurrentTryIndex(); 1327 try_index = CurrentTryIndex();
1329 } 1328 }
(...skipping 16 matching lines...) Expand all
1346 __ Drop(argument_count); 1345 __ Drop(argument_count);
1347 } 1346 }
1348 1347
1349 1348
1350 void FlowGraphCompiler::EmitSwitchableInstanceCall( 1349 void FlowGraphCompiler::EmitSwitchableInstanceCall(
1351 const ICData& ic_data, 1350 const ICData& ic_data,
1352 intptr_t argument_count, 1351 intptr_t argument_count,
1353 intptr_t deopt_id, 1352 intptr_t deopt_id,
1354 TokenPosition token_pos, 1353 TokenPosition token_pos,
1355 LocationSummary* locs) { 1354 LocationSummary* locs) {
1355 ASSERT(ic_data.NumArgsTested() == 1);
1356 const Code& initial_stub = Code::ZoneHandle(
1357 StubCode::ICLookupThroughFunction_entry()->code());
1356 __ Comment("SwitchableCall"); 1358 __ Comment("SwitchableCall");
1359
1357 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); 1360 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize);
1358 ASSERT(ic_data.NumArgsTested() == 1);
1359 __ LoadUniqueObject(R5, ic_data); 1361 __ LoadUniqueObject(R5, ic_data);
1360 __ BranchLinkPatchable(*StubCode::ICLookupThroughFunction_entry()); 1362 __ LoadUniqueObject(CODE_REG, initial_stub);
1361 __ blr(R1); 1363 __ ldr(TMP, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
1364 __ blr(TMP);
1362 1365
1363 AddCurrentDescriptor(RawPcDescriptors::kOther, 1366 AddCurrentDescriptor(RawPcDescriptors::kOther,
1364 Thread::kNoDeoptId, token_pos); 1367 Thread::kNoDeoptId, token_pos);
1365 RecordSafepoint(locs); 1368 RecordSafepoint(locs);
1366 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1369 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1367 if (is_optimizing()) { 1370 if (is_optimizing()) {
1368 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1371 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1369 } else { 1372 } else {
1370 // Add deoptimization continuation point after the call and before the 1373 // Add deoptimization continuation point after the call and before the
1371 // arguments are removed. 1374 // arguments are removed.
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1931 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1929 __ PopDouble(reg); 1932 __ PopDouble(reg);
1930 } 1933 }
1931 1934
1932 1935
1933 #undef __ 1936 #undef __
1934 1937
1935 } // namespace dart 1938 } // namespace dart
1936 1939
1937 #endif // defined TARGET_ARCH_ARM64 1940 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698