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

Unified Diff: src/transitions.h

Issue 10915260: Reduce space usage of simple transitions and descriptors holders. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 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/objects-visiting-inl.h ('k') | src/transitions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/transitions.h
diff --git a/src/transitions.h b/src/transitions.h
index b87b9730303aa32274885c2b6309cdc1679833e4..52a043ce096d837db9e49ef1a214d4591f78bf9c 100644
--- a/src/transitions.h
+++ b/src/transitions.h
@@ -91,7 +91,7 @@ class TransitionArray: public FixedArray {
// Returns the number of transitions in the array.
int number_of_transitions() {
- ASSERT(length() >= kFirstIndex);
+ if (IsSimpleTransition()) return 1;
int len = length();
return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize;
}
@@ -100,11 +100,17 @@ class TransitionArray: public FixedArray {
// Allocate a new transition array with a single entry.
static MUST_USE_RESULT MaybeObject* NewWith(
- String* name,
+ SimpleTransitionFlag flag,
+ String* key,
Map* target,
JSGlobalPropertyCell* descriptor_pointer,
Object* back_pointer);
+ static MUST_USE_RESULT MaybeObject* AllocateDescriptorsHolder(
+ JSGlobalPropertyCell* descriptor_pointer);
+
+ MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray();
+
// Copy the transition array, inserting a new transition.
// TODO(verwaest): This should not cause an existing transition to be
// overwritten.
@@ -123,6 +129,10 @@ class TransitionArray: public FixedArray {
int number_of_transitions,
JSGlobalPropertyCell* descriptors_cell);
+ bool IsDescriptorsHolder() { return length() == kDescriptorsHolderSize; }
+ bool IsSimpleTransition() { return length() == kSimpleTransitionSize; }
+ bool IsFullTransitionArray() { return length() >= kFirstIndex; }
+
// Casting.
static inline TransitionArray* cast(Object* obj);
@@ -131,20 +141,30 @@ class TransitionArray: public FixedArray {
static const int kDescriptorsPointerIndex = 0;
static const int kBackPointerStorageIndex = 1;
+ static const int kDescriptorsHolderSize = 2;
+
+ // Layout for full transition arrays.
static const int kElementsTransitionIndex = 2;
static const int kPrototypeTransitionsIndex = 3;
static const int kFirstIndex = 4;
- // Layout transition array header.
+ // Layout for simple transition arrays.
+ static const int kSimpleTransitionTarget = 2;
+ static const int kSimpleTransitionSize = 3;
+ static const int kSimpleTransitionIndex = 0;
+ STATIC_ASSERT(kSimpleTransitionIndex != kNotFound);
+
static const int kDescriptorsPointerOffset = FixedArray::kHeaderSize;
static const int kBackPointerStorageOffset = kDescriptorsPointerOffset +
kPointerSize;
+
+ // Layout for the full transition array header.
static const int kElementsTransitionOffset = kBackPointerStorageOffset +
kPointerSize;
static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
kPointerSize;
- // Layout of map transition.
+ // Layout of map transition entries in full transition arrays.
static const int kTransitionKey = 0;
static const int kTransitionTarget = 1;
static const int kTransitionSize = 2;
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698