Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/objects.h

Issue 24250005: AllocationSites for all literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 LookupResult* result, 2025 LookupResult* result,
2026 Handle<Name> key, 2026 Handle<Name> key,
2027 Handle<Object> value, 2027 Handle<Object> value,
2028 PropertyAttributes attributes, 2028 PropertyAttributes attributes,
2029 StrictModeFlag strict_mode, 2029 StrictModeFlag strict_mode,
2030 StoreFromKeyed store_from_keyed); 2030 StoreFromKeyed store_from_keyed);
2031 2031
2032 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); 2032 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
2033 }; 2033 };
2034 2034
2035 class AllocationSiteContext;
2036
2035 // The JSObject describes real heap allocated JavaScript objects with 2037 // The JSObject describes real heap allocated JavaScript objects with
2036 // properties. 2038 // properties.
2037 // Note that the map of JSObject changes during execution to enable inline 2039 // Note that the map of JSObject changes during execution to enable inline
2038 // caching. 2040 // caching.
2039 class JSObject: public JSReceiver { 2041 class JSObject: public JSReceiver {
2040 public: 2042 public:
2041 // [properties]: Backing storage for properties. 2043 // [properties]: Backing storage for properties.
2042 // properties is a FixedArray in the fast case and a Dictionary in the 2044 // properties is a FixedArray in the fast case and a Dictionary in the
2043 // slow case. 2045 // slow case.
2044 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. 2046 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties.
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 // Disalow further properties to be added to the object. 2536 // Disalow further properties to be added to the object.
2535 static Handle<Object> PreventExtensions(Handle<JSObject> object); 2537 static Handle<Object> PreventExtensions(Handle<JSObject> object);
2536 2538
2537 // ES5 Object.freeze 2539 // ES5 Object.freeze
2538 static Handle<Object> Freeze(Handle<JSObject> object); 2540 static Handle<Object> Freeze(Handle<JSObject> object);
2539 2541
2540 // Called the first time an object is observed with ES7 Object.observe. 2542 // Called the first time an object is observed with ES7 Object.observe.
2541 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); 2543 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate);
2542 2544
2543 // Copy object. 2545 // Copy object.
2546 static Handle<JSObject> Copy(Handle<JSObject> object,
2547 AllocationSiteContext* site_context);
2544 static Handle<JSObject> Copy(Handle<JSObject> object); 2548 static Handle<JSObject> Copy(Handle<JSObject> object);
2545 static Handle<JSObject> DeepCopy(Handle<JSObject> object); 2549 static Handle<JSObject> DeepCopy(Handle<JSObject> object,
2550 AllocationSiteContext* site_context);
2551 static Handle<JSObject> DeepWalk(Handle<JSObject> object,
2552 AllocationSiteContext* site_context);
2546 2553
2547 // Casting. 2554 // Casting.
2548 static inline JSObject* cast(Object* obj); 2555 static inline JSObject* cast(Object* obj);
2549 2556
2550 // Dispatched behavior. 2557 // Dispatched behavior.
2551 void JSObjectShortPrint(StringStream* accumulator); 2558 void JSObjectShortPrint(StringStream* accumulator);
2552 DECLARE_PRINTER(JSObject) 2559 DECLARE_PRINTER(JSObject)
2553 DECLARE_VERIFIER(JSObject) 2560 DECLARE_VERIFIER(JSObject)
2554 #ifdef OBJECT_PRINT 2561 #ifdef OBJECT_PRINT
2555 void PrintProperties(FILE* out = stdout); 2562 void PrintProperties(FILE* out = stdout);
(...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after
7901 DECL_ACCESSORS(transition_info, Object) 7908 DECL_ACCESSORS(transition_info, Object)
7902 // nested_site threads a list of sites that represent nested literals 7909 // 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 7910 // 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. 7911 // nested_site, but [[1, 2], 3, [4]] will have a list of two.
7905 DECL_ACCESSORS(nested_site, Object) 7912 DECL_ACCESSORS(nested_site, Object)
7906 DECL_ACCESSORS(dependent_code, DependentCode) 7913 DECL_ACCESSORS(dependent_code, DependentCode)
7907 DECL_ACCESSORS(weak_next, Object) 7914 DECL_ACCESSORS(weak_next, Object)
7908 7915
7909 inline void Initialize(); 7916 inline void Initialize();
7910 7917
7918 bool HasNestedSites() {
7919 return nested_site()->IsAllocationSite();
7920 }
7921
7922 // This method is expensive, it should only be called for reporting.
7923 bool IsNestedSite();
7924
7911 ElementsKind GetElementsKind() { 7925 ElementsKind GetElementsKind() {
7912 ASSERT(!IsLiteralSite()); 7926 ASSERT(!IsLiteralSite());
7913 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); 7927 return static_cast<ElementsKind>(Smi::cast(transition_info())->value());
7914 } 7928 }
7915 7929
7916 void SetElementsKind(ElementsKind kind) { 7930 void SetElementsKind(ElementsKind kind) {
7917 set_transition_info(Smi::FromInt(static_cast<int>(kind))); 7931 set_transition_info(Smi::FromInt(static_cast<int>(kind)));
7918 } 7932 }
7919 7933
7920 bool IsLiteralSite() { 7934 bool IsLiteralSite() {
7921 // If transition_info is a smi, then it represents an ElementsKind 7935 // If transition_info is a smi, then it represents an ElementsKind
7922 // for a constructed array. Otherwise, it must be a boilerplate 7936 // for a constructed array. Otherwise, it must be a boilerplate
7923 // for an array literal 7937 // for an array literal
7924 return transition_info()->IsJSArray(); 7938 return transition_info()->IsJSArray() || transition_info()->IsJSObject();
7925 } 7939 }
7926 7940
7927 DECLARE_PRINTER(AllocationSite) 7941 DECLARE_PRINTER(AllocationSite)
7928 DECLARE_VERIFIER(AllocationSite) 7942 DECLARE_VERIFIER(AllocationSite)
7929 7943
7930 static inline AllocationSite* cast(Object* obj); 7944 static inline AllocationSite* cast(Object* obj);
7931 static inline AllocationSiteMode GetMode( 7945 static inline AllocationSiteMode GetMode(
7932 ElementsKind boilerplate_elements_kind); 7946 ElementsKind boilerplate_elements_kind);
7933 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); 7947 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
7934 static inline bool CanTrack(InstanceType type); 7948 static inline bool CanTrack(InstanceType type);
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after
10310 } else { 10324 } else {
10311 value &= ~(1 << bit_position); 10325 value &= ~(1 << bit_position);
10312 } 10326 }
10313 return value; 10327 return value;
10314 } 10328 }
10315 }; 10329 };
10316 10330
10317 } } // namespace v8::internal 10331 } } // namespace v8::internal
10318 10332
10319 #endif // V8_OBJECTS_H_ 10333 #endif // V8_OBJECTS_H_
OLDNEW
« src/allocation-site-scopes.cc ('K') | « src/hydrogen.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698