| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 2c54dee4216fb564a2236605c919b1cf6a5d8a8c..e124171032798a7920b8f9a19395ab14b108c72f 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -52,6 +52,7 @@
|
| // - JSReceiver (suitable for property access)
|
| // - JSObject
|
| // - JSArray
|
| +// - JSWeakMap
|
| // - JSRegExp
|
| // - JSFunction
|
| // - GlobalObject
|
| @@ -73,17 +74,19 @@
|
| // - ExternalIntArray
|
| // - ExternalUnsignedIntArray
|
| // - ExternalFloatArray
|
| -// - FixedArray
|
| -// - DescriptorArray
|
| -// - HashTable
|
| -// - Dictionary
|
| -// - SymbolTable
|
| -// - CompilationCacheTable
|
| -// - CodeCacheHashTable
|
| -// - MapCache
|
| -// - Context
|
| -// - JSFunctionResultCache
|
| -// - SerializedScopeInfo
|
| +// - FixedArrayBase
|
| +// - FixedArray
|
| +// - DescriptorArray
|
| +// - HashTable
|
| +// - Dictionary
|
| +// - SymbolTable
|
| +// - CompilationCacheTable
|
| +// - CodeCacheHashTable
|
| +// - MapCache
|
| +// - Context
|
| +// - JSFunctionResultCache
|
| +// - SerializedScopeInfo
|
| +// - FixedDoubleArray
|
| // - String
|
| // - SeqString
|
| // - SeqAsciiString
|
| @@ -334,6 +337,7 @@ static const int kVariableSizeSentinel = 0;
|
| V(JS_GLOBAL_PROXY_TYPE) \
|
| V(JS_ARRAY_TYPE) \
|
| V(JS_PROXY_TYPE) \
|
| + V(JS_WEAK_MAP_TYPE) \
|
| V(JS_REGEXP_TYPE) \
|
| \
|
| V(JS_FUNCTION_TYPE) \
|
| @@ -572,6 +576,7 @@ enum InstanceType {
|
| JS_GLOBAL_PROXY_TYPE,
|
| JS_ARRAY_TYPE,
|
| JS_PROXY_TYPE,
|
| + JS_WEAK_MAP_TYPE,
|
|
|
| JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE
|
|
|
| @@ -634,8 +639,10 @@ enum CompareResult {
|
| WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
|
|
|
|
|
| +class ElementsAccessor;
|
| class StringStream;
|
| class ObjectVisitor;
|
| +class DictionaryElementsAccessor;
|
| class Failure;
|
|
|
| struct ValueInfo : public Malloced {
|
| @@ -753,6 +760,7 @@ class MaybeObject BASE_EMBEDDED {
|
| V(JSArray) \
|
| V(JSProxy) \
|
| V(JSFunctionProxy) \
|
| + V(JSWeakMap) \
|
| V(JSRegExp) \
|
| V(HashTable) \
|
| V(Dictionary) \
|
| @@ -1384,6 +1392,7 @@ class JSObject: public JSReceiver {
|
| inline void initialize_elements();
|
| MUST_USE_RESULT inline MaybeObject* ResetElements();
|
| inline ElementsKind GetElementsKind();
|
| + inline ElementsAccessor* GetElementsAccessor();
|
| inline bool HasFastElements();
|
| inline bool HasFastDoubleElements();
|
| inline bool HasDictionaryElements();
|
| @@ -1626,14 +1635,8 @@ class JSObject: public JSReceiver {
|
|
|
| // Returns the index'th element.
|
| // The undefined object if index is out of bounds.
|
| - MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
|
| MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
|
|
|
| - // Get external element value at index if there is one and undefined
|
| - // otherwise. Can return a failure if allocation of a heap number
|
| - // failed.
|
| - MaybeObject* GetExternalElement(uint32_t index);
|
| -
|
| // Replace the elements' backing store with fast elements of the given
|
| // capacity. Update the length for JSArrays. Returns the new backing
|
| // store.
|
| @@ -1897,6 +1900,8 @@ class JSObject: public JSReceiver {
|
| };
|
|
|
| private:
|
| + friend class DictionaryElementsAccessor;
|
| +
|
| MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
|
| Object* structure,
|
| uint32_t index,
|
| @@ -1917,14 +1922,10 @@ class JSObject: public JSReceiver {
|
| StrictModeFlag strict_mode,
|
| bool check_prototype);
|
|
|
| - MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
|
| -
|
| MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
|
| DeleteMode mode);
|
| MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
|
|
|
| - MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
|
| - DeleteMode mode);
|
| MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
|
|
|
| MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index);
|
| @@ -1988,6 +1989,7 @@ class FixedArray: public FixedArrayBase {
|
| inline Object* get(int index);
|
| // Setter that uses write barrier.
|
| inline void set(int index, Object* value);
|
| + inline bool is_the_hole(int index);
|
|
|
| // Setter that doesn't need write barrier).
|
| inline void set(int index, Smi* value);
|
| @@ -2093,7 +2095,8 @@ class FixedDoubleArray: public FixedArrayBase {
|
| inline void Initialize(NumberDictionary* from);
|
|
|
| // Setter and getter for elements.
|
| - inline double get(int index);
|
| + inline double get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, double value);
|
| inline void set_the_hole(int index);
|
|
|
| @@ -2701,7 +2704,7 @@ class Dictionary: public HashTable<Shape, Key> {
|
| PropertyAttributes filter,
|
| SortMode sort_mode);
|
| // Fill in details for properties into storage.
|
| - void CopyKeysTo(FixedArray* storage, SortMode sort_mode);
|
| + void CopyKeysTo(FixedArray* storage, int index, SortMode sort_mode);
|
|
|
| // Accessors for next enumeration index.
|
| void SetNextEnumerationIndex(int index) {
|
| @@ -2875,8 +2878,16 @@ class ObjectHashTable: public HashTable<ObjectHashTableShape, JSObject*> {
|
| MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value);
|
|
|
| private:
|
| + friend class MarkCompactCollector;
|
| +
|
| void AddEntry(int entry, JSObject* key, Object* value);
|
| - void RemoveEntry(int entry);
|
| + void RemoveEntry(int entry, Heap* heap);
|
| + inline void RemoveEntry(int entry);
|
| +
|
| + // Returns the index to the value of an entry.
|
| + static inline int EntryToValueIndex(int entry) {
|
| + return EntryToIndex(entry) + 1;
|
| + }
|
| };
|
|
|
|
|
| @@ -3064,6 +3075,8 @@ class ExternalArray: public HeapObject {
|
| inline int length();
|
| inline void set_length(int value);
|
|
|
| + inline bool is_the_hole(int index) { return false; }
|
| +
|
| // [external_pointer]: The pointer to the external memory area backing this
|
| // external array.
|
| DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
|
| @@ -3099,7 +3112,8 @@ class ExternalPixelArray: public ExternalArray {
|
| inline uint8_t* external_pixel_pointer();
|
|
|
| // Setter and getter.
|
| - inline uint8_t get(int index);
|
| + inline uint8_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, uint8_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber and
|
| @@ -3127,7 +3141,8 @@ class ExternalPixelArray: public ExternalArray {
|
| class ExternalByteArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline int8_t get(int index);
|
| + inline int8_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, int8_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3155,7 +3170,8 @@ class ExternalByteArray: public ExternalArray {
|
| class ExternalUnsignedByteArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline uint8_t get(int index);
|
| + inline uint8_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, uint8_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3183,7 +3199,8 @@ class ExternalUnsignedByteArray: public ExternalArray {
|
| class ExternalShortArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline int16_t get(int index);
|
| + inline int16_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, int16_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3211,7 +3228,8 @@ class ExternalShortArray: public ExternalArray {
|
| class ExternalUnsignedShortArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline uint16_t get(int index);
|
| + inline uint16_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, uint16_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3239,7 +3257,8 @@ class ExternalUnsignedShortArray: public ExternalArray {
|
| class ExternalIntArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline int32_t get(int index);
|
| + inline int32_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, int32_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3267,7 +3286,8 @@ class ExternalIntArray: public ExternalArray {
|
| class ExternalUnsignedIntArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline uint32_t get(int index);
|
| + inline uint32_t get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, uint32_t value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3295,7 +3315,8 @@ class ExternalUnsignedIntArray: public ExternalArray {
|
| class ExternalFloatArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline float get(int index);
|
| + inline float get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, float value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -3323,7 +3344,8 @@ class ExternalFloatArray: public ExternalArray {
|
| class ExternalDoubleArray: public ExternalArray {
|
| public:
|
| // Setter and getter.
|
| - inline double get(int index);
|
| + inline double get_scalar(int index);
|
| + inline MaybeObject* get(int index);
|
| inline void set(int index, double value);
|
|
|
| // This accessor applies the correct conversion from Smi, HeapNumber
|
| @@ -4572,12 +4594,10 @@ class SharedFunctionInfo: public HeapObject {
|
| inline void set_end_position(int end_position);
|
|
|
| // Is this function a function expression in the source code.
|
| - inline bool is_expression();
|
| - inline void set_is_expression(bool value);
|
| + DECL_BOOLEAN_ACCESSORS(is_expression)
|
|
|
| // Is this function a top-level function (scripts, evals).
|
| - inline bool is_toplevel();
|
| - inline void set_is_toplevel(bool value);
|
| + DECL_BOOLEAN_ACCESSORS(is_toplevel)
|
|
|
| // Bit field containing various information collected by the compiler to
|
| // drive optimization.
|
| @@ -4633,13 +4653,21 @@ class SharedFunctionInfo: public HeapObject {
|
| // These needs special threatment in .call and .apply since
|
| // null passed as the receiver should not be translated to the
|
| // global object.
|
| - inline bool native();
|
| - inline void set_native(bool value);
|
| + DECL_BOOLEAN_ACCESSORS(native)
|
| +
|
| + // Indicates that the function was created by the Function function.
|
| + // Though it's anonymous, toString should treat it as if it had the name
|
| + // "anonymous". We don't set the name itself so that the system does not
|
| + // see a binding for it.
|
| + DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
|
|
|
| // Indicates whether the function is a bound function created using
|
| // the bind function.
|
| - inline bool bound();
|
| - inline void set_bound(bool value);
|
| + DECL_BOOLEAN_ACCESSORS(bound)
|
| +
|
| + // Indicates that the function is anonymous (the name field can be set
|
| + // through the API, which does not change this flag).
|
| + DECL_BOOLEAN_ACCESSORS(is_anonymous)
|
|
|
| // Indicates whether or not the code in the shared function support
|
| // deoptimization.
|
| @@ -4821,7 +4849,6 @@ class SharedFunctionInfo: public HeapObject {
|
| // Bit positions in compiler_hints.
|
| static const int kCodeAgeSize = 3;
|
| static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
|
| - static const int kBoundFunction = 9;
|
|
|
| enum CompilerHints {
|
| kHasOnlySimpleThisPropertyAssignments,
|
| @@ -4832,7 +4859,11 @@ class SharedFunctionInfo: public HeapObject {
|
| kStrictModeFunction,
|
| kUsesArguments,
|
| kHasDuplicateParameters,
|
| - kNative
|
| + kNative,
|
| + kBoundFunction,
|
| + kIsAnonymous,
|
| + kNameShouldPrintAsAnonymous,
|
| + kCompilerHintsCount // Pseudo entry
|
| };
|
|
|
| private:
|
| @@ -4846,6 +4877,9 @@ class SharedFunctionInfo: public HeapObject {
|
| static const int kCompilerHintsSize = kIntSize;
|
| #endif
|
|
|
| + STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <=
|
| + SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte);
|
| +
|
| public:
|
| // Constants for optimizing codegen for strict mode function and
|
| // native tests.
|
| @@ -6544,6 +6578,40 @@ class JSFunctionProxy: public JSProxy {
|
| };
|
|
|
|
|
| +// The JSWeakMap describes EcmaScript Harmony weak maps
|
| +class JSWeakMap: public JSObject {
|
| + public:
|
| + // [table]: the backing hash table mapping keys to values.
|
| + DECL_ACCESSORS(table, ObjectHashTable)
|
| +
|
| + // [next]: linked list of encountered weak maps during GC.
|
| + DECL_ACCESSORS(next, Object)
|
| +
|
| + // Unchecked accessors to be used during GC.
|
| + inline ObjectHashTable* unchecked_table();
|
| +
|
| + // Casting.
|
| + static inline JSWeakMap* cast(Object* obj);
|
| +
|
| +#ifdef OBJECT_PRINT
|
| + inline void JSWeakMapPrint() {
|
| + JSWeakMapPrint(stdout);
|
| + }
|
| + void JSWeakMapPrint(FILE* out);
|
| +#endif
|
| +#ifdef DEBUG
|
| + void JSWeakMapVerify();
|
| +#endif
|
| +
|
| + static const int kTableOffset = JSObject::kHeaderSize;
|
| + static const int kNextOffset = kTableOffset + kPointerSize;
|
| + static const int kSize = kNextOffset + kPointerSize;
|
| +
|
| + private:
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
|
| +};
|
| +
|
| +
|
| // Foreign describes objects pointing from JavaScript to C structures.
|
| // Since they cannot contain references to JS HeapObjects they can be
|
| // placed in old_data_space.
|
|
|