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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 arguments_stack_height_(argument_count), | 526 arguments_stack_height_(argument_count), |
527 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), | 527 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), |
528 translation_index_(-1), | 528 translation_index_(-1), |
529 ast_id_(ast_id), | 529 ast_id_(ast_id), |
530 translation_size_(value_count), | 530 translation_size_(value_count), |
531 parameter_count_(parameter_count), | 531 parameter_count_(parameter_count), |
532 pc_offset_(-1), | 532 pc_offset_(-1), |
533 values_(value_count, zone), | 533 values_(value_count, zone), |
534 is_tagged_(value_count, zone), | 534 is_tagged_(value_count, zone), |
535 is_uint32_(value_count, zone), | 535 is_uint32_(value_count, zone), |
536 object_mapping_(0, zone), | |
536 outer_(outer), | 537 outer_(outer), |
537 entry_(entry), | 538 entry_(entry), |
538 zone_(zone) { } | 539 zone_(zone) { } |
539 | 540 |
540 Handle<JSFunction> closure() const { return closure_; } | 541 Handle<JSFunction> closure() const { return closure_; } |
541 FrameType frame_type() const { return frame_type_; } | 542 FrameType frame_type() const { return frame_type_; } |
542 int arguments_stack_height() const { return arguments_stack_height_; } | 543 int arguments_stack_height() const { return arguments_stack_height_; } |
543 int deoptimization_index() const { return deoptimization_index_; } | 544 int deoptimization_index() const { return deoptimization_index_; } |
544 int translation_index() const { return translation_index_; } | 545 int translation_index() const { return translation_index_; } |
545 BailoutId ast_id() const { return ast_id_; } | 546 BailoutId ast_id() const { return ast_id_; } |
(...skipping 20 matching lines...) Expand all Loading... | |
566 } | 567 } |
567 | 568 |
568 bool HasTaggedValueAt(int index) const { | 569 bool HasTaggedValueAt(int index) const { |
569 return is_tagged_.Contains(index); | 570 return is_tagged_.Contains(index); |
570 } | 571 } |
571 | 572 |
572 bool HasUint32ValueAt(int index) const { | 573 bool HasUint32ValueAt(int index) const { |
573 return is_uint32_.Contains(index); | 574 return is_uint32_.Contains(index); |
574 } | 575 } |
575 | 576 |
577 void AddNewObject(int length, bool is_arguments) { | |
578 uint32_t encoded = LengthOrDupeField::encode(length) | | |
579 IsArgumentsField::encode(is_arguments) | | |
580 IsDuplicateField::encode(false); | |
581 object_mapping_.Add(encoded, zone()); | |
582 } | |
583 | |
584 void AddDuplicateObject(int dupe_of) { | |
585 uint32_t encoded = LengthOrDupeField::encode(dupe_of) | | |
586 IsDuplicateField::encode(true); | |
587 object_mapping_.Add(encoded, zone()); | |
588 } | |
589 | |
590 int ObjectDuplicateOfAt(int index) { | |
591 ASSERT(ObjectIsDuplicateAt(index)); | |
592 return LengthOrDupeField::decode(object_mapping_[index]); | |
593 } | |
594 | |
595 int ObjectLengthAt(int index) { | |
596 ASSERT(!ObjectIsDuplicateAt(index)); | |
597 return LengthOrDupeField::decode(object_mapping_[index]); | |
598 } | |
599 | |
600 bool ObjectIsArgumentsAt(int index) { | |
601 ASSERT(!ObjectIsDuplicateAt(index)); | |
602 return IsArgumentsField::decode(object_mapping_[index]); | |
603 } | |
604 | |
605 bool ObjectIsDuplicateAt(int index) { | |
606 return IsDuplicateField::decode(object_mapping_[index]); | |
607 } | |
608 | |
576 void Register(int deoptimization_index, | 609 void Register(int deoptimization_index, |
577 int translation_index, | 610 int translation_index, |
578 int pc_offset) { | 611 int pc_offset) { |
579 ASSERT(!HasBeenRegistered()); | 612 ASSERT(!HasBeenRegistered()); |
580 deoptimization_index_ = deoptimization_index; | 613 deoptimization_index_ = deoptimization_index; |
581 translation_index_ = translation_index; | 614 translation_index_ = translation_index; |
582 pc_offset_ = pc_offset; | 615 pc_offset_ = pc_offset; |
583 } | 616 } |
584 bool HasBeenRegistered() const { | 617 bool HasBeenRegistered() const { |
585 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex; | 618 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex; |
586 } | 619 } |
587 | 620 |
588 void PrintTo(StringStream* stream); | 621 void PrintTo(StringStream* stream); |
589 | 622 |
623 // Marker value indicating a de-materialized object. | |
624 static LOperand* materialization_marker() { return NULL; } | |
titzer
2013/08/01 17:11:50
NULL seems like it could get mixed up sometime. Ma
Michael Starzinger
2013/08/05 15:13:00
That would require many changes in the register al
| |
625 | |
626 // Encoding used for the object_mapping map below. | |
627 class LengthOrDupeField : public BitField<int, 0, 30> { }; | |
628 class IsArgumentsField : public BitField<bool, 30, 1> { }; | |
629 class IsDuplicateField : public BitField<bool, 31, 1> { }; | |
630 | |
590 private: | 631 private: |
591 Handle<JSFunction> closure_; | 632 Handle<JSFunction> closure_; |
592 FrameType frame_type_; | 633 FrameType frame_type_; |
593 int arguments_stack_height_; | 634 int arguments_stack_height_; |
594 int deoptimization_index_; | 635 int deoptimization_index_; |
595 int translation_index_; | 636 int translation_index_; |
596 BailoutId ast_id_; | 637 BailoutId ast_id_; |
597 int translation_size_; | 638 int translation_size_; |
598 int parameter_count_; | 639 int parameter_count_; |
599 int pc_offset_; | 640 int pc_offset_; |
600 | 641 |
601 // Value array: [parameters] [locals] [expression stack] [de-materialized]. | 642 // Value array: [parameters] [locals] [expression stack] [de-materialized]. |
602 // |>--------- translation_size ---------<| | 643 // |>--------- translation_size ---------<| |
603 ZoneList<LOperand*> values_; | 644 ZoneList<LOperand*> values_; |
604 GrowableBitVector is_tagged_; | 645 GrowableBitVector is_tagged_; |
605 GrowableBitVector is_uint32_; | 646 GrowableBitVector is_uint32_; |
647 | |
648 // Map with encoded information about kMaterializationMarker operands. | |
649 ZoneList<uint32_t> object_mapping_; | |
650 | |
606 LEnvironment* outer_; | 651 LEnvironment* outer_; |
607 HEnterInlined* entry_; | 652 HEnterInlined* entry_; |
608 Zone* zone_; | 653 Zone* zone_; |
609 }; | 654 }; |
610 | 655 |
611 | 656 |
612 // Iterates over the non-null, non-constant operands in an environment. | 657 // Iterates over the non-null, non-constant operands in an environment. |
613 class ShallowIterator BASE_EMBEDDED { | 658 class ShallowIterator BASE_EMBEDDED { |
614 public: | 659 public: |
615 explicit ShallowIterator(LEnvironment* env) | 660 explicit ShallowIterator(LEnvironment* env) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
769 private: | 814 private: |
770 LChunk* chunk_; | 815 LChunk* chunk_; |
771 | 816 |
772 DISALLOW_COPY_AND_ASSIGN(LPhase); | 817 DISALLOW_COPY_AND_ASSIGN(LPhase); |
773 }; | 818 }; |
774 | 819 |
775 | 820 |
776 } } // namespace v8::internal | 821 } } // namespace v8::internal |
777 | 822 |
778 #endif // V8_LITHIUM_H_ | 823 #endif // V8_LITHIUM_H_ |
OLD | NEW |