OLD | NEW |
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } else { | 559 } else { |
560 if (false_label_ != fall_through_) __ Branch(false_label_); | 560 if (false_label_ != fall_through_) __ Branch(false_label_); |
561 } | 561 } |
562 } | 562 } |
563 | 563 |
564 | 564 |
565 void FullCodeGenerator::DoTest(Label* if_true, | 565 void FullCodeGenerator::DoTest(Label* if_true, |
566 Label* if_false, | 566 Label* if_false, |
567 Label* fall_through) { | 567 Label* fall_through) { |
568 if (CpuFeatures::IsSupported(FPU)) { | 568 if (CpuFeatures::IsSupported(FPU)) { |
569 CpuFeatures::Scope scope(FPU); | |
570 // Emit the inlined tests assumed by the stub. | |
571 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
572 __ Branch(if_false, eq, result_register(), Operand(at)); | |
573 __ LoadRoot(at, Heap::kTrueValueRootIndex); | |
574 __ Branch(if_true, eq, result_register(), Operand(at)); | |
575 __ LoadRoot(at, Heap::kFalseValueRootIndex); | |
576 __ Branch(if_false, eq, result_register(), Operand(at)); | |
577 STATIC_ASSERT(kSmiTag == 0); | |
578 __ Branch(if_false, eq, result_register(), Operand(zero_reg)); | |
579 __ JumpIfSmi(result_register(), if_true); | |
580 | |
581 // Call the ToBoolean stub for all other cases. | |
582 ToBooleanStub stub(result_register()); | 569 ToBooleanStub stub(result_register()); |
583 __ CallStub(&stub); | 570 __ CallStub(&stub); |
584 __ mov(at, zero_reg); | 571 __ mov(at, zero_reg); |
585 } else { | 572 } else { |
586 // Call the runtime to find the boolean value of the source and then | 573 // Call the runtime to find the boolean value of the source and then |
587 // translate it into control flow to the pair of labels. | 574 // translate it into control flow to the pair of labels. |
588 __ push(result_register()); | 575 __ push(result_register()); |
589 __ CallRuntime(Runtime::kToBool, 1); | 576 __ CallRuntime(Runtime::kToBool, 1); |
590 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 577 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
591 } | 578 } |
592 | |
593 // The stub returns nonzero for true. | |
594 Split(ne, v0, Operand(at), if_true, if_false, fall_through); | 579 Split(ne, v0, Operand(at), if_true, if_false, fall_through); |
595 } | 580 } |
596 | 581 |
597 | 582 |
598 void FullCodeGenerator::Split(Condition cc, | 583 void FullCodeGenerator::Split(Condition cc, |
599 Register lhs, | 584 Register lhs, |
600 const Operand& rhs, | 585 const Operand& rhs, |
601 Label* if_true, | 586 Label* if_true, |
602 Label* if_false, | 587 Label* if_false, |
603 Label* fall_through) { | 588 Label* fall_through) { |
(...skipping 3781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4385 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4370 __ Addu(at, a1, Operand(masm_->CodeObject())); |
4386 __ Jump(at); | 4371 __ Jump(at); |
4387 } | 4372 } |
4388 | 4373 |
4389 | 4374 |
4390 #undef __ | 4375 #undef __ |
4391 | 4376 |
4392 } } // namespace v8::internal | 4377 } } // namespace v8::internal |
4393 | 4378 |
4394 #endif // V8_TARGET_ARCH_MIPS | 4379 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |