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

Side by Side Diff: src/objects.h

Issue 12224035: Generalize map dependent codes array to allow multiple dependency groups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
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 4665 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 4676
4677 // Code aging -- platform-specific 4677 // Code aging -- platform-specific
4678 static void PatchPlatformCodeAge(byte* sequence, Age age, 4678 static void PatchPlatformCodeAge(byte* sequence, Age age,
4679 MarkingParity parity); 4679 MarkingParity parity);
4680 4680
4681 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 4681 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
4682 }; 4682 };
4683 4683
4684 4684
4685 // This class describes the layout of dependent codes array of a map. The 4685 // This class describes the layout of dependent codes array of a map. The
4686 // first element contains the number of codes as a Smi. The subsequent 4686 // array is partitioned into several groups of dependent codes. Each group
4687 // elements contain code objects. The suffix of the array can be filled with the 4687 // contains codes with the same dependency on the map. The array has the
4688 // undefined value if the number of codes is less than the length of the array. 4688 // following layout for n dependency groups:
4689 //
4690 // +----+----+-----+----+---------+----------+-----+---------+-----------+
4691 // | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined |
4692 // +----+----+-----+----+---------+----------+-----+---------+-----------+
4693 //
4694 // The first n elements are Smis, each of them specifies the number of codes
4695 // in the corresponding group. The subsequent elements contain grouped code
4696 // objects. The suffix of the array can be filled with the undefined value if
4697 // the number of codes is less than the length of the array.
Michael Starzinger 2013/02/14 10:40:52 Can we also add a sentence stating that the order
ulan_google 2013/02/14 11:59:06 Done.
4698 //
4699 // All code indexes used in the class are counted starting from the first
4700 // code object of the first group. In other words, code index 0 corresponds
4701 // to array index n = kCodesStartIndex.
4702
4689 class DependentCodes: public FixedArray { 4703 class DependentCodes: public FixedArray {
4690 public: 4704 public:
4691 inline int number_of_codes(); 4705 enum DependencyGroup {
4692 inline void set_number_of_codes(int value); 4706 // Group of codes that weakly embed this map and depend on being
4707 // deoptimized when the map is garbage collected.
4708 kWeaklyEmbeddedGroup,
4709 kGroupCount = kWeaklyEmbeddedGroup + 1
4710 };
4711 // Array for holding the index of the first code object of each group.
4712 // The last element stores the total number of code objects.
4713 typedef int GroupStartIndexes[kGroupCount + 1];
4714 inline int number_of_codes(DependencyGroup group);
4715 inline void set_number_of_codes(DependencyGroup group, int value);
4693 inline Code* code_at(int i); 4716 inline Code* code_at(int i);
4694 inline void set_code_at(int i, Code* value); 4717 inline void set_code_at(int i, Code* value);
4695 inline Object** code_slot_at(int i); 4718 inline Object** code_slot_at(int i);
4696 inline void clear_code_at(int i); 4719 inline void clear_code_at(int i);
Michael Starzinger 2013/02/14 10:40:52 As discussed offline: Can we (visually) separate t
ulan_google 2013/02/14 11:59:06 Done.
4697 static Handle<DependentCodes> Append(Handle<DependentCodes> codes, 4720 static inline DependentCodes* cast(Object* object);
4721 inline void ComputeGroupStartIndexes(GroupStartIndexes starts);
4722 bool Contains(DependencyGroup group, Code* code);
4723 static Handle<DependentCodes> Insert(Handle<DependentCodes> codes,
4724 DependencyGroup group,
4698 Handle<Code> value); 4725 Handle<Code> value);
4699 static inline DependentCodes* cast(Object* object); 4726
4700 bool Contains(Code* code);
4701 private: 4727 private:
4702 static const int kNumberOfCodesIndex = 0; 4728 // Make a room at the end of the given group by moving out the first
4703 static const int kCodesIndex = 1; 4729 // code objects of the subsequent groups.
4730 inline void ExtendGroup(DependencyGroup group);
4731 static const int kCodesStartIndex = kGroupCount;
4704 }; 4732 };
4705 4733
4706 4734
4707 // All heap objects have a Map that describes their structure. 4735 // All heap objects have a Map that describes their structure.
4708 // A Map contains information about: 4736 // A Map contains information about:
4709 // - Size information about the object 4737 // - Size information about the object
4710 // - How to iterate over an object (for garbage collection) 4738 // - How to iterate over an object (for garbage collection)
4711 class Map: public HeapObject { 4739 class Map: public HeapObject {
4712 public: 4740 public:
4713 // Instance size. 4741 // Instance size.
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 // heap verification is turned on. 5172 // heap verification is turned on.
5145 void ZapPrototypeTransitions(); 5173 void ZapPrototypeTransitions();
5146 void ZapTransitions(); 5174 void ZapTransitions();
5147 5175
5148 bool CanTransition() { 5176 bool CanTransition() {
5149 // Only JSObject and subtypes have map transitions and back pointers. 5177 // Only JSObject and subtypes have map transitions and back pointers.
5150 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); 5178 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE);
5151 return instance_type() >= FIRST_JS_OBJECT_TYPE; 5179 return instance_type() >= FIRST_JS_OBJECT_TYPE;
5152 } 5180 }
5153 5181
5154 inline void AddDependentCode(Handle<Code> code); 5182 inline void AddDependentCode(DependentCodes::DependencyGroup group,
5183 Handle<Code> code);
5155 5184
5156 // Dispatched behavior. 5185 // Dispatched behavior.
5157 DECLARE_PRINTER(Map) 5186 DECLARE_PRINTER(Map)
5158 DECLARE_VERIFIER(Map) 5187 DECLARE_VERIFIER(Map)
5159 5188
5160 #ifdef VERIFY_HEAP 5189 #ifdef VERIFY_HEAP
5161 void SharedMapVerify(); 5190 void SharedMapVerify();
5162 #endif 5191 #endif
5163 5192
5164 inline int visitor_id(); 5193 inline int visitor_id();
(...skipping 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after
8885 } else { 8914 } else {
8886 value &= ~(1 << bit_position); 8915 value &= ~(1 << bit_position);
8887 } 8916 }
8888 return value; 8917 return value;
8889 } 8918 }
8890 }; 8919 };
8891 8920
8892 } } // namespace v8::internal 8921 } } // namespace v8::internal
8893 8922
8894 #endif // V8_OBJECTS_H_ 8923 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | src/objects-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698