| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 5757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5768 // any cleared weak cell. | 5768 // any cleared weak cell. |
| 5769 bool Compact(); | 5769 bool Compact(); |
| 5770 static int Grow(int number_of_entries) { | 5770 static int Grow(int number_of_entries) { |
| 5771 if (number_of_entries < 5) return number_of_entries + 1; | 5771 if (number_of_entries < 5) return number_of_entries + 1; |
| 5772 return number_of_entries * 5 / 4; | 5772 return number_of_entries * 5 / 4; |
| 5773 } | 5773 } |
| 5774 static const int kCodesStartIndex = kGroupCount; | 5774 static const int kCodesStartIndex = kGroupCount; |
| 5775 }; | 5775 }; |
| 5776 | 5776 |
| 5777 | 5777 |
| 5778 class PrototypeInfo; |
| 5779 |
| 5780 |
| 5778 // All heap objects have a Map that describes their structure. | 5781 // All heap objects have a Map that describes their structure. |
| 5779 // A Map contains information about: | 5782 // A Map contains information about: |
| 5780 // - Size information about the object | 5783 // - Size information about the object |
| 5781 // - How to iterate over an object (for garbage collection) | 5784 // - How to iterate over an object (for garbage collection) |
| 5782 class Map: public HeapObject { | 5785 class Map: public HeapObject { |
| 5783 public: | 5786 public: |
| 5784 // Instance size. | 5787 // Instance size. |
| 5785 // Size in bytes or kVariableSizeSentinel if instances do not have | 5788 // Size in bytes or kVariableSizeSentinel if instances do not have |
| 5786 // a fixed size. | 5789 // a fixed size. |
| 5787 inline int instance_size(); | 5790 inline int instance_size(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5975 | 5978 |
| 5976 inline FixedArrayBase* GetInitialElements(); | 5979 inline FixedArrayBase* GetInitialElements(); |
| 5977 | 5980 |
| 5978 // [raw_transitions]: Provides access to the transitions storage field. | 5981 // [raw_transitions]: Provides access to the transitions storage field. |
| 5979 // Don't call set_raw_transitions() directly to overwrite transitions, use | 5982 // Don't call set_raw_transitions() directly to overwrite transitions, use |
| 5980 // the TransitionArray::ReplaceTransitions() wrapper instead! | 5983 // the TransitionArray::ReplaceTransitions() wrapper instead! |
| 5981 DECL_ACCESSORS(raw_transitions, Object) | 5984 DECL_ACCESSORS(raw_transitions, Object) |
| 5982 // [prototype_info]: Per-prototype metadata. Aliased with transitions | 5985 // [prototype_info]: Per-prototype metadata. Aliased with transitions |
| 5983 // (which prototype maps don't have). | 5986 // (which prototype maps don't have). |
| 5984 DECL_ACCESSORS(prototype_info, Object) | 5987 DECL_ACCESSORS(prototype_info, Object) |
| 5988 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(Handle<Map> map, |
| 5989 Isolate* isolate); |
| 5990 // [prototype object]: points from a prototype map (which is never shared) |
| 5991 // to the object using it. Can be a Smi if the map is no longer used by a |
| 5992 // prototype object. Always use the GetPrototypeObject() getter, which zaps |
| 5993 // invalid references on the fly; the raw value is in the prototype_info. |
| 5994 static void SetPrototypeObject(Handle<Map> map, |
| 5995 Handle<JSObject> prototype_obj, |
| 5996 Isolate* isolate); |
| 5997 Object* GetPrototypeObject(); |
| 5985 | 5998 |
| 5986 Map* FindRootMap(); | 5999 Map* FindRootMap(); |
| 5987 Map* FindFieldOwner(int descriptor); | 6000 Map* FindFieldOwner(int descriptor); |
| 5988 | 6001 |
| 5989 inline int GetInObjectPropertyOffset(int index); | 6002 inline int GetInObjectPropertyOffset(int index); |
| 5990 | 6003 |
| 5991 int NumberOfFields(); | 6004 int NumberOfFields(); |
| 5992 | 6005 |
| 5993 // TODO(ishell): candidate with JSObject::MigrateToMap(). | 6006 // TODO(ishell): candidate with JSObject::MigrateToMap(). |
| 5994 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, | 6007 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6546 static const int kSize = kValueOffset + kPointerSize; | 6559 static const int kSize = kValueOffset + kPointerSize; |
| 6547 | 6560 |
| 6548 private: | 6561 private: |
| 6549 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); | 6562 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); |
| 6550 }; | 6563 }; |
| 6551 | 6564 |
| 6552 | 6565 |
| 6553 // Container for metadata stored on each prototype map. | 6566 // Container for metadata stored on each prototype map. |
| 6554 class PrototypeInfo : public Struct { | 6567 class PrototypeInfo : public Struct { |
| 6555 public: | 6568 public: |
| 6556 // [prototype_object]: The object using the map holding this PrototypeInfo. | 6569 // [prototype_object]: The object using the map holding this PrototypeInfo, |
| 6557 DECL_ACCESSORS(prototype_object, JSObject) | 6570 // or Smi(0) if uninitialized. |
| 6571 DECL_ACCESSORS(prototype_object, Object) |
| 6558 // [prototype_users]: WeakFixedArray containing maps using this prototype, | 6572 // [prototype_users]: WeakFixedArray containing maps using this prototype, |
| 6559 // or Smi(0) if uninitialized. | 6573 // or Smi(0) if uninitialized. |
| 6560 DECL_ACCESSORS(prototype_users, Object) | 6574 DECL_ACCESSORS(prototype_users, Object) |
| 6561 // [validity_cell]: Cell containing the validity bit for prototype chains | 6575 // [validity_cell]: Cell containing the validity bit for prototype chains |
| 6562 // going through this object, or Smi(0) if uninitialized. | 6576 // going through this object, or Smi(0) if uninitialized. |
| 6563 DECL_ACCESSORS(validity_cell, Object) | 6577 DECL_ACCESSORS(validity_cell, Object) |
| 6564 | 6578 |
| 6565 DECLARE_CAST(PrototypeInfo) | 6579 DECLARE_CAST(PrototypeInfo) |
| 6566 | 6580 |
| 6567 // Dispatched behavior. | 6581 // Dispatched behavior. |
| (...skipping 4471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11039 } else { | 11053 } else { |
| 11040 value &= ~(1 << bit_position); | 11054 value &= ~(1 << bit_position); |
| 11041 } | 11055 } |
| 11042 return value; | 11056 return value; |
| 11043 } | 11057 } |
| 11044 }; | 11058 }; |
| 11045 | 11059 |
| 11046 } } // namespace v8::internal | 11060 } } // namespace v8::internal |
| 11047 | 11061 |
| 11048 #endif // V8_OBJECTS_H_ | 11062 #endif // V8_OBJECTS_H_ |
| OLD | NEW |