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