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

Side by Side Diff: src/objects.h

Issue 660086: Revert r3952 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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/heap.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 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
76 // - MapCache 75 // - MapCache
77 // - Context 76 // - Context
78 // - GlobalContext 77 // - GlobalContext
79 // - String 78 // - String
80 // - SeqString 79 // - SeqString
81 // - SeqAsciiString 80 // - SeqAsciiString
82 // - SeqTwoByteString 81 // - SeqTwoByteString
83 // - ConsString 82 // - ConsString
84 // - ExternalString 83 // - ExternalString
85 // - ExternalAsciiString 84 // - ExternalAsciiString
(...skipping 10 matching lines...) Expand all
96 // - InterceptorInfo 95 // - InterceptorInfo
97 // - CallHandlerInfo 96 // - CallHandlerInfo
98 // - TemplateInfo 97 // - TemplateInfo
99 // - FunctionTemplateInfo 98 // - FunctionTemplateInfo
100 // - ObjectTemplateInfo 99 // - ObjectTemplateInfo
101 // - Script 100 // - Script
102 // - SignatureInfo 101 // - SignatureInfo
103 // - TypeSwitchInfo 102 // - TypeSwitchInfo
104 // - DebugInfo 103 // - DebugInfo
105 // - BreakPointInfo 104 // - BreakPointInfo
106 // - CodeCache
107 // 105 //
108 // Formats of Object*: 106 // Formats of Object*:
109 // Smi: [31 bit signed int] 0 107 // Smi: [31 bit signed int] 0
110 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 108 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01
111 // Failure: [30 bit signed int] 11 109 // Failure: [30 bit signed int] 11
112 110
113 // Ecma-262 3rd 8.6.1 111 // Ecma-262 3rd 8.6.1
114 enum PropertyAttributes { 112 enum PropertyAttributes {
115 NONE = v8::None, 113 NONE = v8::None,
116 READ_ONLY = v8::ReadOnly, 114 READ_ONLY = v8::ReadOnly,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 V(ACCESSOR_INFO_TYPE) \ 262 V(ACCESSOR_INFO_TYPE) \
265 V(ACCESS_CHECK_INFO_TYPE) \ 263 V(ACCESS_CHECK_INFO_TYPE) \
266 V(INTERCEPTOR_INFO_TYPE) \ 264 V(INTERCEPTOR_INFO_TYPE) \
267 V(SHARED_FUNCTION_INFO_TYPE) \ 265 V(SHARED_FUNCTION_INFO_TYPE) \
268 V(CALL_HANDLER_INFO_TYPE) \ 266 V(CALL_HANDLER_INFO_TYPE) \
269 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 267 V(FUNCTION_TEMPLATE_INFO_TYPE) \
270 V(OBJECT_TEMPLATE_INFO_TYPE) \ 268 V(OBJECT_TEMPLATE_INFO_TYPE) \
271 V(SIGNATURE_INFO_TYPE) \ 269 V(SIGNATURE_INFO_TYPE) \
272 V(TYPE_SWITCH_INFO_TYPE) \ 270 V(TYPE_SWITCH_INFO_TYPE) \
273 V(SCRIPT_TYPE) \ 271 V(SCRIPT_TYPE) \
274 V(CODE_CACHE_TYPE) \
275 \ 272 \
276 V(JS_VALUE_TYPE) \ 273 V(JS_VALUE_TYPE) \
277 V(JS_OBJECT_TYPE) \ 274 V(JS_OBJECT_TYPE) \
278 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 275 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
279 V(JS_GLOBAL_OBJECT_TYPE) \ 276 V(JS_GLOBAL_OBJECT_TYPE) \
280 V(JS_BUILTINS_OBJECT_TYPE) \ 277 V(JS_BUILTINS_OBJECT_TYPE) \
281 V(JS_GLOBAL_PROXY_TYPE) \ 278 V(JS_GLOBAL_PROXY_TYPE) \
282 V(JS_ARRAY_TYPE) \ 279 V(JS_ARRAY_TYPE) \
283 V(JS_REGEXP_TYPE) \ 280 V(JS_REGEXP_TYPE) \
284 \ 281 \
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // manually. 357 // manually.
361 #define STRUCT_LIST_ALL(V) \ 358 #define STRUCT_LIST_ALL(V) \
362 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ 359 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
363 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 360 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
364 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 361 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
365 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 362 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
366 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 363 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
367 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ 364 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
368 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ 365 V(SIGNATURE_INFO, SignatureInfo, signature_info) \
369 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ 366 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
370 V(SCRIPT, Script, script) \ 367 V(SCRIPT, Script, script)
371 V(CODE_CACHE, CodeCache, code_cache)
372 368
373 #ifdef ENABLE_DEBUGGER_SUPPORT 369 #ifdef ENABLE_DEBUGGER_SUPPORT
374 #define STRUCT_LIST_DEBUGGER(V) \ 370 #define STRUCT_LIST_DEBUGGER(V) \
375 V(DEBUG_INFO, DebugInfo, debug_info) \ 371 V(DEBUG_INFO, DebugInfo, debug_info) \
376 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) 372 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info)
377 #else 373 #else
378 #define STRUCT_LIST_DEBUGGER(V) 374 #define STRUCT_LIST_DEBUGGER(V)
379 #endif 375 #endif
380 376
381 #define STRUCT_LIST(V) \ 377 #define STRUCT_LIST(V) \
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // Structs. 461 // Structs.
466 ACCESSOR_INFO_TYPE, 462 ACCESSOR_INFO_TYPE,
467 ACCESS_CHECK_INFO_TYPE, 463 ACCESS_CHECK_INFO_TYPE,
468 INTERCEPTOR_INFO_TYPE, 464 INTERCEPTOR_INFO_TYPE,
469 CALL_HANDLER_INFO_TYPE, 465 CALL_HANDLER_INFO_TYPE,
470 FUNCTION_TEMPLATE_INFO_TYPE, 466 FUNCTION_TEMPLATE_INFO_TYPE,
471 OBJECT_TEMPLATE_INFO_TYPE, 467 OBJECT_TEMPLATE_INFO_TYPE,
472 SIGNATURE_INFO_TYPE, 468 SIGNATURE_INFO_TYPE,
473 TYPE_SWITCH_INFO_TYPE, 469 TYPE_SWITCH_INFO_TYPE,
474 SCRIPT_TYPE, 470 SCRIPT_TYPE,
475 CODE_CACHE_TYPE,
476 #ifdef ENABLE_DEBUGGER_SUPPORT 471 #ifdef ENABLE_DEBUGGER_SUPPORT
477 DEBUG_INFO_TYPE, 472 DEBUG_INFO_TYPE,
478 BREAK_POINT_INFO_TYPE, 473 BREAK_POINT_INFO_TYPE,
479 #endif 474 #endif
480 475
481 FIXED_ARRAY_TYPE, 476 FIXED_ARRAY_TYPE,
482 SHARED_FUNCTION_INFO_TYPE, 477 SHARED_FUNCTION_INFO_TYPE,
483 478
484 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE 479 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
485 JS_OBJECT_TYPE, 480 JS_OBJECT_TYPE,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 inline bool IsJSValue(); 594 inline bool IsJSValue();
600 inline bool IsStringWrapper(); 595 inline bool IsStringWrapper();
601 inline bool IsProxy(); 596 inline bool IsProxy();
602 inline bool IsBoolean(); 597 inline bool IsBoolean();
603 inline bool IsJSArray(); 598 inline bool IsJSArray();
604 inline bool IsJSRegExp(); 599 inline bool IsJSRegExp();
605 inline bool IsHashTable(); 600 inline bool IsHashTable();
606 inline bool IsDictionary(); 601 inline bool IsDictionary();
607 inline bool IsSymbolTable(); 602 inline bool IsSymbolTable();
608 inline bool IsCompilationCacheTable(); 603 inline bool IsCompilationCacheTable();
609 inline bool IsCodeCacheHashTable();
610 inline bool IsMapCache(); 604 inline bool IsMapCache();
611 inline bool IsPrimitive(); 605 inline bool IsPrimitive();
612 inline bool IsGlobalObject(); 606 inline bool IsGlobalObject();
613 inline bool IsJSGlobalObject(); 607 inline bool IsJSGlobalObject();
614 inline bool IsJSBuiltinsObject(); 608 inline bool IsJSBuiltinsObject();
615 inline bool IsJSGlobalProxy(); 609 inline bool IsJSGlobalProxy();
616 inline bool IsUndetectableObject(); 610 inline bool IsUndetectableObject();
617 inline bool IsAccessCheckNeeded(); 611 inline bool IsAccessCheckNeeded();
618 inline bool IsJSGlobalPropertyCell(); 612 inline bool IsJSGlobalPropertyCell();
619 613
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 // [prototype]: implicit prototype object. 2915 // [prototype]: implicit prototype object.
2922 DECL_ACCESSORS(prototype, Object) 2916 DECL_ACCESSORS(prototype, Object)
2923 2917
2924 // [constructor]: points back to the function responsible for this map. 2918 // [constructor]: points back to the function responsible for this map.
2925 DECL_ACCESSORS(constructor, Object) 2919 DECL_ACCESSORS(constructor, Object)
2926 2920
2927 // [instance descriptors]: describes the object. 2921 // [instance descriptors]: describes the object.
2928 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 2922 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
2929 2923
2930 // [stub cache]: contains stubs compiled for this map. 2924 // [stub cache]: contains stubs compiled for this map.
2931 DECL_ACCESSORS(code_cache, Object) 2925 DECL_ACCESSORS(code_cache, FixedArray)
2932 2926
2933 Object* CopyDropDescriptors(); 2927 Object* CopyDropDescriptors();
2934 2928
2935 // Returns a copy of the map, with all transitions dropped from the 2929 // Returns a copy of the map, with all transitions dropped from the
2936 // instance descriptors. 2930 // instance descriptors.
2937 Object* CopyDropTransitions(); 2931 Object* CopyDropTransitions();
2938 2932
2939 // Returns the property index for name (only valid for FAST MODE). 2933 // Returns the property index for name (only valid for FAST MODE).
2940 int PropertyIndexFor(String* name); 2934 int PropertyIndexFor(String* name);
2941 2935
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 static const int kHasNamedInterceptor = 3; 3019 static const int kHasNamedInterceptor = 3;
3026 static const int kHasIndexedInterceptor = 4; 3020 static const int kHasIndexedInterceptor = 4;
3027 static const int kIsUndetectable = 5; 3021 static const int kIsUndetectable = 5;
3028 static const int kHasInstanceCallHandler = 6; 3022 static const int kHasInstanceCallHandler = 6;
3029 static const int kIsAccessCheckNeeded = 7; 3023 static const int kIsAccessCheckNeeded = 7;
3030 3024
3031 // Bit positions for bit field 2 3025 // Bit positions for bit field 2
3032 static const int kNeedsLoading = 0; 3026 static const int kNeedsLoading = 0;
3033 static const int kIsExtensible = 1; 3027 static const int kIsExtensible = 1;
3034 3028
3035 // Layout of the default cache. It holds alternating name and code objects.
3036 static const int kCodeCacheEntrySize = 2;
3037 static const int kCodeCacheEntryNameOffset = 0;
3038 static const int kCodeCacheEntryCodeOffset = 1;
3039
3040 private: 3029 private:
3041 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3030 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3042 }; 3031 };
3043 3032
3044 3033
3045 // An abstract superclass, a marker class really, for simple structure classes. 3034 // An abstract superclass, a marker class really, for simple structure classes.
3046 // It doesn't carry much functionality but allows struct classes to me 3035 // It doesn't carry much functionality but allows struct classes to me
3047 // identified in the type system. 3036 // identified in the type system.
3048 class Struct: public HeapObject { 3037 class Struct: public HeapObject {
3049 public: 3038 public:
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 Object* PutEval(String* src, Context* context, Object* value); 3704 Object* PutEval(String* src, Context* context, Object* value);
3716 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); 3705 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value);
3717 3706
3718 static inline CompilationCacheTable* cast(Object* obj); 3707 static inline CompilationCacheTable* cast(Object* obj);
3719 3708
3720 private: 3709 private:
3721 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 3710 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
3722 }; 3711 };
3723 3712
3724 3713
3725 class CodeCache: public Struct {
3726 public:
3727 DECL_ACCESSORS(default_cache, FixedArray)
3728 DECL_ACCESSORS(normal_type_cache, Object)
3729
3730 // Add the code object to the cache.
3731 Object* Update(String* name, Code* code);
3732
3733 // Lookup code object in the cache. Returns code object if found.
3734 Object* Lookup(String* name, Code::Flags flags);
3735
3736 // Get the internal index of a code object in the cache. Returns -1 if the
3737 // code object is not in that cache. This index can be used to later call
3738 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and
3739 // RemoveByIndex.
3740 int GetIndex(Code* code);
3741
3742 // Remove an object from the cache with the provided internal index.
3743 void RemoveByIndex(int index);
3744
3745 static inline CodeCache* cast(Object* obj);
3746
3747 #ifdef DEBUG
3748 void CodeCachePrint();
3749 void CodeCacheVerify();
3750 #endif
3751
3752 static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
3753 static const int kNormalTypeCacheOffset =
3754 kDefaultCacheOffset + kPointerSize;
3755 static const int kSize = kNormalTypeCacheOffset + kPointerSize;
3756
3757 private:
3758 Object* UpdateDefaultCache(String* name, Code* code);
3759 Object* UpdateNormalTypeCache(String* name, Code* code);
3760 Object* LookupDefaultCache(String* name, Code::Flags flags);
3761 Object* LookupNormalTypeCache(String* name, Code::Flags flags);
3762
3763 // Code cache layout of the default cache. Elements are alternating name and
3764 // code objects for non normal load/store/call IC's.
3765 static const int kCodeCacheEntrySize = 2;
3766 static const int kCodeCacheEntryNameOffset = 0;
3767 static const int kCodeCacheEntryCodeOffset = 1;
3768
3769 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache);
3770 };
3771
3772
3773 class CodeCacheHashTableShape {
3774 public:
3775 static inline bool IsMatch(HashTableKey* key, Object* value) {
3776 return key->IsMatch(value);
3777 }
3778
3779 static inline uint32_t Hash(HashTableKey* key) {
3780 return key->Hash();
3781 }
3782
3783 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
3784 return key->HashForObject(object);
3785 }
3786
3787 static Object* AsObject(HashTableKey* key) {
3788 return key->AsObject();
3789 }
3790
3791 static const int kPrefixSize = 0;
3792 static const int kEntrySize = 2;
3793 };
3794
3795
3796 class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
3797 HashTableKey*> {
3798 public:
3799 Object* Lookup(String* name, Code::Flags flags);
3800 Object* Put(String* name, Code* code);
3801
3802 static inline CodeCacheHashTable* cast(Object* obj);
3803
3804 // Initial size of the fixed array backing the hash table.
3805 static const int kInitialSize = 64;
3806
3807 private:
3808 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
3809 };
3810
3811
3812 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; 3714 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS};
3813 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; 3715 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
3814 3716
3815 3717
3816 class StringHasher { 3718 class StringHasher {
3817 public: 3719 public:
3818 inline StringHasher(int length); 3720 inline StringHasher(int length);
3819 3721
3820 // Returns true if the hash of this string can be computed without 3722 // Returns true if the hash of this string can be computed without
3821 // looking at the contents. 3723 // looking at the contents.
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
5074 } else { 4976 } else {
5075 value &= ~(1 << bit_position); 4977 value &= ~(1 << bit_position);
5076 } 4978 }
5077 return value; 4979 return value;
5078 } 4980 }
5079 }; 4981 };
5080 4982
5081 } } // namespace v8::internal 4983 } } // namespace v8::internal
5082 4984
5083 #endif // V8_OBJECTS_H_ 4985 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698