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

Side by Side Diff: src/objects.h

Issue 7607031: Update gc branch to bleeding_edge revision 8862. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Fix bug in weak-map merge Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // 45 //
46 // Inheritance hierarchy: 46 // Inheritance hierarchy:
47 // - MaybeObject (an object or a failure) 47 // - MaybeObject (an object or a failure)
48 // - Failure (immediate for marking failed operation) 48 // - Failure (immediate for marking failed operation)
49 // - Object 49 // - Object
50 // - Smi (immediate small integer) 50 // - Smi (immediate small integer)
51 // - HeapObject (superclass for everything allocated in the heap) 51 // - HeapObject (superclass for everything allocated in the heap)
52 // - JSReceiver (suitable for property access) 52 // - JSReceiver (suitable for property access)
53 // - JSObject 53 // - JSObject
54 // - JSArray 54 // - JSArray
55 // - JSWeakMap
55 // - JSRegExp 56 // - JSRegExp
56 // - JSFunction 57 // - JSFunction
57 // - GlobalObject 58 // - GlobalObject
58 // - JSGlobalObject 59 // - JSGlobalObject
59 // - JSBuiltinsObject 60 // - JSBuiltinsObject
60 // - JSGlobalProxy 61 // - JSGlobalProxy
61 // - JSValue 62 // - JSValue
62 // - JSMessageObject 63 // - JSMessageObject
63 // - JSProxy 64 // - JSProxy
64 // - JSFunctionProxy 65 // - JSFunctionProxy
65 // - ByteArray 66 // - ByteArray
66 // - FreeSpace 67 // - FreeSpace
67 // - ExternalArray 68 // - ExternalArray
68 // - ExternalPixelArray 69 // - ExternalPixelArray
69 // - ExternalByteArray 70 // - ExternalByteArray
70 // - ExternalUnsignedByteArray 71 // - ExternalUnsignedByteArray
71 // - ExternalShortArray 72 // - ExternalShortArray
72 // - ExternalUnsignedShortArray 73 // - ExternalUnsignedShortArray
73 // - ExternalIntArray 74 // - ExternalIntArray
74 // - ExternalUnsignedIntArray 75 // - ExternalUnsignedIntArray
75 // - ExternalFloatArray 76 // - ExternalFloatArray
76 // - FixedArray 77 // - FixedArrayBase
77 // - DescriptorArray 78 // - FixedArray
78 // - HashTable 79 // - DescriptorArray
79 // - Dictionary 80 // - HashTable
80 // - SymbolTable 81 // - Dictionary
81 // - CompilationCacheTable 82 // - SymbolTable
82 // - CodeCacheHashTable 83 // - CompilationCacheTable
83 // - MapCache 84 // - CodeCacheHashTable
84 // - Context 85 // - MapCache
85 // - JSFunctionResultCache 86 // - Context
86 // - SerializedScopeInfo 87 // - JSFunctionResultCache
88 // - SerializedScopeInfo
89 // - FixedDoubleArray
87 // - String 90 // - String
88 // - SeqString 91 // - SeqString
89 // - SeqAsciiString 92 // - SeqAsciiString
90 // - SeqTwoByteString 93 // - SeqTwoByteString
91 // - ConsString 94 // - ConsString
92 // - ExternalString 95 // - ExternalString
93 // - ExternalAsciiString 96 // - ExternalAsciiString
94 // - ExternalTwoByteString 97 // - ExternalTwoByteString
95 // - HeapNumber 98 // - HeapNumber
96 // - Code 99 // - Code
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 V(JS_MESSAGE_OBJECT_TYPE) \ 330 V(JS_MESSAGE_OBJECT_TYPE) \
328 \ 331 \
329 V(JS_VALUE_TYPE) \ 332 V(JS_VALUE_TYPE) \
330 V(JS_OBJECT_TYPE) \ 333 V(JS_OBJECT_TYPE) \
331 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 334 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
332 V(JS_GLOBAL_OBJECT_TYPE) \ 335 V(JS_GLOBAL_OBJECT_TYPE) \
333 V(JS_BUILTINS_OBJECT_TYPE) \ 336 V(JS_BUILTINS_OBJECT_TYPE) \
334 V(JS_GLOBAL_PROXY_TYPE) \ 337 V(JS_GLOBAL_PROXY_TYPE) \
335 V(JS_ARRAY_TYPE) \ 338 V(JS_ARRAY_TYPE) \
336 V(JS_PROXY_TYPE) \ 339 V(JS_PROXY_TYPE) \
340 V(JS_WEAK_MAP_TYPE) \
337 V(JS_REGEXP_TYPE) \ 341 V(JS_REGEXP_TYPE) \
338 \ 342 \
339 V(JS_FUNCTION_TYPE) \ 343 V(JS_FUNCTION_TYPE) \
340 V(JS_FUNCTION_PROXY_TYPE) \ 344 V(JS_FUNCTION_PROXY_TYPE) \
341 345
342 #ifdef ENABLE_DEBUGGER_SUPPORT 346 #ifdef ENABLE_DEBUGGER_SUPPORT
343 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ 347 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \
344 V(DEBUG_INFO_TYPE) \ 348 V(DEBUG_INFO_TYPE) \
345 V(BREAK_POINT_INFO_TYPE) 349 V(BREAK_POINT_INFO_TYPE)
346 #else 350 #else
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 JS_MESSAGE_OBJECT_TYPE, 569 JS_MESSAGE_OBJECT_TYPE,
566 570
567 JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE 571 JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE
568 JS_OBJECT_TYPE, 572 JS_OBJECT_TYPE,
569 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 573 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
570 JS_GLOBAL_OBJECT_TYPE, 574 JS_GLOBAL_OBJECT_TYPE,
571 JS_BUILTINS_OBJECT_TYPE, 575 JS_BUILTINS_OBJECT_TYPE,
572 JS_GLOBAL_PROXY_TYPE, 576 JS_GLOBAL_PROXY_TYPE,
573 JS_ARRAY_TYPE, 577 JS_ARRAY_TYPE,
574 JS_PROXY_TYPE, 578 JS_PROXY_TYPE,
579 JS_WEAK_MAP_TYPE,
575 580
576 JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE 581 JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE
577 582
578 JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE 583 JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE
579 JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE 584 JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE
580 585
581 // Pseudo-types 586 // Pseudo-types
582 FIRST_TYPE = 0x0, 587 FIRST_TYPE = 0x0,
583 LAST_TYPE = JS_FUNCTION_PROXY_TYPE, 588 LAST_TYPE = JS_FUNCTION_PROXY_TYPE,
584 INVALID_TYPE = FIRST_TYPE - 1, 589 INVALID_TYPE = FIRST_TYPE - 1,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 inline bool name(); \ 632 inline bool name(); \
628 inline void set_##name(bool value); \ 633 inline void set_##name(bool value); \
629 634
630 635
631 #define DECL_ACCESSORS(name, type) \ 636 #define DECL_ACCESSORS(name, type) \
632 inline type* name(); \ 637 inline type* name(); \
633 inline void set_##name(type* value, \ 638 inline void set_##name(type* value, \
634 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 639 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
635 640
636 641
642 class ElementsAccessor;
637 class StringStream; 643 class StringStream;
638 class ObjectVisitor; 644 class ObjectVisitor;
645 class DictionaryElementsAccessor;
639 class Failure; 646 class Failure;
640 647
641 struct ValueInfo : public Malloced { 648 struct ValueInfo : public Malloced {
642 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 649 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
643 InstanceType type; 650 InstanceType type;
644 Object* ptr; 651 Object* ptr;
645 const char* str; 652 const char* str;
646 double number; 653 double number;
647 }; 654 };
648 655
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 V(Oddball) \ 753 V(Oddball) \
747 V(SharedFunctionInfo) \ 754 V(SharedFunctionInfo) \
748 V(JSValue) \ 755 V(JSValue) \
749 V(JSMessageObject) \ 756 V(JSMessageObject) \
750 V(StringWrapper) \ 757 V(StringWrapper) \
751 V(Foreign) \ 758 V(Foreign) \
752 V(Boolean) \ 759 V(Boolean) \
753 V(JSArray) \ 760 V(JSArray) \
754 V(JSProxy) \ 761 V(JSProxy) \
755 V(JSFunctionProxy) \ 762 V(JSFunctionProxy) \
763 V(JSWeakMap) \
756 V(JSRegExp) \ 764 V(JSRegExp) \
757 V(HashTable) \ 765 V(HashTable) \
758 V(Dictionary) \ 766 V(Dictionary) \
759 V(SymbolTable) \ 767 V(SymbolTable) \
760 V(JSFunctionResultCache) \ 768 V(JSFunctionResultCache) \
761 V(NormalizedMapCache) \ 769 V(NormalizedMapCache) \
762 V(CompilationCacheTable) \ 770 V(CompilationCacheTable) \
763 V(CodeCacheHashTable) \ 771 V(CodeCacheHashTable) \
764 V(PolymorphicCodeCacheHashTable) \ 772 V(PolymorphicCodeCacheHashTable) \
765 V(MapCache) \ 773 V(MapCache) \
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 // writing to any element the array must be copied. Use 1385 // writing to any element the array must be copied. Use
1378 // EnsureWritableFastElements in this case. 1386 // EnsureWritableFastElements in this case.
1379 // 1387 //
1380 // In the slow mode the elements is either a NumberDictionary, an 1388 // In the slow mode the elements is either a NumberDictionary, an
1381 // ExternalArray, or a FixedArray parameter map for a (non-strict) 1389 // ExternalArray, or a FixedArray parameter map for a (non-strict)
1382 // arguments object. 1390 // arguments object.
1383 DECL_ACCESSORS(elements, HeapObject) 1391 DECL_ACCESSORS(elements, HeapObject)
1384 inline void initialize_elements(); 1392 inline void initialize_elements();
1385 MUST_USE_RESULT inline MaybeObject* ResetElements(); 1393 MUST_USE_RESULT inline MaybeObject* ResetElements();
1386 inline ElementsKind GetElementsKind(); 1394 inline ElementsKind GetElementsKind();
1395 inline ElementsAccessor* GetElementsAccessor();
1387 inline bool HasFastElements(); 1396 inline bool HasFastElements();
1388 inline bool HasFastDoubleElements(); 1397 inline bool HasFastDoubleElements();
1389 inline bool HasDictionaryElements(); 1398 inline bool HasDictionaryElements();
1390 inline bool HasExternalPixelElements(); 1399 inline bool HasExternalPixelElements();
1391 inline bool HasExternalArrayElements(); 1400 inline bool HasExternalArrayElements();
1392 inline bool HasExternalByteElements(); 1401 inline bool HasExternalByteElements();
1393 inline bool HasExternalUnsignedByteElements(); 1402 inline bool HasExternalUnsignedByteElements();
1394 inline bool HasExternalShortElements(); 1403 inline bool HasExternalShortElements();
1395 inline bool HasExternalUnsignedShortElements(); 1404 inline bool HasExternalUnsignedShortElements();
1396 inline bool HasExternalIntElements(); 1405 inline bool HasExternalIntElements();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 1628
1620 // Set the index'th array element. 1629 // Set the index'th array element.
1621 // A Failure object is returned if GC is needed. 1630 // A Failure object is returned if GC is needed.
1622 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, 1631 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
1623 Object* value, 1632 Object* value,
1624 StrictModeFlag strict_mode, 1633 StrictModeFlag strict_mode,
1625 bool check_prototype); 1634 bool check_prototype);
1626 1635
1627 // Returns the index'th element. 1636 // Returns the index'th element.
1628 // The undefined object if index is out of bounds. 1637 // The undefined object if index is out of bounds.
1629 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
1630 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); 1638 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1631 1639
1632 // Get external element value at index if there is one and undefined
1633 // otherwise. Can return a failure if allocation of a heap number
1634 // failed.
1635 MaybeObject* GetExternalElement(uint32_t index);
1636
1637 // Replace the elements' backing store with fast elements of the given 1640 // Replace the elements' backing store with fast elements of the given
1638 // capacity. Update the length for JSArrays. Returns the new backing 1641 // capacity. Update the length for JSArrays. Returns the new backing
1639 // store. 1642 // store.
1640 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, 1643 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity,
1641 int length); 1644 int length);
1642 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 1645 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
1643 int capacity, 1646 int capacity,
1644 int length); 1647 int length);
1645 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); 1648 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length);
1646 1649
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 static const int kHeaderSize = kElementsOffset + kPointerSize; 1893 static const int kHeaderSize = kElementsOffset + kPointerSize;
1891 1894
1892 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); 1895 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
1893 1896
1894 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { 1897 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
1895 public: 1898 public:
1896 static inline int SizeOf(Map* map, HeapObject* object); 1899 static inline int SizeOf(Map* map, HeapObject* object);
1897 }; 1900 };
1898 1901
1899 private: 1902 private:
1903 friend class DictionaryElementsAccessor;
1904
1900 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 1905 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
1901 Object* structure, 1906 Object* structure,
1902 uint32_t index, 1907 uint32_t index,
1903 Object* holder); 1908 Object* holder);
1904 MaybeObject* SetElementWithCallback(Object* structure, 1909 MaybeObject* SetElementWithCallback(Object* structure,
1905 uint32_t index, 1910 uint32_t index,
1906 Object* value, 1911 Object* value,
1907 JSObject* holder, 1912 JSObject* holder,
1908 StrictModeFlag strict_mode); 1913 StrictModeFlag strict_mode);
1909 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 1914 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
1910 uint32_t index, 1915 uint32_t index,
1911 Object* value, 1916 Object* value,
1912 StrictModeFlag strict_mode, 1917 StrictModeFlag strict_mode,
1913 bool check_prototype); 1918 bool check_prototype);
1914 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 1919 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(
1915 uint32_t index, 1920 uint32_t index,
1916 Object* value, 1921 Object* value,
1917 StrictModeFlag strict_mode, 1922 StrictModeFlag strict_mode,
1918 bool check_prototype); 1923 bool check_prototype);
1919 1924
1920 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
1921
1922 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, 1925 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
1923 DeleteMode mode); 1926 DeleteMode mode);
1924 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); 1927 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
1925 1928
1926 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
1927 DeleteMode mode);
1928 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); 1929 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
1929 1930
1930 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); 1931 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index);
1931 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, 1932 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index,
1932 DeleteMode mode); 1933 DeleteMode mode);
1933 1934
1934 bool ReferencesObjectFromElements(FixedArray* elements, 1935 bool ReferencesObjectFromElements(FixedArray* elements,
1935 ElementsKind kind, 1936 ElementsKind kind,
1936 Object* object); 1937 Object* object);
1937 bool HasElementInElements(FixedArray* elements, 1938 bool HasElementInElements(FixedArray* elements,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 1982
1982 class FixedDoubleArray; 1983 class FixedDoubleArray;
1983 1984
1984 // FixedArray describes fixed-sized arrays with element type Object*. 1985 // FixedArray describes fixed-sized arrays with element type Object*.
1985 class FixedArray: public FixedArrayBase { 1986 class FixedArray: public FixedArrayBase {
1986 public: 1987 public:
1987 // Setter and getter for elements. 1988 // Setter and getter for elements.
1988 inline Object* get(int index); 1989 inline Object* get(int index);
1989 // Setter that uses write barrier. 1990 // Setter that uses write barrier.
1990 inline void set(int index, Object* value); 1991 inline void set(int index, Object* value);
1992 inline bool is_the_hole(int index);
1991 1993
1992 // Setter that doesn't need write barrier). 1994 // Setter that doesn't need write barrier).
1993 inline void set(int index, Smi* value); 1995 inline void set(int index, Smi* value);
1994 // Setter with explicit barrier mode. 1996 // Setter with explicit barrier mode.
1995 inline void set(int index, Object* value, WriteBarrierMode mode); 1997 inline void set(int index, Object* value, WriteBarrierMode mode);
1996 1998
1997 // Setters for frequently used oddballs located in old space. 1999 // Setters for frequently used oddballs located in old space.
1998 inline void set_undefined(int index); 2000 inline void set_undefined(int index);
1999 // TODO(isolates): duplicate. 2001 // TODO(isolates): duplicate.
2000 inline void set_undefined(Heap* heap, int index); 2002 inline void set_undefined(Heap* heap, int index);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 2088
2087 2089
2088 // FixedDoubleArray describes fixed-sized arrays with element type double. 2090 // FixedDoubleArray describes fixed-sized arrays with element type double.
2089 class FixedDoubleArray: public FixedArrayBase { 2091 class FixedDoubleArray: public FixedArrayBase {
2090 public: 2092 public:
2091 inline void Initialize(FixedArray* from); 2093 inline void Initialize(FixedArray* from);
2092 inline void Initialize(FixedDoubleArray* from); 2094 inline void Initialize(FixedDoubleArray* from);
2093 inline void Initialize(NumberDictionary* from); 2095 inline void Initialize(NumberDictionary* from);
2094 2096
2095 // Setter and getter for elements. 2097 // Setter and getter for elements.
2096 inline double get(int index); 2098 inline double get_scalar(int index);
2099 inline MaybeObject* get(int index);
2097 inline void set(int index, double value); 2100 inline void set(int index, double value);
2098 inline void set_the_hole(int index); 2101 inline void set_the_hole(int index);
2099 2102
2100 // Checking for the hole. 2103 // Checking for the hole.
2101 inline bool is_the_hole(int index); 2104 inline bool is_the_hole(int index);
2102 2105
2103 // Garbage collection support. 2106 // Garbage collection support.
2104 inline static int SizeFor(int length) { 2107 inline static int SizeFor(int length) {
2105 return kHeaderSize + length * kDoubleSize; 2108 return kHeaderSize + length * kDoubleSize;
2106 } 2109 }
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 2697
2695 // Returns the number of enumerable elements in the dictionary. 2698 // Returns the number of enumerable elements in the dictionary.
2696 int NumberOfEnumElements(); 2699 int NumberOfEnumElements();
2697 2700
2698 enum SortMode { UNSORTED, SORTED }; 2701 enum SortMode { UNSORTED, SORTED };
2699 // Copies keys to preallocated fixed array. 2702 // Copies keys to preallocated fixed array.
2700 void CopyKeysTo(FixedArray* storage, 2703 void CopyKeysTo(FixedArray* storage,
2701 PropertyAttributes filter, 2704 PropertyAttributes filter,
2702 SortMode sort_mode); 2705 SortMode sort_mode);
2703 // Fill in details for properties into storage. 2706 // Fill in details for properties into storage.
2704 void CopyKeysTo(FixedArray* storage, SortMode sort_mode); 2707 void CopyKeysTo(FixedArray* storage, int index, SortMode sort_mode);
2705 2708
2706 // Accessors for next enumeration index. 2709 // Accessors for next enumeration index.
2707 void SetNextEnumerationIndex(int index) { 2710 void SetNextEnumerationIndex(int index) {
2708 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); 2711 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index));
2709 } 2712 }
2710 2713
2711 int NextEnumerationIndex() { 2714 int NextEnumerationIndex() {
2712 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); 2715 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value();
2713 } 2716 }
2714 2717
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 2871
2869 // Looks up the value associated with the given key. The undefined value is 2872 // Looks up the value associated with the given key. The undefined value is
2870 // returned in case the key is not present. 2873 // returned in case the key is not present.
2871 Object* Lookup(JSObject* key); 2874 Object* Lookup(JSObject* key);
2872 2875
2873 // Adds (or overwrites) the value associated with the given key. Mapping a 2876 // Adds (or overwrites) the value associated with the given key. Mapping a
2874 // key to the undefined value causes removal of the whole entry. 2877 // key to the undefined value causes removal of the whole entry.
2875 MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value); 2878 MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value);
2876 2879
2877 private: 2880 private:
2881 friend class MarkCompactCollector;
2882
2878 void AddEntry(int entry, JSObject* key, Object* value); 2883 void AddEntry(int entry, JSObject* key, Object* value);
2879 void RemoveEntry(int entry); 2884 void RemoveEntry(int entry, Heap* heap);
2885 inline void RemoveEntry(int entry);
2886
2887 // Returns the index to the value of an entry.
2888 static inline int EntryToValueIndex(int entry) {
2889 return EntryToIndex(entry) + 1;
2890 }
2880 }; 2891 };
2881 2892
2882 2893
2883 // JSFunctionResultCache caches results of some JSFunction invocation. 2894 // JSFunctionResultCache caches results of some JSFunction invocation.
2884 // It is a fixed array with fixed structure: 2895 // It is a fixed array with fixed structure:
2885 // [0]: factory function 2896 // [0]: factory function
2886 // [1]: finger index 2897 // [1]: finger index
2887 // [2]: current cache size 2898 // [2]: current cache size
2888 // [3]: dummy field. 2899 // [3]: dummy field.
2889 // The rest of array are key/value pairs. 2900 // The rest of array are key/value pairs.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 // The semantics of these arrays differ from CanvasPixelArray. 3068 // The semantics of these arrays differ from CanvasPixelArray.
3058 // Out-of-range values passed to the setter are converted via a C 3069 // Out-of-range values passed to the setter are converted via a C
3059 // cast, not clamping. Out-of-range indices cause exceptions to be 3070 // cast, not clamping. Out-of-range indices cause exceptions to be
3060 // raised rather than being silently ignored. 3071 // raised rather than being silently ignored.
3061 class ExternalArray: public HeapObject { 3072 class ExternalArray: public HeapObject {
3062 public: 3073 public:
3063 // [length]: length of the array. 3074 // [length]: length of the array.
3064 inline int length(); 3075 inline int length();
3065 inline void set_length(int value); 3076 inline void set_length(int value);
3066 3077
3078 inline bool is_the_hole(int index) { return false; }
3079
3067 // [external_pointer]: The pointer to the external memory area backing this 3080 // [external_pointer]: The pointer to the external memory area backing this
3068 // external array. 3081 // external array.
3069 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store. 3082 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
3070 3083
3071 // Casting. 3084 // Casting.
3072 static inline ExternalArray* cast(Object* obj); 3085 static inline ExternalArray* cast(Object* obj);
3073 3086
3074 // Maximal acceptable length for an external array. 3087 // Maximal acceptable length for an external array.
3075 static const int kMaxLength = 0x3fffffff; 3088 static const int kMaxLength = 0x3fffffff;
3076 3089
(...skipping 15 matching lines...) Expand all
3092 3105
3093 // http://www.whatwg.org/specs/web-apps/current-work/ 3106 // http://www.whatwg.org/specs/web-apps/current-work/
3094 // multipage/the-canvas-element.html#canvaspixelarray 3107 // multipage/the-canvas-element.html#canvaspixelarray
3095 // In particular, write access clamps the value written to 0 or 255 if the 3108 // In particular, write access clamps the value written to 0 or 255 if the
3096 // value written is outside this range. 3109 // value written is outside this range.
3097 class ExternalPixelArray: public ExternalArray { 3110 class ExternalPixelArray: public ExternalArray {
3098 public: 3111 public:
3099 inline uint8_t* external_pixel_pointer(); 3112 inline uint8_t* external_pixel_pointer();
3100 3113
3101 // Setter and getter. 3114 // Setter and getter.
3102 inline uint8_t get(int index); 3115 inline uint8_t get_scalar(int index);
3116 inline MaybeObject* get(int index);
3103 inline void set(int index, uint8_t value); 3117 inline void set(int index, uint8_t value);
3104 3118
3105 // This accessor applies the correct conversion from Smi, HeapNumber and 3119 // This accessor applies the correct conversion from Smi, HeapNumber and
3106 // undefined and clamps the converted value between 0 and 255. 3120 // undefined and clamps the converted value between 0 and 255.
3107 Object* SetValue(uint32_t index, Object* value); 3121 Object* SetValue(uint32_t index, Object* value);
3108 3122
3109 // Casting. 3123 // Casting.
3110 static inline ExternalPixelArray* cast(Object* obj); 3124 static inline ExternalPixelArray* cast(Object* obj);
3111 3125
3112 #ifdef OBJECT_PRINT 3126 #ifdef OBJECT_PRINT
3113 inline void ExternalPixelArrayPrint() { 3127 inline void ExternalPixelArrayPrint() {
3114 ExternalPixelArrayPrint(stdout); 3128 ExternalPixelArrayPrint(stdout);
3115 } 3129 }
3116 void ExternalPixelArrayPrint(FILE* out); 3130 void ExternalPixelArrayPrint(FILE* out);
3117 #endif 3131 #endif
3118 #ifdef DEBUG 3132 #ifdef DEBUG
3119 void ExternalPixelArrayVerify(); 3133 void ExternalPixelArrayVerify();
3120 #endif // DEBUG 3134 #endif // DEBUG
3121 3135
3122 private: 3136 private:
3123 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); 3137 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
3124 }; 3138 };
3125 3139
3126 3140
3127 class ExternalByteArray: public ExternalArray { 3141 class ExternalByteArray: public ExternalArray {
3128 public: 3142 public:
3129 // Setter and getter. 3143 // Setter and getter.
3130 inline int8_t get(int index); 3144 inline int8_t get_scalar(int index);
3145 inline MaybeObject* get(int index);
3131 inline void set(int index, int8_t value); 3146 inline void set(int index, int8_t value);
3132 3147
3133 // This accessor applies the correct conversion from Smi, HeapNumber 3148 // This accessor applies the correct conversion from Smi, HeapNumber
3134 // and undefined. 3149 // and undefined.
3135 MaybeObject* SetValue(uint32_t index, Object* value); 3150 MaybeObject* SetValue(uint32_t index, Object* value);
3136 3151
3137 // Casting. 3152 // Casting.
3138 static inline ExternalByteArray* cast(Object* obj); 3153 static inline ExternalByteArray* cast(Object* obj);
3139 3154
3140 #ifdef OBJECT_PRINT 3155 #ifdef OBJECT_PRINT
3141 inline void ExternalByteArrayPrint() { 3156 inline void ExternalByteArrayPrint() {
3142 ExternalByteArrayPrint(stdout); 3157 ExternalByteArrayPrint(stdout);
3143 } 3158 }
3144 void ExternalByteArrayPrint(FILE* out); 3159 void ExternalByteArrayPrint(FILE* out);
3145 #endif 3160 #endif
3146 #ifdef DEBUG 3161 #ifdef DEBUG
3147 void ExternalByteArrayVerify(); 3162 void ExternalByteArrayVerify();
3148 #endif // DEBUG 3163 #endif // DEBUG
3149 3164
3150 private: 3165 private:
3151 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 3166 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
3152 }; 3167 };
3153 3168
3154 3169
3155 class ExternalUnsignedByteArray: public ExternalArray { 3170 class ExternalUnsignedByteArray: public ExternalArray {
3156 public: 3171 public:
3157 // Setter and getter. 3172 // Setter and getter.
3158 inline uint8_t get(int index); 3173 inline uint8_t get_scalar(int index);
3174 inline MaybeObject* get(int index);
3159 inline void set(int index, uint8_t value); 3175 inline void set(int index, uint8_t value);
3160 3176
3161 // This accessor applies the correct conversion from Smi, HeapNumber 3177 // This accessor applies the correct conversion from Smi, HeapNumber
3162 // and undefined. 3178 // and undefined.
3163 MaybeObject* SetValue(uint32_t index, Object* value); 3179 MaybeObject* SetValue(uint32_t index, Object* value);
3164 3180
3165 // Casting. 3181 // Casting.
3166 static inline ExternalUnsignedByteArray* cast(Object* obj); 3182 static inline ExternalUnsignedByteArray* cast(Object* obj);
3167 3183
3168 #ifdef OBJECT_PRINT 3184 #ifdef OBJECT_PRINT
3169 inline void ExternalUnsignedByteArrayPrint() { 3185 inline void ExternalUnsignedByteArrayPrint() {
3170 ExternalUnsignedByteArrayPrint(stdout); 3186 ExternalUnsignedByteArrayPrint(stdout);
3171 } 3187 }
3172 void ExternalUnsignedByteArrayPrint(FILE* out); 3188 void ExternalUnsignedByteArrayPrint(FILE* out);
3173 #endif 3189 #endif
3174 #ifdef DEBUG 3190 #ifdef DEBUG
3175 void ExternalUnsignedByteArrayVerify(); 3191 void ExternalUnsignedByteArrayVerify();
3176 #endif // DEBUG 3192 #endif // DEBUG
3177 3193
3178 private: 3194 private:
3179 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 3195 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
3180 }; 3196 };
3181 3197
3182 3198
3183 class ExternalShortArray: public ExternalArray { 3199 class ExternalShortArray: public ExternalArray {
3184 public: 3200 public:
3185 // Setter and getter. 3201 // Setter and getter.
3186 inline int16_t get(int index); 3202 inline int16_t get_scalar(int index);
3203 inline MaybeObject* get(int index);
3187 inline void set(int index, int16_t value); 3204 inline void set(int index, int16_t value);
3188 3205
3189 // This accessor applies the correct conversion from Smi, HeapNumber 3206 // This accessor applies the correct conversion from Smi, HeapNumber
3190 // and undefined. 3207 // and undefined.
3191 MaybeObject* SetValue(uint32_t index, Object* value); 3208 MaybeObject* SetValue(uint32_t index, Object* value);
3192 3209
3193 // Casting. 3210 // Casting.
3194 static inline ExternalShortArray* cast(Object* obj); 3211 static inline ExternalShortArray* cast(Object* obj);
3195 3212
3196 #ifdef OBJECT_PRINT 3213 #ifdef OBJECT_PRINT
3197 inline void ExternalShortArrayPrint() { 3214 inline void ExternalShortArrayPrint() {
3198 ExternalShortArrayPrint(stdout); 3215 ExternalShortArrayPrint(stdout);
3199 } 3216 }
3200 void ExternalShortArrayPrint(FILE* out); 3217 void ExternalShortArrayPrint(FILE* out);
3201 #endif 3218 #endif
3202 #ifdef DEBUG 3219 #ifdef DEBUG
3203 void ExternalShortArrayVerify(); 3220 void ExternalShortArrayVerify();
3204 #endif // DEBUG 3221 #endif // DEBUG
3205 3222
3206 private: 3223 private:
3207 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 3224 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
3208 }; 3225 };
3209 3226
3210 3227
3211 class ExternalUnsignedShortArray: public ExternalArray { 3228 class ExternalUnsignedShortArray: public ExternalArray {
3212 public: 3229 public:
3213 // Setter and getter. 3230 // Setter and getter.
3214 inline uint16_t get(int index); 3231 inline uint16_t get_scalar(int index);
3232 inline MaybeObject* get(int index);
3215 inline void set(int index, uint16_t value); 3233 inline void set(int index, uint16_t value);
3216 3234
3217 // This accessor applies the correct conversion from Smi, HeapNumber 3235 // This accessor applies the correct conversion from Smi, HeapNumber
3218 // and undefined. 3236 // and undefined.
3219 MaybeObject* SetValue(uint32_t index, Object* value); 3237 MaybeObject* SetValue(uint32_t index, Object* value);
3220 3238
3221 // Casting. 3239 // Casting.
3222 static inline ExternalUnsignedShortArray* cast(Object* obj); 3240 static inline ExternalUnsignedShortArray* cast(Object* obj);
3223 3241
3224 #ifdef OBJECT_PRINT 3242 #ifdef OBJECT_PRINT
3225 inline void ExternalUnsignedShortArrayPrint() { 3243 inline void ExternalUnsignedShortArrayPrint() {
3226 ExternalUnsignedShortArrayPrint(stdout); 3244 ExternalUnsignedShortArrayPrint(stdout);
3227 } 3245 }
3228 void ExternalUnsignedShortArrayPrint(FILE* out); 3246 void ExternalUnsignedShortArrayPrint(FILE* out);
3229 #endif 3247 #endif
3230 #ifdef DEBUG 3248 #ifdef DEBUG
3231 void ExternalUnsignedShortArrayVerify(); 3249 void ExternalUnsignedShortArrayVerify();
3232 #endif // DEBUG 3250 #endif // DEBUG
3233 3251
3234 private: 3252 private:
3235 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 3253 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
3236 }; 3254 };
3237 3255
3238 3256
3239 class ExternalIntArray: public ExternalArray { 3257 class ExternalIntArray: public ExternalArray {
3240 public: 3258 public:
3241 // Setter and getter. 3259 // Setter and getter.
3242 inline int32_t get(int index); 3260 inline int32_t get_scalar(int index);
3261 inline MaybeObject* get(int index);
3243 inline void set(int index, int32_t value); 3262 inline void set(int index, int32_t value);
3244 3263
3245 // This accessor applies the correct conversion from Smi, HeapNumber 3264 // This accessor applies the correct conversion from Smi, HeapNumber
3246 // and undefined. 3265 // and undefined.
3247 MaybeObject* SetValue(uint32_t index, Object* value); 3266 MaybeObject* SetValue(uint32_t index, Object* value);
3248 3267
3249 // Casting. 3268 // Casting.
3250 static inline ExternalIntArray* cast(Object* obj); 3269 static inline ExternalIntArray* cast(Object* obj);
3251 3270
3252 #ifdef OBJECT_PRINT 3271 #ifdef OBJECT_PRINT
3253 inline void ExternalIntArrayPrint() { 3272 inline void ExternalIntArrayPrint() {
3254 ExternalIntArrayPrint(stdout); 3273 ExternalIntArrayPrint(stdout);
3255 } 3274 }
3256 void ExternalIntArrayPrint(FILE* out); 3275 void ExternalIntArrayPrint(FILE* out);
3257 #endif 3276 #endif
3258 #ifdef DEBUG 3277 #ifdef DEBUG
3259 void ExternalIntArrayVerify(); 3278 void ExternalIntArrayVerify();
3260 #endif // DEBUG 3279 #endif // DEBUG
3261 3280
3262 private: 3281 private:
3263 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 3282 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
3264 }; 3283 };
3265 3284
3266 3285
3267 class ExternalUnsignedIntArray: public ExternalArray { 3286 class ExternalUnsignedIntArray: public ExternalArray {
3268 public: 3287 public:
3269 // Setter and getter. 3288 // Setter and getter.
3270 inline uint32_t get(int index); 3289 inline uint32_t get_scalar(int index);
3290 inline MaybeObject* get(int index);
3271 inline void set(int index, uint32_t value); 3291 inline void set(int index, uint32_t value);
3272 3292
3273 // This accessor applies the correct conversion from Smi, HeapNumber 3293 // This accessor applies the correct conversion from Smi, HeapNumber
3274 // and undefined. 3294 // and undefined.
3275 MaybeObject* SetValue(uint32_t index, Object* value); 3295 MaybeObject* SetValue(uint32_t index, Object* value);
3276 3296
3277 // Casting. 3297 // Casting.
3278 static inline ExternalUnsignedIntArray* cast(Object* obj); 3298 static inline ExternalUnsignedIntArray* cast(Object* obj);
3279 3299
3280 #ifdef OBJECT_PRINT 3300 #ifdef OBJECT_PRINT
3281 inline void ExternalUnsignedIntArrayPrint() { 3301 inline void ExternalUnsignedIntArrayPrint() {
3282 ExternalUnsignedIntArrayPrint(stdout); 3302 ExternalUnsignedIntArrayPrint(stdout);
3283 } 3303 }
3284 void ExternalUnsignedIntArrayPrint(FILE* out); 3304 void ExternalUnsignedIntArrayPrint(FILE* out);
3285 #endif 3305 #endif
3286 #ifdef DEBUG 3306 #ifdef DEBUG
3287 void ExternalUnsignedIntArrayVerify(); 3307 void ExternalUnsignedIntArrayVerify();
3288 #endif // DEBUG 3308 #endif // DEBUG
3289 3309
3290 private: 3310 private:
3291 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 3311 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
3292 }; 3312 };
3293 3313
3294 3314
3295 class ExternalFloatArray: public ExternalArray { 3315 class ExternalFloatArray: public ExternalArray {
3296 public: 3316 public:
3297 // Setter and getter. 3317 // Setter and getter.
3298 inline float get(int index); 3318 inline float get_scalar(int index);
3319 inline MaybeObject* get(int index);
3299 inline void set(int index, float value); 3320 inline void set(int index, float value);
3300 3321
3301 // This accessor applies the correct conversion from Smi, HeapNumber 3322 // This accessor applies the correct conversion from Smi, HeapNumber
3302 // and undefined. 3323 // and undefined.
3303 MaybeObject* SetValue(uint32_t index, Object* value); 3324 MaybeObject* SetValue(uint32_t index, Object* value);
3304 3325
3305 // Casting. 3326 // Casting.
3306 static inline ExternalFloatArray* cast(Object* obj); 3327 static inline ExternalFloatArray* cast(Object* obj);
3307 3328
3308 #ifdef OBJECT_PRINT 3329 #ifdef OBJECT_PRINT
3309 inline void ExternalFloatArrayPrint() { 3330 inline void ExternalFloatArrayPrint() {
3310 ExternalFloatArrayPrint(stdout); 3331 ExternalFloatArrayPrint(stdout);
3311 } 3332 }
3312 void ExternalFloatArrayPrint(FILE* out); 3333 void ExternalFloatArrayPrint(FILE* out);
3313 #endif 3334 #endif
3314 #ifdef DEBUG 3335 #ifdef DEBUG
3315 void ExternalFloatArrayVerify(); 3336 void ExternalFloatArrayVerify();
3316 #endif // DEBUG 3337 #endif // DEBUG
3317 3338
3318 private: 3339 private:
3319 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 3340 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
3320 }; 3341 };
3321 3342
3322 3343
3323 class ExternalDoubleArray: public ExternalArray { 3344 class ExternalDoubleArray: public ExternalArray {
3324 public: 3345 public:
3325 // Setter and getter. 3346 // Setter and getter.
3326 inline double get(int index); 3347 inline double get_scalar(int index);
3348 inline MaybeObject* get(int index);
3327 inline void set(int index, double value); 3349 inline void set(int index, double value);
3328 3350
3329 // This accessor applies the correct conversion from Smi, HeapNumber 3351 // This accessor applies the correct conversion from Smi, HeapNumber
3330 // and undefined. 3352 // and undefined.
3331 MaybeObject* SetValue(uint32_t index, Object* value); 3353 MaybeObject* SetValue(uint32_t index, Object* value);
3332 3354
3333 // Casting. 3355 // Casting.
3334 static inline ExternalDoubleArray* cast(Object* obj); 3356 static inline ExternalDoubleArray* cast(Object* obj);
3335 3357
3336 #ifdef OBJECT_PRINT 3358 #ifdef OBJECT_PRINT
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4565 4587
4566 // Position of this function in the script source. 4588 // Position of this function in the script source.
4567 inline int start_position(); 4589 inline int start_position();
4568 inline void set_start_position(int start_position); 4590 inline void set_start_position(int start_position);
4569 4591
4570 // End position of this function in the script source. 4592 // End position of this function in the script source.
4571 inline int end_position(); 4593 inline int end_position();
4572 inline void set_end_position(int end_position); 4594 inline void set_end_position(int end_position);
4573 4595
4574 // Is this function a function expression in the source code. 4596 // Is this function a function expression in the source code.
4575 inline bool is_expression(); 4597 DECL_BOOLEAN_ACCESSORS(is_expression)
4576 inline void set_is_expression(bool value);
4577 4598
4578 // Is this function a top-level function (scripts, evals). 4599 // Is this function a top-level function (scripts, evals).
4579 inline bool is_toplevel(); 4600 DECL_BOOLEAN_ACCESSORS(is_toplevel)
4580 inline void set_is_toplevel(bool value);
4581 4601
4582 // Bit field containing various information collected by the compiler to 4602 // Bit field containing various information collected by the compiler to
4583 // drive optimization. 4603 // drive optimization.
4584 inline int compiler_hints(); 4604 inline int compiler_hints();
4585 inline void set_compiler_hints(int value); 4605 inline void set_compiler_hints(int value);
4586 4606
4587 // A counter used to determine when to stress the deoptimizer with a 4607 // A counter used to determine when to stress the deoptimizer with a
4588 // deopt. 4608 // deopt.
4589 inline Smi* deopt_counter(); 4609 inline Smi* deopt_counter();
4590 inline void set_deopt_counter(Smi* counter); 4610 inline void set_deopt_counter(Smi* counter);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4626 // False if the function definitely does not allocate an arguments object. 4646 // False if the function definitely does not allocate an arguments object.
4627 DECL_BOOLEAN_ACCESSORS(uses_arguments) 4647 DECL_BOOLEAN_ACCESSORS(uses_arguments)
4628 4648
4629 // True if the function has any duplicated parameter names. 4649 // True if the function has any duplicated parameter names.
4630 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) 4650 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters)
4631 4651
4632 // Indicates whether the function is a native function. 4652 // Indicates whether the function is a native function.
4633 // These needs special threatment in .call and .apply since 4653 // These needs special threatment in .call and .apply since
4634 // null passed as the receiver should not be translated to the 4654 // null passed as the receiver should not be translated to the
4635 // global object. 4655 // global object.
4636 inline bool native(); 4656 DECL_BOOLEAN_ACCESSORS(native)
4637 inline void set_native(bool value); 4657
4658 // Indicates that the function was created by the Function function.
4659 // Though it's anonymous, toString should treat it as if it had the name
4660 // "anonymous". We don't set the name itself so that the system does not
4661 // see a binding for it.
4662 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
4638 4663
4639 // Indicates whether the function is a bound function created using 4664 // Indicates whether the function is a bound function created using
4640 // the bind function. 4665 // the bind function.
4641 inline bool bound(); 4666 DECL_BOOLEAN_ACCESSORS(bound)
4642 inline void set_bound(bool value); 4667
4668 // Indicates that the function is anonymous (the name field can be set
4669 // through the API, which does not change this flag).
4670 DECL_BOOLEAN_ACCESSORS(is_anonymous)
4643 4671
4644 // Indicates whether or not the code in the shared function support 4672 // Indicates whether or not the code in the shared function support
4645 // deoptimization. 4673 // deoptimization.
4646 inline bool has_deoptimization_support(); 4674 inline bool has_deoptimization_support();
4647 4675
4648 // Enable deoptimization support through recompiled code. 4676 // Enable deoptimization support through recompiled code.
4649 void EnableDeoptimizationSupport(Code* recompiled); 4677 void EnableDeoptimizationSupport(Code* recompiled);
4650 4678
4651 // Disable (further) attempted optimization of all functions sharing this 4679 // Disable (further) attempted optimization of all functions sharing this
4652 // shared function info. The function is the one we actually tried to 4680 // shared function info. The function is the one we actually tried to
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4814 // The source code start position is in the 30 most significant bits of 4842 // The source code start position is in the 30 most significant bits of
4815 // the start_position_and_type field. 4843 // the start_position_and_type field.
4816 static const int kIsExpressionBit = 0; 4844 static const int kIsExpressionBit = 0;
4817 static const int kIsTopLevelBit = 1; 4845 static const int kIsTopLevelBit = 1;
4818 static const int kStartPositionShift = 2; 4846 static const int kStartPositionShift = 2;
4819 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 4847 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
4820 4848
4821 // Bit positions in compiler_hints. 4849 // Bit positions in compiler_hints.
4822 static const int kCodeAgeSize = 3; 4850 static const int kCodeAgeSize = 3;
4823 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; 4851 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
4824 static const int kBoundFunction = 9;
4825 4852
4826 enum CompilerHints { 4853 enum CompilerHints {
4827 kHasOnlySimpleThisPropertyAssignments, 4854 kHasOnlySimpleThisPropertyAssignments,
4828 kAllowLazyCompilation, 4855 kAllowLazyCompilation,
4829 kLiveObjectsMayExist, 4856 kLiveObjectsMayExist,
4830 kCodeAgeShift, 4857 kCodeAgeShift,
4831 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, 4858 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
4832 kStrictModeFunction, 4859 kStrictModeFunction,
4833 kUsesArguments, 4860 kUsesArguments,
4834 kHasDuplicateParameters, 4861 kHasDuplicateParameters,
4835 kNative 4862 kNative,
4863 kBoundFunction,
4864 kIsAnonymous,
4865 kNameShouldPrintAsAnonymous,
4866 kCompilerHintsCount // Pseudo entry
4836 }; 4867 };
4837 4868
4838 private: 4869 private:
4839 #if V8_HOST_ARCH_32_BIT 4870 #if V8_HOST_ARCH_32_BIT
4840 // On 32 bit platforms, compiler hints is a smi. 4871 // On 32 bit platforms, compiler hints is a smi.
4841 static const int kCompilerHintsSmiTagSize = kSmiTagSize; 4872 static const int kCompilerHintsSmiTagSize = kSmiTagSize;
4842 static const int kCompilerHintsSize = kPointerSize; 4873 static const int kCompilerHintsSize = kPointerSize;
4843 #else 4874 #else
4844 // On 64 bit platforms, compiler hints is not a smi, see comment above. 4875 // On 64 bit platforms, compiler hints is not a smi, see comment above.
4845 static const int kCompilerHintsSmiTagSize = 0; 4876 static const int kCompilerHintsSmiTagSize = 0;
4846 static const int kCompilerHintsSize = kIntSize; 4877 static const int kCompilerHintsSize = kIntSize;
4847 #endif 4878 #endif
4848 4879
4880 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <=
4881 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte);
4882
4849 public: 4883 public:
4850 // Constants for optimizing codegen for strict mode function and 4884 // Constants for optimizing codegen for strict mode function and
4851 // native tests. 4885 // native tests.
4852 // Allows to use byte-widgh instructions. 4886 // Allows to use byte-widgh instructions.
4853 static const int kStrictModeBitWithinByte = 4887 static const int kStrictModeBitWithinByte =
4854 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; 4888 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
4855 4889
4856 static const int kNativeBitWithinByte = 4890 static const int kNativeBitWithinByte =
4857 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; 4891 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte;
4858 4892
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6537 class JSFunctionProxy: public JSProxy { 6571 class JSFunctionProxy: public JSProxy {
6538 public: 6572 public:
6539 // Casting. 6573 // Casting.
6540 static inline JSFunctionProxy* cast(Object* obj); 6574 static inline JSFunctionProxy* cast(Object* obj);
6541 6575
6542 private: 6576 private:
6543 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); 6577 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
6544 }; 6578 };
6545 6579
6546 6580
6581 // The JSWeakMap describes EcmaScript Harmony weak maps
6582 class JSWeakMap: public JSObject {
6583 public:
6584 // [table]: the backing hash table mapping keys to values.
6585 DECL_ACCESSORS(table, ObjectHashTable)
6586
6587 // [next]: linked list of encountered weak maps during GC.
6588 DECL_ACCESSORS(next, Object)
6589
6590 // Unchecked accessors to be used during GC.
6591 inline ObjectHashTable* unchecked_table();
6592
6593 // Casting.
6594 static inline JSWeakMap* cast(Object* obj);
6595
6596 #ifdef OBJECT_PRINT
6597 inline void JSWeakMapPrint() {
6598 JSWeakMapPrint(stdout);
6599 }
6600 void JSWeakMapPrint(FILE* out);
6601 #endif
6602 #ifdef DEBUG
6603 void JSWeakMapVerify();
6604 #endif
6605
6606 static const int kTableOffset = JSObject::kHeaderSize;
6607 static const int kNextOffset = kTableOffset + kPointerSize;
6608 static const int kSize = kNextOffset + kPointerSize;
6609
6610 private:
6611 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
6612 };
6613
6614
6547 // Foreign describes objects pointing from JavaScript to C structures. 6615 // Foreign describes objects pointing from JavaScript to C structures.
6548 // Since they cannot contain references to JS HeapObjects they can be 6616 // Since they cannot contain references to JS HeapObjects they can be
6549 // placed in old_data_space. 6617 // placed in old_data_space.
6550 class Foreign: public HeapObject { 6618 class Foreign: public HeapObject {
6551 public: 6619 public:
6552 // [address]: field containing the address. 6620 // [address]: field containing the address.
6553 inline Address address(); 6621 inline Address address();
6554 inline void set_address(Address value); 6622 inline void set_address(Address value);
6555 6623
6556 // Casting. 6624 // Casting.
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
7180 } else { 7248 } else {
7181 value &= ~(1 << bit_position); 7249 value &= ~(1 << bit_position);
7182 } 7250 }
7183 return value; 7251 return value;
7184 } 7252 }
7185 }; 7253 };
7186 7254
7187 } } // namespace v8::internal 7255 } } // namespace v8::internal
7188 7256
7189 #endif // V8_OBJECTS_H_ 7257 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698