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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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_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"
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 if (flow_graph().IsCompiledForOsr()) { 1080 if (flow_graph().IsCompiledForOsr()) {
1080 intptr_t extra_slots = StackSize() 1081 intptr_t extra_slots = StackSize()
1081 - flow_graph().num_stack_locals() 1082 - flow_graph().num_stack_locals()
1082 - flow_graph().num_copied_params(); 1083 - flow_graph().num_copied_params();
1083 ASSERT(extra_slots >= 0); 1084 ASSERT(extra_slots >= 0);
1084 __ EnterOsrFrame(extra_slots * kWordSize); 1085 __ EnterOsrFrame(extra_slots * kWordSize);
1085 } else { 1086 } else {
1086 ASSERT(StackSize() >= 0); 1087 ASSERT(StackSize() >= 0);
1087 __ EnterDartFrame(StackSize() * kWordSize); 1088 __ EnterDartFrame(StackSize() * kWordSize);
1088 } 1089 }
1090
1091 // TODO(zra): maybe do this only before we try to optimize?
1092 if (FLAG_collect_code) {
1093 // If we are collecting code, make sure this function still has a pointer
1094 // to the code object.
1095 // TODO(zra): Is it cheaper just to write the Function fields with the
1096 // code object without doing the test?
1097 Label is_connected;
1098 const Register function_reg = R6;
1099 __ LoadObject(function_reg, function);
1100 __ ldr(R0, FieldAddress(function_reg, Function::code_offset()));
1101 __ CompareImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
1102 __ b(&is_connected, NE);
1103 __ ldr(R1, Address(FP, kPcMarkerSlotFromFp * kWordSize));
1104 const intptr_t code_pc_dist =
1105 Instructions::HeaderSize() - Instructions::code_offset() +
1106 Assembler::kEntryPointToPcMarkerOffset;
1107 __ ldr(R1, Address(R1, -code_pc_dist));
1108 __ str(R1, FieldAddress(function_reg, Function::code_offset()));
1109 __ str(R1, FieldAddress(function_reg, Function::unoptimized_code_offset()));
1110 __ Bind(&is_connected);
1111 }
1089 } 1112 }
1090 1113
1091 1114
1092 // Input parameters: 1115 // Input parameters:
1093 // LR: return address. 1116 // LR: return address.
1094 // SP: address of last argument. 1117 // SP: address of last argument.
1095 // FP: caller's frame pointer. 1118 // FP: caller's frame pointer.
1096 // PP: caller's pool pointer. 1119 // PP: caller's pool pointer.
1097 // R5: ic-data. 1120 // R5: ic-data.
1098 // R4: arguments descriptor array. 1121 // R4: arguments descriptor array.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 __ cmp(R4, ShifterOperand(R0)); 1384 __ cmp(R4, ShifterOperand(R0));
1362 __ b(&update, NE); 1385 __ b(&update, NE);
1363 1386
1364 __ Bind(&call_target_function); 1387 __ Bind(&call_target_function);
1365 // Call the target found in the cache. For a class id match, this is a 1388 // Call the target found in the cache. For a class id match, this is a
1366 // proper target for the given name and arguments descriptor. If the 1389 // proper target for the given name and arguments descriptor. If the
1367 // illegal class id was found, the target is a cache miss handler that can 1390 // illegal class id was found, the target is a cache miss handler that can
1368 // be invoked as a normal Dart function. 1391 // be invoked as a normal Dart function.
1369 __ add(IP, R2, ShifterOperand(R3, LSL, 2)); 1392 __ add(IP, R2, ShifterOperand(R3, LSL, 2));
1370 __ ldr(R0, FieldAddress(IP, base + kWordSize)); 1393 __ ldr(R0, FieldAddress(IP, base + kWordSize));
1371 __ ldr(R0, FieldAddress(R0, Function::code_offset())); 1394 __ ldr(R1, FieldAddress(R0, Function::code_offset()));
1372 __ ldr(R0, FieldAddress(R0, Code::instructions_offset())); 1395 if (FLAG_collect_code) {
1396 // If we are collecting code, the code object may be null.
1397 Label is_compiled;
1398 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null()));
1399 __ b(&is_compiled, NE);
1400 __ EnterStubFrame();
1401 // Preserve arg desc. and IC data object.
1402 __ PushList((1 << R4) | (1 << R5));
1403 __ Push(R0); // Pass function.
1404 __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
1405 __ Pop(R0); // Discard argument.
1406 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data.
1407 __ LeaveStubFrame();
1408 // R0: target function.
1409 __ ldr(R1, FieldAddress(R0, Function::code_offset()));
1410 __ Bind(&is_compiled);
1411 }
1412 __ ldr(R0, FieldAddress(R1, Code::instructions_offset()));
1373 __ LoadObject(R5, ic_data); 1413 __ LoadObject(R5, ic_data);
1374 __ LoadObject(R4, arguments_descriptor); 1414 __ LoadObject(R4, arguments_descriptor);
1375 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); 1415 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag);
1376 __ blx(R0); 1416 __ blx(R0);
1377 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1417 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1378 RecordSafepoint(locs); 1418 RecordSafepoint(locs);
1379 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); 1419 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1380 __ Drop(argument_count); 1420 __ Drop(argument_count);
1381 } 1421 }
1382 1422
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 DRegister dreg = EvenDRegisterOf(reg); 1951 DRegister dreg = EvenDRegisterOf(reg);
1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1952 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1913 } 1953 }
1914 1954
1915 1955
1916 #undef __ 1956 #undef __
1917 1957
1918 } // namespace dart 1958 } // namespace dart
1919 1959
1920 #endif // defined TARGET_ARCH_ARM 1960 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | runtime/vm/flow_graph_compiler_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698