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

Side by Side Diff: runtime/vm/flow_graph_compiler.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
« no previous file with comments | « runtime/vm/deopt_instructions.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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (it.CurrentLocation().IsInvalid()) { 55 if (it.CurrentLocation().IsInvalid()) {
56 MaterializeObjectInstr* mat = 56 MaterializeObjectInstr* mat =
57 it.CurrentValue()->definition()->AsMaterializeObject(); 57 it.CurrentValue()->definition()->AsMaterializeObject();
58 ASSERT(mat != NULL); 58 ASSERT(mat != NULL);
59 builder->AddMaterialization(mat); 59 builder->AddMaterialization(mat);
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 64
65 RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
66 DeoptInfoBuilder* builder) {
67 if (deoptimization_env_ == NULL) return DeoptInfo::null();
68
69 intptr_t stack_height = compiler->StackSize();
70 AllocateIncomingParametersRecursive(deoptimization_env_, &stack_height);
71
72 intptr_t slot_ix = 0;
73 Environment* current = deoptimization_env_;
74
75 // Emit all kMaterializeObject instructions describing objects to be
76 // materialized on the deoptimization as a prefix to the deoptimization info.
77 EmitMaterializations(deoptimization_env_, builder);
78
79 // The real frame starts here.
80 builder->MarkFrameStart();
81 builder->AddReturnAddress(current->function(),
82 deopt_id(),
83 slot_ix++);
84
85 // Emit all values that are needed for materialization as a part of the
86 // expression stack for the bottom-most frame. This guarantees that GC
87 // will be able to find them during materialization.
88 slot_ix = builder->EmitMaterializationArguments();
89
90 // For the innermost environment, set outgoing arguments and the locals.
91 for (intptr_t i = current->Length() - 1;
92 i >= current->fixed_parameter_count();
93 i--) {
94 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++);
95 }
96
97 // PC marker and caller FP.
98 builder->AddPcMarker(current->function(), slot_ix++);
99 builder->AddCallerFp(slot_ix++);
100
101 Environment* previous = current;
102 current = current->outer();
103 while (current != NULL) {
104 // For any outer environment the deopt id is that of the call instruction
105 // which is recorded in the outer environment.
106 builder->AddReturnAddress(current->function(),
107 Isolate::ToDeoptAfter(current->deopt_id()),
108 slot_ix++);
109
110 // The values of outgoing arguments can be changed from the inlined call so
111 // we must read them from the previous environment.
112 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
113 builder->AddCopy(previous->ValueAt(i),
114 previous->LocationAt(i),
115 slot_ix++);
116 }
117
118 // Set the locals, note that outgoing arguments are not in the environment.
119 for (intptr_t i = current->Length() - 1;
120 i >= current->fixed_parameter_count();
121 i--) {
122 builder->AddCopy(current->ValueAt(i),
123 current->LocationAt(i),
124 slot_ix++);
125 }
126
127 // PC marker and caller FP.
128 builder->AddPcMarker(current->function(), slot_ix++);
129 builder->AddCallerFp(slot_ix++);
130
131 // Iterate on the outer environment.
132 previous = current;
133 current = current->outer();
134 }
135 // The previous pointer is now the outermost environment.
136 ASSERT(previous != NULL);
137
138 // For the outermost environment, set caller PC.
139 builder->AddCallerPc(slot_ix++);
140
141 // For the outermost environment, set the incoming arguments.
142 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
143 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++);
144 }
145
146 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder->CreateDeoptInfo());
147 return deopt_info.raw();
148 }
149
150
151 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, 65 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler,
152 const FlowGraph& flow_graph, 66 const FlowGraph& flow_graph,
153 bool is_optimizing) 67 bool is_optimizing)
154 : assembler_(assembler), 68 : assembler_(assembler),
155 parsed_function_(flow_graph.parsed_function()), 69 parsed_function_(flow_graph.parsed_function()),
156 flow_graph_(flow_graph), 70 flow_graph_(flow_graph),
157 block_order_(flow_graph.reverse_postorder()), 71 block_order_(flow_graph.reverse_postorder()),
158 current_block_(NULL), 72 current_block_(NULL),
159 exception_handlers_list_(NULL), 73 exception_handlers_list_(NULL),
160 pc_descriptors_list_(NULL), 74 pc_descriptors_list_(NULL),
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1080
1167 for (int i = 0; i < len; i++) { 1081 for (int i = 0; i < len; i++) {
1168 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1082 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1169 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1083 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1170 ic_data.GetCountAt(i))); 1084 ic_data.GetCountAt(i)));
1171 } 1085 }
1172 sorted->Sort(HighestCountFirst); 1086 sorted->Sort(HighestCountFirst);
1173 } 1087 }
1174 1088
1175 } // namespace dart 1089 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698