📄 objects.h.svn-base
字号:
short_sliced_ascii_string) \ V(MEDIUM_SLICED_ASCII_STRING_TYPE, \ SlicedString::kSize, \ medium_sliced_ascii_string) \ V(LONG_SLICED_ASCII_STRING_TYPE, \ SlicedString::kSize, \ long_sliced_ascii_string) \ V(SHORT_EXTERNAL_STRING_TYPE, \ ExternalTwoByteString::kSize, \ short_external_string) \ V(MEDIUM_EXTERNAL_STRING_TYPE, \ ExternalTwoByteString::kSize, \ medium_external_string) \ V(LONG_EXTERNAL_STRING_TYPE, \ ExternalTwoByteString::kSize, \ long_external_string) \ V(SHORT_EXTERNAL_ASCII_STRING_TYPE, \ ExternalAsciiString::kSize, \ short_external_ascii_string) \ V(MEDIUM_EXTERNAL_ASCII_STRING_TYPE, \ ExternalAsciiString::kSize, \ medium_external_ascii_string) \ V(LONG_EXTERNAL_ASCII_STRING_TYPE, \ ExternalAsciiString::kSize, \ long_external_ascii_string)// A struct is a simple object a set of object-valued fields. Including an// object type in this causes the compiler to generate most of the boilerplate// code for the class including allocation and garbage collection routines,// casts and predicates. All you need to define is the class, methods and// object verification routines. Easy, no?//// Note that for subtle reasons related to the ordering or numerical values of// type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST// manually.#define STRUCT_LIST(V) \ V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ V(SIGNATURE_INFO, SignatureInfo, signature_info) \ V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ V(DEBUG_INFO, DebugInfo, debug_info) \ V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ V(SCRIPT, Script, script)// We use the full 8 bits of the instance_type field to encode heap object// instance types. The high-order bit (bit 7) is set if the object is not a// string, and cleared if it is a string.const uint32_t kIsNotStringMask = 0x80;const uint32_t kStringTag = 0x0;const uint32_t kNotStringTag = 0x80;// If bit 7 is clear, bits 5 and 6 are the string's size (short, medium, or// long).const uint32_t kStringSizeMask = 0x60;const uint32_t kShortStringTag = 0x0;const uint32_t kMediumStringTag = 0x20;const uint32_t kLongStringTag = 0x40;// If bit 7 is clear, bit 4 indicates that the string is a symbol (if set) or// not (if cleared).const uint32_t kIsSymbolMask = 0x10;const uint32_t kNotSymbolTag = 0x0;const uint32_t kSymbolTag = 0x10;// If bit 7 is clear, and the string representation is a sequential string,// then bit 3 indicates whether the string consists of two-byte characters or// one-byte characters.const uint32_t kStringEncodingMask = 0x8;const uint32_t kTwoByteStringTag = 0x0;const uint32_t kAsciiStringTag = 0x8;// If bit 7 is clear, the low-order 3 bits indicate the representation// of the string.const uint32_t kStringRepresentationMask = 0x07;enum StringRepresentationTag { kSeqStringTag = 0x0, kConsStringTag = 0x1, kSlicedStringTag = 0x2, kExternalStringTag = 0x3};enum InstanceType { SHORT_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kSeqStringTag, MEDIUM_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kSeqStringTag, LONG_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kSeqStringTag, SHORT_ASCII_SYMBOL_TYPE = kShortStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, MEDIUM_ASCII_SYMBOL_TYPE = kMediumStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, LONG_ASCII_SYMBOL_TYPE = kLongStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, SHORT_CONS_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kConsStringTag, MEDIUM_CONS_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kConsStringTag, LONG_CONS_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kConsStringTag, SHORT_CONS_ASCII_SYMBOL_TYPE = kShortStringTag | kAsciiStringTag | kSymbolTag | kConsStringTag, MEDIUM_CONS_ASCII_SYMBOL_TYPE = kMediumStringTag | kAsciiStringTag | kSymbolTag | kConsStringTag, LONG_CONS_ASCII_SYMBOL_TYPE = kLongStringTag | kAsciiStringTag | kSymbolTag | kConsStringTag, SHORT_SLICED_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kSlicedStringTag, MEDIUM_SLICED_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kSlicedStringTag, LONG_SLICED_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kSlicedStringTag, SHORT_SLICED_ASCII_SYMBOL_TYPE = kShortStringTag | kAsciiStringTag | kSymbolTag | kSlicedStringTag, MEDIUM_SLICED_ASCII_SYMBOL_TYPE = kMediumStringTag | kAsciiStringTag | kSymbolTag | kSlicedStringTag, LONG_SLICED_ASCII_SYMBOL_TYPE = kLongStringTag | kAsciiStringTag | kSymbolTag | kSlicedStringTag, SHORT_EXTERNAL_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kExternalStringTag, MEDIUM_EXTERNAL_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kExternalStringTag, LONG_EXTERNAL_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kExternalStringTag, SHORT_EXTERNAL_ASCII_SYMBOL_TYPE = kShortStringTag | kAsciiStringTag | kSymbolTag | kExternalStringTag, MEDIUM_EXTERNAL_ASCII_SYMBOL_TYPE = kMediumStringTag | kAsciiStringTag | kSymbolTag | kExternalStringTag, LONG_EXTERNAL_ASCII_SYMBOL_TYPE = kLongStringTag | kAsciiStringTag | kSymbolTag | kExternalStringTag, SHORT_STRING_TYPE = kShortStringTag | kSeqStringTag, MEDIUM_STRING_TYPE = kMediumStringTag | kSeqStringTag, LONG_STRING_TYPE = kLongStringTag | kSeqStringTag, SHORT_ASCII_STRING_TYPE = kShortStringTag | kAsciiStringTag | kSeqStringTag, MEDIUM_ASCII_STRING_TYPE = kMediumStringTag | kAsciiStringTag | kSeqStringTag, LONG_ASCII_STRING_TYPE = kLongStringTag | kAsciiStringTag | kSeqStringTag, SHORT_CONS_STRING_TYPE = kShortStringTag | kConsStringTag, MEDIUM_CONS_STRING_TYPE = kMediumStringTag | kConsStringTag, LONG_CONS_STRING_TYPE = kLongStringTag | kConsStringTag, SHORT_CONS_ASCII_STRING_TYPE = kShortStringTag | kAsciiStringTag | kConsStringTag, MEDIUM_CONS_ASCII_STRING_TYPE = kMediumStringTag | kAsciiStringTag | kConsStringTag, LONG_CONS_ASCII_STRING_TYPE = kLongStringTag | kAsciiStringTag | kConsStringTag, SHORT_SLICED_STRING_TYPE = kShortStringTag | kSlicedStringTag, MEDIUM_SLICED_STRING_TYPE = kMediumStringTag | kSlicedStringTag, LONG_SLICED_STRING_TYPE = kLongStringTag | kSlicedStringTag, SHORT_SLICED_ASCII_STRING_TYPE = kShortStringTag | kAsciiStringTag | kSlicedStringTag, MEDIUM_SLICED_ASCII_STRING_TYPE = kMediumStringTag | kAsciiStringTag | kSlicedStringTag, LONG_SLICED_ASCII_STRING_TYPE = kLongStringTag | kAsciiStringTag | kSlicedStringTag, SHORT_EXTERNAL_STRING_TYPE = kShortStringTag | kExternalStringTag, MEDIUM_EXTERNAL_STRING_TYPE = kMediumStringTag | kExternalStringTag, LONG_EXTERNAL_STRING_TYPE = kLongStringTag | kExternalStringTag, SHORT_EXTERNAL_ASCII_STRING_TYPE = kShortStringTag | kAsciiStringTag | kExternalStringTag, MEDIUM_EXTERNAL_ASCII_STRING_TYPE = kMediumStringTag | kAsciiStringTag | kExternalStringTag, LONG_EXTERNAL_ASCII_STRING_TYPE = kLongStringTag | kAsciiStringTag | kExternalStringTag, LONG_PRIVATE_EXTERNAL_ASCII_STRING_TYPE = LONG_EXTERNAL_ASCII_STRING_TYPE, MAP_TYPE = kNotStringTag, HEAP_NUMBER_TYPE, FIXED_ARRAY_TYPE, CODE_TYPE, ODDBALL_TYPE, PROXY_TYPE, BYTE_ARRAY_TYPE, FILLER_TYPE, SMI_TYPE, ACCESSOR_INFO_TYPE, ACCESS_CHECK_INFO_TYPE, INTERCEPTOR_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, CALL_HANDLER_INFO_TYPE, FUNCTION_TEMPLATE_INFO_TYPE, OBJECT_TEMPLATE_INFO_TYPE, SIGNATURE_INFO_TYPE, TYPE_SWITCH_INFO_TYPE, DEBUG_INFO_TYPE, BREAK_POINT_INFO_TYPE, SCRIPT_TYPE, JS_VALUE_TYPE, JS_OBJECT_TYPE, JS_GLOBAL_OBJECT_TYPE, JS_BUILTINS_OBJECT_TYPE, JS_ARRAY_TYPE, JS_REGEXP_TYPE, JS_FUNCTION_TYPE, // Pseudo-types FIRST_NONSTRING_TYPE = MAP_TYPE, FIRST_TYPE = 0x0, LAST_TYPE = JS_FUNCTION_TYPE, // Boundaries for testing the type is a JavaScript "object". Note that // function objects are not counted as objects, even though they are // implemented as such; only values whose typeof is "object" are included. FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE};enum CompareResult { LESS = -1, EQUAL = 0, GREATER = 1, NOT_EQUAL = GREATER};#define DECL_BOOLEAN_ACCESSORS(name) \ inline bool name(); \ inline void set_##name(bool value); \#define DECL_ACCESSORS(name, type) \ inline type* name(); \ inline void set_##name(type* value);class StringStream;class ObjectVisitor;struct ValueInfo : public Malloced { ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } InstanceType type; Object* ptr; const char* str; double number;};// A template-ized version of the IsXXX functions.template <class C> static inline bool Is(Object* obj);// Object is the abstract superclass for all classes in the// object hierarchy.// Object does not use any virtual functions to avoid the// allocation of the C++ vtable.// Since Smi and Failure are subclasses of Object no// data members can be present in Object.class Object BASE_EMBEDDED { public: // Type testing. inline bool IsSmi(); inline bool IsHeapObject(); inline bool IsHeapNumber(); inline bool IsString(); inline bool IsSeqString(); inline bool IsAsciiString(); inline bool IsTwoByteString(); inline bool IsConsString(); inline bool IsSlicedString(); inline bool IsExternalString(); inline bool IsExternalAsciiString(); inline bool IsExternalTwoByteString(); inline bool IsShortString(); inline bool IsMediumString(); inline bool IsLongString(); inline bool IsSymbol(); inline bool IsNumber(); inline bool IsByteArray(); inline bool IsFailure(); inline bool IsRetryAfterGC(); inline bool IsException(); inline bool IsJSObject(); inline bool IsMap(); inline bool IsFixedArray(); inline bool IsDescriptorArray(); inline bool IsContext(); inline bool IsGlobalContext(); inline bool IsJSFunction(); inline bool IsCode(); inline bool IsOddball(); inline bool IsSharedFunctionInfo(); inline bool IsJSValue(); inline bool IsProxy(); inline bool IsBoolean(); inline bool IsJSArray(); inline bool IsJSRegExp(); inline bool IsHashTable(); inline bool IsDictionary(); inline bool IsSymbolTable(); inline bool IsCompilationCacheTable(); inline bool IsMapCache(); inline bool IsPrimitive(); inline bool IsGlobalObject(); inline bool IsJSGlobalObject(); inline bool IsJSBuiltinsObject(); inline bool IsUndetectableObject(); inline bool IsAccessCheckNeeded(); // Returns true if this object is an instance of the specified // function template. bool IsInstanceOf(FunctionTemplateInfo* type); inline bool IsStruct();#define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); STRUCT_LIST(DECLARE_STRUCT_PREDICATE)#undef DECLARE_STRUCT_PREDICATE // Oddball testing. INLINE(bool IsUndefined()); INLINE(bool IsTheHole()); INLINE(bool IsNull()); INLINE(bool IsTrue()); INLINE(bool IsFalse()); // Extract the number. inline double Number(); Object* ToObject(); // ECMA-262 9.9. Object* ToBoolean(); // ECMA-262 9.2. // Convert to a JSObject if needed. // global_context is used when creating wrapper object. Object* ToObject(Context* global_context); // Converts this to a Smi if possible. // Failure is returned otherwise. inline Object* ToSmi(); void Lookup(String* name, LookupResult* result); // Property access. inline Object* GetProperty(String* key); inline Object* GetProperty(String* key, PropertyAttributes* attributes); Object* GetPropertyWithReceiver(Object* receiver, String* key,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -