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

Unified Diff: src/objects.h

Issue 15094018: Create AllocationSite objects, pointed to by AllocationSiteInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index eb6d882a07b8a76188875dceb6bcffd2c2f5643b..7aae7864d6528fdf5f124fb5e201dd0ab1d298dd 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -387,6 +387,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
V(SIGNATURE_INFO_TYPE) \
V(TYPE_SWITCH_INFO_TYPE) \
V(ALLOCATION_SITE_INFO_TYPE) \
+ V(ALLOCATION_SITE_TYPE) \
V(SCRIPT_TYPE) \
V(CODE_CACHE_TYPE) \
V(POLYMORPHIC_CODE_CACHE_TYPE) \
@@ -550,6 +551,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
V(SIGNATURE_INFO, SignatureInfo, signature_info) \
V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
V(SCRIPT, Script, script) \
+ V(ALLOCATION_SITE, AllocationSite, allocation_site) \
V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \
V(CODE_CACHE, CodeCache, code_cache) \
V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \
@@ -709,6 +711,7 @@ enum InstanceType {
OBJECT_TEMPLATE_INFO_TYPE,
SIGNATURE_INFO_TYPE,
TYPE_SWITCH_INFO_TYPE,
+ ALLOCATION_SITE_TYPE,
ALLOCATION_SITE_INFO_TYPE,
SCRIPT_TYPE,
CODE_CACHE_TYPE,
@@ -2210,8 +2213,7 @@ class JSObject: public JSReceiver {
ElementsKind to_kind);
MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
- MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo(
- ElementsKind to_kind);
+ MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
// Replaces an existing transition with a transition to a map with a FIELD.
MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition(
@@ -7461,26 +7463,68 @@ enum AllocationSiteMode {
};
-class AllocationSiteInfo: public Struct {
+class AllocationSite: public Struct {
public:
+ static const int kPayloadOffset = HeapObject::kHeaderSize;
+ static const int kSize = kPayloadOffset + kPointerSize;
+ static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
+
+ // TODO(mvstanton): rename payload to transition_info.
DECL_ACCESSORS(payload, Object)
- static inline AllocationSiteInfo* cast(Object* obj);
+ void Initialize() {
+ SetElementsKindPayload(GetInitialFastElementsKind());
+ }
- DECLARE_PRINTER(AllocationSiteInfo)
- DECLARE_VERIFIER(AllocationSiteInfo)
+ ElementsKind GetElementsKindPayload() {
+ ASSERT(!IsLiteralSite());
+ return static_cast<ElementsKind>(Smi::cast(payload())->value());
+ }
- // Returns NULL if no AllocationSiteInfo is available for object.
- static AllocationSiteInfo* FindForJSObject(JSObject* object);
+ void SetElementsKindPayload(ElementsKind kind) {
+ set_payload(Smi::FromInt(static_cast<int>(kind)));
+ }
+
+ bool IsLiteralSite() {
+ // If the payload is a smi, then it represents an ElementsKind
+ // for a constructed array. Otherwise, it must be a boilerplate
+ // for an array literal
+ return payload()->IsJSArray();
+ }
+
+ DECLARE_PRINTER(AllocationSite)
+ DECLARE_VERIFIER(AllocationSite)
+
+ static inline AllocationSite* cast(Object* obj);
static inline AllocationSiteMode GetMode(
ElementsKind boilerplate_elements_kind);
static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
- static const int kPayloadOffset = HeapObject::kHeaderSize;
- static const int kSize = kPayloadOffset + kPointerSize;
- static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
+};
+
+
+class AllocationSiteInfo: public Struct {
+ public:
+ static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
+ static const int kSize = kAllocationSiteOffset + kPointerSize;
+
+ DECL_ACCESSORS(allocation_site, Object)
+
+ bool IsValid() { return allocation_site()->IsAllocationSite(); }
+ AllocationSite* GetAllocationSite() {
+ ASSERT(IsValid());
+ return AllocationSite::cast(allocation_site());
+ }
+
+ DECLARE_PRINTER(AllocationSiteInfo)
+ DECLARE_VERIFIER(AllocationSiteInfo)
+
+ // Returns NULL if no AllocationSiteInfo is available for object.
+ static AllocationSiteInfo* FindForJSObject(JSObject* object);
+ static inline AllocationSiteInfo* cast(Object* obj);
- bool GetElementsKindPayload(ElementsKind* kind);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo);
};
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698