13 #include <v8constants.h> 20 #define IS_SMI(value) \ 21 ((value & V8_SmiTagMask) == V8_SmiTag) 22 #define SMI_VALUE(value) \ 23 ((uint32_t) ((value) >> V8_SmiValueShift)) 31 #define V8_MAP_PTR(ptr) \ 32 ((ptr & ~V8_HeapObjectTagMask) | V8_HeapObjectTag) 34 #define V8_TYPE_SCRIPT(type) \ 35 ((type) == V8_IT_SCRIPT) 40 #define V8_TYPE_STRING(type) \ 41 (((type) & V8_IsNotStringMask) == V8_StringTag) 43 #define V8_STRENC_ASCII(type) \ 44 (((type) & V8_StringEncodingMask) == V8_AsciiStringTag) 46 #define V8_STRREP_SEQ(type) \ 47 (((type) & V8_StringRepresentationMask) == V8_SeqStringTag) 48 #define V8_STRREP_CONS(type) \ 49 (((type) & V8_StringRepresentationMask) == V8_ConsStringTag) 50 #define V8_STRREP_EXT(type) \ 51 (((type) & V8_StringRepresentationMask) == V8_ExternalStringTag) 56 #define ASCII_SEQSTR(value) \ 57 (V8_TYPE_STRING(value) && V8_STRENC_ASCII(value) && V8_STRREP_SEQ(value)) 59 #define TWOBYTE_SEQSTR(value) \ 60 (V8_TYPE_STRING(value) && !V8_STRENC_ASCII(value) && V8_STRREP_SEQ(value)) 62 #define IS_CONSSTR(value) \ 63 (V8_TYPE_STRING(value) && V8_STRREP_CONS(value)) 65 #define ASCII_EXTSTR(value) \ 66 (V8_TYPE_STRING(value) && V8_STRENC_ASCII(value) && V8_STRREP_EXT(value)) 71 #define COPYIN_UINT8(addr) (*(uint8_t*) copyin((addr), sizeof(uint8_t))) 72 #define COPYIN_UINT32(addr) (*(uint32_t*) copyin((addr), sizeof(uint32_t))) 73 #define COPYIN_UINT64(addr) (*(uint64_t*) copyin((addr), sizeof(uint64_t))) 76 # define COPYIN_PTR(addr) COPYIN_UINT32(addr) 77 # define off_t uint32_t 78 # define APPEND_PTR(p) APPEND_PTR_32(p) 80 # define COPYIN_PTR(addr) COPYIN_UINT64(addr) 81 # define off_t uint64_t 82 # define APPEND_PTR(p) APPEND_PTR_64(p) 85 #define APPEND_CHR(c) (this->buf[this->off++] = (c)) 86 #define APPEND_CHR4(s0, s1, s2, s3) \ 91 #define APPEND_CHR8(s0, s1, s2, s3, s4, s5, s6, s7) \ 92 APPEND_CHR4(s0, s1, s2, s3) \ 93 APPEND_CHR4(s4, s5, s6, s7) 95 #define APPEND_DGT(i, d) \ 96 (((i) / (d)) ? APPEND_CHR('0' + ((i)/(d) % 10)) : 0) 98 #define APPEND_NUM(i) \ 99 APPEND_DGT((i), 100000); \ 100 APPEND_DGT((i), 10000); \ 101 APPEND_DGT((i), 1000); \ 102 APPEND_DGT((i), 100); \ 103 APPEND_DGT((i), 10); \ 106 #define APPEND_HEX(d) \ 107 APPEND_CHR((d) < 10 ? '0' + (d) : 'a' - 10 + (d)) 109 #define APPEND_PTR_32(p) \ 110 APPEND_HEX((p >> 28) & 0xf); \ 111 APPEND_HEX((p >> 24) & 0xf); \ 112 APPEND_HEX((p >> 20) & 0xf); \ 113 APPEND_HEX((p >> 16) & 0xf); \ 114 APPEND_HEX((p >> 12) & 0xf); \ 115 APPEND_HEX((p >> 8) & 0xf); \ 116 APPEND_HEX((p >> 4) & 0xf); \ 117 APPEND_HEX((p) & 0xf); 119 #define APPEND_PTR_64(p) \ 120 APPEND_PTR_32(p >> 32) \ 147 #define LOAD_STRFIELDS(str, len, attrs) \ 148 len = SMI_VALUE(COPYIN_PTR(str + V8_OFF_STR_LENGTH)); \ 149 this->map = V8_MAP_PTR(COPYIN_PTR(str + V8_OFF_HEAPOBJ_MAP)); \ 150 attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS); 152 #define APPEND_SEQSTR(str, len, attrs) \ 153 APPEND_SEQONEBYTESTR(str, len, attrs) \ 154 APPEND_SEQTWOBYTESTR(str, len, attrs) 160 #define APPEND_SEQONEBYTESTR(str, len, attrs) \ 161 dtrace:helper:ustack: \ 162 /!this->done && len > 0 && ASCII_SEQSTR(attrs)/ \ 164 copyinto(str + V8_OFF_STR_CHARS, len, this->buf + this->off); \ 175 #define LOOP_ITER(ivar, dynmax, statmax, block) \ 176 ((ivar) < (dynmax)) && ((ivar) < (statmax)) && (block); (ivar)++; 178 #define LOOP_4(block) \ 184 #define LOOP_8(block) \ 193 #define MAX_TWOBYTESTR_CHARS 128 194 #define MAX_TWOBYTESTR_BYTES (2 * MAX_TWOBYTESTR_CHARS) 195 #define TO_ASCII(c) ((c) < 128 ? (c) : '?') 197 #define APPEND_SEQTWOBYTESTR(str, len, attrs) \ 198 dtrace:helper:ustack: \ 199 /!this->done && len > 0 && TWOBYTE_SEQSTR(attrs)/ \ 202 this->stbuf = (uint16_t *)alloca(MAX_TWOBYTESTR_BYTES + 2); \ 203 copyinto(str + V8_OFF_TWOBYTESTR_CHARS, \ 204 MAX_TWOBYTESTR_BYTES, this->stbuf); \ 205 this->stbuf[MAX_TWOBYTESTR_BYTES - 1] = '\0'; \ 206 this->stbuf[MAX_TWOBYTESTR_BYTES] = '\0'; \ 208 LOOP_8(LOOP_8(LOOP_4(LOOP_ITER(this->i, len, \ 209 MAX_TWOBYTESTR_CHARS, \ 210 APPEND_CHR(TO_ASCII(this->stbuf[this->i])))))) \ 220 #define APPEND_NODESTR(str, len, attrs) \ 221 dtrace:helper:ustack: \ 222 /!this->done && len > 0 && ASCII_EXTSTR(attrs)/ \ 224 this->resource = COPYIN_PTR(str + V8_OFF_EXTSTR_RSRC); \ 225 this->dataptr = COPYIN_PTR(this->resource + NODE_OFF_EXTSTR_DATA); \ 226 copyinto(this->dataptr, len, this->buf + this->off); \ 259 #define EXPAND_START() \ 260 dtrace:helper:ustack: \ 263 this->s0str = this->s1str = this->s2str = (off_t) 0; \ 264 this->s3str = this->s4str = this->s5str = (off_t) 0; \ 265 this->s6str = this->s7str = this->s8str = (off_t) 0; \ 266 this->s9str = this->s10str = this->s11str = (off_t) 0; \ 267 this->s12str = this->s13str = (off_t) 0; \ 269 this->s0len = this->s1len = this->s2len = (off_t) 0; \ 270 this->s3len = this->s4len = this->s5len = (off_t) 0; \ 271 this->s6len = this->s7len = this->s8len = (off_t) 0; \ 272 this->s9len = this->s10len = this->s11len = (off_t) 0; \ 273 this->s12len = this->s13len = (off_t) 0; \ 275 this->s0attrs = this->s1attrs = this->s2attrs = 0; \ 276 this->s3attrs = this->s4attrs = this->s5attrs = 0; \ 277 this->s6attrs = this->s7attrs = this->s8attrs = 0; \ 278 this->s9attrs = this->s10attrs = this->s11attrs = 0; \ 279 this->s12attrs = this->s13attrs = 0; \ 287 #define EXPAND_STR(str, len, attrs, s1s, s1l, s1a, s2s, s2l, s2a) \ 288 dtrace:helper:ustack: \ 289 /!this->done && len > 0 && IS_CONSSTR(attrs)/ \ 293 s1s = COPYIN_PTR(str + V8_OFF_CONSSTR_CAR); \ 294 LOAD_STRFIELDS(s1s, s1l, s1a) \ 296 s2s = COPYIN_PTR(str + V8_OFF_CONSSTR_CDR); \ 297 LOAD_STRFIELDS(s2s, s2l, s2a) \ 304 #define APPEND_CONSSTR(str, len, attrs) \ 306 EXPAND_STR(str, len, attrs, \ 307 this->s0str, this->s0len, this->s0attrs, \ 308 this->s7str, this->s7len, this->s7attrs) \ 309 EXPAND_STR(this->s0str, this->s0len, this->s0attrs, \ 310 this->s1str, this->s1len, this->s1attrs, \ 311 this->s4str, this->s4len, this->s4attrs) \ 312 EXPAND_STR(this->s1str, this->s1len, this->s1attrs, \ 313 this->s2str, this->s2len, this->s2attrs, \ 314 this->s3str, this->s3len, this->s3attrs) \ 315 EXPAND_STR(this->s4str, this->s4len, this->s4attrs, \ 316 this->s5str, this->s5len, this->s5attrs, \ 317 this->s6str, this->s6len, this->s6attrs) \ 318 EXPAND_STR(this->s7str, this->s7len, this->s7attrs, \ 319 this->s8str, this->s8len, this->s8attrs, \ 320 this->s11str, this->s11len, this->s11attrs) \ 321 EXPAND_STR(this->s8str, this->s8len, this->s8attrs, \ 322 this->s9str, this->s9len, this->s9attrs, \ 323 this->s10str, this->s10len, this->s10attrs) \ 324 EXPAND_STR(this->s11str, this->s11len, this->s11attrs, \ 325 this->s12str, this->s12len, this->s12attrs, \ 326 this->s13str, this->s13len, this->s13attrs) \ 328 APPEND_SEQSTR(str, len, attrs) \ 329 APPEND_SEQSTR(this->s0str, this->s0len, this->s0attrs) \ 330 APPEND_SEQSTR(this->s1str, this->s1len, this->s1attrs) \ 331 APPEND_SEQSTR(this->s2str, this->s2len, this->s2attrs) \ 332 APPEND_SEQSTR(this->s3str, this->s3len, this->s3attrs) \ 333 APPEND_SEQSTR(this->s4str, this->s4len, this->s4attrs) \ 334 APPEND_SEQSTR(this->s5str, this->s5len, this->s5attrs) \ 335 APPEND_SEQSTR(this->s6str, this->s6len, this->s6attrs) \ 336 APPEND_SEQSTR(this->s7str, this->s7len, this->s7attrs) \ 337 APPEND_SEQSTR(this->s8str, this->s8len, this->s8attrs) \ 338 APPEND_SEQSTR(this->s9str, this->s9len, this->s9attrs) \ 339 APPEND_SEQSTR(this->s10str, this->s10len, this->s10attrs) \ 340 APPEND_SEQSTR(this->s11str, this->s11len, this->s11attrs) \ 341 APPEND_SEQSTR(this->s12str, this->s12len, this->s12attrs) \ 342 APPEND_SEQSTR(this->s13str, this->s13len, this->s13attrs) \ 350 #define APPEND_V8STR(str, len, attrs) \ 351 APPEND_CONSSTR(str, len, attrs) \ 352 APPEND_NODESTR(str, len, attrs) 364 this->
buf = (
char*) alloca(128);
541 /!this->
done && this->funcnamelen == 0/
633 this->bsearch_line = this->position <
645 #define BSEARCH_LOOP \ 646 dtrace:helper:ustack: \ 647 /!this->done && this->bsearch_max >= 1/ \ 649 this->ii = (this->bsearch_min + this->bsearch_max) >> 1; \ 652 dtrace:helper:ustack: \ 653 /!this->done && this->bsearch_max >= 1 && \ 654 this->position > SMI_VALUE( \ 655 COPYIN_PTR(this->line_ends + V8_OFF_FA_DATA + \ 656 this->ii * sizeof (uint32_t)))/ \ 658 this->bsearch_min = this->ii + 1; \ 661 dtrace:helper:ustack: \ 662 /!this->done && this->bsearch_max >= 1 && \ 663 this->position <= SMI_VALUE( \ 664 COPYIN_PTR(this->line_ends + V8_OFF_FA_DATA + \ 665 (this->ii - 1) * sizeof (uint32_t)))/ \ 667 this->bsearch_max = this->ii - 1; \ 687 /!this->
done && !this->bsearch_line/
689 this->bsearch_line = this->
ii + 1;
APPEND_CHR8('<','<',' ', 'a', 'd', 'a', 'p', 't')
#define V8_OFF_SHARED_IDENT
LOAD_STRFIELDS(this->funcnamestr, this->funcnamelen, this->funcnameattrs)
#define V8_OFF_SHARED_FUNTOK
#define V8_OFF_SCRIPT_NAME
#define V8_OFF_SCRIPT_LENDS
APPEND_V8STR(this->funcnamestr, this->funcnamelen, this->funcnameattrs) dtrace
APPEND_CHR4(' ','>','>','\0')
#define V8_OFF_FUNC_SHARED
APPEND_NUM(SMI_VALUE(this->position))
#define V8_OFF_SHARED_NAME
#define V8_OFF_FP_CONTEXT
BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP BSEARCH_LOOP dtrace
#define V8_FT_ENTRYCONSTRUCT
#define V8_OFF_SHARED_SCRIPT
#define V8_OFF_HEAPOBJ_MAP