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

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

Issue 10912146: Finish implementing lazy deoptimization (ia32, x64). Ran tests with --deoptimize-alot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/code_patcher.h » ('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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 intptr_t deopt_id, deopt_reason, deopt_index; 1445 intptr_t deopt_id, deopt_reason, deopt_index;
1446 GetDeoptIxDescrAtPc(optimized_code, frame->pc(), 1446 GetDeoptIxDescrAtPc(optimized_code, frame->pc(),
1447 &deopt_id, &deopt_reason, &deopt_index); 1447 &deopt_id, &deopt_reason, &deopt_index);
1448 ASSERT(deopt_id != Isolate::kNoDeoptId); 1448 ASSERT(deopt_id != Isolate::kNoDeoptId);
1449 function = optimized_code.function(); 1449 function = optimized_code.function();
1450 unoptimized_code = function.unoptimized_code(); 1450 unoptimized_code = function.unoptimized_code();
1451 ASSERT(!unoptimized_code.IsNull()); 1451 ASSERT(!unoptimized_code.IsNull());
1452 uword continue_at_pc = 1452 uword continue_at_pc =
1453 unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id); 1453 unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
1454 ASSERT(continue_at_pc != 0); 1454 ASSERT(continue_at_pc != 0);
1455 // The switch to unoptimized code may have already occured.
1456 if (function.HasOptimizedCode()) {
1457 function.SwitchToUnoptimizedCode();
1458 }
1459 // Patch call site (lazy deoptimization is quite rare, patching it twice
1460 // is not a performance issue).
1461 uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc();
1462 ASSERT(lazy_deopt_jump != 0);
1463 CodePatcher::InsertCallAt(frame->pc(), lazy_deopt_jump);
1464 // Mark code as dead (do not GC its embedded objects).
1465 optimized_code.set_is_alive(false);
1455 } 1466 }
1456 frame = iterator.NextFrame(); 1467 frame = iterator.NextFrame();
1457 } 1468 }
1458 } 1469 }
1459 1470
1460 1471
1461 // Copy saved registers into the isolate buffer. 1472 // Copy saved registers into the isolate buffer.
1462 static void CopySavedRegisters(uword saved_registers_address) { 1473 static void CopySavedRegisters(uword saved_registers_address) {
1463 double* xmm_registers_copy = new double[kNumberOfXmmRegisters]; 1474 double* xmm_registers_copy = new double[kNumberOfXmmRegisters];
1464 ASSERT(xmm_registers_copy != NULL); 1475 ASSERT(xmm_registers_copy != NULL);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); 1632 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized());
1622 1633
1623 intptr_t* frame_copy = isolate->deopt_frame_copy(); 1634 intptr_t* frame_copy = isolate->deopt_frame_copy();
1624 intptr_t* cpu_registers_copy = isolate->deopt_cpu_registers_copy(); 1635 intptr_t* cpu_registers_copy = isolate->deopt_cpu_registers_copy();
1625 double* xmm_registers_copy = isolate->deopt_xmm_registers_copy(); 1636 double* xmm_registers_copy = isolate->deopt_xmm_registers_copy();
1626 1637
1627 intptr_t deopt_id, deopt_reason, deopt_index; 1638 intptr_t deopt_id, deopt_reason, deopt_index;
1628 GetDeoptIxDescrAtPc(optimized_code, caller_frame->pc(), 1639 GetDeoptIxDescrAtPc(optimized_code, caller_frame->pc(),
1629 &deopt_id, &deopt_reason, &deopt_index); 1640 &deopt_id, &deopt_reason, &deopt_index);
1630 ASSERT(deopt_id != Isolate::kNoDeoptId); 1641 ASSERT(deopt_id != Isolate::kNoDeoptId);
1631 uword continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id); 1642 uword continue_at_pc = 0;
1643 if (deopt_reason == kDeoptAtCall) {
1644 continue_at_pc = unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
1645 } else {
1646 continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id);
1647 }
1632 ASSERT(continue_at_pc != 0); 1648 ASSERT(continue_at_pc != 0);
1633 if (FLAG_trace_deopt) { 1649 if (FLAG_trace_deopt) {
1634 OS::Print(" -> continue at %#"Px"\n", continue_at_pc); 1650 OS::Print(" -> continue at %#"Px"\n", continue_at_pc);
1635 // TODO(srdjan): If we could allow GC, we could print the line where 1651 // TODO(srdjan): If we could allow GC, we could print the line where
1636 // deoptimization occured. 1652 // deoptimization occured.
1637 } 1653 }
1638 const Array& deopt_info_array = 1654 const Array& deopt_info_array =
1639 Array::Handle(optimized_code.deopt_info_array()); 1655 Array::Handle(optimized_code.deopt_info_array());
1640 ASSERT(!deopt_info_array.IsNull()); 1656 ASSERT(!deopt_info_array.IsNull());
1641 DeoptInfo& deopt_info = DeoptInfo::Handle(); 1657 DeoptInfo& deopt_info = DeoptInfo::Handle();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 current->slot(), 1693 current->slot(),
1678 current->value()); 1694 current->value());
1679 } 1695 }
1680 1696
1681 delete current; 1697 delete current;
1682 } 1698 }
1683 } 1699 }
1684 1700
1685 1701
1686 } // namespace dart 1702 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698