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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 void Generate(MacroAssembler* masm); | 520 void Generate(MacroAssembler* masm); |
521 void GenerateCall(MacroAssembler* masm, Register target); | 521 void GenerateCall(MacroAssembler* masm, Register target); |
522 | 522 |
523 private: | 523 private: |
524 Major MajorKey() { return DirectCEntry; } | 524 Major MajorKey() { return DirectCEntry; } |
525 int MinorKey() { return 0; } | 525 int MinorKey() { return 0; } |
526 | 526 |
527 bool NeedsImmovableCode() { return true; } | 527 bool NeedsImmovableCode() { return true; } |
528 }; | 528 }; |
529 | 529 |
530 class FloatingPointHelper : public AllStatic { | |
531 public: | |
532 enum Destination { | |
533 kFPURegisters, | |
534 kCoreRegisters | |
535 }; | |
536 | |
537 | |
538 // Loads smis from a0 and a1 (right and left in binary operations) into | |
539 // floating point registers. Depending on the destination the values ends up | |
540 // either f14 and f12 or in a2/a3 and a0/a1 respectively. If the destination | |
541 // is floating point registers FPU must be supported. If core registers are | |
542 // requested when FPU is supported f12 and f14 will be scratched. | |
543 static void LoadSmis(MacroAssembler* masm, | |
544 Destination destination, | |
545 Register scratch1, | |
546 Register scratch2); | |
547 | |
548 // Convert the smi or heap number in object to an int32 using the rules | |
549 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated | |
550 // and brought into the range -2^31 .. +2^31 - 1. | |
551 static void ConvertNumberToInt32(MacroAssembler* masm, | |
552 Register object, | |
553 Register dst, | |
554 Register heap_number_map, | |
555 Register scratch1, | |
556 Register scratch2, | |
557 Register scratch3, | |
558 FPURegister double_scratch, | |
559 Label* not_int32); | |
560 | |
561 // Converts the integer (untagged smi) in |int_scratch| to a double, storing | |
562 // the result either in |double_dst| or |dst2:dst1|, depending on | |
563 // |destination|. | |
564 // Warning: The value in |int_scratch| will be changed in the process! | |
565 static void ConvertIntToDouble(MacroAssembler* masm, | |
566 Register int_scratch, | |
567 Destination destination, | |
568 FPURegister double_dst, | |
569 Register dst1, | |
570 Register dst2, | |
571 Register scratch2, | |
572 FPURegister single_scratch); | |
573 | |
574 // Load the number from object into double_dst in the double format. | |
575 // Control will jump to not_int32 if the value cannot be exactly represented | |
576 // by a 32-bit integer. | |
577 // Floating point value in the 32-bit integer range that are not exact integer | |
578 // won't be loaded. | |
579 static void LoadNumberAsInt32Double(MacroAssembler* masm, | |
580 Register object, | |
581 Destination destination, | |
582 FPURegister double_dst, | |
583 FPURegister double_scratch, | |
584 Register dst1, | |
585 Register dst2, | |
586 Register heap_number_map, | |
587 Register scratch1, | |
588 Register scratch2, | |
589 FPURegister single_scratch, | |
590 Label* not_int32); | |
591 | |
592 // Loads the number from object into dst as a 32-bit integer. | |
593 // Control will jump to not_int32 if the object cannot be exactly represented | |
594 // by a 32-bit integer. | |
595 // Floating point value in the 32-bit integer range that are not exact integer | |
596 // won't be converted. | |
597 // scratch3 is not used when FPU is supported. | |
598 static void LoadNumberAsInt32(MacroAssembler* masm, | |
599 Register object, | |
600 Register dst, | |
601 Register heap_number_map, | |
602 Register scratch1, | |
603 Register scratch2, | |
604 Register scratch3, | |
605 FPURegister double_scratch0, | |
606 FPURegister double_scratch1, | |
607 Label* not_int32); | |
608 | |
609 // Generates code to call a C function to do a double operation using core | |
610 // registers. (Used when FPU is not supported.) | |
611 // This code never falls through, but returns with a heap number containing | |
612 // the result in v0. | |
613 // Register heapnumber_result must be a heap number in which the | |
614 // result of the operation will be stored. | |
615 // Requires the following layout on entry: | |
616 // a0: Left value (least significant part of mantissa). | |
617 // a1: Left value (sign, exponent, top of mantissa). | |
618 // a2: Right value (least significant part of mantissa). | |
619 // a3: Right value (sign, exponent, top of mantissa). | |
620 static void CallCCodeForDoubleOperation(MacroAssembler* masm, | |
621 Token::Value op, | |
622 Register heap_number_result, | |
623 Register scratch); | |
624 | |
625 // Loads the objects from |object| into floating point registers. | |
626 // Depending on |destination| the value ends up either in |dst| or | |
627 // in |dst1|/|dst2|. If |destination| is kFPURegisters, then FPU | |
628 // must be supported. If kCoreRegisters are requested and FPU is | |
629 // supported, |dst| will be scratched. If |object| is neither smi nor | |
630 // heap number, |not_number| is jumped to with |object| still intact. | |
631 static void LoadNumber(MacroAssembler* masm, | |
632 FloatingPointHelper::Destination destination, | |
633 Register object, | |
634 FPURegister dst, | |
635 Register dst1, | |
636 Register dst2, | |
637 Register heap_number_map, | |
638 Register scratch1, | |
639 Register scratch2, | |
640 Label* not_number); | |
641 }; | |
642 | |
643 | 530 |
644 class NameDictionaryLookupStub: public PlatformCodeStub { | 531 class NameDictionaryLookupStub: public PlatformCodeStub { |
645 public: | 532 public: |
646 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 533 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
647 | 534 |
648 explicit NameDictionaryLookupStub(LookupMode mode) : mode_(mode) { } | 535 explicit NameDictionaryLookupStub(LookupMode mode) : mode_(mode) { } |
649 | 536 |
650 void Generate(MacroAssembler* masm); | 537 void Generate(MacroAssembler* masm); |
651 | 538 |
652 static void GenerateNegativeLookup(MacroAssembler* masm, | 539 static void GenerateNegativeLookup(MacroAssembler* masm, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 574 |
688 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 575 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
689 | 576 |
690 LookupMode mode_; | 577 LookupMode mode_; |
691 }; | 578 }; |
692 | 579 |
693 | 580 |
694 } } // namespace v8::internal | 581 } } // namespace v8::internal |
695 | 582 |
696 #endif // V8_MIPS_CODE_STUBS_ARM_H_ | 583 #endif // V8_MIPS_CODE_STUBS_ARM_H_ |
OLD | NEW |