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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 #define DECL_BOOLEAN_ACCESSORS(name) \ | 858 #define DECL_BOOLEAN_ACCESSORS(name) \ |
859 inline bool name(); \ | 859 inline bool name(); \ |
860 inline void set_##name(bool value); \ | 860 inline void set_##name(bool value); \ |
861 | 861 |
862 | 862 |
863 #define DECL_ACCESSORS(name, type) \ | 863 #define DECL_ACCESSORS(name, type) \ |
864 inline type* name(); \ | 864 inline type* name(); \ |
865 inline void set_##name(type* value, \ | 865 inline void set_##name(type* value, \ |
866 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 866 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
867 | 867 |
| 868 |
868 class AccessorPair; | 869 class AccessorPair; |
869 class AllocationSite; | |
870 class AllocationSiteContext; | |
871 class DictionaryElementsAccessor; | 870 class DictionaryElementsAccessor; |
872 class ElementsAccessor; | 871 class ElementsAccessor; |
873 class Failure; | 872 class Failure; |
874 class FixedArrayBase; | 873 class FixedArrayBase; |
875 class ObjectVisitor; | 874 class ObjectVisitor; |
876 class StringStream; | 875 class StringStream; |
877 class Type; | 876 class Type; |
878 | 877 |
879 struct ValueInfo : public Malloced { | 878 struct ValueInfo : public Malloced { |
880 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 879 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 // Disalow further properties to be added to the object. | 2537 // Disalow further properties to be added to the object. |
2539 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2538 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
2540 | 2539 |
2541 // ES5 Object.freeze | 2540 // ES5 Object.freeze |
2542 static Handle<Object> Freeze(Handle<JSObject> object); | 2541 static Handle<Object> Freeze(Handle<JSObject> object); |
2543 | 2542 |
2544 // Called the first time an object is observed with ES7 Object.observe. | 2543 // Called the first time an object is observed with ES7 Object.observe. |
2545 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2544 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
2546 | 2545 |
2547 // Copy object. | 2546 // Copy object. |
2548 static Handle<JSObject> Copy(Handle<JSObject> object, | |
2549 Handle<AllocationSite> site); | |
2550 static Handle<JSObject> Copy(Handle<JSObject> object); | 2547 static Handle<JSObject> Copy(Handle<JSObject> object); |
2551 static Handle<JSObject> DeepCopy(Handle<JSObject> object, | 2548 static Handle<JSObject> DeepCopy(Handle<JSObject> object); |
2552 AllocationSiteContext* site_context); | |
2553 static Handle<JSObject> DeepWalk(Handle<JSObject> object, | |
2554 AllocationSiteContext* site_context); | |
2555 | 2549 |
2556 // Casting. | 2550 // Casting. |
2557 static inline JSObject* cast(Object* obj); | 2551 static inline JSObject* cast(Object* obj); |
2558 | 2552 |
2559 // Dispatched behavior. | 2553 // Dispatched behavior. |
2560 void JSObjectShortPrint(StringStream* accumulator); | 2554 void JSObjectShortPrint(StringStream* accumulator); |
2561 DECLARE_PRINTER(JSObject) | 2555 DECLARE_PRINTER(JSObject) |
2562 DECLARE_VERIFIER(JSObject) | 2556 DECLARE_VERIFIER(JSObject) |
2563 #ifdef OBJECT_PRINT | 2557 #ifdef OBJECT_PRINT |
2564 void PrintProperties(FILE* out = stdout); | 2558 void PrintProperties(FILE* out = stdout); |
(...skipping 5439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8004 DECL_ACCESSORS(transition_info, Object) | 7998 DECL_ACCESSORS(transition_info, Object) |
8005 // nested_site threads a list of sites that represent nested literals | 7999 // nested_site threads a list of sites that represent nested literals |
8006 // walked in a particular order. So [[1, 2], 1, 2] will have one | 8000 // walked in a particular order. So [[1, 2], 1, 2] will have one |
8007 // nested_site, but [[1, 2], 3, [4]] will have a list of two. | 8001 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
8008 DECL_ACCESSORS(nested_site, Object) | 8002 DECL_ACCESSORS(nested_site, Object) |
8009 DECL_ACCESSORS(dependent_code, DependentCode) | 8003 DECL_ACCESSORS(dependent_code, DependentCode) |
8010 DECL_ACCESSORS(weak_next, Object) | 8004 DECL_ACCESSORS(weak_next, Object) |
8011 | 8005 |
8012 inline void Initialize(); | 8006 inline void Initialize(); |
8013 | 8007 |
8014 bool HasNestedSites() { | |
8015 return nested_site()->IsAllocationSite(); | |
8016 } | |
8017 | |
8018 // This method is expensive, it should only be called for reporting. | |
8019 bool IsNestedSite(); | |
8020 | |
8021 ElementsKind GetElementsKind() { | 8008 ElementsKind GetElementsKind() { |
8022 ASSERT(!SitePointsToLiteral()); | 8009 ASSERT(!IsLiteralSite()); |
8023 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 8010 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
8024 } | 8011 } |
8025 | 8012 |
8026 void SetElementsKind(ElementsKind kind) { | 8013 void SetElementsKind(ElementsKind kind) { |
8027 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 8014 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
8028 } | 8015 } |
8029 | 8016 |
8030 bool SitePointsToLiteral() { | 8017 bool IsLiteralSite() { |
8031 // If transition_info is a smi, then it represents an ElementsKind | 8018 // If transition_info is a smi, then it represents an ElementsKind |
8032 // for a constructed array. Otherwise, it must be a boilerplate | 8019 // for a constructed array. Otherwise, it must be a boilerplate |
8033 // for an object or array literal. | 8020 // for an array literal |
8034 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8021 return transition_info()->IsJSArray(); |
8035 } | 8022 } |
8036 | 8023 |
8037 DECLARE_PRINTER(AllocationSite) | 8024 DECLARE_PRINTER(AllocationSite) |
8038 DECLARE_VERIFIER(AllocationSite) | 8025 DECLARE_VERIFIER(AllocationSite) |
8039 | 8026 |
8040 static inline AllocationSite* cast(Object* obj); | 8027 static inline AllocationSite* cast(Object* obj); |
8041 static inline AllocationSiteMode GetMode( | 8028 static inline AllocationSiteMode GetMode( |
8042 ElementsKind boilerplate_elements_kind); | 8029 ElementsKind boilerplate_elements_kind); |
8043 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8030 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
8044 static inline bool CanTrack(InstanceType type); | 8031 static inline bool CanTrack(InstanceType type); |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10420 } else { | 10407 } else { |
10421 value &= ~(1 << bit_position); | 10408 value &= ~(1 << bit_position); |
10422 } | 10409 } |
10423 return value; | 10410 return value; |
10424 } | 10411 } |
10425 }; | 10412 }; |
10426 | 10413 |
10427 } } // namespace v8::internal | 10414 } } // namespace v8::internal |
10428 | 10415 |
10429 #endif // V8_OBJECTS_H_ | 10416 #endif // V8_OBJECTS_H_ |
OLD | NEW |