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

Side by Side Diff: runtime/vm/flow_graph_compiler_mips.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) 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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 __ BranchNotEqual( 1332 __ BranchNotEqual(
1333 CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call); 1333 CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call);
1334 1334
1335 __ lw(V0, FieldAddress(T0, String::hash_offset())); 1335 __ lw(V0, FieldAddress(T0, String::hash_offset()));
1336 __ bne(V0, ZR, &done); 1336 __ bne(V0, ZR, &done);
1337 1337
1338 __ Bind(&megamorphic_call); 1338 __ Bind(&megamorphic_call);
1339 __ Comment("Slow case: megamorphic call"); 1339 __ Comment("Slow case: megamorphic call");
1340 } 1340 }
1341 __ LoadObject(S5, cache); 1341 __ LoadObject(S5, cache);
1342 __ lw(T9, Address(THR, Thread::megamorphic_lookup_entry_point_offset())); 1342 __ lw(T9, Address(THR, Thread::megamorphic_lookup_checked_entry_offset()));
1343 __ jalr(T9); 1343 __ jalr(T9);
1344 __ jalr(T1);
1345 1344
1346 __ Bind(&done); 1345 __ Bind(&done);
1347 RecordSafepoint(locs, slow_path_argument_count); 1346 RecordSafepoint(locs, slow_path_argument_count);
1348 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1347 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1349 if (FLAG_precompiled_mode) { 1348 if (FLAG_precompiled_mode) {
1350 // Megamorphic calls may occur in slow path stubs. 1349 // Megamorphic calls may occur in slow path stubs.
1351 // If valid use try_index argument. 1350 // If valid use try_index argument.
1352 if (try_index == CatchClauseNode::kInvalidTryIndex) { 1351 if (try_index == CatchClauseNode::kInvalidTryIndex) {
1353 try_index = CurrentTryIndex(); 1352 try_index = CurrentTryIndex();
1354 } 1353 }
(...skipping 16 matching lines...) Expand all
1371 __ Drop(argument_count); 1370 __ Drop(argument_count);
1372 } 1371 }
1373 1372
1374 1373
1375 void FlowGraphCompiler::EmitSwitchableInstanceCall( 1374 void FlowGraphCompiler::EmitSwitchableInstanceCall(
1376 const ICData& ic_data, 1375 const ICData& ic_data,
1377 intptr_t argument_count, 1376 intptr_t argument_count,
1378 intptr_t deopt_id, 1377 intptr_t deopt_id,
1379 TokenPosition token_pos, 1378 TokenPosition token_pos,
1380 LocationSummary* locs) { 1379 LocationSummary* locs) {
1380 ASSERT(ic_data.NumArgsTested() == 1);
1381 const Code& initial_stub = Code::ZoneHandle(
1382 StubCode::ICLookupThroughFunction_entry()->code());
1383
1381 __ Comment("SwitchableCall"); 1384 __ Comment("SwitchableCall");
1382 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); 1385 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize));
1383 ASSERT(ic_data.NumArgsTested() == 1);
1384 __ LoadUniqueObject(S5, ic_data); 1386 __ LoadUniqueObject(S5, ic_data);
1385 __ BranchLinkPatchable(*StubCode::ICLookupThroughFunction_entry()); 1387 __ LoadUniqueObject(CODE_REG, initial_stub);
1386 __ jalr(T1); 1388 __ lw(T9, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
1389 __ jalr(T9);
1387 1390
1388 AddCurrentDescriptor(RawPcDescriptors::kOther, 1391 AddCurrentDescriptor(RawPcDescriptors::kOther,
1389 Thread::kNoDeoptId, token_pos); 1392 Thread::kNoDeoptId, token_pos);
1390 RecordSafepoint(locs); 1393 RecordSafepoint(locs);
1391 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1394 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1392 if (is_optimizing()) { 1395 if (is_optimizing()) {
1393 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1396 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1394 } else { 1397 } else {
1395 // Add deoptimization continuation point after the call and before the 1398 // Add deoptimization continuation point after the call and before the
1396 // arguments are removed. 1399 // arguments are removed.
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 __ AddImmediate(SP, kDoubleSize); 1956 __ AddImmediate(SP, kDoubleSize);
1954 } 1957 }
1955 1958
1956 1959
1957 #undef __ 1960 #undef __
1958 1961
1959 1962
1960 } // namespace dart 1963 } // namespace dart
1961 1964
1962 #endif // defined TARGET_ARCH_MIPS 1965 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698