Index: src/objects.h |
=================================================================== |
--- src/objects.h (revision 7683) |
+++ src/objects.h (working copy) |
@@ -523,6 +523,7 @@ |
EXTERNAL_INT_ARRAY_TYPE, |
EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
EXTERNAL_FLOAT_ARRAY_TYPE, |
+ EXTERNAL_DOUBLE_ARRAY_TYPE, |
EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
FILLER_TYPE, // LAST_DATA_TYPE |
@@ -648,6 +649,13 @@ |
return reinterpret_cast<Object*>(this); |
} |
+ template<typename T> |
+ inline bool To(T** obj) { |
+ if (IsFailure()) return false; |
+ *obj = T::cast(reinterpret_cast<Object*>(this)); |
+ return true; |
+ } |
+ |
#ifdef OBJECT_PRINT |
// Prints this object with details. |
inline void Print() { |
@@ -691,6 +699,7 @@ |
V(ExternalIntArray) \ |
V(ExternalUnsignedIntArray) \ |
V(ExternalFloatArray) \ |
+ V(ExternalDoubleArray) \ |
V(ExternalPixelArray) \ |
V(ByteArray) \ |
V(JSObject) \ |
@@ -1336,6 +1345,7 @@ |
EXTERNAL_INT_ELEMENTS, |
EXTERNAL_UNSIGNED_INT_ELEMENTS, |
EXTERNAL_FLOAT_ELEMENTS, |
+ EXTERNAL_DOUBLE_ELEMENTS, |
EXTERNAL_PIXEL_ELEMENTS |
}; |
@@ -1377,6 +1387,7 @@ |
inline bool HasExternalIntElements(); |
inline bool HasExternalUnsignedIntElements(); |
inline bool HasExternalFloatElements(); |
+ inline bool HasExternalDoubleElements(); |
inline bool AllowsSetElementsLength(); |
inline NumberDictionary* element_dictionary(); // Gets slow elements. |
// Requires: this->HasFastElements(). |
@@ -3093,6 +3104,34 @@ |
}; |
+class ExternalDoubleArray: public ExternalArray { |
+ public: |
+ // Setter and getter. |
+ inline double get(int index); |
+ inline void set(int index, double value); |
+ |
+ // This accessor applies the correct conversion from Smi, HeapNumber |
+ // and undefined. |
+ MaybeObject* SetValue(uint32_t index, Object* value); |
+ |
+ // Casting. |
+ static inline ExternalDoubleArray* cast(Object* obj); |
+ |
+#ifdef OBJECT_PRINT |
+ inline void ExternalDoubleArrayPrint() { |
+ ExternalDoubleArrayPrint(stdout); |
+ } |
+ void ExternalDoubleArrayPrint(FILE* out); |
+#endif // OBJECT_PRINT |
+#ifdef DEBUG |
+ void ExternalDoubleArrayVerify(); |
+#endif // DEBUG |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray); |
+}; |
+ |
+ |
// DeoptimizationInputData is a fixed array used to hold the deoptimization |
// data for code generated by the Hydrogen/Lithium compiler. It also |
// contains information about functions that were inlined. If N different |
@@ -3712,6 +3751,16 @@ |
// [stub cache]: contains stubs compiled for this map. |
DECL_ACCESSORS(code_cache, Object) |
+ // [prototype transitions]: cache of prototype transitions. |
+ // Prototype transition is a transition that happens |
+ // when we change object's prototype to a new one. |
+ // Cache format: |
+ // 0: finger - index of the first free cell in the cache |
+ // 1 + 2 * i: prototype |
+ // 2 + 2 * i: target map |
+ DECL_ACCESSORS(prototype_transitions, FixedArray) |
+ inline FixedArray* unchecked_prototype_transitions(); |
+ |
// Lookup in the map's instance descriptors and fill out the result |
// with the given holder if the name is found. The holder may be |
// NULL when this function is used from the compiler. |
@@ -3811,6 +3860,12 @@ |
void TraverseTransitionTree(TraverseCallback callback, void* data); |
+ static const int kMaxCachedPrototypeTransitions = 256; |
+ |
+ Object* GetPrototypeTransition(Object* prototype); |
+ |
+ MaybeObject* PutPrototypeTransition(Object* prototype, Map* map); |
+ |
static const int kMaxPreAllocatedPropertyFields = 255; |
// Layout description. |
@@ -3821,14 +3876,16 @@ |
static const int kInstanceDescriptorsOffset = |
kConstructorOffset + kPointerSize; |
static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; |
- static const int kPadStart = kCodeCacheOffset + kPointerSize; |
+ static const int kPrototypeTransitionsOffset = |
+ kCodeCacheOffset + kPointerSize; |
+ static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize; |
static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
// Layout of pointer fields. Heap iteration code relies on them |
// being continiously allocated. |
static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
static const int kPointerFieldsEndOffset = |
- Map::kCodeCacheOffset + kPointerSize; |
+ Map::kPrototypeTransitionsOffset + kPointerSize; |
// Byte offsets within kInstanceSizesOffset. |
static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |