17
17
* value. To extract the actual integer value, we must shift it over.
18
18
*/
19
19
#define IS_SMI (value ) ((value & V8_SmiTagMask) == V8_SmiTag)
20
- #define SMI_VALUE (value ) ((int32_t)(value) >> V8_SmiValueShift)
20
+ #define SMI_VALUE (value ) ((uint32_t)(value) >> V8_SmiValueShift)
21
+
22
+ /*
23
+ * Heap objects usually start off with a Map pointer, itself another heap
24
+ * object. However, during garbage collection, the low order bits of the
25
+ * pointer (which are normally 01) are used to record GC state. Of course, we
26
+ * have no idea if we're in GC or not, so we must always normalize the pointer.
27
+ */
28
+ #define V8_MAP_PTR (ptr ) \
29
+ ((ptr & ~V8_HeapObjectTagMask) | V8_HeapObjectTag)
21
30
22
31
/*
23
32
* Determine the encoding and representation of a V8 string.
88
97
*/
89
98
#define LOAD_STRFIELDS (str , len , attrs ) \
90
99
len = SMI_VALUE(COPYIN_UINT32(str + V8_OFF_STR_LENGTH)); \
91
- this->map = COPYIN_UINT32(str + V8_OFF_HEAPOBJ_MAP); \
100
+ this->map = V8_MAP_PTR( COPYIN_UINT32(str + V8_OFF_HEAPOBJ_MAP)); \
92
101
attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS);
93
102
94
103
/*
@@ -170,7 +179,7 @@ dtrace:helper:ustack: \
170
179
}
171
180
172
181
/*
173
- * Expand the ConsString "str" (represensted by "str", "len", and "attrs") into
182
+ * Expand the ConsString "str" (represented by "str", "len", and "attrs") into
174
183
* strings "s1" (represented by "s1s", "s1l", and "s1a") and "s2" (represented
175
184
* by "s2s", "s2l", "s2a"). If "str" is not a ConsString, do nothing.
176
185
*/
@@ -261,6 +270,7 @@ dtrace:helper:ustack:
261
270
this -> func = 0 ;
262
271
this -> shared = 0 ;
263
272
this -> map = 0 ;
273
+ this -> attrs = 0 ;
264
274
this -> funcnamestr = 0 ;
265
275
this -> funcnamelen = 0 ;
266
276
this -> funcnameattrs = 0 ;
@@ -435,6 +445,46 @@ dtrace:helper:ustack:
435
445
stringof (this -> buf );
436
446
}
437
447
448
+ /*
449
+ * Now check for internal frames that we can only identify by seeing that
450
+ * there's a Code object where there would be a JSFunction object for a
451
+ * JavaScriptFrame.
452
+ */
453
+ dtrace :helper :ustack :
454
+ /!this -> done /
455
+ {
456
+ this -> func = COPYIN_UINT32 (this -> fp + V8_OFF_FP_FUNC );
457
+ this -> map = V8_MAP_PTR (COPYIN_UINT32 (this -> func + V8_OFF_HEAPOBJ_MAP ));
458
+ this -> attrs = COPYIN_UINT8 (this -> map + V8_OFF_MAP_ATTRS );
459
+ }
460
+
461
+ dtrace :helper :ustack :
462
+ /!this -> done && this -> attrs == V8_IT_CODE /
463
+ {
464
+ this -> done = 1 ;
465
+ APPEND_CHR ('<' );
466
+ APPEND_CHR ('<' );
467
+ APPEND_CHR (' ' );
468
+ APPEND_CHR ('i' );
469
+ APPEND_CHR ('n' );
470
+ APPEND_CHR ('t' );
471
+ APPEND_CHR ('e' );
472
+ APPEND_CHR ('r' );
473
+ APPEND_CHR ('n' );
474
+ APPEND_CHR ('a' );
475
+ APPEND_CHR ('l' );
476
+ APPEND_CHR (' ' );
477
+ APPEND_CHR ('c' );
478
+ APPEND_CHR ('o' );
479
+ APPEND_CHR ('d' );
480
+ APPEND_CHR ('e' );
481
+ APPEND_CHR (' ' );
482
+ APPEND_CHR ('>' );
483
+ APPEND_CHR ('>' );
484
+ APPEND_CHR ('\0' );
485
+ stringof (this -> buf );
486
+ }
487
+
438
488
/*
439
489
* At this point, we're either looking at a JavaScriptFrame or an
440
490
* OptimizedFrame. For now, we assume JavaScript and start by grabbing the
@@ -443,7 +493,9 @@ dtrace:helper:ustack:
443
493
dtrace :helper :ustack :
444
494
/!this -> done /
445
495
{
446
- this -> func = COPYIN_UINT32 (this -> fp + V8_OFF_FP_FUNC );
496
+ this -> map = 0 ;
497
+ this -> attrs = 0 ;
498
+
447
499
this -> shared = COPYIN_UINT32 (this -> func + V8_OFF_FUNC_SHARED );
448
500
this -> funcnamestr = COPYIN_UINT32 (this -> shared + V8_OFF_SHARED_NAME );
449
501
LOAD_STRFIELDS (this -> funcnamestr , this -> funcnamelen ,
@@ -515,7 +567,8 @@ dtrace:helper:ustack:
515
567
{
516
568
this -> position = COPYIN_UINT32 (this -> shared + V8_OFF_SHARED_FUNTOK );
517
569
this -> line_ends = COPYIN_UINT32 (this -> script + V8_OFF_SCRIPT_LENDS );
518
- this -> map = COPYIN_UINT32 (this -> line_ends + V8_OFF_HEAPOBJ_MAP );
570
+ this -> map = V8_MAP_PTR (COPYIN_UINT32 (this -> line_ends +
571
+ V8_OFF_HEAPOBJ_MAP ));
519
572
this -> le_attrs = COPYIN_UINT8 (this -> map + V8_OFF_MAP_ATTRS );
520
573
}
521
574
0 commit comments