Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 0c8ee7147c04c3dbc033c9101f223a958e450f10..9a9dfd392bd2176322f49b52a361fd999a59e939 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -381,6 +381,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) \ |
@@ -543,6 +544,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) \ |
@@ -702,6 +704,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, |
@@ -2206,8 +2209,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( |
@@ -7455,6 +7457,45 @@ enum AllocationSiteMode { |
}; |
+class AllocationSite: public Struct { |
+ public: |
+ DECL_ACCESSORS(payload, Object) |
Hannes Payer (out of office)
2013/06/25 16:35:07
Can we rename payload to something more meaningful
mvstanton
2013/07/02 13:55:11
For this one I added a TODO because I'd have to to
|
+ |
+ static inline AllocationSite* cast(Object* obj); |
+ |
+ void Initialize() { |
+ set_payload(Smi::FromInt(GetInitialFastElementsKind())); |
Hannes Payer (out of office)
2013/06/25 16:35:07
You can call SetElementsKindPayload there.
mvstanton
2013/07/02 13:55:11
Done.
|
+ } |
Hannes Payer (out of office)
2013/06/25 16:35:07
declaration order: Typedefs and Enums, Constants (
mvstanton
2013/07/02 13:55:11
I think I've arranged it better now, have a look.
|
+ |
+ DECLARE_PRINTER(AllocationSite) |
+ DECLARE_VERIFIER(AllocationSite) |
+ |
+ 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; |
+ |
+ ElementsKind GetElementsKindPayload() { |
+ ASSERT(!IsLiteralSite()); |
+ return static_cast<ElementsKind>(Smi::cast(payload())->value()); |
+ } |
+ |
+ void SetElementsKindPayload(ElementsKind kind) { |
+ set_payload(Smi::FromInt(static_cast<int>(kind))); |
+ } |
+ |
+ bool IsLiteralSite() { |
+ return !payload()->IsSmi(); // payload is a boilerplate |
Hannes Payer (out of office)
2013/06/25 16:35:07
remove comment or make it clear.
mvstanton
2013/07/02 13:55:11
Clarified, and made the test stronger: return payl
|
+ } |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
+}; |
+ |
+ |
class AllocationSiteInfo: public Struct { |
Hannes Payer (out of office)
2013/06/25 16:35:07
declaration order... I just saw that it is not con
mvstanton
2013/07/02 13:55:11
Done.
|
public: |
DECL_ACCESSORS(payload, Object) |
@@ -7466,15 +7507,10 @@ class AllocationSiteInfo: public Struct { |
// Returns NULL if no AllocationSiteInfo is available for object. |
static AllocationSiteInfo* FindForJSObject(JSObject* object); |
- static inline AllocationSiteMode GetMode( |
- ElementsKind boilerplate_elements_kind); |
- static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
static const int kPayloadOffset = HeapObject::kHeaderSize; |
Hannes Payer (out of office)
2013/06/25 16:35:07
Do you think it makes sense to rename kPayloadOffs
mvstanton
2013/07/02 13:55:11
Done.
|
static const int kSize = kPayloadOffset + kPointerSize; |
- static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
- bool GetElementsKindPayload(ElementsKind* kind); |
private: |
DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); |
}; |