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

Side by Side Diff: src/arm/full-codegen-arm.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } else { 555 } else {
556 if (false_label_ != fall_through_) __ b(false_label_); 556 if (false_label_ != fall_through_) __ b(false_label_);
557 } 557 }
558 } 558 }
559 559
560 560
561 void FullCodeGenerator::DoTest(Label* if_true, 561 void FullCodeGenerator::DoTest(Label* if_true,
562 Label* if_false, 562 Label* if_false,
563 Label* fall_through) { 563 Label* fall_through) {
564 if (CpuFeatures::IsSupported(VFP3)) { 564 if (CpuFeatures::IsSupported(VFP3)) {
565 CpuFeatures::Scope scope(VFP3);
566 // Emit the inlined tests assumed by the stub.
567 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
568 __ cmp(result_register(), ip);
569 __ b(eq, if_false);
570 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
571 __ cmp(result_register(), ip);
572 __ b(eq, if_true);
573 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
574 __ cmp(result_register(), ip);
575 __ b(eq, if_false);
576 STATIC_ASSERT(kSmiTag == 0);
577 __ tst(result_register(), result_register());
578 __ b(eq, if_false);
579 __ JumpIfSmi(result_register(), if_true);
580
581 // Call the ToBoolean stub for all other cases.
582 ToBooleanStub stub(result_register()); 565 ToBooleanStub stub(result_register());
583 __ CallStub(&stub); 566 __ CallStub(&stub);
584 __ tst(result_register(), result_register()); 567 __ tst(result_register(), result_register());
585 } else { 568 } else {
586 // Call the runtime to find the boolean value of the source and then 569 // Call the runtime to find the boolean value of the source and then
587 // translate it into control flow to the pair of labels. 570 // translate it into control flow to the pair of labels.
588 __ push(result_register()); 571 __ push(result_register());
589 __ CallRuntime(Runtime::kToBool, 1); 572 __ CallRuntime(Runtime::kToBool, 1);
590 __ LoadRoot(ip, Heap::kFalseValueRootIndex); 573 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
591 __ cmp(r0, ip); 574 __ cmp(r0, ip);
592 } 575 }
593
594 // The stub returns nonzero for true.
595 Split(ne, if_true, if_false, fall_through); 576 Split(ne, if_true, if_false, fall_through);
596 } 577 }
597 578
598 579
599 void FullCodeGenerator::Split(Condition cond, 580 void FullCodeGenerator::Split(Condition cond,
600 Label* if_true, 581 Label* if_true,
601 Label* if_false, 582 Label* if_false,
602 Label* fall_through) { 583 Label* fall_through) {
603 if (if_false == fall_through) { 584 if (if_false == fall_through) {
604 __ b(cond, if_true); 585 __ b(cond, if_true);
(...skipping 3769 matching lines...) Expand 10 before | Expand all | Expand 10 after
4374 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4355 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4375 __ add(pc, r1, Operand(masm_->CodeObject())); 4356 __ add(pc, r1, Operand(masm_->CodeObject()));
4376 } 4357 }
4377 4358
4378 4359
4379 #undef __ 4360 #undef __
4380 4361
4381 } } // namespace v8::internal 4362 } } // namespace v8::internal
4382 4363
4383 #endif // V8_TARGET_ARCH_ARM 4364 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698