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

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

Issue 11031040: Don't inline functions above the deoptimization threshold. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review comments. Created 8 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 | « no previous file | runtime/vm/deopt_instructions.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_macros.h" 7 #include "vm/assembler_macros.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1574
1575 1575
1576 DeoptInfo& deopt_info = DeoptInfo::Handle(); 1576 DeoptInfo& deopt_info = DeoptInfo::Handle();
1577 DeoptReasonId deopt_reason = kDeoptUnknown; 1577 DeoptReasonId deopt_reason = kDeoptUnknown;
1578 GetDeoptInfoAtPc(optimized_code, caller_frame->pc(), &deopt_info, 1578 GetDeoptInfoAtPc(optimized_code, caller_frame->pc(), &deopt_info,
1579 &deopt_reason); 1579 &deopt_reason);
1580 ASSERT(!deopt_info.IsNull()); 1580 ASSERT(!deopt_info.IsNull());
1581 1581
1582 CopyFrame(optimized_code, *caller_frame); 1582 CopyFrame(optimized_code, *caller_frame);
1583 if (FLAG_trace_deoptimization) { 1583 if (FLAG_trace_deoptimization) {
1584 OS::Print("Deoptimizing (reason %d '%s') at pc %#"Px" '%s'\n", 1584 Function& function = Function::Handle(optimized_code.function());
1585 OS::Print("Deoptimizing (reason %d '%s') at pc %#"Px" '%s' (count %d)\n",
1585 deopt_reason, 1586 deopt_reason,
1586 DeoptReasonToText(deopt_reason), 1587 DeoptReasonToText(deopt_reason),
1587 caller_frame->pc(), 1588 caller_frame->pc(),
1588 Function::Handle(optimized_code.function()).ToFullyQualifiedCString()); 1589 function.ToFullyQualifiedCString(),
1590 function.deoptimization_counter());
1589 } 1591 }
1590 1592
1591 // Compute the stack size of the unoptimized frame. For functions with 1593 // Compute the stack size of the unoptimized frame. For functions with
1592 // optional arguments the deoptimization info does not describe the 1594 // optional arguments the deoptimization info does not describe the
1593 // incoming arguments. 1595 // incoming arguments.
1594 const Function& function = Function::Handle(optimized_code.function()); 1596 const Function& function = Function::Handle(optimized_code.function());
1595 const intptr_t num_args = 1597 const intptr_t num_args =
1596 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); 1598 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
1597 intptr_t unoptimized_stack_size = 1599 intptr_t unoptimized_stack_size =
1598 + deopt_info.Length() - num_args 1600 + deopt_info.Length() - num_args
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 const intptr_t caller_fp = 1674 const intptr_t caller_fp =
1673 DeoptimizeWithDeoptInfo(optimized_code, deopt_info, *caller_frame); 1675 DeoptimizeWithDeoptInfo(optimized_code, deopt_info, *caller_frame);
1674 1676
1675 isolate->SetDeoptFrameCopy(NULL, 0); 1677 isolate->SetDeoptFrameCopy(NULL, 0);
1676 isolate->set_deopt_cpu_registers_copy(NULL); 1678 isolate->set_deopt_cpu_registers_copy(NULL);
1677 isolate->set_deopt_xmm_registers_copy(NULL); 1679 isolate->set_deopt_xmm_registers_copy(NULL);
1678 delete[] frame_copy; 1680 delete[] frame_copy;
1679 delete[] cpu_registers_copy; 1681 delete[] cpu_registers_copy;
1680 delete[] xmm_registers_copy; 1682 delete[] xmm_registers_copy;
1681 1683
1682 // Clear invocation counter so that the function gets optimized after
1683 // classes have been collected.
1684 function.set_usage_counter(0);
1685 function.set_deoptimization_counter(function.deoptimization_counter() + 1);
1686
1687 if (function.HasOptimizedCode()) {
1688 function.SwitchToUnoptimizedCode();
1689 }
1690 return caller_fp; 1684 return caller_fp;
1691 } 1685 }
1692 END_LEAF_RUNTIME_ENTRY 1686 END_LEAF_RUNTIME_ENTRY
1693 1687
1694 1688
1695 // This is the last step in the deoptimization, GC can occur. 1689 // This is the last step in the deoptimization, GC can occur.
1696 DEFINE_RUNTIME_ENTRY(DeoptimizeMaterializeDoubles, 0) { 1690 DEFINE_RUNTIME_ENTRY(DeoptimizeMaterializeDoubles, 0) {
1697 DeferredDouble* deferred_double = Isolate::Current()->DetachDeferredDoubles(); 1691 DeferredDouble* deferred_double = Isolate::Current()->DetachDeferredDoubles();
1698 1692
1699 while (deferred_double != NULL) { 1693 while (deferred_double != NULL) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 intptr_t line, column; 1737 intptr_t line, column;
1744 script.GetTokenLocation(token_pos, &line, &column); 1738 script.GetTokenLocation(token_pos, &line, &column);
1745 String& line_string = String::Handle(script.GetLine(line)); 1739 String& line_string = String::Handle(script.GetLine(line));
1746 OS::Print(" Function: %s\n", top_function.ToFullyQualifiedCString()); 1740 OS::Print(" Function: %s\n", top_function.ToFullyQualifiedCString());
1747 OS::Print(" Line %"Pd": '%s'\n", line, line_string.ToCString()); 1741 OS::Print(" Line %"Pd": '%s'\n", line, line_string.ToCString());
1748 } 1742 }
1749 } 1743 }
1750 1744
1751 1745
1752 } // namespace dart 1746 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698