v8对象机制
1.概述
v8中每一个API对象都对应一个内部实现对象(堆对象)
2.对象创建过程
(1)v8::internal::Factory类:创建各种内部对象(v8::internal::)
(2)创建内部对象的内部Handle(v8::internal::Handle),调用
i::Handle::Handle(T* obj)->HandleScope::CreateHandle(obj);
把(T*内部对象指针)放入static HandleScopeData;
(3)把内部句柄转化为API Handle(v8::internal::T**->v8::T*),返回API Handle
---------------------------------------------------------------------------------------------------------------------------------
V8内部类继承层次
Object
| Smi (immediate small integer)
| Failure (immediate for marking failed operation)
| HeapObject (superclass for everything allocated in the heap)
| | JSObject
| | | JSArray
| | | JSRegExp
| | | JSFunction
| | | GlobalObject
| | | | JSGlobalObject
| | | | JSBuiltinsObject
| | | JSGlobalProxy
| | | JSValue
| | ByteArray
| | PixelArray
| | ExternalArray
| | | ExternalByteArray
| | | ExternalUnsignedByteArray
| | | ExternalShortArray
| | | ExternalUnsignedShortArray
| | | ExternalIntArray
| | | ExternalUnsignedIntArray
| | | ExternalFloatArray
| | FixedArray
| | | DescriptorArray
| | | HashTable
| | | | Dictionary
| | | | | StringDictionary
| | | | | NumberDictionary
| | | | SymbolTable
| | | | CompilationCacheTable
| | | | CodeCacheHashTable
| | | | MapCache
| | | Context
| | | JSFunctionResultCache
| | | SerializedScopeInfo
| | String
| | | SeqString
| | | | SeqAsciiString
| | | | SeqTwoByteString
| | | ConsString
| | | ExternalString
| | | | ExternalAsciiString
| | | | ExternalTwoByteString
| | HeapNumber
| | Code
| | Map
| | Oddball
| | Proxy
| | SharedFunctionInfo
| | Struct
| | | AccessorInfo
| | | AccessCheckInfo
| | | InterceptorInfo
| | | CallHandlerInfo
| | | TemplateInfo
| | | | FunctionTemplateInfo
| | | | ObjectTemplateInfo
| | | Script
| | | SignatureInfo
| | | TypeSwitchInfo
| | | DebugInfo
| | | BreakPointInfo
| | | CodeCache