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

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

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: new test case Created 4 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
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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph.h" 12 #include "vm/flow_graph.h"
13 #include "vm/flow_graph_compiler.h" 13 #include "vm/flow_graph_compiler.h"
14 #include "vm/flow_graph_range_analysis.h" 14 #include "vm/flow_graph_range_analysis.h"
15 #include "vm/instructions.h"
15 #include "vm/locations.h" 16 #include "vm/locations.h"
16 #include "vm/object_store.h" 17 #include "vm/object_store.h"
17 #include "vm/parser.h" 18 #include "vm/parser.h"
18 #include "vm/stack_frame.h" 19 #include "vm/stack_frame.h"
19 #include "vm/stub_code.h" 20 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 21 #include "vm/symbols.h"
21 22
22 #define __ compiler->assembler()-> 23 #define __ compiler->assembler()->
23 #define Z (compiler->zone()) 24 #define Z (compiler->zone())
24 25
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 2541
2541 2542
2542 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, 2543 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone,
2543 bool opt) const { 2544 bool opt) const {
2544 UNREACHABLE(); 2545 UNREACHABLE();
2545 return NULL; 2546 return NULL;
2546 } 2547 }
2547 2548
2548 2549
2549 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2550 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2551 // Ensure space for patching return sites for lazy deopt.
2552 __ nop(CallPattern::pattern_length_in_bytes());
Florian Schneider 2016/09/23 19:53:34 Needed to ensure, patching a return-address does n
rmacnak 2016/09/26 20:21:48 Just noting that space might disappear on the RISC
Florian Schneider 2016/09/26 23:05:28 Actually, I'll add space on ARM/MIPS archs as well
2553
2550 __ Bind(compiler->GetJumpLabel(this)); 2554 __ Bind(compiler->GetJumpLabel(this));
2551 compiler->AddExceptionHandler(catch_try_index(), 2555 compiler->AddExceptionHandler(catch_try_index(),
2552 try_index(), 2556 try_index(),
2553 compiler->assembler()->CodeSize(), 2557 compiler->assembler()->CodeSize(),
2554 catch_handler_types_, 2558 catch_handler_types_,
2555 needs_stacktrace()); 2559 needs_stacktrace());
2560 // On lazy deoptimization we patch the optimized code here to enter the
2561 // deoptimization stub.
2562 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
2563 if (compiler->is_optimizing()) {
2564 compiler->AddDeoptIndexAtCall(deopt_id);
2565 } else {
2566 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2567 deopt_id,
2568 TokenPosition::kNoSource);
2569 }
2556 if (HasParallelMove()) { 2570 if (HasParallelMove()) {
2557 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2571 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2558 } 2572 }
2559 2573
2560 // Restore ESP from EBP as we are coming from a throw and the code for 2574 // Restore ESP from EBP as we are coming from a throw and the code for
2561 // popping arguments has not been run. 2575 // popping arguments has not been run.
2562 const intptr_t fp_sp_dist = 2576 const intptr_t fp_sp_dist =
2563 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2577 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2564 ASSERT(fp_sp_dist <= 0); 2578 ASSERT(fp_sp_dist <= 0);
2565 __ leal(ESP, Address(EBP, fp_sp_dist)); 2579 __ leal(ESP, Address(EBP, fp_sp_dist));
(...skipping 4211 matching lines...) Expand 10 before | Expand all | Expand 10 after
6777 // EAX: Function. 6791 // EAX: Function.
6778 // EDX: Arguments descriptor array. 6792 // EDX: Arguments descriptor array.
6779 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 6793 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
6780 __ xorl(ECX, ECX); 6794 __ xorl(ECX, ECX);
6781 __ call(EBX); 6795 __ call(EBX);
6782 compiler->RecordSafepoint(locs()); 6796 compiler->RecordSafepoint(locs());
6783 // Marks either the continuation point in unoptimized code or the 6797 // Marks either the continuation point in unoptimized code or the
6784 // deoptimization point in optimized code, after call. 6798 // deoptimization point in optimized code, after call.
6785 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 6799 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
6786 if (compiler->is_optimizing()) { 6800 if (compiler->is_optimizing()) {
6787 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 6801 compiler->AddDeoptIndexAtCall(deopt_id_after);
6788 } 6802 }
6789 // Add deoptimization continuation point after the call and before the 6803 // Add deoptimization continuation point after the call and before the
6790 // arguments are removed. 6804 // arguments are removed.
6791 // In optimized code this descriptor is needed for exception handling. 6805 // In optimized code this descriptor is needed for exception handling.
6792 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 6806 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
6793 deopt_id_after, 6807 deopt_id_after,
6794 token_pos()); 6808 token_pos());
6795 __ Drop(argument_count); 6809 __ Drop(argument_count);
6796 } 6810 }
6797 6811
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6871 __ Drop(1); 6885 __ Drop(1);
6872 __ popl(result); 6886 __ popl(result);
6873 } 6887 }
6874 6888
6875 6889
6876 } // namespace dart 6890 } // namespace dart
6877 6891
6878 #undef __ 6892 #undef __
6879 6893
6880 #endif // defined TARGET_ARCH_IA32 6894 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698