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

Side by Side Diff: src/objects.h

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/number-info.h ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // - ExternalUnsignedShortArray 65 // - ExternalUnsignedShortArray
66 // - ExternalIntArray 66 // - ExternalIntArray
67 // - ExternalUnsignedIntArray 67 // - ExternalUnsignedIntArray
68 // - ExternalFloatArray 68 // - ExternalFloatArray
69 // - FixedArray 69 // - FixedArray
70 // - DescriptorArray 70 // - DescriptorArray
71 // - HashTable 71 // - HashTable
72 // - Dictionary 72 // - Dictionary
73 // - SymbolTable 73 // - SymbolTable
74 // - CompilationCacheTable 74 // - CompilationCacheTable
75 // - CodeCacheHashTable
75 // - MapCache 76 // - MapCache
76 // - Context 77 // - Context
77 // - GlobalContext 78 // - GlobalContext
78 // - String 79 // - String
79 // - SeqString 80 // - SeqString
80 // - SeqAsciiString 81 // - SeqAsciiString
81 // - SeqTwoByteString 82 // - SeqTwoByteString
82 // - ConsString 83 // - ConsString
83 // - ExternalString 84 // - ExternalString
84 // - ExternalAsciiString 85 // - ExternalAsciiString
(...skipping 10 matching lines...) Expand all
95 // - InterceptorInfo 96 // - InterceptorInfo
96 // - CallHandlerInfo 97 // - CallHandlerInfo
97 // - TemplateInfo 98 // - TemplateInfo
98 // - FunctionTemplateInfo 99 // - FunctionTemplateInfo
99 // - ObjectTemplateInfo 100 // - ObjectTemplateInfo
100 // - Script 101 // - Script
101 // - SignatureInfo 102 // - SignatureInfo
102 // - TypeSwitchInfo 103 // - TypeSwitchInfo
103 // - DebugInfo 104 // - DebugInfo
104 // - BreakPointInfo 105 // - BreakPointInfo
106 // - CodeCache
105 // 107 //
106 // Formats of Object*: 108 // Formats of Object*:
107 // Smi: [31 bit signed int] 0 109 // Smi: [31 bit signed int] 0
108 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 110 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01
109 // Failure: [30 bit signed int] 11 111 // Failure: [30 bit signed int] 11
110 112
111 // Ecma-262 3rd 8.6.1 113 // Ecma-262 3rd 8.6.1
112 enum PropertyAttributes { 114 enum PropertyAttributes {
113 NONE = v8::None, 115 NONE = v8::None,
114 READ_ONLY = v8::ReadOnly, 116 READ_ONLY = v8::ReadOnly,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 V(ACCESSOR_INFO_TYPE) \ 264 V(ACCESSOR_INFO_TYPE) \
263 V(ACCESS_CHECK_INFO_TYPE) \ 265 V(ACCESS_CHECK_INFO_TYPE) \
264 V(INTERCEPTOR_INFO_TYPE) \ 266 V(INTERCEPTOR_INFO_TYPE) \
265 V(SHARED_FUNCTION_INFO_TYPE) \ 267 V(SHARED_FUNCTION_INFO_TYPE) \
266 V(CALL_HANDLER_INFO_TYPE) \ 268 V(CALL_HANDLER_INFO_TYPE) \
267 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 269 V(FUNCTION_TEMPLATE_INFO_TYPE) \
268 V(OBJECT_TEMPLATE_INFO_TYPE) \ 270 V(OBJECT_TEMPLATE_INFO_TYPE) \
269 V(SIGNATURE_INFO_TYPE) \ 271 V(SIGNATURE_INFO_TYPE) \
270 V(TYPE_SWITCH_INFO_TYPE) \ 272 V(TYPE_SWITCH_INFO_TYPE) \
271 V(SCRIPT_TYPE) \ 273 V(SCRIPT_TYPE) \
274 V(CODE_CACHE_TYPE) \
272 \ 275 \
273 V(JS_VALUE_TYPE) \ 276 V(JS_VALUE_TYPE) \
274 V(JS_OBJECT_TYPE) \ 277 V(JS_OBJECT_TYPE) \
275 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 278 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
276 V(JS_GLOBAL_OBJECT_TYPE) \ 279 V(JS_GLOBAL_OBJECT_TYPE) \
277 V(JS_BUILTINS_OBJECT_TYPE) \ 280 V(JS_BUILTINS_OBJECT_TYPE) \
278 V(JS_GLOBAL_PROXY_TYPE) \ 281 V(JS_GLOBAL_PROXY_TYPE) \
279 V(JS_ARRAY_TYPE) \ 282 V(JS_ARRAY_TYPE) \
280 V(JS_REGEXP_TYPE) \ 283 V(JS_REGEXP_TYPE) \
281 \ 284 \
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // manually. 360 // manually.
358 #define STRUCT_LIST_ALL(V) \ 361 #define STRUCT_LIST_ALL(V) \
359 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ 362 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
360 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 363 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
361 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 364 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
362 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 365 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
363 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 366 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
364 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ 367 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
365 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ 368 V(SIGNATURE_INFO, SignatureInfo, signature_info) \
366 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ 369 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
367 V(SCRIPT, Script, script) 370 V(SCRIPT, Script, script) \
371 V(CODE_CACHE, CodeCache, code_cache)
368 372
369 #ifdef ENABLE_DEBUGGER_SUPPORT 373 #ifdef ENABLE_DEBUGGER_SUPPORT
370 #define STRUCT_LIST_DEBUGGER(V) \ 374 #define STRUCT_LIST_DEBUGGER(V) \
371 V(DEBUG_INFO, DebugInfo, debug_info) \ 375 V(DEBUG_INFO, DebugInfo, debug_info) \
372 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) 376 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info)
373 #else 377 #else
374 #define STRUCT_LIST_DEBUGGER(V) 378 #define STRUCT_LIST_DEBUGGER(V)
375 #endif 379 #endif
376 380
377 #define STRUCT_LIST(V) \ 381 #define STRUCT_LIST(V) \
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // Structs. 465 // Structs.
462 ACCESSOR_INFO_TYPE, 466 ACCESSOR_INFO_TYPE,
463 ACCESS_CHECK_INFO_TYPE, 467 ACCESS_CHECK_INFO_TYPE,
464 INTERCEPTOR_INFO_TYPE, 468 INTERCEPTOR_INFO_TYPE,
465 CALL_HANDLER_INFO_TYPE, 469 CALL_HANDLER_INFO_TYPE,
466 FUNCTION_TEMPLATE_INFO_TYPE, 470 FUNCTION_TEMPLATE_INFO_TYPE,
467 OBJECT_TEMPLATE_INFO_TYPE, 471 OBJECT_TEMPLATE_INFO_TYPE,
468 SIGNATURE_INFO_TYPE, 472 SIGNATURE_INFO_TYPE,
469 TYPE_SWITCH_INFO_TYPE, 473 TYPE_SWITCH_INFO_TYPE,
470 SCRIPT_TYPE, 474 SCRIPT_TYPE,
475 CODE_CACHE_TYPE,
471 #ifdef ENABLE_DEBUGGER_SUPPORT 476 #ifdef ENABLE_DEBUGGER_SUPPORT
472 DEBUG_INFO_TYPE, 477 DEBUG_INFO_TYPE,
473 BREAK_POINT_INFO_TYPE, 478 BREAK_POINT_INFO_TYPE,
474 #endif 479 #endif
475 480
476 FIXED_ARRAY_TYPE, 481 FIXED_ARRAY_TYPE,
477 SHARED_FUNCTION_INFO_TYPE, 482 SHARED_FUNCTION_INFO_TYPE,
478 483
479 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE 484 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
480 JS_OBJECT_TYPE, 485 JS_OBJECT_TYPE,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 inline bool IsJSValue(); 599 inline bool IsJSValue();
595 inline bool IsStringWrapper(); 600 inline bool IsStringWrapper();
596 inline bool IsProxy(); 601 inline bool IsProxy();
597 inline bool IsBoolean(); 602 inline bool IsBoolean();
598 inline bool IsJSArray(); 603 inline bool IsJSArray();
599 inline bool IsJSRegExp(); 604 inline bool IsJSRegExp();
600 inline bool IsHashTable(); 605 inline bool IsHashTable();
601 inline bool IsDictionary(); 606 inline bool IsDictionary();
602 inline bool IsSymbolTable(); 607 inline bool IsSymbolTable();
603 inline bool IsCompilationCacheTable(); 608 inline bool IsCompilationCacheTable();
609 inline bool IsCodeCacheHashTable();
604 inline bool IsMapCache(); 610 inline bool IsMapCache();
605 inline bool IsPrimitive(); 611 inline bool IsPrimitive();
606 inline bool IsGlobalObject(); 612 inline bool IsGlobalObject();
607 inline bool IsJSGlobalObject(); 613 inline bool IsJSGlobalObject();
608 inline bool IsJSBuiltinsObject(); 614 inline bool IsJSBuiltinsObject();
609 inline bool IsJSGlobalProxy(); 615 inline bool IsJSGlobalProxy();
610 inline bool IsUndetectableObject(); 616 inline bool IsUndetectableObject();
611 inline bool IsAccessCheckNeeded(); 617 inline bool IsAccessCheckNeeded();
612 inline bool IsJSGlobalPropertyCell(); 618 inline bool IsJSGlobalPropertyCell();
613 619
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 // Setter that doesn't need write barrier). 1609 // Setter that doesn't need write barrier).
1604 inline void set(int index, Smi* value); 1610 inline void set(int index, Smi* value);
1605 // Setter with explicit barrier mode. 1611 // Setter with explicit barrier mode.
1606 inline void set(int index, Object* value, WriteBarrierMode mode); 1612 inline void set(int index, Object* value, WriteBarrierMode mode);
1607 1613
1608 // Setters for frequently used oddballs located in old space. 1614 // Setters for frequently used oddballs located in old space.
1609 inline void set_undefined(int index); 1615 inline void set_undefined(int index);
1610 inline void set_null(int index); 1616 inline void set_null(int index);
1611 inline void set_the_hole(int index); 1617 inline void set_the_hole(int index);
1612 1618
1619 // Gives access to raw memory which stores the array's data.
1620 inline Object** data_start();
1621
1613 // Copy operations. 1622 // Copy operations.
1614 inline Object* Copy(); 1623 inline Object* Copy();
1615 Object* CopySize(int new_length); 1624 Object* CopySize(int new_length);
1616 1625
1617 // Add the elements of a JSArray to this FixedArray. 1626 // Add the elements of a JSArray to this FixedArray.
1618 Object* AddKeysFromJSArray(JSArray* array); 1627 Object* AddKeysFromJSArray(JSArray* array);
1619 1628
1620 // Compute the union of this and other. 1629 // Compute the union of this and other.
1621 Object* UnionOfKeys(FixedArray* other); 1630 Object* UnionOfKeys(FixedArray* other);
1622 1631
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 void ElementRemoved() { 1919 void ElementRemoved() {
1911 SetNumberOfElements(NumberOfElements() - 1); 1920 SetNumberOfElements(NumberOfElements() - 1);
1912 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1); 1921 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1);
1913 } 1922 }
1914 void ElementsRemoved(int n) { 1923 void ElementsRemoved(int n) {
1915 SetNumberOfElements(NumberOfElements() - n); 1924 SetNumberOfElements(NumberOfElements() - n);
1916 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); 1925 SetNumberOfDeletedElements(NumberOfDeletedElements() + n);
1917 } 1926 }
1918 1927
1919 // Returns a new HashTable object. Might return Failure. 1928 // Returns a new HashTable object. Might return Failure.
1920 static Object* Allocate(int at_least_space_for); 1929 static Object* Allocate(int at_least_space_for,
1930 PretenureFlag pretenure = NOT_TENURED);
1921 1931
1922 // Returns the key at entry. 1932 // Returns the key at entry.
1923 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } 1933 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
1924 1934
1925 // Tells whether k is a real key. Null and undefined are not allowed 1935 // Tells whether k is a real key. Null and undefined are not allowed
1926 // as keys and can be used to indicate missing or deleted elements. 1936 // as keys and can be used to indicate missing or deleted elements.
1927 bool IsKey(Object* k) { 1937 bool IsKey(Object* k) {
1928 return !k->IsNull() && !k->IsUndefined(); 1938 return !k->IsNull() && !k->IsUndefined();
1929 } 1939 }
1930 1940
(...skipping 11 matching lines...) Expand all
1942 1952
1943 static const int kNumberOfElementsIndex = 0; 1953 static const int kNumberOfElementsIndex = 0;
1944 static const int kNumberOfDeletedElementsIndex = 1; 1954 static const int kNumberOfDeletedElementsIndex = 1;
1945 static const int kCapacityIndex = 2; 1955 static const int kCapacityIndex = 2;
1946 static const int kPrefixStartIndex = 3; 1956 static const int kPrefixStartIndex = 3;
1947 static const int kElementsStartIndex = 1957 static const int kElementsStartIndex =
1948 kPrefixStartIndex + Shape::kPrefixSize; 1958 kPrefixStartIndex + Shape::kPrefixSize;
1949 static const int kEntrySize = Shape::kEntrySize; 1959 static const int kEntrySize = Shape::kEntrySize;
1950 static const int kElementsStartOffset = 1960 static const int kElementsStartOffset =
1951 kHeaderSize + kElementsStartIndex * kPointerSize; 1961 kHeaderSize + kElementsStartIndex * kPointerSize;
1962 static const int kCapacityOffset =
1963 kHeaderSize + kCapacityIndex * kPointerSize;
1952 1964
1953 // Constant used for denoting a absent entry. 1965 // Constant used for denoting a absent entry.
1954 static const int kNotFound = -1; 1966 static const int kNotFound = -1;
1955 1967
1956 // Maximal capacity of HashTable. Based on maximal length of underlying 1968 // Maximal capacity of HashTable. Based on maximal length of underlying
1957 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex 1969 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex
1958 // cannot overflow. 1970 // cannot overflow.
1959 static const int kMaxCapacity = 1971 static const int kMaxCapacity =
1960 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; 1972 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize;
1961 1973
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 2604
2593 enum Kind { 2605 enum Kind {
2594 FUNCTION, 2606 FUNCTION,
2595 STUB, 2607 STUB,
2596 BUILTIN, 2608 BUILTIN,
2597 LOAD_IC, 2609 LOAD_IC,
2598 KEYED_LOAD_IC, 2610 KEYED_LOAD_IC,
2599 CALL_IC, 2611 CALL_IC,
2600 STORE_IC, 2612 STORE_IC,
2601 KEYED_STORE_IC, 2613 KEYED_STORE_IC,
2602 // No more than eight kinds. The value currently encoded in three bits in 2614 BINARY_OP_IC,
2615 // No more than 16 kinds. The value currently encoded in four bits in
2603 // Flags. 2616 // Flags.
2604 2617
2605 // Pseudo-kinds. 2618 // Pseudo-kinds.
2606 REGEXP = BUILTIN, 2619 REGEXP = BUILTIN,
2607 FIRST_IC_KIND = LOAD_IC, 2620 FIRST_IC_KIND = LOAD_IC,
2608 LAST_IC_KIND = KEYED_STORE_IC 2621 LAST_IC_KIND = BINARY_OP_IC
2609 }; 2622 };
2610 2623
2611 enum { 2624 enum {
2612 NUMBER_OF_KINDS = KEYED_STORE_IC + 1 2625 NUMBER_OF_KINDS = KEYED_STORE_IC + 1
2613 }; 2626 };
2614 2627
2615 #ifdef ENABLE_DISASSEMBLER 2628 #ifdef ENABLE_DISASSEMBLER
2616 // Printing 2629 // Printing
2617 static const char* Kind2String(Kind kind); 2630 static const char* Kind2String(Kind kind);
2618 static const char* ICState2String(InlineCacheState state); 2631 static const char* ICState2String(InlineCacheState state);
(...skipping 25 matching lines...) Expand all
2644 inline int arguments_count(); // Only valid for call IC stubs. 2657 inline int arguments_count(); // Only valid for call IC stubs.
2645 2658
2646 // Testers for IC stub kinds. 2659 // Testers for IC stub kinds.
2647 inline bool is_inline_cache_stub(); 2660 inline bool is_inline_cache_stub();
2648 inline bool is_load_stub() { return kind() == LOAD_IC; } 2661 inline bool is_load_stub() { return kind() == LOAD_IC; }
2649 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 2662 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
2650 inline bool is_store_stub() { return kind() == STORE_IC; } 2663 inline bool is_store_stub() { return kind() == STORE_IC; }
2651 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 2664 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
2652 inline bool is_call_stub() { return kind() == CALL_IC; } 2665 inline bool is_call_stub() { return kind() == CALL_IC; }
2653 2666
2654 // [major_key]: For kind STUB, the major key. 2667 // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
2655 inline CodeStub::Major major_key(); 2668 inline CodeStub::Major major_key();
2656 inline void set_major_key(CodeStub::Major major); 2669 inline void set_major_key(CodeStub::Major major);
2657 2670
2658 // Flags operations. 2671 // Flags operations.
2659 static inline Flags ComputeFlags(Kind kind, 2672 static inline Flags ComputeFlags(Kind kind,
2660 InLoopFlag in_loop = NOT_IN_LOOP, 2673 InLoopFlag in_loop = NOT_IN_LOOP,
2661 InlineCacheState ic_state = UNINITIALIZED, 2674 InlineCacheState ic_state = UNINITIALIZED,
2662 PropertyType type = NORMAL, 2675 PropertyType type = NORMAL,
2663 int argc = -1); 2676 int argc = -1);
2664 2677
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) & 2764 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) &
2752 ~kCodeAlignmentMask; 2765 ~kCodeAlignmentMask;
2753 2766
2754 // Byte offsets within kKindSpecificFlagsOffset. 2767 // Byte offsets within kKindSpecificFlagsOffset.
2755 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; 2768 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1;
2756 2769
2757 // Flags layout. 2770 // Flags layout.
2758 static const int kFlagsICStateShift = 0; 2771 static const int kFlagsICStateShift = 0;
2759 static const int kFlagsICInLoopShift = 3; 2772 static const int kFlagsICInLoopShift = 3;
2760 static const int kFlagsKindShift = 4; 2773 static const int kFlagsKindShift = 4;
2761 static const int kFlagsTypeShift = 7; 2774 static const int kFlagsTypeShift = 8;
2762 static const int kFlagsArgumentsCountShift = 10; 2775 static const int kFlagsArgumentsCountShift = 11;
2763 2776
2764 static const int kFlagsICStateMask = 0x00000007; // 0000000111 2777 static const int kFlagsICStateMask = 0x00000007; // 00000000111
2765 static const int kFlagsICInLoopMask = 0x00000008; // 0000001000 2778 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000
2766 static const int kFlagsKindMask = 0x00000070; // 0001110000 2779 static const int kFlagsKindMask = 0x000000F0; // 00011110000
2767 static const int kFlagsTypeMask = 0x00000380; // 1110000000 2780 static const int kFlagsTypeMask = 0x00000700; // 11100000000
2768 static const int kFlagsArgumentsCountMask = 0xFFFFFC00; 2781 static const int kFlagsArgumentsCountMask = 0xFFFFF800;
2769 2782
2770 static const int kFlagsNotUsedInLookup = 2783 static const int kFlagsNotUsedInLookup =
2771 (kFlagsICInLoopMask | kFlagsTypeMask); 2784 (kFlagsICInLoopMask | kFlagsTypeMask);
2772 2785
2773 private: 2786 private:
2774 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 2787 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
2775 }; 2788 };
2776 2789
2777 2790
2778 // All heap objects have a Map that describes their structure. 2791 // All heap objects have a Map that describes their structure.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 // [prototype]: implicit prototype object. 2898 // [prototype]: implicit prototype object.
2886 DECL_ACCESSORS(prototype, Object) 2899 DECL_ACCESSORS(prototype, Object)
2887 2900
2888 // [constructor]: points back to the function responsible for this map. 2901 // [constructor]: points back to the function responsible for this map.
2889 DECL_ACCESSORS(constructor, Object) 2902 DECL_ACCESSORS(constructor, Object)
2890 2903
2891 // [instance descriptors]: describes the object. 2904 // [instance descriptors]: describes the object.
2892 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 2905 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
2893 2906
2894 // [stub cache]: contains stubs compiled for this map. 2907 // [stub cache]: contains stubs compiled for this map.
2895 DECL_ACCESSORS(code_cache, FixedArray) 2908 DECL_ACCESSORS(code_cache, Object)
2896 2909
2897 Object* CopyDropDescriptors(); 2910 Object* CopyDropDescriptors();
2898 2911
2899 // Returns a copy of the map, with all transitions dropped from the 2912 // Returns a copy of the map, with all transitions dropped from the
2900 // instance descriptors. 2913 // instance descriptors.
2901 Object* CopyDropTransitions(); 2914 Object* CopyDropTransitions();
2902 2915
2903 // Returns the property index for name (only valid for FAST MODE). 2916 // Returns the property index for name (only valid for FAST MODE).
2904 int PropertyIndexFor(String* name); 2917 int PropertyIndexFor(String* name);
2905 2918
(...skipping 15 matching lines...) Expand all
2921 inline void ClearCodeCache(); 2934 inline void ClearCodeCache();
2922 2935
2923 // Update code cache. 2936 // Update code cache.
2924 Object* UpdateCodeCache(String* name, Code* code); 2937 Object* UpdateCodeCache(String* name, Code* code);
2925 2938
2926 // Returns the found code or undefined if absent. 2939 // Returns the found code or undefined if absent.
2927 Object* FindInCodeCache(String* name, Code::Flags flags); 2940 Object* FindInCodeCache(String* name, Code::Flags flags);
2928 2941
2929 // Returns the non-negative index of the code object if it is in the 2942 // Returns the non-negative index of the code object if it is in the
2930 // cache and -1 otherwise. 2943 // cache and -1 otherwise.
2931 int IndexInCodeCache(Code* code); 2944 int IndexInCodeCache(String* name, Code* code);
2932 2945
2933 // Removes a code object from the code cache at the given index. 2946 // Removes a code object from the code cache at the given index.
2934 void RemoveFromCodeCache(int index); 2947 void RemoveFromCodeCache(String* name, Code* code, int index);
2935 2948
2936 // For every transition in this map, makes the transition's 2949 // For every transition in this map, makes the transition's
2937 // target's prototype pointer point back to this map. 2950 // target's prototype pointer point back to this map.
2938 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). 2951 // This is undone in MarkCompactCollector::ClearNonLiveTransitions().
2939 void CreateBackPointers(); 2952 void CreateBackPointers();
2940 2953
2941 // Set all map transitions from this map to dead maps to null. 2954 // Set all map transitions from this map to dead maps to null.
2942 // Also, restore the original prototype on the targets of these 2955 // Also, restore the original prototype on the targets of these
2943 // transitions, so that we do not process this map again while 2956 // transitions, so that we do not process this map again while
2944 // following back pointers. 2957 // following back pointers.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 static const int kIsHiddenPrototype = 2; 3001 static const int kIsHiddenPrototype = 2;
2989 static const int kHasNamedInterceptor = 3; 3002 static const int kHasNamedInterceptor = 3;
2990 static const int kHasIndexedInterceptor = 4; 3003 static const int kHasIndexedInterceptor = 4;
2991 static const int kIsUndetectable = 5; 3004 static const int kIsUndetectable = 5;
2992 static const int kHasInstanceCallHandler = 6; 3005 static const int kHasInstanceCallHandler = 6;
2993 static const int kIsAccessCheckNeeded = 7; 3006 static const int kIsAccessCheckNeeded = 7;
2994 3007
2995 // Bit positions for bit field 2 3008 // Bit positions for bit field 2
2996 static const int kIsExtensible = 0; 3009 static const int kIsExtensible = 0;
2997 3010
3011 // Layout of the default cache. It holds alternating name and code objects.
3012 static const int kCodeCacheEntrySize = 2;
3013 static const int kCodeCacheEntryNameOffset = 0;
3014 static const int kCodeCacheEntryCodeOffset = 1;
3015
2998 private: 3016 private:
2999 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3017 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3000 }; 3018 };
3001 3019
3002 3020
3003 // An abstract superclass, a marker class really, for simple structure classes. 3021 // An abstract superclass, a marker class really, for simple structure classes.
3004 // It doesn't carry much functionality but allows struct classes to me 3022 // It doesn't carry much functionality but allows struct classes to me
3005 // identified in the type system. 3023 // identified in the type system.
3006 class Struct: public HeapObject { 3024 class Struct: public HeapObject {
3007 public: 3025 public:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
3237 void SharedFunctionInfoVerify(); 3255 void SharedFunctionInfoVerify();
3238 #endif 3256 #endif
3239 3257
3240 // Casting. 3258 // Casting.
3241 static inline SharedFunctionInfo* cast(Object* obj); 3259 static inline SharedFunctionInfo* cast(Object* obj);
3242 3260
3243 // Constants. 3261 // Constants.
3244 static const int kDontAdaptArgumentsSentinel = -1; 3262 static const int kDontAdaptArgumentsSentinel = -1;
3245 3263
3246 // Layout description. 3264 // Layout description.
3247 // (An even number of integers has a size that is a multiple of a pointer.) 3265 // Pointer fields.
3248 static const int kNameOffset = HeapObject::kHeaderSize; 3266 static const int kNameOffset = HeapObject::kHeaderSize;
3249 static const int kCodeOffset = kNameOffset + kPointerSize; 3267 static const int kCodeOffset = kNameOffset + kPointerSize;
3250 static const int kConstructStubOffset = kCodeOffset + kPointerSize; 3268 static const int kConstructStubOffset = kCodeOffset + kPointerSize;
3251 static const int kLengthOffset = kConstructStubOffset + kPointerSize; 3269 static const int kInstanceClassNameOffset =
3270 kConstructStubOffset + kPointerSize;
3271 static const int kExternalReferenceDataOffset =
3272 kInstanceClassNameOffset + kPointerSize;
3273 static const int kScriptOffset = kExternalReferenceDataOffset + kPointerSize;
3274 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
3275 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
3276 static const int kThisPropertyAssignmentsOffset =
3277 kInferredNameOffset + kPointerSize;
3278 // Integer fields.
3279 static const int kLengthOffset =
3280 kThisPropertyAssignmentsOffset + kPointerSize;
3252 static const int kFormalParameterCountOffset = kLengthOffset + kIntSize; 3281 static const int kFormalParameterCountOffset = kLengthOffset + kIntSize;
3253 static const int kExpectedNofPropertiesOffset = 3282 static const int kExpectedNofPropertiesOffset =
3254 kFormalParameterCountOffset + kIntSize; 3283 kFormalParameterCountOffset + kIntSize;
3255 static const int kStartPositionAndTypeOffset = 3284 static const int kStartPositionAndTypeOffset =
3256 kExpectedNofPropertiesOffset + kIntSize; 3285 kExpectedNofPropertiesOffset + kIntSize;
3257 static const int kEndPositionOffset = kStartPositionAndTypeOffset + kIntSize; 3286 static const int kEndPositionOffset = kStartPositionAndTypeOffset + kIntSize;
3258 static const int kFunctionTokenPositionOffset = kEndPositionOffset + kIntSize; 3287 static const int kFunctionTokenPositionOffset = kEndPositionOffset + kIntSize;
3259 static const int kInstanceClassNameOffset = 3288 static const int kCompilerHintsOffset =
3260 kFunctionTokenPositionOffset + kIntSize; 3289 kFunctionTokenPositionOffset + kIntSize;
3261 static const int kExternalReferenceDataOffset =
3262 kInstanceClassNameOffset + kPointerSize;
3263 static const int kScriptOffset = kExternalReferenceDataOffset + kPointerSize;
3264 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
3265 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
3266 static const int kCompilerHintsOffset = kInferredNameOffset + kPointerSize;
3267 static const int kThisPropertyAssignmentsOffset =
3268 kCompilerHintsOffset + kPointerSize;
3269 static const int kThisPropertyAssignmentsCountOffset = 3290 static const int kThisPropertyAssignmentsCountOffset =
3270 kThisPropertyAssignmentsOffset + kPointerSize; 3291 kCompilerHintsOffset + kIntSize;
3271 static const int kSize = kThisPropertyAssignmentsCountOffset + kPointerSize; 3292 // Total size.
3293 static const int kSize = kThisPropertyAssignmentsCountOffset + kIntSize;
3272 3294
3273 private: 3295 private:
3274 // Bit positions in length_and_flg.
3275 // The least significant bit is used as the flag.
3276 static const int kFlagBit = 0;
3277 static const int kLengthShift = 1;
3278 static const int kLengthMask = ~((1 << kLengthShift) - 1);
3279
3280 // Bit positions in start_position_and_type. 3296 // Bit positions in start_position_and_type.
3281 // The source code start position is in the 30 most significant bits of 3297 // The source code start position is in the 30 most significant bits of
3282 // the start_position_and_type field. 3298 // the start_position_and_type field.
3283 static const int kIsExpressionBit = 0; 3299 static const int kIsExpressionBit = 0;
3284 static const int kIsTopLevelBit = 1; 3300 static const int kIsTopLevelBit = 1;
3285 static const int kStartPositionShift = 2; 3301 static const int kStartPositionShift = 2;
3286 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 3302 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
3287 3303
3288 // Bit positions in compiler_hints. 3304 // Bit positions in compiler_hints.
3289 static const int kHasOnlySimpleThisPropertyAssignments = 0; 3305 static const int kHasOnlySimpleThisPropertyAssignments = 0;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 Object* PutEval(String* src, Context* context, Object* value); 3689 Object* PutEval(String* src, Context* context, Object* value);
3674 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); 3690 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value);
3675 3691
3676 static inline CompilationCacheTable* cast(Object* obj); 3692 static inline CompilationCacheTable* cast(Object* obj);
3677 3693
3678 private: 3694 private:
3679 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 3695 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
3680 }; 3696 };
3681 3697
3682 3698
3699 class CodeCache: public Struct {
3700 public:
3701 DECL_ACCESSORS(default_cache, FixedArray)
3702 DECL_ACCESSORS(normal_type_cache, Object)
3703
3704 // Add the code object to the cache.
3705 Object* Update(String* name, Code* code);
3706
3707 // Lookup code object in the cache. Returns code object if found and undefined
3708 // if not.
3709 Object* Lookup(String* name, Code::Flags flags);
3710
3711 // Get the internal index of a code object in the cache. Returns -1 if the
3712 // code object is not in that cache. This index can be used to later call
3713 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and
3714 // RemoveByIndex.
3715 int GetIndex(String* name, Code* code);
3716
3717 // Remove an object from the cache with the provided internal index.
3718 void RemoveByIndex(String* name, Code* code, int index);
3719
3720 static inline CodeCache* cast(Object* obj);
3721
3722 #ifdef DEBUG
3723 void CodeCachePrint();
3724 void CodeCacheVerify();
3725 #endif
3726
3727 static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
3728 static const int kNormalTypeCacheOffset =
3729 kDefaultCacheOffset + kPointerSize;
3730 static const int kSize = kNormalTypeCacheOffset + kPointerSize;
3731
3732 private:
3733 Object* UpdateDefaultCache(String* name, Code* code);
3734 Object* UpdateNormalTypeCache(String* name, Code* code);
3735 Object* LookupDefaultCache(String* name, Code::Flags flags);
3736 Object* LookupNormalTypeCache(String* name, Code::Flags flags);
3737
3738 // Code cache layout of the default cache. Elements are alternating name and
3739 // code objects for non normal load/store/call IC's.
3740 static const int kCodeCacheEntrySize = 2;
3741 static const int kCodeCacheEntryNameOffset = 0;
3742 static const int kCodeCacheEntryCodeOffset = 1;
3743
3744 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache);
3745 };
3746
3747
3748 class CodeCacheHashTableShape {
3749 public:
3750 static inline bool IsMatch(HashTableKey* key, Object* value) {
3751 return key->IsMatch(value);
3752 }
3753
3754 static inline uint32_t Hash(HashTableKey* key) {
3755 return key->Hash();
3756 }
3757
3758 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
3759 return key->HashForObject(object);
3760 }
3761
3762 static Object* AsObject(HashTableKey* key) {
3763 return key->AsObject();
3764 }
3765
3766 static const int kPrefixSize = 0;
3767 static const int kEntrySize = 2;
3768 };
3769
3770
3771 class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
3772 HashTableKey*> {
3773 public:
3774 Object* Lookup(String* name, Code::Flags flags);
3775 Object* Put(String* name, Code* code);
3776
3777 int GetIndex(String* name, Code::Flags flags);
3778 void RemoveByIndex(int index);
3779
3780 static inline CodeCacheHashTable* cast(Object* obj);
3781
3782 // Initial size of the fixed array backing the hash table.
3783 static const int kInitialSize = 64;
3784
3785 private:
3786 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
3787 };
3788
3789
3683 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; 3790 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS};
3684 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; 3791 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
3685 3792
3686 3793
3687 class StringHasher { 3794 class StringHasher {
3688 public: 3795 public:
3689 inline StringHasher(int length); 3796 inline StringHasher(int length);
3690 3797
3691 // Returns true if the hash of this string can be computed without 3798 // Returns true if the hash of this string can be computed without
3692 // looking at the contents. 3799 // looking at the contents.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3799 3906
3800 // Get and set individual two byte chars in the string. 3907 // Get and set individual two byte chars in the string.
3801 inline void Set(int index, uint16_t value); 3908 inline void Set(int index, uint16_t value);
3802 // Get individual two byte char in the string. Repeated calls 3909 // Get individual two byte char in the string. Repeated calls
3803 // to this method are not efficient unless the string is flat. 3910 // to this method are not efficient unless the string is flat.
3804 inline uint16_t Get(int index); 3911 inline uint16_t Get(int index);
3805 3912
3806 // Try to flatten the top level ConsString that is hiding behind this 3913 // Try to flatten the top level ConsString that is hiding behind this
3807 // string. This is a no-op unless the string is a ConsString. Flatten 3914 // string. This is a no-op unless the string is a ConsString. Flatten
3808 // mutates the ConsString and might return a failure. 3915 // mutates the ConsString and might return a failure.
3809 Object* TryFlatten(); 3916 Object* SlowTryFlatten(PretenureFlag pretenure);
3810 3917
3811 // Try to flatten the string. Checks first inline to see if it is necessary. 3918 // Try to flatten the string. Checks first inline to see if it is necessary.
3812 // Do not handle allocation failures. After calling TryFlattenIfNotFlat, the 3919 // Do not handle allocation failures. After calling TryFlatten, the
3813 // string could still be a ConsString, in which case a failure is returned. 3920 // string could still be a ConsString, in which case a failure is returned.
3814 // Use FlattenString from Handles.cc to be sure to flatten. 3921 // Use FlattenString from Handles.cc to be sure to flatten.
3815 inline Object* TryFlattenIfNotFlat(); 3922 inline Object* TryFlatten(PretenureFlag pretenure = NOT_TENURED);
3816 3923
3817 Vector<const char> ToAsciiVector(); 3924 Vector<const char> ToAsciiVector();
3818 Vector<const uc16> ToUC16Vector(); 3925 Vector<const uc16> ToUC16Vector();
3819 3926
3820 // Mark the string as an undetectable object. It only applies to 3927 // Mark the string as an undetectable object. It only applies to
3821 // ascii and two byte string types. 3928 // ascii and two byte string types.
3822 bool MarkAsUndetectable(); 3929 bool MarkAsUndetectable();
3823 3930
3824 // Return a substring. 3931 // Return a substring.
3825 Object* SubString(int from, int to); 3932 Object* SubString(int from, int to, PretenureFlag pretenure = NOT_TENURED);
3826 3933
3827 // String equality operations. 3934 // String equality operations.
3828 inline bool Equals(String* other); 3935 inline bool Equals(String* other);
3829 bool IsEqualTo(Vector<const char> str); 3936 bool IsEqualTo(Vector<const char> str);
3830 3937
3831 // Return a UTF8 representation of the string. The string is null 3938 // Return a UTF8 representation of the string. The string is null
3832 // terminated but may optionally contain nulls. Length is returned 3939 // terminated but may optionally contain nulls. Length is returned
3833 // in length_output if length_output is not a null pointer The string 3940 // in length_output if length_output is not a null pointer The string
3834 // should be nearly flat, otherwise the performance of this method may 3941 // should be nearly flat, otherwise the performance of this method may
3835 // be very slow (quadratic in the length). Setting robustness_flag to 3942 // be very slow (quadratic in the length). Setting robustness_flag to
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 }; 4120 };
4014 4121
4015 4122
4016 // The SeqString abstract class captures sequential string values. 4123 // The SeqString abstract class captures sequential string values.
4017 class SeqString: public String { 4124 class SeqString: public String {
4018 public: 4125 public:
4019 4126
4020 // Casting. 4127 // Casting.
4021 static inline SeqString* cast(Object* obj); 4128 static inline SeqString* cast(Object* obj);
4022 4129
4023 // Dispatched behaviour.
4024 // For regexp code.
4025 uint16_t* SeqStringGetTwoByteAddress();
4026
4027 private: 4130 private:
4028 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); 4131 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
4029 }; 4132 };
4030 4133
4031 4134
4032 // The AsciiString class captures sequential ascii string objects. 4135 // The AsciiString class captures sequential ascii string objects.
4033 // Each character in the AsciiString is an ascii character. 4136 // Each character in the AsciiString is an ascii character.
4034 class SeqAsciiString: public SeqString { 4137 class SeqAsciiString: public SeqString {
4035 public: 4138 public:
4036 // Dispatched behavior. 4139 // Dispatched behavior.
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
4949 } else { 5052 } else {
4950 value &= ~(1 << bit_position); 5053 value &= ~(1 << bit_position);
4951 } 5054 }
4952 return value; 5055 return value;
4953 } 5056 }
4954 }; 5057 };
4955 5058
4956 } } // namespace v8::internal 5059 } } // namespace v8::internal
4957 5060
4958 #endif // V8_OBJECTS_H_ 5061 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/number-info.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698