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

Unified Diff: src/objects.h

Issue 6685073: Remember and reuse derived map for external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 9 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/mirror-debugger.js ('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 e0ea06486f009db8c9f96c541fbf6b3bf85fdcd4..20391416afe37056f9d9fa29c18f06878ebf2275 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -135,19 +135,37 @@ class PropertyDetails BASE_EMBEDDED {
PropertyDetails(PropertyAttributes attributes,
PropertyType type,
int index = 0) {
+ ASSERT(type != EXTERNAL_ARRAY_TRANSITION);
ASSERT(TypeField::is_valid(type));
ASSERT(AttributesField::is_valid(attributes));
- ASSERT(IndexField::is_valid(index));
+ ASSERT(StorageField::is_valid(index));
value_ = TypeField::encode(type)
| AttributesField::encode(attributes)
- | IndexField::encode(index);
+ | StorageField::encode(index);
ASSERT(type == this->type());
ASSERT(attributes == this->attributes());
ASSERT(index == this->index());
}
+ PropertyDetails(PropertyAttributes attributes,
+ PropertyType type,
+ ExternalArrayType array_type) {
+ ASSERT(type == EXTERNAL_ARRAY_TRANSITION);
+ ASSERT(TypeField::is_valid(type));
+ ASSERT(AttributesField::is_valid(attributes));
+ ASSERT(StorageField::is_valid(static_cast<int>(array_type)));
+
+ value_ = TypeField::encode(type)
+ | AttributesField::encode(attributes)
+ | StorageField::encode(static_cast<int>(array_type));
+
+ ASSERT(type == this->type());
+ ASSERT(attributes == this->attributes());
+ ASSERT(array_type == this->array_type());
+ }
+
// Conversion for storing details as Object*.
inline PropertyDetails(Smi* smi);
inline Smi* AsSmi();
@@ -157,7 +175,8 @@ class PropertyDetails BASE_EMBEDDED {
bool IsTransition() {
PropertyType t = type();
ASSERT(t != INTERCEPTOR);
- return t == MAP_TRANSITION || t == CONSTANT_TRANSITION;
+ return t == MAP_TRANSITION || t == CONSTANT_TRANSITION ||
+ t == EXTERNAL_ARRAY_TRANSITION;
}
bool IsProperty() {
@@ -166,11 +185,18 @@ class PropertyDetails BASE_EMBEDDED {
PropertyAttributes attributes() { return AttributesField::decode(value_); }
- int index() { return IndexField::decode(value_); }
+ int index() { return StorageField::decode(value_); }
+
+ ExternalArrayType array_type() {
+ ASSERT(type() == EXTERNAL_ARRAY_TRANSITION);
+ return static_cast<ExternalArrayType>(StorageField::decode(value_));
+ }
inline PropertyDetails AsDeleted();
- static bool IsValidIndex(int index) { return IndexField::is_valid(index); }
+ static bool IsValidIndex(int index) {
+ return StorageField::is_valid(index);
+ }
bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; }
bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; }
@@ -179,10 +205,10 @@ class PropertyDetails BASE_EMBEDDED {
// Bit fields in value_ (type, shift, size). Must be public so the
// constants can be embedded in generated code.
- class TypeField: public BitField<PropertyType, 0, 3> {};
- class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
- class DeletedField: public BitField<uint32_t, 6, 1> {};
- class IndexField: public BitField<uint32_t, 7, 32-7> {};
+ class TypeField: public BitField<PropertyType, 0, 4> {};
+ class AttributesField: public BitField<PropertyAttributes, 4, 3> {};
+ class DeletedField: public BitField<uint32_t, 7, 1> {};
+ class StorageField: public BitField<uint32_t, 8, 32-8> {};
static const int kInitialIndex = 1;
private:
@@ -3502,18 +3528,18 @@ class Code: public HeapObject {
static const int kFlagsICStateShift = 0;
static const int kFlagsICInLoopShift = 3;
static const int kFlagsTypeShift = 4;
- static const int kFlagsKindShift = 7;
- static const int kFlagsICHolderShift = 11;
- static const int kFlagsExtraICStateShift = 12;
- static const int kFlagsArgumentsCountShift = 14;
+ static const int kFlagsKindShift = 8;
+ static const int kFlagsICHolderShift = 12;
+ static const int kFlagsExtraICStateShift = 13;
+ static const int kFlagsArgumentsCountShift = 15;
static const int kFlagsICStateMask = 0x00000007; // 00000000111
static const int kFlagsICInLoopMask = 0x00000008; // 00000001000
- static const int kFlagsTypeMask = 0x00000070; // 00001110000
- static const int kFlagsKindMask = 0x00000780; // 11110000000
- static const int kFlagsCacheInPrototypeMapMask = 0x00000800;
- static const int kFlagsExtraICStateMask = 0x00003000;
- static const int kFlagsArgumentsCountMask = 0xFFFFC000;
+ static const int kFlagsTypeMask = 0x000000F0; // 00001110000
+ static const int kFlagsKindMask = 0x00000F00; // 11110000000
+ static const int kFlagsCacheInPrototypeMapMask = 0x00001000;
+ static const int kFlagsExtraICStateMask = 0x00006000;
+ static const int kFlagsArgumentsCountMask = 0xFFFF8000;
static const int kFlagsNotUsedInLookup =
(kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask);
@@ -3715,7 +3741,9 @@ class Map: public HeapObject {
// Returns a new map with all transitions dropped from the descriptors and the
// external array elements bit set.
- MUST_USE_RESULT inline MaybeObject* NewExternalArrayElementsMap();
+ MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap(
+ ExternalArrayType array_type,
+ bool safe_to_add_transition);
// Returns the property index for name (only valid for FAST MODE).
int PropertyIndexFor(String* name);
« no previous file with comments | « src/mirror-debugger.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698