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

Side by Side Diff: src/objects.h

Issue 11188031: Move DescriptorArray into the map (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove padding area Created 8 years, 2 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/mips/macro-assembler-mips.cc ('k') | src/objects.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 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 #endif 2449 #endif
2450 DECLARE_VERIFIER(FixedDoubleArray) 2450 DECLARE_VERIFIER(FixedDoubleArray)
2451 2451
2452 private: 2452 private:
2453 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); 2453 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
2454 }; 2454 };
2455 2455
2456 2456
2457 // DescriptorArrays are fixed arrays used to hold instance descriptors. 2457 // DescriptorArrays are fixed arrays used to hold instance descriptors.
2458 // The format of the these objects is: 2458 // The format of the these objects is:
2459 // [0]: Either Smi(0) if uninitialized, or a pointer to small fixed array: 2459 // [0]: Number of descriptors
2460 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array:
2460 // [0]: pointer to fixed array with enum cache 2461 // [0]: pointer to fixed array with enum cache
2461 // [1]: either Smi(0) or pointer to fixed array with indices 2462 // [1]: either Smi(0) or pointer to fixed array with indices
2462 // [1]: first key 2463 // [2]: first key
2463 // [length() - kDescriptorSize]: last key 2464 // [2 + number of descriptors * kDescriptorSize]: start of slack
2464 class DescriptorArray: public FixedArray { 2465 class DescriptorArray: public FixedArray {
2465 public: 2466 public:
2466 // WhitenessWitness is used to prove that a descriptor array is white 2467 // WhitenessWitness is used to prove that a descriptor array is white
2467 // (unmarked), so incremental write barriers can be skipped because the 2468 // (unmarked), so incremental write barriers can be skipped because the
2468 // marking invariant cannot be broken and slots pointing into evacuation 2469 // marking invariant cannot be broken and slots pointing into evacuation
2469 // candidates will be discovered when the object is scanned. A witness is 2470 // candidates will be discovered when the object is scanned. A witness is
2470 // always stack-allocated right after creating an array. By allocating a 2471 // always stack-allocated right after creating an array. By allocating a
2471 // witness, incremental marking is globally disabled. The witness is then 2472 // witness, incremental marking is globally disabled. The witness is then
2472 // passed along wherever needed to statically prove that the array is known to 2473 // passed along wherever needed to statically prove that the array is known to
2473 // be white. 2474 // be white.
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after
4801 } 4802 }
4802 4803
4803 inline bool has_slow_elements_kind() { 4804 inline bool has_slow_elements_kind() {
4804 return elements_kind() == DICTIONARY_ELEMENTS 4805 return elements_kind() == DICTIONARY_ELEMENTS
4805 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; 4806 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
4806 } 4807 }
4807 4808
4808 static bool IsValidElementsTransition(ElementsKind from_kind, 4809 static bool IsValidElementsTransition(ElementsKind from_kind,
4809 ElementsKind to_kind); 4810 ElementsKind to_kind);
4810 4811
4811 bool StoresOwnDescriptors() { return HasTransitionArray(); }
4812 inline bool HasTransitionArray(); 4812 inline bool HasTransitionArray();
4813 inline bool HasElementsTransition(); 4813 inline bool HasElementsTransition();
4814 inline Map* elements_transition_map(); 4814 inline Map* elements_transition_map();
4815 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( 4815 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map(
4816 Map* transitioned_map); 4816 Map* transitioned_map);
4817 inline void SetTransition(int transition_index, Map* target); 4817 inline void SetTransition(int transition_index, Map* target);
4818 inline Map* GetTransition(int transition_index); 4818 inline Map* GetTransition(int transition_index);
4819 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key, 4819 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key,
4820 Map* target, 4820 Map* target,
4821 SimpleTransitionFlag flag); 4821 SimpleTransitionFlag flag);
(...skipping 27 matching lines...) Expand all
4849 4849
4850 // [prototype]: implicit prototype object. 4850 // [prototype]: implicit prototype object.
4851 DECL_ACCESSORS(prototype, Object) 4851 DECL_ACCESSORS(prototype, Object)
4852 4852
4853 // [constructor]: points back to the function responsible for this map. 4853 // [constructor]: points back to the function responsible for this map.
4854 DECL_ACCESSORS(constructor, Object) 4854 DECL_ACCESSORS(constructor, Object)
4855 4855
4856 inline JSFunction* unchecked_constructor(); 4856 inline JSFunction* unchecked_constructor();
4857 4857
4858 // [instance descriptors]: describes the object. 4858 // [instance descriptors]: describes the object.
4859 inline DescriptorArray* instance_descriptors(); 4859 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
4860 MUST_USE_RESULT inline MaybeObject* SetDescriptors( 4860 inline void InitializeDescriptors(DescriptorArray* descriptors);
4861 DescriptorArray* descriptors);
4862 static void SetDescriptors(Handle<Map> map,
4863 Handle<DescriptorArray> descriptors);
4864 MUST_USE_RESULT inline MaybeObject* InitializeDescriptors(
4865 DescriptorArray* descriptors);
4866 4861
4867 // [stub cache]: contains stubs compiled for this map. 4862 // [stub cache]: contains stubs compiled for this map.
4868 DECL_ACCESSORS(code_cache, Object) 4863 DECL_ACCESSORS(code_cache, Object)
4869 4864
4870 // [back pointer]: points back to the parent map from which a transition 4865 // [back pointer]: points back to the parent map from which a transition
4871 // leads to this map. The field overlaps with prototype transitions and the 4866 // leads to this map. The field overlaps with prototype transitions and the
4872 // back pointer will be moved into the prototype transitions array if 4867 // back pointer will be moved into the prototype transitions array if
4873 // required. 4868 // required.
4874 inline Object* GetBackPointer(); 4869 inline Object* GetBackPointer();
4875 inline void SetBackPointer(Object* value, 4870 inline void SetBackPointer(Object* value,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5117 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 5112 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
5118 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 5113 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
5119 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 5114 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
5120 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 5115 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
5121 // Storage for the transition array is overloaded to directly contain a back 5116 // Storage for the transition array is overloaded to directly contain a back
5122 // pointer if unused. When the map has transitions, the back pointer is 5117 // pointer if unused. When the map has transitions, the back pointer is
5123 // transferred to the transition array and accessed through an extra 5118 // transferred to the transition array and accessed through an extra
5124 // indirection. 5119 // indirection.
5125 static const int kTransitionsOrBackPointerOffset = 5120 static const int kTransitionsOrBackPointerOffset =
5126 kConstructorOffset + kPointerSize; 5121 kConstructorOffset + kPointerSize;
5122 static const int kDescriptorsOffset =
5123 kTransitionsOrBackPointerOffset + kPointerSize;
5127 static const int kCodeCacheOffset = 5124 static const int kCodeCacheOffset =
5128 kTransitionsOrBackPointerOffset + kPointerSize; 5125 kDescriptorsOffset + kPointerSize;
5129 static const int kBitField3Offset = kCodeCacheOffset + kPointerSize; 5126 static const int kBitField3Offset = kCodeCacheOffset + kPointerSize;
5130 static const int kPadStart = kBitField3Offset + kPointerSize; 5127 static const int kSize = kBitField3Offset + kPointerSize;
5131 static const int kSize = MAP_POINTER_ALIGN(kPadStart);
5132 5128
5133 // Layout of pointer fields. Heap iteration code relies on them 5129 // Layout of pointer fields. Heap iteration code relies on them
5134 // being continuously allocated. 5130 // being continuously allocated.
5135 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; 5131 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
5136 static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize; 5132 static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize;
5137 5133
5138 // Byte offsets within kInstanceSizesOffset. 5134 // Byte offsets within kInstanceSizesOffset.
5139 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; 5135 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
5140 static const int kInObjectPropertiesByte = 1; 5136 static const int kInObjectPropertiesByte = 1;
5141 static const int kInObjectPropertiesOffset = 5137 static const int kInObjectPropertiesOffset =
(...skipping 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after
8932 } else { 8928 } else {
8933 value &= ~(1 << bit_position); 8929 value &= ~(1 << bit_position);
8934 } 8930 }
8935 return value; 8931 return value;
8936 } 8932 }
8937 }; 8933 };
8938 8934
8939 } } // namespace v8::internal 8935 } } // namespace v8::internal
8940 8936
8941 #endif // V8_OBJECTS_H_ 8937 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698