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

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

Issue 24744002: Pattern match on generated code to find edge counters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.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_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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 __ addiu(SP, SP, Immediate(7 * kWordSize)); 737 __ addiu(SP, SP, Immediate(7 * kWordSize));
738 738
739 __ Bind(&is_assignable); 739 __ Bind(&is_assignable);
740 // Restore instantiator and its type arguments. 740 // Restore instantiator and its type arguments.
741 __ lw(A1, Address(SP, 0 * kWordSize)); 741 __ lw(A1, Address(SP, 0 * kWordSize));
742 __ lw(A2, Address(SP, 1 * kWordSize)); 742 __ lw(A2, Address(SP, 1 * kWordSize));
743 __ addiu(SP, SP, Immediate(2 * kWordSize)); 743 __ addiu(SP, SP, Immediate(2 * kWordSize));
744 } 744 }
745 745
746 746
747 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
748 if (!is_optimizing()) {
749 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) {
750 AssertAssignableInstr* assert = instr->AsAssertAssignable();
751 AddCurrentDescriptor(PcDescriptors::kDeopt,
752 assert->deopt_id(),
753 assert->token_pos());
754 } else if (instr->IsGuardField() ||
755 instr->CanBecomeDeoptimizationTarget()) {
756 AddCurrentDescriptor(PcDescriptors::kDeopt,
757 instr->deopt_id(),
758 Scanner::kDummyTokenIndex);
759 }
760 AllocateRegistersLocally(instr);
761 } else if (instr->MayThrow() &&
762 (CurrentTryIndex() != CatchClauseNode::kInvalidTryIndex)) {
763 // Optimized try-block: Sync locals to fixed stack locations.
764 EmitTrySync(instr, CurrentTryIndex());
765 }
766 }
767
768
769 void FlowGraphCompiler::EmitTrySyncMove(intptr_t dest_offset, 747 void FlowGraphCompiler::EmitTrySyncMove(intptr_t dest_offset,
770 Location loc, 748 Location loc,
771 bool* push_emitted) { 749 bool* push_emitted) {
772 if (loc.IsConstant()) { 750 if (loc.IsConstant()) {
773 if (!*push_emitted) { 751 if (!*push_emitted) {
774 __ Push(T0); 752 __ Push(T0);
775 *push_emitted = true; 753 *push_emitted = true;
776 } 754 }
777 __ LoadObject(T0, loc.constant()); 755 __ LoadObject(T0, loc.constant());
778 __ StoreToOffset(T0, FP, dest_offset); 756 __ StoreToOffset(T0, FP, dest_offset);
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 // Add deoptimization continuation point after the call and before the 1290 // Add deoptimization continuation point after the call and before the
1313 // arguments are removed. 1291 // arguments are removed.
1314 AddCurrentDescriptor(PcDescriptors::kDeopt, 1292 AddCurrentDescriptor(PcDescriptors::kDeopt,
1315 deopt_id_after, 1293 deopt_id_after,
1316 token_pos); 1294 token_pos);
1317 } 1295 }
1318 } 1296 }
1319 } 1297 }
1320 1298
1321 1299
1300 void FlowGraphCompiler::EmitEdgeCounter() {
1301 // We do not check for overflow when incrementing the edge counter. The
1302 // function should normally be optimized long before the counter can
1303 // overflow; and though we do not reset the counters when we optimize or
1304 // deoptimize, there is a bound on the number of
1305 // optimization/deoptimization cycles we will attempt.
1306 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
1307 counter.SetAt(0, Smi::Handle(Smi::New(0)));
1308 __ Comment("Edge counter");
1309 __ LoadObject(T0, counter);
1310 __ lw(T1, FieldAddress(T0, Array::element_offset(0)));
1311 __ AddImmediate(T1, T1, Smi::RawValue(1));
1312 __ sw(T1, FieldAddress(T0, Array::element_offset(0)));
1313 }
1314
1315
1322 void FlowGraphCompiler::EmitOptimizedInstanceCall( 1316 void FlowGraphCompiler::EmitOptimizedInstanceCall(
1323 ExternalLabel* target_label, 1317 ExternalLabel* target_label,
1324 const ICData& ic_data, 1318 const ICData& ic_data,
1325 intptr_t argument_count, 1319 intptr_t argument_count,
1326 intptr_t deopt_id, 1320 intptr_t deopt_id,
1327 intptr_t token_pos, 1321 intptr_t token_pos,
1328 LocationSummary* locs) { 1322 LocationSummary* locs) {
1329 // Each ICData propagated from unoptimized to optimized code contains the 1323 // Each ICData propagated from unoptimized to optimized code contains the
1330 // function that corresponds to the Dart function of that IC call. Due 1324 // function that corresponds to the Dart function of that IC call. Due
1331 // to inlining in optimized code, that function may not correspond to the 1325 // to inlining in optimized code, that function may not correspond to the
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 __ AddImmediate(SP, kDoubleSize); 2006 __ AddImmediate(SP, kDoubleSize);
2013 } 2007 }
2014 2008
2015 2009
2016 #undef __ 2010 #undef __
2017 2011
2018 2012
2019 } // namespace dart 2013 } // namespace dart
2020 2014
2021 #endif // defined TARGET_ARCH_MIPS 2015 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698