-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path642.bug
More file actions
executable file
·690 lines (690 loc) · 20.9 KB
/
642.bug
File metadata and controls
executable file
·690 lines (690 loc) · 20.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
diff -r 642/src/config/CVS/Tag 641/src/config/CVS/Tag
1c1
< D2006.06.29.13.51.33
---
> D2006.06.24.17.48.56
diff -r 642/src/CVS/Entries 641/src/CVS/Entries
50d49
< /js.c/3.118/Mon Nov 17 05:07:14 2014//D2006.06.29.13.51.33
53,54d51
< /jsapi.c/3.272/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
< /jsapi.h/3.126/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
61d57
< /jsbit.h/3.15/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
63,64d58
< /jscntxt.c/3.86/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
< /jscntxt.h/3.109/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
76d69
< /jsfile.c/3.44/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
79,80d71
< /jsgc.c/3.157/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
< /jsgc.h/3.47/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
83,84d73
< /jsiter.c/3.16/Thu Jun 29 06:51:33 2006//D2006.06.29.13.51.33
< /jsiter.h/3.5/Thu Jun 29 06:51:33 2006//D2006.06.29.13.51.33
103d91
< /jspubtd.h/3.65/Mon Nov 17 05:07:15 2014//D2006.06.29.13.51.33
116a105,116
> /js.c/3.117/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsapi.c/3.271/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsapi.h/3.125/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsbit.h/3.14/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jscntxt.c/3.85/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jscntxt.h/3.107/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsfile.c/3.43/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsgc.c/3.156/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsgc.h/3.46/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsiter.c/3.15/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jsiter.h/3.4/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
> /jspubtd.h/3.64/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
diff -r 642/src/CVS/Tag 641/src/CVS/Tag
1c1
< D2006.06.29.13.51.33
---
> D2006.06.24.17.48.56
diff -r 642/src/editline/CVS/Entries 641/src/editline/CVS/Entries
7c7
< /editline.c/1.8/Mon Nov 17 05:07:16 2014//D2006.06.29.13.51.33
---
> /editline.c/1.6/Mon Nov 17 05:07:24 2014//D2006.06.24.17.48.56
diff -r 642/src/editline/CVS/Tag 641/src/editline/CVS/Tag
1c1
< D2006.06.29.13.51.33
---
> D2006.06.24.17.48.56
diff -r 642/src/fdlibm/CVS/Tag 641/src/fdlibm/CVS/Tag
1c1
< D2006.06.29.13.51.33
---
> D2006.06.24.17.48.56
diff -r 642/src/jsapi.c 641/src/jsapi.c
933,942d932
< JS_PUBLIC_API(JSContextCallback)
< JS_SetContextCallback(JSRuntime *rt, JSContextCallback cxCallback)
< {
< JSContextCallback old;
<
< old = rt->cxCallback;
< rt->cxCallback = cxCallback;
< return old;
< }
<
952c942
< js_DestroyContext(cx, JSDCM_FORCE_GC);
---
> js_DestroyContext(cx, JS_FORCE_GC);
958c948
< js_DestroyContext(cx, JSDCM_NO_GC);
---
> js_DestroyContext(cx, JS_NO_GC);
964c954
< js_DestroyContext(cx, JSDCM_MAYBE_GC);
---
> js_DestroyContext(cx, JS_MAYBE_GC);
diff -r 642/src/jsapi.h 641/src/jsapi.h
440,442d439
< extern JS_PUBLIC_API(JSContextCallback)
< JS_SetContextCallback(JSRuntime *rt, JSContextCallback cxCallback);
<
diff -r 642/src/jsbit.h 641/src/jsbit.h
152,159d151
< * Compute the log of the least power of 2 greater than or equal to n.
< * This is a version of JS_CeilingLog2 that operates on jsuword with
< * CPU-dependant size.
< */
< #define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))
<
< /*
< * Internal function.
diff -r 642/src/js.c 641/src/js.c
2c2
< * vim: set ts=8 sw=4 et tw=78:
---
> * vim: set ts=8 sw=4 et tw=80:
2239c2239,2240
< JSBool resolved;
---
> if ((flags & JSRESOLVE_ASSIGNING) == 0) {
> JSBool resolved;
2241,2245c2242,2247
< if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
< return JS_FALSE;
< if (resolved) {
< *objp = obj;
< return JS_TRUE;
---
> if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
> return JS_FALSE;
> if (resolved) {
> *objp = obj;
> return JS_TRUE;
> }
diff -r 642/src/jscntxt.c 641/src/jscntxt.c
171d170
< JSContextCallback cxCallback;
218c217
< js_DestroyContext(cx, JSDCM_NEW_FAILED);
---
> js_DestroyContext(cx, JS_NO_GC);
254c253
< js_DestroyContext(cx, JSDCM_NEW_FAILED);
---
> js_DestroyContext(cx, JS_NO_GC);
264,268d262
< cxCallback = rt->cxCallback;
< if (cxCallback && !cxCallback(cx, JSCONTEXT_NEW)) {
< js_DestroyContext(cx, JSDCM_NEW_FAILED);
< return NULL;
< }
273c267
< js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
---
> js_DestroyContext(JSContext *cx, JSGCMode gcmode)
276d269
< JSContextCallback cxCallback;
284,298d276
< if (mode != JSDCM_NEW_FAILED) {
< cxCallback = rt->cxCallback;
< if (cxCallback) {
< /*
< * JSCONTEXT_DESTROY callback is not allowed to fail and must
< * return true.
< */
< #ifdef DEBUG
< JSBool callbackStatus =
< #endif
< cxCallback(cx, JSCONTEXT_DESTROY);
< JS_ASSERT(callbackStatus);
< }
< }
<
382c360
< if (mode == JSDCM_FORCE_GC)
---
> if (gcmode == JS_FORCE_GC)
384c362
< else if (mode == JSDCM_MAYBE_GC)
---
> else if (gcmode == JS_MAYBE_GC)
diff -r 642/src/jscntxt.h 641/src/jscntxt.h
97,102c97
< typedef enum JSDestroyContextMode {
< JSDCM_NO_GC,
< JSDCM_MAYBE_GC,
< JSDCM_FORCE_GC,
< JSDCM_NEW_FAILED
< } JSDestroyContextMode;
---
> typedef enum JSGCMode { JS_NO_GC, JS_MAYBE_GC, JS_FORCE_GC } JSGCMode;
125,127d119
< /* Context create/destroy callback. */
< JSContextCallback cxCallback;
<
175,181c167
< JSPtrTable gcCloseTable;
<
< /*
< * Table for tracking iterators to ensure that we close iterator's state
< * before finalizing the iterable object.
< */
< JSPtrTable gcIteratorTable;
---
> JSGCCloseTable gcCloseTable;
752c738
< js_DestroyContext(JSContext *cx, JSDestroyContextMode mode);
---
> js_DestroyContext(JSContext *cx, JSGCMode gcmode);
diff -r 642/src/jsfile.c 641/src/jsfile.c
1132c1132
< return JSVAL_VOID;
---
> return JS_FALSE;
2547d2546
< PR_CloseDir(dir);
2549c2548
< return !JSVAL_IS_NULL(*vp);
---
> return JS_TRUE;
2552d2550
< PR_CloseDir(dir);
diff -r 642/src/jsgc.c 641/src/jsgc.c
67d66
< #include "jsiter.h"
241,383d239
< /*
< * JSPtrTable capacity growth descriptor. The table grows by powers of two
< * starting from capacity JSPtrTableInfo.minCapacity, but switching to linear
< * growth when capacity reaches JSPtrTableInfo.linearGrowthThreshold.
< */
< typedef struct JSPtrTableInfo {
< uint16 minCapacity;
< uint16 linearGrowthThreshold;
< } JSPtrTableInfo;
<
< #define GC_CLOSE_TABLE_MIN 4
< #define GC_CLOSE_TABLE_LINEAR 1024
< #define GC_ITERATOR_TABLE_MIN 4
< #define GC_ITERATOR_TABLE_LINEAR 1024
<
< static const JSPtrTableInfo closeTableInfo = {
< GC_CLOSE_TABLE_MIN,
< GC_CLOSE_TABLE_LINEAR
< };
<
< static const JSPtrTableInfo iteratorTableInfo = {
< GC_ITERATOR_TABLE_MIN,
< GC_ITERATOR_TABLE_LINEAR
< };
<
< /* Calculate table capacity based on the current value of JSPtrTable.count. */
< static size_t
< PtrTableCapacity(size_t count, const JSPtrTableInfo *info)
< {
< size_t linear, log, capacity;
<
< linear = info->linearGrowthThreshold;
< JS_ASSERT(info->minCapacity <= linear);
<
< if (count == 0) {
< capacity = 0;
< } else if (count < linear) {
< log = JS_CEILING_LOG2W(count);
< JS_ASSERT(log != JS_BITS_PER_WORD);
< capacity = (size_t)1 << log;
< if (capacity < info->minCapacity)
< capacity = info->minCapacity;
< } else {
< capacity = JS_ROUNDUP(count, linear);
< }
<
< JS_ASSERT(capacity >= count);
< return capacity;
< }
<
< static void
< FreePtrTable(JSPtrTable *table, const JSPtrTableInfo *info)
< {
< if (table->array) {
< JS_ASSERT(table->count > 0);
< free(table->array);
< table->array = NULL;
< table->count = 0;
< }
< JS_ASSERT(table->count == 0);
< }
<
< static JSBool
< AddToPtrTable(JSContext *cx, JSPtrTable *table, const JSPtrTableInfo *info,
< void *ptr)
< {
< size_t count, capacity;
< void **array;
<
< count = table->count;
< capacity = PtrTableCapacity(count, info);
<
< if (count == capacity) {
< if (capacity < info->minCapacity) {
< JS_ASSERT(capacity == 0);
< JS_ASSERT(!table->array);
< capacity = info->minCapacity;
< } else {
< /*
< * Simplify the overflow detection assuming pointer is bigger
< * than byte.
< */
< JS_STATIC_ASSERT(2 <= sizeof table->array[0]);
< capacity = (capacity < info->linearGrowthThreshold)
< ? 2 * capacity
< : capacity + info->linearGrowthThreshold;
< if (capacity > (size_t)-1 / sizeof table->array[0])
< goto bad;
< }
< array = (void **) realloc(table->array,
< capacity * sizeof table->array[0]);
< if (!array)
< goto bad;
< #ifdef DEBUG
< memset(array + count, JS_FREE_PATTERN,
< (capacity - count) * sizeof table->array[0]);
< #endif
< table->array = array;
< }
<
< table->array[count] = ptr;
< table->count = count + 1;
<
< return JS_TRUE;
<
< bad:
< JS_ReportOutOfMemory(cx);
< return JS_FALSE;
< }
<
< static void
< ShrinkPtrTable(JSPtrTable *table, const JSPtrTableInfo *info,
< size_t newCount)
< {
< size_t oldCapacity, capacity;
< void **array;
<
< JS_ASSERT(newCount <= table->count);
< if (newCount == table->count)
< return;
<
< oldCapacity = PtrTableCapacity(table->count, info);
< table->count = newCount;
< capacity = PtrTableCapacity(newCount, info);
<
< if (oldCapacity != capacity) {
< array = table->array;
< JS_ASSERT(array);
< if (capacity == 0) {
< free(array);
< table->array = NULL;
< return;
< }
< array = (void **) realloc(array, capacity * sizeof array[0]);
< if (array)
< table->array = array;
< }
< #ifdef DEBUG
< memset(table->array + newCount, JS_FREE_PATTERN,
< (capacity - newCount) * sizeof table->array[0]);
< #endif
< }
<
490,491c346,350
< FreePtrTable(&rt->gcCloseTable, &closeTableInfo);
< FreePtrTable(&rt->gcIteratorTable, &iteratorTableInfo);
---
> if (rt->gcCloseTable.array) {
> free(rt->gcCloseTable.array);
> rt->gcCloseTable.array = NULL;
> rt->gcCloseTable.count = 0;
> }
843,880d701
< js_RegisterCloseableIterator(JSContext *cx, JSObject *obj)
< {
< JSRuntime *rt;
< JSBool ok;
<
< rt = cx->runtime;
< JS_ASSERT(!rt->gcRunning || rt->gcClosePhase);
<
< JS_LOCK_GC(rt);
< ok = AddToPtrTable(cx, &rt->gcIteratorTable, &iteratorTableInfo, obj);
< JS_UNLOCK_GC(rt);
< return ok;
< }
<
< static void
< CloseIteratorStates(JSContext *cx)
< {
< JSRuntime *rt;
< size_t count, newCount, i;
< void **array;
< JSObject *obj;
<
< rt = cx->runtime;
< count = rt->gcIteratorTable.count;
< array = rt->gcIteratorTable.array;
<
< newCount = 0;
< for (i = 0; i != count; ++i) {
< obj = (JSObject *)array[i];
< if (js_IsAboutToBeFinalized(cx, obj))
< js_CloseIteratorState(cx, obj);
< else
< array[newCount++] = obj;
< }
< ShrinkPtrTable(&rt->gcIteratorTable, &iteratorTableInfo, newCount);
< }
<
< JSBool
884c705,706
< JSBool ok;
---
> JSObject **array;
> uint32 count, length;
906c728,749
< ok = AddToPtrTable(cx, &rt->gcCloseTable, &closeTableInfo, obj);
---
> array = rt->gcCloseTable.array;
> count = rt->gcCloseTable.count;
> length = GC_CLOSE_TABLE_LENGTH(count);
>
> if (!array || count == length) {
> length = (length < GC_CLOSE_TABLE_LINEAR)
> ? 2 * length
> : length + GC_CLOSE_TABLE_LINEAR;
> array = (JSObject **) realloc(array, length * sizeof(JSObject *));
> if (!array) {
> JS_UNLOCK_GC(rt);
> JS_ReportOutOfMemory(cx);
> return JS_FALSE;
> }
> #ifdef DEBUG
> memset(array + count, 0, (length - count) * sizeof(JSObject *));
> #endif
> rt->gcCloseTable.array = array;
> }
>
> array[count++] = obj;
> rt->gcCloseTable.count = count;
908c751
< return ok;
---
> return JS_TRUE;
917,918c760,761
< size_t count;
< size_t startIndex;
---
> uint32 count;
> uint32 startIndex;
920c763
< JSPtrTable tableSnapshot;
---
> JSGCCloseTable tableSnapshot;
931,933c774,775
< void **array;
< JSObject *obj;
< size_t count, index, pivot;
---
> JSObject **array, *obj;
> uint32 count, index, pivot;
944c786
< obj = (JSObject *)array[index];
---
> obj = array[index];
988c830
< JSObject *obj;
---
> JSObject *obj, **array;
990c832
< void **array;
---
> uint32 added, length;
996,997c838,839
< JS_ASSERT(memcmp(&toClose->tableSnapshot, &rt->gcCloseTable,
< sizeof toClose->tableSnapshot) == 0);
---
> JS_ASSERT(toClose->tableSnapshot.array == rt->gcCloseTable.array);
> JS_ASSERT(toClose->tableSnapshot.count == rt->gcCloseTable.count);
1014c856
< obj = (JSObject *)rt->gcCloseTable.array[index];
---
> obj = rt->gcCloseTable.array[index];
1027a870
> added = rt->gcCloseTable.count - endIndex;
1029,1031c872,899
< (rt->gcCloseTable.count - endIndex) * sizeof array[0]);
< ShrinkPtrTable(&rt->gcCloseTable, &closeTableInfo,
< rt->gcCloseTable.count - toClose->count);
---
> added * sizeof array[0]);
> rt->gcCloseTable.count -= toClose->count;
>
> /*
> * Check whether we need to shrink the table now. The previous
> * value, which is possibly the maximum, of the table count is
> * (endIndex + added). If as many or more objects were added during
> * the above close loop as were closed, we won't shrink.
> *
> * Note that we might not shrink even if more objects were closed
> * than were added, since we may not have closed enough to justify
> * a shrink by power of two or linear growth increment. So use
> * straightforward code here, computing current and previous
> * lengths and comparing.
> */
> length = GC_CLOSE_TABLE_LENGTH(rt->gcCloseTable.count);
> endIndex += added;
> if (length < GC_CLOSE_TABLE_LENGTH(endIndex)) {
> JS_ASSERT(toClose->count > added);
> array = (JSObject **) realloc(array, length * sizeof array[0]);
> if (array) {
> rt->gcCloseTable.array = array;
> #ifdef DEBUG
> memset(array + rt->gcCloseTable.count, JS_FREE_PATTERN,
> (length - rt->gcCloseTable.count) * sizeof array[0]);
> #endif
> }
> }
2620,2622d2487
< /* Finalize iterator states before the objects they iterate over. */
< CloseIteratorStates(cx);
<
2629,2633c2494
< */
< js_SweepAtomState(&rt->atomState);
< js_SweepScopeProperties(rt);
<
< /*
---
> *
2636a2498,2499
> js_SweepAtomState(&rt->atomState);
> js_SweepScopeProperties(rt);
diff -r 642/src/jsgc.h 641/src/jsgc.h
134,141c134,145
< /* Table of pointers with count valid members. */
< typedef struct JSPtrTable {
< size_t count;
< void **array;
< } JSPtrTable;
<
< extern JSBool
< js_RegisterCloseableIterator(JSContext *cx, JSObject *obj);
---
> /*
> * Table for tracking objects of extended classes that have non-null close
> * hooks, and need the GC to perform two-phase finalization. The array grows
> * by powers of two starting from length GC_CLOSE_TABLE_MIN, but switching to
> * linear growth when length reaches GC_CLOSE_TABLE_LINEAR. The count member
> * counts valid slots in array, so the current allocated length is given by
> * GC_CLOSE_TABLE_LENGTH(count).
> */
> typedef struct JSGCCloseTable {
> JSObject **array;
> uint32 count;
> } JSGCCloseTable;
145a150,159
> #define GC_CLOSE_TABLE_MIN_LOG2 3
> #define GC_CLOSE_TABLE_MIN JS_BIT(GC_CLOSE_TABLE_MIN_LOG2)
> #define GC_CLOSE_TABLE_LINEAR_LOG2 10
> #define GC_CLOSE_TABLE_LINEAR JS_BIT(GC_CLOSE_TABLE_LINEAR_LOG2)
>
> #define GC_CLOSE_TABLE_LENGTH(count) \
> (((count) < GC_CLOSE_TABLE_LINEAR) \
> ? JS_MAX(JS_BIT(JS_CeilingLog2(count)), GC_CLOSE_TABLE_MIN) \
> : JS_ROUNDUP(count, GC_CLOSE_TABLE_LINEAR))
>
diff -r 642/src/jsiter.c 641/src/jsiter.c
79,84c79,80
< /*
< * Shared code to close iterator's state either through an explicit call or
< * when GC detects that the iterator is no longer reachable.
< */
< void
< js_CloseIteratorState(JSContext *cx, JSObject *iterobj)
---
> static void
> iterator_close(JSContext *cx, JSObject *obj)
86d81
< jsval *slots;
90,92d84
< JS_ASSERT(JS_InstanceOf(cx, iterobj, &js_IteratorClass, NULL));
< slots = iterobj->slots;
<
94,95c86,87
< state = slots[JSSLOT_ITER_STATE];
< if (JSVAL_IS_NULL(state))
---
> state = obj->slots[JSSLOT_ITER_STATE];
> if (JSVAL_IS_VOID(state))
99,100c91,92
< parent = slots[JSSLOT_PARENT];
< if (!JSVAL_IS_PRIMITIVE(parent)) {
---
> parent = obj->slots[JSSLOT_PARENT];
> if (!JSVAL_IS_NULL(state) && !JSVAL_IS_PRIMITIVE(parent)) {
103c95
< if ((JSVAL_TO_INT(slots[JSSLOT_ITER_FLAGS]) & JSITER_FOREACH) &&
---
> if ((JSVAL_TO_INT(obj->slots[JSSLOT_ITER_FLAGS]) & JSITER_FOREACH) &&
112d103
< slots[JSSLOT_ITER_STATE] = JSVAL_NULL;
115,116c106,108
< JSClass js_IteratorClass = {
< "Iterator",
---
> JSExtendedClass js_IteratorClass = {
> { "Iterator",
> JSCLASS_IS_EXTENDED |
121c113,115
< JSCLASS_NO_OPTIONAL_MEMBERS
---
> JSCLASS_NO_OPTIONAL_MEMBERS },
> NULL, NULL, NULL, iterator_close,
> JSCLASS_NO_RESERVED_MEMBERS
226c220
< if (!JS_InstanceOf(cx, obj, &js_IteratorClass, argv))
---
> if (!JS_InstanceOf(cx, obj, &js_IteratorClass.base, argv))
299c293
< iterobj = js_NewObject(cx, &js_IteratorClass, NULL, NULL);
---
> iterobj = js_NewObject(cx, &js_IteratorClass.base, NULL, NULL);
310,311d303
< if (!js_RegisterCloseableIterator(cx, iterobj))
< return JS_FALSE;
331c323
< if (OBJ_GET_CLASS(cx, iterobj) != &js_IteratorClass)
---
> if (OBJ_GET_CLASS(cx, iterobj) != &js_IteratorClass.base)
341c333
< if (!JS_InstanceOf(cx, iterobj, &js_IteratorClass, NULL))
---
> if (!JS_InstanceOf(cx, iterobj, &js_IteratorClass.base, NULL))
362c354,356
< js_CloseIteratorState(cx, iterobj);
---
> /* Close iterobj, then mark its ITER_STATE slot to flag it as dead. */
> iterator_close(cx, iterobj);
> iterobj->slots[JSSLOT_ITER_STATE] = JSVAL_VOID;
371c365
< if (OBJ_GET_CLASS(cx, obj) == &js_IteratorClass) {
---
> if (OBJ_GET_CLASS(cx, obj) == &js_IteratorClass.base) {
416c410
< JS_ASSERT(OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass);
---
> JS_ASSERT(OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass.base);
436c430
< if (OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass &&
---
> if (OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass.base &&
476c470
< JS_ASSERT(OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass);
---
> JS_ASSERT(OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass.base);
493c487
< while (LOCKED_OBJ_GET_CLASS(obj) == &js_IteratorClass) {
---
> while (LOCKED_OBJ_GET_CLASS(obj) == &js_IteratorClass.base) {
882c876
< proto = JS_InitClass(cx, obj, NULL, &js_IteratorClass, Iterator, 2,
---
> proto = JS_InitClass(cx, obj, NULL, &js_IteratorClass.base, Iterator, 2,
diff -r 642/src/jsiter.h 641/src/jsiter.h
61,63d60
< extern void
< js_CloseIteratorState(JSContext *cx, JSObject *iterobj);
<
99c96
< extern JSClass js_IteratorClass;
---
> extern JSExtendedClass js_IteratorClass;
diff -r 642/src/jspubtd.h 641/src/jspubtd.h
544,564d543
< typedef enum JSContextOp {
< JSCONTEXT_NEW,
< JSCONTEXT_DESTROY
< } JSContextOp;
<
< /*
< * The possible values for contextOp when the runtime calls the callback are:
< * JSCONTEXT_NEW JS_NewContext succesfully created a new JSContext
< * instance. The callback can initialize the instance as
< * required. If the callback returns false, the instance
< * will be destroyed and JS_NewContext returns null. In
< * this case the callback is not called again.
< * JSCONTEXT_DESTROY One of JS_DestroyContext* methods is called. The
< * callback may perform its own cleanup and must always
< * return true.
< * Any other value For future compatibility the callback must do nothing
< * and return true in this case.
< */
< typedef JSBool
< (* JS_DLL_CALLBACK JSContextCallback)(JSContext *cx, uintN contextOp);
<