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

Side by Side Diff: runtime/vm/code_generator.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, 1 month 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/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_arm.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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 if (frame->IsEntryFrame()) { 1411 if (frame->IsEntryFrame()) {
1412 // Since function's current code is always unpatched, the entry frame always 1412 // Since function's current code is always unpatched, the entry frame always
1413 // calls to unpatched code. 1413 // calls to unpatched code.
1414 UNREACHABLE(); 1414 UNREACHABLE();
1415 } 1415 }
1416 ASSERT(frame->IsDartFrame()); 1416 ASSERT(frame->IsDartFrame());
1417 const Code& caller_code = Code::Handle(frame->LookupDartCode()); 1417 const Code& caller_code = Code::Handle(frame->LookupDartCode());
1418 ASSERT(caller_code.is_optimized()); 1418 ASSERT(caller_code.is_optimized());
1419 const Function& target_function = Function::Handle( 1419 const Function& target_function = Function::Handle(
1420 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); 1420 caller_code.GetStaticCallTargetFunctionAt(frame->pc()));
1421 const Code& target_code = Code::Handle(target_function.CurrentCode()); 1421
1422 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, 1422 // Check whether the code object has been detached from the target function.
1423 target_code.EntryPoint()); 1423 // If it has been detached, reattach it.
1424 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); 1424 Code& target_code = Code::Handle();
1425 if (target_function.HasCode()) {
1426 target_code ^= target_function.CurrentCode();
1427 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
1428 target_code.EntryPoint());
1429 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code);
1430 } else {
1431 ASSERT(target_function.unoptimized_code() == Code::null());
1432 target_code ^= caller_code.GetStaticCallTargetCodeAt(frame->pc());
1433 ASSERT(!target_code.IsNull());
1434 ASSERT(!target_code.is_optimized());
1435 target_function.ReattachCode(target_code);
1436 }
1425 if (FLAG_trace_patching) { 1437 if (FLAG_trace_patching) {
1426 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", 1438 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n",
1427 frame->pc(), 1439 frame->pc(),
1428 Function::Handle(target_code.function()).ToFullyQualifiedCString(), 1440 Function::Handle(target_code.function()).ToFullyQualifiedCString(),
1429 target_code.EntryPoint()); 1441 target_code.EntryPoint());
1430 } 1442 }
1431 arguments.SetReturn(target_code); 1443 arguments.SetReturn(target_code);
1432 } 1444 }
1433 1445
1434 1446
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 field.UpdateCid(cid); 1715 field.UpdateCid(cid);
1704 intptr_t list_length = Field::kNoFixedLength; 1716 intptr_t list_length = Field::kNoFixedLength;
1705 if ((field.guarded_cid() != kDynamicCid) && 1717 if ((field.guarded_cid() != kDynamicCid) &&
1706 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { 1718 field.is_final() && RawObject::IsBuiltinListClassId(cid)) {
1707 list_length = GetListLength(value); 1719 list_length = GetListLength(value);
1708 } 1720 }
1709 field.UpdateLength(list_length); 1721 field.UpdateLength(list_length);
1710 } 1722 }
1711 1723
1712 } // namespace dart 1724 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698