| 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 | 875 |
| 876 struct ValueInfo : public Malloced { | 876 struct ValueInfo : public Malloced { |
| 877 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 877 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
| (...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2534 // Disalow further properties to be added to the object. | 2534 // Disalow further properties to be added to the object. |
| 2535 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2535 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
| 2536 | 2536 |
| 2537 // ES5 Object.freeze | 2537 // ES5 Object.freeze |
| 2538 static Handle<Object> Freeze(Handle<JSObject> object); | 2538 static Handle<Object> Freeze(Handle<JSObject> object); |
| 2539 | 2539 |
| 2540 // Called the first time an object is observed with ES7 Object.observe. | 2540 // Called the first time an object is observed with ES7 Object.observe. |
| 2541 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2541 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
| 2542 | 2542 |
| 2543 // Copy object. | 2543 // Copy object. |
| 2544 static Handle<JSObject> Copy(Handle<JSObject> object, |
| 2545 AllocationSiteContext* site_context); |
| 2544 static Handle<JSObject> Copy(Handle<JSObject> object); | 2546 static Handle<JSObject> Copy(Handle<JSObject> object); |
| 2545 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2547 static Handle<JSObject> DeepCopy(Handle<JSObject> object, |
| 2548 AllocationSiteContext* site_context); |
| 2549 static Handle<JSObject> DeepWalk(Handle<JSObject> object, |
| 2550 AllocationSiteContext* site_context); |
| 2546 | 2551 |
| 2547 // Casting. | 2552 // Casting. |
| 2548 static inline JSObject* cast(Object* obj); | 2553 static inline JSObject* cast(Object* obj); |
| 2549 | 2554 |
| 2550 // Dispatched behavior. | 2555 // Dispatched behavior. |
| 2551 void JSObjectShortPrint(StringStream* accumulator); | 2556 void JSObjectShortPrint(StringStream* accumulator); |
| 2552 DECLARE_PRINTER(JSObject) | 2557 DECLARE_PRINTER(JSObject) |
| 2553 DECLARE_VERIFIER(JSObject) | 2558 DECLARE_VERIFIER(JSObject) |
| 2554 #ifdef OBJECT_PRINT | 2559 #ifdef OBJECT_PRINT |
| 2555 void PrintProperties(FILE* out = stdout); | 2560 void PrintProperties(FILE* out = stdout); |
| (...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7901 DECL_ACCESSORS(transition_info, Object) | 7906 DECL_ACCESSORS(transition_info, Object) |
| 7902 // nested_site threads a list of sites that represent nested literals | 7907 // 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 | 7908 // 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. | 7909 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
| 7905 DECL_ACCESSORS(nested_site, Object) | 7910 DECL_ACCESSORS(nested_site, Object) |
| 7906 DECL_ACCESSORS(dependent_code, DependentCode) | 7911 DECL_ACCESSORS(dependent_code, DependentCode) |
| 7907 DECL_ACCESSORS(weak_next, Object) | 7912 DECL_ACCESSORS(weak_next, Object) |
| 7908 | 7913 |
| 7909 inline void Initialize(); | 7914 inline void Initialize(); |
| 7910 | 7915 |
| 7916 bool HasNestedSites() { |
| 7917 return nested_site()->IsAllocationSite(); |
| 7918 } |
| 7919 |
| 7920 // This method is expensive, it should only be called for reporting. |
| 7921 bool IsNestedSite(); |
| 7922 |
| 7911 ElementsKind GetElementsKind() { | 7923 ElementsKind GetElementsKind() { |
| 7912 ASSERT(!IsLiteralSite()); | 7924 ASSERT(!SitePointsToLiteral()); |
| 7913 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7925 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7914 } | 7926 } |
| 7915 | 7927 |
| 7916 void SetElementsKind(ElementsKind kind) { | 7928 void SetElementsKind(ElementsKind kind) { |
| 7917 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7929 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7918 } | 7930 } |
| 7919 | 7931 |
| 7920 bool IsLiteralSite() { | 7932 bool SitePointsToLiteral() { |
| 7921 // If transition_info is a smi, then it represents an ElementsKind | 7933 // If transition_info is a smi, then it represents an ElementsKind |
| 7922 // for a constructed array. Otherwise, it must be a boilerplate | 7934 // for a constructed array. Otherwise, it must be a boilerplate |
| 7923 // for an array literal | 7935 // for an object or array literal. |
| 7924 return transition_info()->IsJSArray(); | 7936 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
| 7925 } | 7937 } |
| 7926 | 7938 |
| 7927 DECLARE_PRINTER(AllocationSite) | 7939 DECLARE_PRINTER(AllocationSite) |
| 7928 DECLARE_VERIFIER(AllocationSite) | 7940 DECLARE_VERIFIER(AllocationSite) |
| 7929 | 7941 |
| 7930 static inline AllocationSite* cast(Object* obj); | 7942 static inline AllocationSite* cast(Object* obj); |
| 7931 static inline AllocationSiteMode GetMode( | 7943 static inline AllocationSiteMode GetMode( |
| 7932 ElementsKind boilerplate_elements_kind); | 7944 ElementsKind boilerplate_elements_kind); |
| 7933 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7945 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7934 static inline bool CanTrack(InstanceType type); | 7946 static inline bool CanTrack(InstanceType type); |
| (...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10310 } else { | 10322 } else { |
| 10311 value &= ~(1 << bit_position); | 10323 value &= ~(1 << bit_position); |
| 10312 } | 10324 } |
| 10313 return value; | 10325 return value; |
| 10314 } | 10326 } |
| 10315 }; | 10327 }; |
| 10316 | 10328 |
| 10317 } } // namespace v8::internal | 10329 } } // namespace v8::internal |
| 10318 | 10330 |
| 10319 #endif // V8_OBJECTS_H_ | 10331 #endif // V8_OBJECTS_H_ |
| OLD | NEW |