1 /** Copyright Joyent, Inc. and other Node contributors. 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a 4 * copy of this software and associated documentation files (the 5 * "Software"), to deal in the Software without restriction, including 6 * without limitation the rights to use, copy, modify, merge, publish, 7 * distribute, sublicense, and/or sell copies of the Software, and to permit 8 * persons to whom the Software is furnished to do so, subject to the 9 * following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 * USE OR OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 /* 24 * This header defines short names for V8 constants for use by the ustack 25 * helper. 26 */ 27 28 #ifndef SRC_V8ABBR_H_ 29 #define SRC_V8ABBR_H_ 30 31 /* Frame pointer offsets */ 32 #define V8_OFF_FP_FUNC V8DBG_OFF_FP_FUNCTION 33 #define V8_OFF_FP_CONTEXT V8DBG_OFF_FP_CONTEXT 34 #define V8_OFF_FP_MARKER V8DBG_OFF_FP_MARKER 35 36 /* Stack frame types */ 37 #define V8_FT_ENTRY V8DBG_FRAMETYPE_ENTRYFRAME 38 #define V8_FT_ENTRYCONSTRUCT V8DBG_FRAMETYPE_CONSTRUCTENTRYFRAME 39 #define V8_FT_EXIT V8DBG_FRAMETYPE_EXITFRAME 40 #define V8_FT_JAVASCRIPT V8DBG_FRAMETYPE_JAVASCRIPTFRAME 41 #define V8_FT_OPTIMIZED V8DBG_FRAMETYPE_OPTIMIZEDFRAME 42 #define V8_FT_INTERNAL V8DBG_FRAMETYPE_INTERNALFRAME 43 #define V8_FT_CONSTRUCT V8DBG_FRAMETYPE_CONSTRUCTFRAME 44 #define V8_FT_ADAPTOR V8DBG_FRAMETYPE_ARGUMENTSADAPTORFRAME 45 #define V8_FT_STUB V8DBG_FRAMETYPE_STUBFRAME 46 47 /* Identification masks and tags */ 48 #define V8_SmiTagMask (V8DBG_SMITAGMASK) 49 #define V8_SmiTag (V8DBG_SMITAG) 50 #define V8_SmiValueShift (V8DBG_SMISHIFTSIZE + V8DBG_SMITAGMASK) 51 52 #define V8_HeapObjectTagMask V8DBG_HEAPOBJECTTAGMASK 53 #define V8_HeapObjectTag V8DBG_HEAPOBJECTTAG 54 55 #define V8_IsNotStringMask V8DBG_ISNOTSTRINGMASK 56 #define V8_StringTag V8DBG_STRINGTAG 57 58 #define V8_StringEncodingMask V8DBG_STRINGENCODINGMASK 59 #define V8_AsciiStringTag V8DBG_ONEBYTESTRINGTAG 60 61 #define V8_StringRepresentationMask V8DBG_STRINGREPRESENTATIONMASK 62 #define V8_SeqStringTag V8DBG_SEQSTRINGTAG 63 #define V8_ConsStringTag V8DBG_CONSSTRINGTAG 64 #define V8_ExternalStringTag V8DBG_EXTERNALSTRINGTAG 65 66 /* Instance types */ 67 #define V8_IT_FIXEDARRAY V8DBG_TYPE_FIXEDARRAY__FIXED_ARRAY_TYPE 68 #define V8_IT_CODE V8DBG_TYPE_CODE__CODE_TYPE 69 #define V8_IT_SCRIPT V8DBG_TYPE_SCRIPT__SCRIPT_TYPE 70 71 /* Node-specific offsets */ 72 #define NODE_OFF_EXTSTR_DATA sizeof(void*) 73 74 /* 75 * Not all versions of V8 have the offset for the "chars" array in the 76 * SeqTwoByteString class, but it's the same as the one for SeqOneByteString. 77 */ 78 #ifndef V8DBG_CLASS_SEQTWOBYTESTRING__CHARS__CHAR 79 #define V8DBG_CLASS_SEQTWOBYTESTRING__CHARS__CHAR \ 80 V8DBG_CLASS_SEQONEBYTESTRING__CHARS__CHAR 81 #endif 82 83 /* Heap class->field offsets */ 84 #define V8_OFF_HEAP(off) ((off) - 1) 85 86 #define V8_OFF_FUNC_SHARED \ 87 V8_OFF_HEAP(V8DBG_CLASS_JSFUNCTION__SHARED__SHAREDFUNCTIONINFO) 88 #define V8_OFF_RAW_NAME \ 89 V8_OFF_HEAP(V8DBG_CLASS_SHAREDFUNCTIONINFO__NAME_OR_SCOPE_INFO__OBJECT) 90 #define V8_OFF_SHARED_IDENT \ 91 V8_OFF_HEAP( \ 92 V8DBG_CLASS_SHAREDFUNCTIONINFO__NAME_OR_SCOPE_INFO__OBJECT) 93 #define V8_OFF_SHARED_SCRIPT \ 94 V8_OFF_HEAP( \ 95 V8DBG_CLASS_SHAREDFUNCTIONINFO__SCRIPT_OR_DEBUG_INFO__HEAPOBJECT) 96 #define V8_OFF_SHARED_FUNIDENT \ 97 V8_OFF_HEAP( \ 98 V8DBG_CLASS_SHAREDFUNCTIONINFO__NAME_OR_SCOPE_INFO__OBJECT) 99 #define V8_OFF_SCRIPT_NAME \ 100 V8_OFF_HEAP(V8DBG_CLASS_SCRIPT__NAME__OBJECT) 101 #define V8_OFF_SCRIPT_LENDS \ 102 V8_OFF_HEAP(V8DBG_CLASS_SCRIPT__LINE_ENDS__OBJECT) 103 #define V8_OFF_STR_LENGTH \ 104 V8_OFF_HEAP(V8DBG_CLASS_STRING__LENGTH__INT32_T) 105 #define V8_OFF_STR_CHARS \ 106 V8_OFF_HEAP(V8DBG_CLASS_SEQONEBYTESTRING__CHARS__CHAR) 107 #define V8_OFF_CONSSTR_CAR \ 108 V8_OFF_HEAP(V8DBG_CLASS_CONSSTRING__FIRST__STRING) 109 #define V8_OFF_CONSSTR_CDR \ 110 V8_OFF_HEAP(V8DBG_CLASS_CONSSTRING__SECOND__STRING) 111 #define V8_OFF_EXTSTR_RSRC \ 112 V8_OFF_HEAP(V8DBG_CLASS_EXTERNALSTRING__RESOURCE__OBJECT) 113 #define V8_OFF_FA_SIZE \ 114 V8_OFF_HEAP(V8DBG_CLASS_FIXEDARRAYBASE__LENGTH__SMI) 115 #define V8_OFF_FA_DATA \ 116 V8_OFF_HEAP(V8DBG_CLASS_FIXEDARRAY__DATA__UINTPTR_T) 117 #define V8_OFF_HEAPOBJ_MAP \ 118 V8_OFF_HEAP(V8DBG_CLASS_HEAPOBJECT__MAP__MAP) 119 #define V8_OFF_MAP_ATTRS \ 120 V8_OFF_HEAP(V8DBG_CLASS_MAP__INSTANCE_TYPE__UINT16_T) 121 #define V8_OFF_TWOBYTESTR_CHARS \ 122 V8_OFF_HEAP(V8DBG_CLASS_SEQTWOBYTESTRING__CHARS__CHAR) 123 124 #endif /* SRC_V8ABBR_H_ */ 125