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

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

Issue 15110003: Make deoptimization architecture dependent (it depends on the frame layout). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/ast_printer.h" 11 #include "vm/ast_printer.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.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
21 namespace dart { 22 namespace dart {
22 23
(...skipping 13 matching lines...) Expand all
36 ASSERT(!block_info_[i]->jump_label()->HasNear()); 37 ASSERT(!block_info_[i]->jump_label()->HasNear());
37 } 38 }
38 } 39 }
39 40
40 41
41 bool FlowGraphCompiler::SupportsUnboxedMints() { 42 bool FlowGraphCompiler::SupportsUnboxedMints() {
42 return false; 43 return false;
43 } 44 }
44 45
45 46
47 RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
48 DeoptInfoBuilder* builder) {
49 if (deoptimization_env_ == NULL) return DeoptInfo::null();
50
51 intptr_t stack_height = compiler->StackSize();
52 AllocateIncomingParametersRecursive(deoptimization_env_, &stack_height);
53
54 intptr_t slot_ix = 0;
55 Environment* current = deoptimization_env_;
56
57 // Emit all kMaterializeObject instructions describing objects to be
58 // materialized on the deoptimization as a prefix to the deoptimization info.
59 EmitMaterializations(deoptimization_env_, builder);
60
61 // The real frame starts here.
62 builder->MarkFrameStart();
63
64 // Callee's PC marker is not used anymore. Pass Function::null() to set to 0.
65 builder->AddPcMarker(Function::Handle(), slot_ix++);
66
67 // Current FP and PC.
68 builder->AddCallerFp(slot_ix++);
69 builder->AddReturnAddress(current->function(),
70 deopt_id(),
71 slot_ix++);
72
73 // Emit all values that are needed for materialization as a part of the
74 // expression stack for the bottom-most frame. This guarantees that GC
75 // will be able to find them during materialization.
76 slot_ix = builder->EmitMaterializationArguments(slot_ix);
77
78 // For the innermost environment, set outgoing arguments and the locals.
79 for (intptr_t i = current->Length() - 1;
80 i >= current->fixed_parameter_count();
81 i--) {
82 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++);
83 }
84
85 // Current PC marker and caller FP.
86 builder->AddPcMarker(current->function(), slot_ix++);
87 builder->AddCallerFp(slot_ix++);
88
89 Environment* previous = current;
90 current = current->outer();
91 while (current != NULL) {
92 // For any outer environment the deopt id is that of the call instruction
93 // which is recorded in the outer environment.
94 builder->AddReturnAddress(current->function(),
95 Isolate::ToDeoptAfter(current->deopt_id()),
96 slot_ix++);
97
98 // The values of outgoing arguments can be changed from the inlined call so
99 // we must read them from the previous environment.
100 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
101 builder->AddCopy(previous->ValueAt(i),
102 previous->LocationAt(i),
103 slot_ix++);
104 }
105
106 // Set the locals, note that outgoing arguments are not in the environment.
107 for (intptr_t i = current->Length() - 1;
108 i >= current->fixed_parameter_count();
109 i--) {
110 builder->AddCopy(current->ValueAt(i),
111 current->LocationAt(i),
112 slot_ix++);
113 }
114
115 // PC marker and caller FP.
116 builder->AddPcMarker(current->function(), slot_ix++);
117 builder->AddCallerFp(slot_ix++);
118
119 // Iterate on the outer environment.
120 previous = current;
121 current = current->outer();
122 }
123 // The previous pointer is now the outermost environment.
124 ASSERT(previous != NULL);
125
126 // For the outermost environment, set caller PC.
127 builder->AddCallerPc(slot_ix++);
128
129 // For the outermost environment, set the incoming arguments.
130 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
131 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++);
132 }
133
134 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder->CreateDeoptInfo());
135 return deopt_info.raw();
136 }
137
138
46 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, 139 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
47 intptr_t stub_ix) { 140 intptr_t stub_ix) {
48 // Calls do not need stubs, they share a deoptimization trampoline. 141 // Calls do not need stubs, they share a deoptimization trampoline.
49 ASSERT(reason() != kDeoptAtCall); 142 ASSERT(reason() != kDeoptAtCall);
50 Assembler* assem = compiler->assembler(); 143 Assembler* assem = compiler->assembler();
51 #define __ assem-> 144 #define __ assem->
52 __ Comment("Deopt stub for id %"Pd"", deopt_id()); 145 __ Comment("Deopt stub for id %"Pd"", deopt_id());
53 __ Bind(entry_label()); 146 __ Bind(entry_label());
54 if (FLAG_trap_on_deoptimization) __ int3(); 147 if (FLAG_trap_on_deoptimization) __ int3();
55 148
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 __ movups(reg, Address(RSP, 0)); 1933 __ movups(reg, Address(RSP, 0));
1841 __ addq(RSP, Immediate(kFpuRegisterSize)); 1934 __ addq(RSP, Immediate(kFpuRegisterSize));
1842 } 1935 }
1843 1936
1844 1937
1845 #undef __ 1938 #undef __
1846 1939
1847 } // namespace dart 1940 } // namespace dart
1848 1941
1849 #endif // defined TARGET_ARCH_X64 1942 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698