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

Unified Diff: src/ia32/code-stubs-ia32.cc

Issue 7042004: Handle all kind of arguments in the ToBooleanStub. While this is not very (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/code-stubs-ia32.cc
===================================================================
--- src/ia32/code-stubs-ia32.cc (revision 7918)
+++ src/ia32/code-stubs-ia32.cc (working copy)
@@ -244,9 +244,25 @@
void ToBooleanStub::Generate(MacroAssembler* masm) {
Label false_result, true_result, not_string;
__ mov(eax, Operand(esp, 1 * kPointerSize));
+ Factory* factory = masm->isolate()->factory();
+ // undefined -> false
+ __ cmp(eax, factory->undefined_value());
+ __ j(equal, &false_result);
+
+ // Boolean -> its value
+ __ cmp(eax, factory->true_value());
+ __ j(equal, &true_result);
+ __ cmp(eax, factory->false_value());
+ __ j(equal, &false_result);
+
+ // Smis: 0 -> false, all other -> true
+ __ test(eax, Operand(eax));
+ __ j(zero, &false_result);
+ __ test(eax, Immediate(kSmiTagMask));
+ __ j(zero, &true_result);
+
// 'null' => false.
- Factory* factory = masm->isolate()->factory();
__ cmp(eax, factory->null_value());
__ j(equal, &false_result, Label::kNear);
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698