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

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

Issue 10446062: Address review comments: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | no next file » | 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ASSERT(delta >= 0); 155 ASSERT(delta >= 0);
156 BindInstr* context = new BindInstr(new CurrentContextComp()); 156 BindInstr* context = new BindInstr(new CurrentContextComp());
157 AddInstruction(context); 157 AddInstruction(context);
158 Value* context_value = new UseVal(context); 158 Value* context_value = new UseVal(context);
159 while (delta-- > 0) { 159 while (delta-- > 0) {
160 BindInstr* load = new BindInstr(new LoadVMFieldComp( 160 BindInstr* load = new BindInstr(new LoadVMFieldComp(
161 context_value, Context::parent_offset(), Type::ZoneHandle())); 161 context_value, Context::parent_offset(), Type::ZoneHandle()));
162 AddInstruction(load); 162 AddInstruction(load);
163 context_value = new UseVal(load); 163 context_value = new UseVal(load);
164 } 164 }
165 Computation* store = new StoreVMFieldComp( 165 return new StoreVMFieldComp(
166 context_value, 166 context_value,
167 Context::variable_offset(local.index()), 167 Context::variable_offset(local.index()),
168 value, 168 value,
169 local.type()); 169 local.type());
170 return store;
171 } else { 170 } else {
172 return new StoreLocalComp(local, value, owner()->context_level()); 171 return new StoreLocalComp(local, value, owner()->context_level());
173 } 172 }
174 } 173 }
175 174
176 175
177 Computation* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) { 176 Computation* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) {
178 if (local.is_captured()) { 177 if (local.is_captured()) {
179 intptr_t delta = owner()->context_level() - 178 intptr_t delta = owner()->context_level() -
180 local.owner()->context_level(); 179 local.owner()->context_level();
181 ASSERT(delta >= 0); 180 ASSERT(delta >= 0);
182 BindInstr* context = new BindInstr(new CurrentContextComp()); 181 BindInstr* context = new BindInstr(new CurrentContextComp());
183 AddInstruction(context); 182 AddInstruction(context);
184 Value* context_value = new UseVal(context); 183 Value* context_value = new UseVal(context);
185 while (delta-- > 0) { 184 while (delta-- > 0) {
186 BindInstr* load = new BindInstr(new LoadVMFieldComp( 185 BindInstr* load = new BindInstr(new LoadVMFieldComp(
187 context_value, Context::parent_offset(), Type::ZoneHandle())); 186 context_value, Context::parent_offset(), Type::ZoneHandle()));
188 AddInstruction(load); 187 AddInstruction(load);
189 context_value = new UseVal(load); 188 context_value = new UseVal(load);
190 } 189 }
191 Computation* store = new LoadVMFieldComp( 190 return new LoadVMFieldComp(
192 context_value, Context::variable_offset(local.index()), local.type()); 191 context_value, Context::variable_offset(local.index()), local.type());
193 return store;
194 } else { 192 } else {
195 return new LoadLocalComp(local, owner()->context_level()); 193 return new LoadLocalComp(local, owner()->context_level());
196 } 194 }
197 } 195 }
198 196
199 197
200 // Stores current context into the 'variable' 198 // Stores current context into the 'variable'
201 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) { 199 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) {
202 BindInstr* context = new BindInstr(new CurrentContextComp()); 200 BindInstr* context = new BindInstr(new CurrentContextComp());
203 AddInstruction(context); 201 AddInstruction(context);
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 char* chars = reinterpret_cast<char*>( 2407 char* chars = reinterpret_cast<char*>(
2410 Isolate::Current()->current_zone()->Allocate(len)); 2408 Isolate::Current()->current_zone()->Allocate(len));
2411 OS::SNPrint(chars, len, kFormat, function_name, reason); 2409 OS::SNPrint(chars, len, kFormat, function_name, reason);
2412 const Error& error = Error::Handle( 2410 const Error& error = Error::Handle(
2413 LanguageError::New(String::Handle(String::New(chars)))); 2411 LanguageError::New(String::Handle(String::New(chars))));
2414 Isolate::Current()->long_jump_base()->Jump(1, error); 2412 Isolate::Current()->long_jump_base()->Jump(1, error);
2415 } 2413 }
2416 2414
2417 2415
2418 } // namespace dart 2416 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698