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

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

Issue 10867050: Separate branch on strict compare into a new IL instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')
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/code_descriptors.h" 8 #include "vm/code_descriptors.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 270
271 void TestGraphVisitor::ReturnValue(Value* value) { 271 void TestGraphVisitor::ReturnValue(Value* value) {
272 if (FLAG_enable_type_checks) { 272 if (FLAG_enable_type_checks) {
273 value = Bind(new AssertBooleanComp(condition_token_pos(), 273 value = Bind(new AssertBooleanComp(condition_token_pos(),
274 owner()->try_index(), 274 owner()->try_index(),
275 value)); 275 value));
276 } 276 }
277 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 277 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
278 Value* constant_true = Bind(Constant(bool_true)); 278 Value* constant_true = Bind(Constant(bool_true));
279 BranchInstr* branch = new BranchInstr(condition_token_pos(), 279 StrictCompareAndBranchInstr* branch =
280 owner()->try_index(), 280 new StrictCompareAndBranchInstr(value, constant_true, Token::kEQ_STRICT);
281 value,
282 constant_true,
283 Token::kEQ_STRICT);
284 AddInstruction(branch); 281 AddInstruction(branch);
285 CloseFragment(); 282 CloseFragment();
286 true_successor_address_ = branch->true_successor_address(); 283 true_successor_address_ = branch->true_successor_address();
287 false_successor_address_ = branch->false_successor_address(); 284 false_successor_address_ = branch->false_successor_address();
288 } 285 }
289 286
290 287
291 void TestGraphVisitor::MergeBranchWithComparison(ComparisonComp* comp) { 288 void TestGraphVisitor::MergeBranchWithComparison(ComparisonComp* comp) {
292 ASSERT(!FLAG_enable_type_checks); 289 ASSERT(!FLAG_enable_type_checks);
293 BranchInstr* branch = new BranchInstr(condition_token_pos(), 290 BranchInstr* branch = new BranchInstr(condition_token_pos(),
294 owner()->try_index(), 291 owner()->try_index(),
295 comp->left(), 292 comp->left(),
296 comp->right(), 293 comp->right(),
297 comp->kind()); 294 comp->kind());
298 AddInstruction(branch); 295 AddInstruction(branch);
299 CloseFragment(); 296 CloseFragment();
300 true_successor_address_ = branch->true_successor_address(); 297 true_successor_address_ = branch->true_successor_address();
301 false_successor_address_ = branch->false_successor_address(); 298 false_successor_address_ = branch->false_successor_address();
302 } 299 }
303 300
304 301
305 void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateComp* comp) { 302 void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateComp* comp) {
306 ASSERT(!FLAG_enable_type_checks); 303 ASSERT(!FLAG_enable_type_checks);
307 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 304 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
308 Value* constant_true = Bind(Constant(bool_true)); 305 Value* constant_true = Bind(Constant(bool_true));
309 BranchInstr* branch = new BranchInstr(condition_token_pos(), 306 StrictCompareAndBranchInstr* branch =
310 owner()->try_index(), 307 new StrictCompareAndBranchInstr(comp->value(),
311 comp->value(), 308 constant_true,
312 constant_true, 309 Token::kNE_STRICT);
313 Token::kNE_STRICT);
314 AddInstruction(branch); 310 AddInstruction(branch);
315 CloseFragment(); 311 CloseFragment();
316 true_successor_address_ = branch->true_successor_address(); 312 true_successor_address_ = branch->true_successor_address();
317 false_successor_address_ = branch->false_successor_address(); 313 false_successor_address_ = branch->false_successor_address();
318 } 314 }
319 315
320 316
321 void TestGraphVisitor::ReturnComputation(Computation* computation) { 317 void TestGraphVisitor::ReturnComputation(Computation* computation) {
322 if (!FLAG_enable_type_checks) { 318 if (!FLAG_enable_type_checks) {
323 if (computation->AsComparison() != NULL) { 319 if (computation->AsComparison() != NULL) {
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2409 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2414 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2410 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2415 OS::SNPrint(chars, len, kFormat, function_name, reason); 2411 OS::SNPrint(chars, len, kFormat, function_name, reason);
2416 const Error& error = Error::Handle( 2412 const Error& error = Error::Handle(
2417 LanguageError::New(String::Handle(String::New(chars)))); 2413 LanguageError::New(String::Handle(String::New(chars))));
2418 Isolate::Current()->long_jump_base()->Jump(1, error); 2414 Isolate::Current()->long_jump_base()->Jump(1, error);
2419 } 2415 }
2420 2416
2421 2417
2422 } // namespace dart 2418 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698