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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2019 LookupResult* result, | 2019 LookupResult* result, |
2020 Handle<Name> key, | 2020 Handle<Name> key, |
2021 Handle<Object> value, | 2021 Handle<Object> value, |
2022 PropertyAttributes attributes, | 2022 PropertyAttributes attributes, |
2023 StrictModeFlag strict_mode, | 2023 StrictModeFlag strict_mode, |
2024 StoreFromKeyed store_from_keyed); | 2024 StoreFromKeyed store_from_keyed); |
2025 | 2025 |
2026 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2026 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
2027 }; | 2027 }; |
2028 | 2028 |
2029 class AllocationSiteContext; | |
Hannes Payer (out of office)
2013/10/11 12:55:44
Move this one up to the other forward class declar
mvstanton
2013/10/11 13:41:47
Done.
| |
2030 | |
2029 // The JSObject describes real heap allocated JavaScript objects with | 2031 // The JSObject describes real heap allocated JavaScript objects with |
2030 // properties. | 2032 // properties. |
2031 // Note that the map of JSObject changes during execution to enable inline | 2033 // Note that the map of JSObject changes during execution to enable inline |
2032 // caching. | 2034 // caching. |
2033 class JSObject: public JSReceiver { | 2035 class JSObject: public JSReceiver { |
2034 public: | 2036 public: |
2035 // [properties]: Backing storage for properties. | 2037 // [properties]: Backing storage for properties. |
2036 // properties is a FixedArray in the fast case and a Dictionary in the | 2038 // properties is a FixedArray in the fast case and a Dictionary in the |
2037 // slow case. | 2039 // slow case. |
2038 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 2040 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2527 // Disalow further properties to be added to the object. | 2529 // Disalow further properties to be added to the object. |
2528 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2530 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
2529 | 2531 |
2530 // ES5 Object.freeze | 2532 // ES5 Object.freeze |
2531 static Handle<Object> Freeze(Handle<JSObject> object); | 2533 static Handle<Object> Freeze(Handle<JSObject> object); |
2532 | 2534 |
2533 // Called the first time an object is observed with ES7 Object.observe. | 2535 // Called the first time an object is observed with ES7 Object.observe. |
2534 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2536 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
2535 | 2537 |
2536 // Copy object. | 2538 // Copy object. |
2539 static Handle<JSObject> Copy(Handle<JSObject> object, | |
2540 AllocationSiteContext* site_context); | |
2537 static Handle<JSObject> Copy(Handle<JSObject> object); | 2541 static Handle<JSObject> Copy(Handle<JSObject> object); |
2538 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2542 static Handle<JSObject> DeepCopy(Handle<JSObject> object, |
2543 AllocationSiteContext* site_context); | |
2544 static Handle<JSObject> DeepWalk(Handle<JSObject> object, | |
2545 AllocationSiteContext* site_context); | |
2539 | 2546 |
2540 // Casting. | 2547 // Casting. |
2541 static inline JSObject* cast(Object* obj); | 2548 static inline JSObject* cast(Object* obj); |
2542 | 2549 |
2543 // Dispatched behavior. | 2550 // Dispatched behavior. |
2544 void JSObjectShortPrint(StringStream* accumulator); | 2551 void JSObjectShortPrint(StringStream* accumulator); |
2545 DECLARE_PRINTER(JSObject) | 2552 DECLARE_PRINTER(JSObject) |
2546 DECLARE_VERIFIER(JSObject) | 2553 DECLARE_VERIFIER(JSObject) |
2547 #ifdef OBJECT_PRINT | 2554 #ifdef OBJECT_PRINT |
2548 void PrintProperties(FILE* out = stdout); | 2555 void PrintProperties(FILE* out = stdout); |
(...skipping 5327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7876 DECL_ACCESSORS(transition_info, Object) | 7883 DECL_ACCESSORS(transition_info, Object) |
7877 // nested_site threads a list of sites that represent nested literals | 7884 // nested_site threads a list of sites that represent nested literals |
7878 // walked in a particular order. So [[1, 2], 1, 2] will have one | 7885 // walked in a particular order. So [[1, 2], 1, 2] will have one |
7879 // nested_site, but [[1, 2], 3, [4]] will have a list of two. | 7886 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
7880 DECL_ACCESSORS(nested_site, Object) | 7887 DECL_ACCESSORS(nested_site, Object) |
7881 DECL_ACCESSORS(dependent_code, DependentCode) | 7888 DECL_ACCESSORS(dependent_code, DependentCode) |
7882 DECL_ACCESSORS(weak_next, Object) | 7889 DECL_ACCESSORS(weak_next, Object) |
7883 | 7890 |
7884 inline void Initialize(); | 7891 inline void Initialize(); |
7885 | 7892 |
7893 bool HasNestedSites() { | |
7894 return nested_site()->IsAllocationSite(); | |
7895 } | |
7896 | |
7886 ElementsKind GetElementsKind() { | 7897 ElementsKind GetElementsKind() { |
7887 ASSERT(!IsLiteralSite()); | 7898 ASSERT(!IsLiteralSite()); |
7888 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7899 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
7889 } | 7900 } |
7890 | 7901 |
7891 void SetElementsKind(ElementsKind kind) { | 7902 void SetElementsKind(ElementsKind kind) { |
7892 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7903 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
7893 } | 7904 } |
7894 | 7905 |
7895 bool IsLiteralSite() { | 7906 bool IsLiteralSite() { |
7896 // If transition_info is a smi, then it represents an ElementsKind | 7907 // If transition_info is a smi, then it represents an ElementsKind |
7897 // for a constructed array. Otherwise, it must be a boilerplate | 7908 // for a constructed array. Otherwise, it must be a boilerplate |
7898 // for an array literal | 7909 // for an array literal |
7899 return transition_info()->IsJSArray(); | 7910 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
Hannes Payer (out of office)
2013/10/11 12:55:44
The method name and the description is outdated.
mvstanton
2013/10/11 13:41:47
Updated comment and changed to SitePointsToLiteral
| |
7900 } | 7911 } |
7901 | 7912 |
7902 DECLARE_PRINTER(AllocationSite) | 7913 DECLARE_PRINTER(AllocationSite) |
7903 DECLARE_VERIFIER(AllocationSite) | 7914 DECLARE_VERIFIER(AllocationSite) |
7904 | 7915 |
7905 static inline AllocationSite* cast(Object* obj); | 7916 static inline AllocationSite* cast(Object* obj); |
7906 static inline AllocationSiteMode GetMode( | 7917 static inline AllocationSiteMode GetMode( |
7907 ElementsKind boilerplate_elements_kind); | 7918 ElementsKind boilerplate_elements_kind); |
7908 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7919 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
7909 static inline bool CanTrack(InstanceType type); | 7920 static inline bool CanTrack(InstanceType type); |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10285 } else { | 10296 } else { |
10286 value &= ~(1 << bit_position); | 10297 value &= ~(1 << bit_position); |
10287 } | 10298 } |
10288 return value; | 10299 return value; |
10289 } | 10300 } |
10290 }; | 10301 }; |
10291 | 10302 |
10292 } } // namespace v8::internal | 10303 } } // namespace v8::internal |
10293 | 10304 |
10294 #endif // V8_OBJECTS_H_ | 10305 #endif // V8_OBJECTS_H_ |
OLD | NEW |