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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 10832277: Eliminate condition type check when possible. (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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 10606)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -213,23 +213,25 @@
Register obj = locs()->in(0).reg();
Register result = locs()->out().reg();
- // Check that the type of the value is allowed in conditional context.
- // Call the runtime if the object is not bool::true or bool::false.
- Label done;
- __ CompareObject(obj, compiler->bool_true());
- __ j(EQUAL, &done, Assembler::kNearJump);
- __ CompareObject(obj, compiler->bool_false());
- __ j(EQUAL, &done, Assembler::kNearJump);
+ if (!IsEliminated()) {
+ // Check that the type of the value is allowed in conditional context.
+ // Call the runtime if the object is not bool::true or bool::false.
+ Label done;
+ __ CompareObject(obj, compiler->bool_true());
+ __ j(EQUAL, &done, Assembler::kNearJump);
+ __ CompareObject(obj, compiler->bool_false());
+ __ j(EQUAL, &done, Assembler::kNearJump);
- __ pushq(obj); // Push the source object.
- compiler->GenerateCallRuntime(deopt_id(),
- token_pos(),
- try_index(),
- kConditionTypeErrorRuntimeEntry);
- // We should never return here.
- __ int3();
+ __ pushq(obj); // Push the source object.
+ compiler->GenerateCallRuntime(deopt_id(),
+ token_pos(),
+ try_index(),
+ kConditionTypeErrorRuntimeEntry);
+ // We should never return here.
+ __ int3();
- __ Bind(&done);
+ __ Bind(&done);
+ }
ASSERT(obj == result);
}
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698