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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 #define DECL_BOOLEAN_ACCESSORS(name) \ | 856 #define DECL_BOOLEAN_ACCESSORS(name) \ |
857 inline bool name(); \ | 857 inline bool name(); \ |
858 inline void set_##name(bool value); \ | 858 inline void set_##name(bool value); \ |
859 | 859 |
860 | 860 |
861 #define DECL_ACCESSORS(name, type) \ | 861 #define DECL_ACCESSORS(name, type) \ |
862 inline type* name(); \ | 862 inline type* name(); \ |
863 inline void set_##name(type* value, \ | 863 inline void set_##name(type* value, \ |
864 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 864 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
865 | 865 |
866 | |
867 class AccessorPair; | 866 class AccessorPair; |
867 class AllocationSiteContext; | |
868 class DictionaryElementsAccessor; | 868 class DictionaryElementsAccessor; |
869 class ElementsAccessor; | 869 class ElementsAccessor; |
870 class Failure; | 870 class Failure; |
871 class FixedArrayBase; | 871 class FixedArrayBase; |
872 class ObjectVisitor; | 872 class ObjectVisitor; |
873 class StringStream; | 873 class StringStream; |
874 class Type; | 874 class Type; |
875 class AllocationSite; | |
Hannes Payer (out of office)
2013/10/15 13:53:20
alphabetic order
| |
875 | 876 |
876 struct ValueInfo : public Malloced { | 877 struct ValueInfo : public Malloced { |
877 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 878 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
878 InstanceType type; | 879 InstanceType type; |
879 Object* ptr; | 880 Object* ptr; |
880 const char* str; | 881 const char* str; |
881 double number; | 882 double number; |
882 }; | 883 }; |
883 | 884 |
884 | 885 |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2534 // Disalow further properties to be added to the object. | 2535 // Disalow further properties to be added to the object. |
2535 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2536 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
2536 | 2537 |
2537 // ES5 Object.freeze | 2538 // ES5 Object.freeze |
2538 static Handle<Object> Freeze(Handle<JSObject> object); | 2539 static Handle<Object> Freeze(Handle<JSObject> object); |
2539 | 2540 |
2540 // Called the first time an object is observed with ES7 Object.observe. | 2541 // Called the first time an object is observed with ES7 Object.observe. |
2541 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2542 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
2542 | 2543 |
2543 // Copy object. | 2544 // Copy object. |
2545 static Handle<JSObject> Copy(Handle<JSObject> object, | |
2546 Handle<AllocationSite> site); | |
2544 static Handle<JSObject> Copy(Handle<JSObject> object); | 2547 static Handle<JSObject> Copy(Handle<JSObject> object); |
2545 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2548 static Handle<JSObject> DeepCopy(Handle<JSObject> object, |
2549 AllocationSiteContext* site_context); | |
2550 static Handle<JSObject> DeepWalk(Handle<JSObject> object, | |
2551 AllocationSiteContext* site_context); | |
2546 | 2552 |
2547 // Casting. | 2553 // Casting. |
2548 static inline JSObject* cast(Object* obj); | 2554 static inline JSObject* cast(Object* obj); |
2549 | 2555 |
2550 // Dispatched behavior. | 2556 // Dispatched behavior. |
2551 void JSObjectShortPrint(StringStream* accumulator); | 2557 void JSObjectShortPrint(StringStream* accumulator); |
2552 DECLARE_PRINTER(JSObject) | 2558 DECLARE_PRINTER(JSObject) |
2553 DECLARE_VERIFIER(JSObject) | 2559 DECLARE_VERIFIER(JSObject) |
2554 #ifdef OBJECT_PRINT | 2560 #ifdef OBJECT_PRINT |
2555 void PrintProperties(FILE* out = stdout); | 2561 void PrintProperties(FILE* out = stdout); |
(...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7901 DECL_ACCESSORS(transition_info, Object) | 7907 DECL_ACCESSORS(transition_info, Object) |
7902 // nested_site threads a list of sites that represent nested literals | 7908 // nested_site threads a list of sites that represent nested literals |
7903 // walked in a particular order. So [[1, 2], 1, 2] will have one | 7909 // walked in a particular order. So [[1, 2], 1, 2] will have one |
7904 // nested_site, but [[1, 2], 3, [4]] will have a list of two. | 7910 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
7905 DECL_ACCESSORS(nested_site, Object) | 7911 DECL_ACCESSORS(nested_site, Object) |
7906 DECL_ACCESSORS(dependent_code, DependentCode) | 7912 DECL_ACCESSORS(dependent_code, DependentCode) |
7907 DECL_ACCESSORS(weak_next, Object) | 7913 DECL_ACCESSORS(weak_next, Object) |
7908 | 7914 |
7909 inline void Initialize(); | 7915 inline void Initialize(); |
7910 | 7916 |
7917 bool HasNestedSites() { | |
7918 return nested_site()->IsAllocationSite(); | |
7919 } | |
7920 | |
7921 // This method is expensive, it should only be called for reporting. | |
7922 bool IsNestedSite(); | |
7923 | |
7911 ElementsKind GetElementsKind() { | 7924 ElementsKind GetElementsKind() { |
7912 ASSERT(!IsLiteralSite()); | 7925 ASSERT(!SitePointsToLiteral()); |
7913 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7926 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
7914 } | 7927 } |
7915 | 7928 |
7916 void SetElementsKind(ElementsKind kind) { | 7929 void SetElementsKind(ElementsKind kind) { |
7917 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7930 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
7918 } | 7931 } |
7919 | 7932 |
7920 bool IsLiteralSite() { | 7933 bool SitePointsToLiteral() { |
7921 // If transition_info is a smi, then it represents an ElementsKind | 7934 // If transition_info is a smi, then it represents an ElementsKind |
7922 // for a constructed array. Otherwise, it must be a boilerplate | 7935 // for a constructed array. Otherwise, it must be a boilerplate |
7923 // for an array literal | 7936 // for an object or array literal. |
7924 return transition_info()->IsJSArray(); | 7937 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
7925 } | 7938 } |
7926 | 7939 |
7927 DECLARE_PRINTER(AllocationSite) | 7940 DECLARE_PRINTER(AllocationSite) |
7928 DECLARE_VERIFIER(AllocationSite) | 7941 DECLARE_VERIFIER(AllocationSite) |
7929 | 7942 |
7930 static inline AllocationSite* cast(Object* obj); | 7943 static inline AllocationSite* cast(Object* obj); |
7931 static inline AllocationSiteMode GetMode( | 7944 static inline AllocationSiteMode GetMode( |
7932 ElementsKind boilerplate_elements_kind); | 7945 ElementsKind boilerplate_elements_kind); |
7933 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7946 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
7934 static inline bool CanTrack(InstanceType type); | 7947 static inline bool CanTrack(InstanceType type); |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10310 } else { | 10323 } else { |
10311 value &= ~(1 << bit_position); | 10324 value &= ~(1 << bit_position); |
10312 } | 10325 } |
10313 return value; | 10326 return value; |
10314 } | 10327 } |
10315 }; | 10328 }; |
10316 | 10329 |
10317 } } // namespace v8::internal | 10330 } } // namespace v8::internal |
10318 | 10331 |
10319 #endif // V8_OBJECTS_H_ | 10332 #endif // V8_OBJECTS_H_ |
OLD | NEW |