OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 Loading... | |
555 | 555 |
556 class Translation BASE_EMBEDDED { | 556 class Translation BASE_EMBEDDED { |
557 public: | 557 public: |
558 enum Opcode { | 558 enum Opcode { |
559 BEGIN, | 559 BEGIN, |
560 JS_FRAME, | 560 JS_FRAME, |
561 CONSTRUCT_STUB_FRAME, | 561 CONSTRUCT_STUB_FRAME, |
562 ARGUMENTS_ADAPTOR_FRAME, | 562 ARGUMENTS_ADAPTOR_FRAME, |
563 REGISTER, | 563 REGISTER, |
564 INT32_REGISTER, | 564 INT32_REGISTER, |
565 UINT32_REGISTER, | |
565 DOUBLE_REGISTER, | 566 DOUBLE_REGISTER, |
566 STACK_SLOT, | 567 STACK_SLOT, |
567 INT32_STACK_SLOT, | 568 INT32_STACK_SLOT, |
569 UINT32_STACK_SLOT, | |
568 DOUBLE_STACK_SLOT, | 570 DOUBLE_STACK_SLOT, |
569 LITERAL, | 571 LITERAL, |
570 ARGUMENTS_OBJECT, | 572 ARGUMENTS_OBJECT, |
571 | 573 |
572 // A prefix indicating that the next command is a duplicate of the one | 574 // A prefix indicating that the next command is a duplicate of the one |
573 // that follows it. | 575 // that follows it. |
574 DUPLICATE | 576 DUPLICATE |
575 }; | 577 }; |
576 | 578 |
577 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count, | 579 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count, |
578 Zone* zone) | 580 Zone* zone) |
579 : buffer_(buffer), | 581 : buffer_(buffer), |
580 index_(buffer->CurrentIndex()), | 582 index_(buffer->CurrentIndex()), |
581 zone_(zone) { | 583 zone_(zone) { |
582 buffer_->Add(BEGIN, zone); | 584 buffer_->Add(BEGIN, zone); |
583 buffer_->Add(frame_count, zone); | 585 buffer_->Add(frame_count, zone); |
584 buffer_->Add(jsframe_count, zone); | 586 buffer_->Add(jsframe_count, zone); |
585 } | 587 } |
586 | 588 |
587 int index() const { return index_; } | 589 int index() const { return index_; } |
588 | 590 |
589 // Commands. | 591 // Commands. |
590 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 592 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
591 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 593 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
592 void BeginConstructStubFrame(int literal_id, unsigned height); | 594 void BeginConstructStubFrame(int literal_id, unsigned height); |
593 void StoreRegister(Register reg); | 595 void StoreRegister(Register reg); |
594 void StoreInt32Register(Register reg); | 596 void StoreInt32Register(Register reg); |
597 void StoreUint32Register(Register reg); | |
595 void StoreDoubleRegister(DoubleRegister reg); | 598 void StoreDoubleRegister(DoubleRegister reg); |
596 void StoreStackSlot(int index); | 599 void StoreStackSlot(int index); |
597 void StoreInt32StackSlot(int index); | 600 void StoreInt32StackSlot(int index); |
601 void StoreUint32StackSlot(int index); | |
598 void StoreDoubleStackSlot(int index); | 602 void StoreDoubleStackSlot(int index); |
599 void StoreLiteral(int literal_id); | 603 void StoreLiteral(int literal_id); |
600 void StoreArgumentsObject(); | 604 void StoreArgumentsObject(); |
601 void MarkDuplicate(); | 605 void MarkDuplicate(); |
602 | 606 |
603 Zone* zone() const { return zone_; } | 607 Zone* zone() const { return zone_; } |
604 | 608 |
605 static int NumberOfOperandsFor(Opcode opcode); | 609 static int NumberOfOperandsFor(Opcode opcode); |
606 | 610 |
607 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) | 611 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
(...skipping 29 matching lines...) Expand all Loading... | |
637 DeoptimizingCodeListNode* next_; | 641 DeoptimizingCodeListNode* next_; |
638 }; | 642 }; |
639 | 643 |
640 | 644 |
641 class SlotRef BASE_EMBEDDED { | 645 class SlotRef BASE_EMBEDDED { |
642 public: | 646 public: |
643 enum SlotRepresentation { | 647 enum SlotRepresentation { |
644 UNKNOWN, | 648 UNKNOWN, |
645 TAGGED, | 649 TAGGED, |
646 INT32, | 650 INT32, |
651 UINT32, | |
647 DOUBLE, | 652 DOUBLE, |
648 LITERAL | 653 LITERAL |
649 }; | 654 }; |
650 | 655 |
651 SlotRef() | 656 SlotRef() |
652 : addr_(NULL), representation_(UNKNOWN) { } | 657 : addr_(NULL), representation_(UNKNOWN) { } |
653 | 658 |
654 SlotRef(Address addr, SlotRepresentation representation) | 659 SlotRef(Address addr, SlotRepresentation representation) |
655 : addr_(addr), representation_(representation) { } | 660 : addr_(addr), representation_(representation) { } |
656 | 661 |
657 explicit SlotRef(Object* literal) | 662 explicit SlotRef(Object* literal) |
658 : literal_(literal), representation_(LITERAL) { } | 663 : literal_(literal), representation_(LITERAL) { } |
659 | 664 |
660 Handle<Object> GetValue() { | 665 Handle<Object> GetValue() { |
661 switch (representation_) { | 666 switch (representation_) { |
662 case TAGGED: | 667 case TAGGED: |
663 return Handle<Object>(Memory::Object_at(addr_)); | 668 return Handle<Object>(Memory::Object_at(addr_)); |
664 | 669 |
665 case INT32: { | 670 case INT32: { |
666 int value = Memory::int32_at(addr_); | 671 int value = Memory::int32_at(addr_); |
667 if (Smi::IsValid(value)) { | 672 if (Smi::IsValid(value)) { |
668 return Handle<Object>(Smi::FromInt(value)); | 673 return Handle<Object>(Smi::FromInt(value)); |
669 } else { | 674 } else { |
670 return Isolate::Current()->factory()->NewNumberFromInt(value); | 675 return Isolate::Current()->factory()->NewNumberFromInt(value); |
671 } | 676 } |
672 } | 677 } |
673 | 678 |
679 case UINT32: { | |
680 uint32_t value = Memory::uint32_at(addr_); | |
681 if (value <= static_cast<uint32_t>(Smi::kMaxValue)) { | |
Massi
2012/08/16 13:57:55
Maybe having a Smi::IsValidUint(uint32_t value) me
| |
682 return Handle<Object>(Smi::FromInt(static_cast<int>(value))); | |
683 } else { | |
684 return Isolate::Current()->factory()->NewNumber( | |
685 static_cast<double>(value)); | |
686 } | |
687 } | |
688 | |
674 case DOUBLE: { | 689 case DOUBLE: { |
675 double value = Memory::double_at(addr_); | 690 double value = Memory::double_at(addr_); |
676 return Isolate::Current()->factory()->NewNumber(value); | 691 return Isolate::Current()->factory()->NewNumber(value); |
677 } | 692 } |
678 | 693 |
679 case LITERAL: | 694 case LITERAL: |
680 return literal_; | 695 return literal_; |
681 | 696 |
682 default: | 697 default: |
683 UNREACHABLE(); | 698 UNREACHABLE(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 Object** expression_stack_; | 804 Object** expression_stack_; |
790 int source_position_; | 805 int source_position_; |
791 | 806 |
792 friend class Deoptimizer; | 807 friend class Deoptimizer; |
793 }; | 808 }; |
794 #endif | 809 #endif |
795 | 810 |
796 } } // namespace v8::internal | 811 } } // namespace v8::internal |
797 | 812 |
798 #endif // V8_DEOPTIMIZER_H_ | 813 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |