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

Side by Side Diff: src/deoptimizer.h

Issue 130803009: Revert "Captured arguments object materialization" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/accessors.cc ('k') | src/deoptimizer.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 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 // Array of output frame descriptions. 428 // Array of output frame descriptions.
429 FrameDescription** output_; 429 FrameDescription** output_;
430 430
431 // Deferred values to be materialized. 431 // Deferred values to be materialized.
432 List<Object*> deferred_objects_tagged_values_; 432 List<Object*> deferred_objects_tagged_values_;
433 List<HeapNumberMaterializationDescriptor<int> > 433 List<HeapNumberMaterializationDescriptor<int> >
434 deferred_objects_double_values_; 434 deferred_objects_double_values_;
435 List<ObjectMaterializationDescriptor> deferred_objects_; 435 List<ObjectMaterializationDescriptor> deferred_objects_;
436 List<HeapNumberMaterializationDescriptor<Address> > deferred_heap_numbers_; 436 List<HeapNumberMaterializationDescriptor<Address> > deferred_heap_numbers_;
437 437
438 // Key for lookup of previously materialized objects
439 Address stack_fp_;
440 Handle<FixedArray> previously_materialized_objects_;
441 int prev_materialized_count_;
442
443 // Output frame information. Only used during heap object materialization. 438 // Output frame information. Only used during heap object materialization.
444 List<Handle<JSFunction> > jsframe_functions_; 439 List<Handle<JSFunction> > jsframe_functions_;
445 List<bool> jsframe_has_adapted_arguments_; 440 List<bool> jsframe_has_adapted_arguments_;
446 441
447 // Materialized objects. Only used during heap object materialization. 442 // Materialized objects. Only used during heap object materialization.
448 List<Handle<Object> >* materialized_values_; 443 List<Handle<Object> >* materialized_values_;
449 List<Handle<Object> >* materialized_objects_; 444 List<Handle<Object> >* materialized_objects_;
450 int materialization_value_index_; 445 int materialization_value_index_;
451 int materialization_object_index_; 446 int materialization_object_index_;
452 447
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 776
782 777
783 class SlotRef BASE_EMBEDDED { 778 class SlotRef BASE_EMBEDDED {
784 public: 779 public:
785 enum SlotRepresentation { 780 enum SlotRepresentation {
786 UNKNOWN, 781 UNKNOWN,
787 TAGGED, 782 TAGGED,
788 INT32, 783 INT32,
789 UINT32, 784 UINT32,
790 DOUBLE, 785 DOUBLE,
791 LITERAL, 786 LITERAL
792 DEFERRED_OBJECT, // Object captured by the escape analysis.
793 // The number of nested objects can be obtained
794 // with the DeferredObjectLength() method
795 // (the SlotRefs of the nested objects follow
796 // this SlotRef in the depth-first order.)
797 DUPLICATE_OBJECT // Duplicated object of a deferred object.
798 }; 787 };
799 788
800 SlotRef() 789 SlotRef()
801 : addr_(NULL), representation_(UNKNOWN) { } 790 : addr_(NULL), representation_(UNKNOWN) { }
802 791
803 SlotRef(Address addr, SlotRepresentation representation) 792 SlotRef(Address addr, SlotRepresentation representation)
804 : addr_(addr), representation_(representation) { } 793 : addr_(addr), representation_(representation) { }
805 794
806 SlotRef(Isolate* isolate, Object* literal) 795 SlotRef(Isolate* isolate, Object* literal)
807 : literal_(literal, isolate), representation_(LITERAL) { } 796 : literal_(literal, isolate), representation_(LITERAL) { }
808 797
809 static SlotRef NewDeferredObject(int length) { 798 Handle<Object> GetValue(Isolate* isolate) {
810 SlotRef slot; 799 switch (representation_) {
811 slot.representation_ = DEFERRED_OBJECT; 800 case TAGGED:
812 slot.deferred_object_length_ = length; 801 return Handle<Object>(Memory::Object_at(addr_), isolate);
813 return slot; 802
803 case INT32: {
804 int value = Memory::int32_at(addr_);
805 if (Smi::IsValid(value)) {
806 return Handle<Object>(Smi::FromInt(value), isolate);
807 } else {
808 return isolate->factory()->NewNumberFromInt(value);
809 }
810 }
811
812 case UINT32: {
813 uint32_t value = Memory::uint32_at(addr_);
814 if (value <= static_cast<uint32_t>(Smi::kMaxValue)) {
815 return Handle<Object>(Smi::FromInt(static_cast<int>(value)), isolate);
816 } else {
817 return isolate->factory()->NewNumber(static_cast<double>(value));
818 }
819 }
820
821 case DOUBLE: {
822 double value = read_double_value(addr_);
823 return isolate->factory()->NewNumber(value);
824 }
825
826 case LITERAL:
827 return literal_;
828
829 default:
830 UNREACHABLE();
831 return Handle<Object>::null();
832 }
814 } 833 }
815 834
816 SlotRepresentation Representation() { return representation_; } 835 static Vector<SlotRef> ComputeSlotMappingForArguments(
817 836 JavaScriptFrame* frame,
818 static SlotRef NewDuplicateObject(int id) { 837 int inlined_frame_index,
819 SlotRef slot; 838 int formal_parameter_count);
820 slot.representation_ = DUPLICATE_OBJECT;
821 slot.duplicate_object_id_ = id;
822 return slot;
823 }
824
825 int DeferredObjectLength() { return deferred_object_length_; }
826
827 int DuplicateObjectId() { return duplicate_object_id_; }
828
829 Handle<Object> GetValue(Isolate* isolate);
830 839
831 private: 840 private:
832 Address addr_; 841 Address addr_;
833 Handle<Object> literal_; 842 Handle<Object> literal_;
834 SlotRepresentation representation_; 843 SlotRepresentation representation_;
835 int deferred_object_length_;
836 int duplicate_object_id_;
837 };
838
839 class SlotRefValueBuilder BASE_EMBEDDED {
840 public:
841 SlotRefValueBuilder(
842 JavaScriptFrame* frame,
843 int inlined_frame_index,
844 int formal_parameter_count);
845
846 void Prepare(Isolate* isolate);
847 Handle<Object> GetNext(Isolate* isolate, int level);
848 void Finish(Isolate* isolate);
849
850 int args_length() { return args_length_; }
851
852 private:
853 List<Handle<Object> > materialized_objects_;
854 Handle<FixedArray> previously_materialized_objects_;
855 int prev_materialized_count_;
856 Address stack_frame_id_;
857 List<SlotRef> slot_refs_;
858 int current_slot_;
859 int args_length_;
860 int first_slot_index_;
861
862 static SlotRef ComputeSlotForNextArgument(
863 Translation::Opcode opcode,
864 TranslationIterator* iterator,
865 DeoptimizationInputData* data,
866 JavaScriptFrame* frame);
867
868 Handle<Object> GetPreviouslyMaterialized(Isolate* isolate, int length);
869 844
870 static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { 845 static Address SlotAddress(JavaScriptFrame* frame, int slot_index) {
871 if (slot_index >= 0) { 846 if (slot_index >= 0) {
872 const int offset = JavaScriptFrameConstants::kLocal0Offset; 847 const int offset = JavaScriptFrameConstants::kLocal0Offset;
873 return frame->fp() + offset - (slot_index * kPointerSize); 848 return frame->fp() + offset - (slot_index * kPointerSize);
874 } else { 849 } else {
875 const int offset = JavaScriptFrameConstants::kLastParameterOffset; 850 const int offset = JavaScriptFrameConstants::kLastParameterOffset;
876 return frame->fp() + offset - ((slot_index + 1) * kPointerSize); 851 return frame->fp() + offset - ((slot_index + 1) * kPointerSize);
877 } 852 }
878 } 853 }
879 854
880 Handle<Object> GetDeferredObject(Isolate* isolate); 855 static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator,
881 }; 856 DeoptimizationInputData* data,
857 JavaScriptFrame* frame);
882 858
883 class MaterializedObjectStore { 859 static void ComputeSlotsForArguments(
884 public: 860 Vector<SlotRef>* args_slots,
885 explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) { 861 TranslationIterator* iterator,
886 } 862 DeoptimizationInputData* data,
887 863 JavaScriptFrame* frame);
888 Handle<FixedArray> Get(Address fp);
889 void Set(Address fp, Handle<FixedArray> materialized_objects);
890 void Remove(Address fp);
891
892 private:
893 Isolate* isolate() { return isolate_; }
894 Handle<FixedArray> GetStackEntries();
895 Handle<FixedArray> EnsureStackEntries(int size);
896
897 int StackIdToIndex(Address fp);
898
899 Isolate* isolate_;
900 List<Address> frame_fps_;
901 }; 864 };
902 865
903 866
904 #ifdef ENABLE_DEBUGGER_SUPPORT 867 #ifdef ENABLE_DEBUGGER_SUPPORT
905 // Class used to represent an unoptimized frame when the debugger 868 // Class used to represent an unoptimized frame when the debugger
906 // needs to inspect a frame that is part of an optimized frame. The 869 // needs to inspect a frame that is part of an optimized frame. The
907 // internally used FrameDescription objects are not GC safe so for use 870 // internally used FrameDescription objects are not GC safe so for use
908 // by the debugger frame information is copied to an object of this type. 871 // by the debugger frame information is copied to an object of this type.
909 // Represents parameters in unadapted form so their number might mismatch 872 // Represents parameters in unadapted form so their number might mismatch
910 // formal parameter count. 873 // formal parameter count.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 Object** expression_stack_; 936 Object** expression_stack_;
974 int source_position_; 937 int source_position_;
975 938
976 friend class Deoptimizer; 939 friend class Deoptimizer;
977 }; 940 };
978 #endif 941 #endif
979 942
980 } } // namespace v8::internal 943 } } // namespace v8::internal
981 944
982 #endif // V8_DEOPTIMIZER_H_ 945 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698