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

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

Issue 27802002: Disconnects code objects from infrequently used unoptimized functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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"
11 #include "vm/compiler.h"
11 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
12 #include "vm/deopt_instructions.h" 13 #include "vm/deopt_instructions.h"
13 #include "vm/il_printer.h" 14 #include "vm/il_printer.h"
14 #include "vm/locations.h" 15 #include "vm/locations.h"
15 #include "vm/object_store.h" 16 #include "vm/object_store.h"
16 #include "vm/parser.h" 17 #include "vm/parser.h"
17 #include "vm/stack_frame.h" 18 #include "vm/stack_frame.h"
18 #include "vm/stub_code.h" 19 #include "vm/stub_code.h"
19 #include "vm/symbols.h" 20 #include "vm/symbols.h"
20 21
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 if (flow_graph().IsCompiledForOsr()) { 1120 if (flow_graph().IsCompiledForOsr()) {
1120 intptr_t extra_slots = StackSize() 1121 intptr_t extra_slots = StackSize()
1121 - flow_graph().num_stack_locals() 1122 - flow_graph().num_stack_locals()
1122 - flow_graph().num_copied_params(); 1123 - flow_graph().num_copied_params();
1123 ASSERT(extra_slots >= 0); 1124 ASSERT(extra_slots >= 0);
1124 __ EnterOsrFrame(extra_slots * kWordSize); 1125 __ EnterOsrFrame(extra_slots * kWordSize);
1125 } else { 1126 } else {
1126 ASSERT(StackSize() >= 0); 1127 ASSERT(StackSize() >= 0);
1127 __ EnterDartFrame(StackSize() * kWordSize); 1128 __ EnterDartFrame(StackSize() * kWordSize);
1128 } 1129 }
1130
1131 // TODO(zra): maybe do this only before we try to optimize?
1132 if (FLAG_collect_code) {
1133 // If we are collecting code, make sure this function still has a pointer
1134 // to the code object.
1135 // TODO(zra): Is it cheaper just to write the Function fields with the
1136 // code object without doing the test?
1137 Label is_connected;
1138 const Register function_reg = T0;
1139 __ LoadObject(function_reg, function);
1140 __ lw(T1, FieldAddress(function_reg, Function::code_offset()));
1141 __ BranchNotEqual(T1, reinterpret_cast<intptr_t>(Object::null()),
1142 &is_connected);
1143 __ lw(T1, Address(FP, kPcMarkerSlotFromFp * kWordSize));
1144 const intptr_t code_pc_dist =
1145 Instructions::HeaderSize() - Instructions::code_offset() +
1146 Assembler::kEntryPointToPcMarkerOffset;
1147 __ lw(T1, Address(T1, -code_pc_dist));
1148 __ sw(T1, FieldAddress(function_reg, Function::code_offset()));
1149 __ sw(T1, FieldAddress(function_reg, Function::unoptimized_code_offset()));
1150 __ Bind(&is_connected);
1151 }
1129 } 1152 }
1130 1153
1131 1154
1132 // Input parameters: 1155 // Input parameters:
1133 // RA: return address. 1156 // RA: return address.
1134 // SP: address of last argument. 1157 // SP: address of last argument.
1135 // FP: caller's frame pointer. 1158 // FP: caller's frame pointer.
1136 // PP: caller's pool pointer. 1159 // PP: caller's pool pointer.
1137 // S5: ic-data. 1160 // S5: ic-data.
1138 // S4: arguments descriptor array. 1161 // S4: arguments descriptor array.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 1428
1406 ASSERT(kIllegalCid == 0); 1429 ASSERT(kIllegalCid == 0);
1407 __ beq(T4, ZR, &call_target_function); 1430 __ beq(T4, ZR, &call_target_function);
1408 __ bne(T4, T0, &update); 1431 __ bne(T4, T0, &update);
1409 1432
1410 __ Bind(&call_target_function); 1433 __ Bind(&call_target_function);
1411 // Call the target found in the cache. For a class id match, this is a 1434 // Call the target found in the cache. For a class id match, this is a
1412 // proper target for the given name and arguments descriptor. If the 1435 // proper target for the given name and arguments descriptor. If the
1413 // illegal class id was found, the target is a cache miss handler that can 1436 // illegal class id was found, the target is a cache miss handler that can
1414 // be invoked as a normal Dart function. 1437 // be invoked as a normal Dart function.
1415 __ sll(TMP1, T3, 2); 1438 __ sll(T1, T3, 2);
1416 __ addu(TMP1, T2, TMP1); 1439 __ addu(T1, T2, T1);
1417 __ lw(T0, FieldAddress(TMP, base + kWordSize)); 1440 __ lw(T0, FieldAddress(T1, base + kWordSize));
1418 __ lw(T0, FieldAddress(T0, Function::code_offset())); 1441 __ lw(T1, FieldAddress(T0, Function::code_offset()));
1419 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); 1442 if (FLAG_collect_code) {
1443 // If we are collecting code, the code object may be null.
1444 Label is_compiled;
1445 __ BranchNotEqual(T1, reinterpret_cast<int32_t>(Object::null()),
1446 &is_compiled);
1447 __ EnterStubFrame();
1448 __ addiu(SP, SP, Immediate(-3 * kWordSize));
1449 __ sw(S5, Address(SP, 2 * kWordSize)); // Preserve IC data.
1450 __ sw(S4, Address(SP, 1 * kWordSize)); // Preserve arg desc.
1451 __ sw(T0, Address(SP, 0 * kWordSize)); // Function argument.
1452 __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
1453 __ lw(T0, Address(SP, 0 * kWordSize)); // Restore function.
1454 __ lw(S4, Address(SP, 1 * kWordSize)); // Restore arg desc.
1455 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data.
1456 __ addiu(SP, SP, Immediate(3 * kWordSize));
1457 __ LeaveStubFrame();
1458 __ lw(T1, FieldAddress(T0, Function::code_offset()));
1459 __ Bind(&is_compiled);
1460 }
1461 __ lw(T0, FieldAddress(T1, Code::instructions_offset()));
1420 __ LoadObject(S5, ic_data); 1462 __ LoadObject(S5, ic_data);
1421 __ LoadObject(S4, arguments_descriptor); 1463 __ LoadObject(S4, arguments_descriptor);
1422 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); 1464 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag);
1423 __ jalr(T0); 1465 __ jalr(T0);
1424 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1466 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1425 RecordSafepoint(locs); 1467 RecordSafepoint(locs);
1426 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); 1468 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1427 __ Drop(argument_count); 1469 __ Drop(argument_count);
1428 } 1470 }
1429 1471
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 __ AddImmediate(SP, kDoubleSize); 2048 __ AddImmediate(SP, kDoubleSize);
2007 } 2049 }
2008 2050
2009 2051
2010 #undef __ 2052 #undef __
2011 2053
2012 2054
2013 } // namespace dart 2055 } // namespace dart
2014 2056
2015 #endif // defined TARGET_ARCH_MIPS 2057 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698