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
|
diff -up firefox-53.0.2/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-53.0.2/dom/plugins/base/nsJSNPRuntime.cpp
--- firefox-53.0.2/dom/plugins/base/nsJSNPRuntime.cpp.1337988 2017-04-11 06:15:22.000000000 +0200
+++ firefox-53.0.2/dom/plugins/base/nsJSNPRuntime.cpp 2017-05-17 13:11:24.628137703 +0200
@@ -1746,7 +1746,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj,
auto entry =
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
MOZ_ASSERT(entry && entry->mJSObj);
- MOZ_ASSERT(entry->mJSObj == old);
+ MOZ_ASSERT(entry->mJSObj.unbarrieredGetPtr() == old);
entry->mJSObj = obj;
}
diff -up firefox-53.0.2/js/ipc/JavaScriptShared.cpp.1337988 firefox-53.0.2/js/ipc/JavaScriptShared.cpp
--- firefox-53.0.2/js/ipc/JavaScriptShared.cpp.1337988 2017-04-11 06:15:17.000000000 +0200
+++ firefox-53.0.2/js/ipc/JavaScriptShared.cpp 2017-05-17 13:11:24.628137703 +0200
@@ -101,7 +101,7 @@ IdToObjectMap::has(const ObjectId& id, c
auto p = table_.lookup(id);
if (!p)
return false;
- return p->value() == obj;
+ return p->value().unbarrieredGet() == obj;
}
#endif
diff -up firefox-53.0.2/js/public/RootingAPI.h.1337988 firefox-53.0.2/js/public/RootingAPI.h
--- firefox-53.0.2/js/public/RootingAPI.h.1337988 2017-04-11 06:15:17.000000000 +0200
+++ firefox-53.0.2/js/public/RootingAPI.h 2017-05-17 14:16:44.378827481 +0200
@@ -150,6 +150,10 @@ template<typename T>
struct PersistentRootedMarker;
} /* namespace gc */
+#define DECLARE_POINTER_COMPARISON_OPS(T) \
+ bool operator==(const T& other) const { return get() == other; } \
+ bool operator!=(const T& other) const { return get() != other; }
+
// Important: Return a reference so passing a Rooted<T>, etc. to
// something that takes a |const T&| is not a GC hazard.
#define DECLARE_POINTER_CONSTREF_OPS(T) \
@@ -235,8 +239,6 @@ class Heap : public js::HeapBase<T, Heap
static_assert(js::IsHeapConstructibleType<T>::value,
"Type T must be a public GC pointer type");
public:
- using ElementType = T;
-
Heap() {
static_assert(sizeof(T) == sizeof(Heap<T>),
"Heap<T> must be binary compatible with T.");
@@ -371,8 +373,6 @@ template <typename T>
class TenuredHeap : public js::HeapBase<T, TenuredHeap<T>>
{
public:
- using ElementType = T;
-
TenuredHeap() : bits(0) {
static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
"TenuredHeap<T> must be binary compatible with T.");
@@ -380,6 +380,9 @@ class TenuredHeap : public js::HeapBase<
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
explicit TenuredHeap(const TenuredHeap<T>& p) : bits(0) { setPtr(p.getPtr()); }
+ bool operator==(const TenuredHeap<T>& other) { return bits == other.bits; }
+ bool operator!=(const TenuredHeap<T>& other) { return bits != other.bits; }
+
void setPtr(T newPtr) {
MOZ_ASSERT((reinterpret_cast<uintptr_t>(newPtr) & flagsMask) == 0);
if (newPtr)
@@ -456,8 +459,6 @@ class MOZ_NONHEAP_CLASS Handle : public
friend class JS::MutableHandle<T>;
public:
- using ElementType = T;
-
/* Creates a handle from a handle of a type convertible to T. */
template <typename S>
MOZ_IMPLICIT Handle(Handle<S> handle,
@@ -518,6 +519,7 @@ class MOZ_NONHEAP_CLASS Handle : public
MOZ_IMPLICIT Handle(MutableHandle<S>& root,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
@@ -544,8 +546,6 @@ template <typename T>
class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T, MutableHandle<T>>
{
public:
- using ElementType = T;
-
inline MOZ_IMPLICIT MutableHandle(Rooted<T>* root);
inline MOZ_IMPLICIT MutableHandle(PersistentRooted<T>* root);
@@ -571,6 +571,7 @@ class MOZ_STACK_CLASS MutableHandle : pu
return h;
}
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
DECLARE_NONPOINTER_MUTABLE_ACCESSOR_METHODS(*ptr);
@@ -775,8 +776,6 @@ class MOZ_RAII Rooted : public js::Roote
}
public:
- using ElementType = T;
-
template <typename RootingContext>
explicit Rooted(const RootingContext& cx)
: ptr(GCPolicy<T>::initial())
@@ -806,6 +805,7 @@ class MOZ_RAII Rooted : public js::Roote
ptr = value;
}
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
DECLARE_POINTER_ASSIGN_OPS(Rooted, T);
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
@@ -882,14 +882,13 @@ template <typename T>
class MOZ_RAII FakeRooted : public RootedBase<T, FakeRooted<T>>
{
public:
- using ElementType = T;
-
template <typename CX>
explicit FakeRooted(CX* cx) : ptr(JS::GCPolicy<T>::initial()) {}
template <typename CX>
FakeRooted(CX* cx, T initial) : ptr(initial) {}
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
DECLARE_POINTER_ASSIGN_OPS(FakeRooted, T);
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
@@ -910,8 +909,6 @@ template <typename T>
class FakeMutableHandle : public js::MutableHandleBase<T, FakeMutableHandle<T>>
{
public:
- using ElementType = T;
-
MOZ_IMPLICIT FakeMutableHandle(T* t) {
ptr = t;
}
@@ -1102,8 +1099,6 @@ class PersistentRooted : public js::Root
js::RootLists& rootLists(js::ContextFriendFields* cx) = delete;
public:
- using ElementType = T;
-
PersistentRooted() : ptr(GCPolicy<T>::initial()) {}
template <typename RootingContext>
@@ -1157,6 +1152,7 @@ class PersistentRooted : public js::Root
}
}
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
DECLARE_POINTER_ASSIGN_OPS(PersistentRooted, T);
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
@@ -1193,8 +1189,6 @@ class JS_PUBLIC_API(ObjectPtr)
Heap<JSObject*> value;
public:
- using ElementType = JSObject*;
-
ObjectPtr() : value(nullptr) {}
explicit ObjectPtr(JSObject* obj) : value(obj) {}
@@ -1297,177 +1291,6 @@ Swap(JS::TenuredHeap<T>& aX, JS::Tenured
} /* namespace mozilla */
-namespace js {
-namespace detail {
-
-// DefineComparisonOps is a trait which selects which wrapper classes to define
-// operator== and operator!= for. It supplies a getter function to extract the
-// value to compare. This is used to avoid triggering the automatic read
-// barriers where appropriate.
-//
-// If DefineComparisonOps is not specialized for a particular wrapper you may
-// get errors such as 'invalid operands to binary expression' or 'no match for
-// operator==' when trying to compare against instances of the wrapper.
-
-template <typename T>
-struct DefineComparisonOps : mozilla::FalseType {};
-
-template <typename T>
-struct DefineComparisonOps<JS::Heap<T>> : mozilla::TrueType {
- static const T& get(const JS::Heap<T>& v) { return v.unbarrieredGet(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<JS::TenuredHeap<T>> : mozilla::TrueType {
- static const T get(const JS::TenuredHeap<T>& v) { return v.unbarrieredGetPtr(); }
-};
-
-template <>
-struct DefineComparisonOps<JS::ObjectPtr> : mozilla::TrueType {
- static const JSObject* get(const JS::ObjectPtr& v) { return v.unbarrieredGet(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<JS::Rooted<T>> : mozilla::TrueType {
- static const T& get(const JS::Rooted<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<JS::Handle<T>> : mozilla::TrueType {
- static const T& get(const JS::Handle<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<JS::MutableHandle<T>> : mozilla::TrueType {
- static const T& get(const JS::MutableHandle<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<JS::PersistentRooted<T>> : mozilla::TrueType {
- static const T& get(const JS::PersistentRooted<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<js::FakeRooted<T>> : mozilla::TrueType {
- static const T& get(const js::FakeRooted<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<js::FakeMutableHandle<T>> : mozilla::TrueType {
- static const T& get(const js::FakeMutableHandle<T>& v) { return v.get(); }
-};
-
-} /* namespace detail */
-} /* namespace js */
-
-// Overload operator== and operator!= for all types with the DefineComparisonOps
-// trait using the supplied getter.
-//
-// There are four cases:
-
-// Case 1: comparison between two wrapper objects.
-
-template <typename T, typename U>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- js::detail::DefineComparisonOps<U>::value, bool>::Type
-operator==(const T& a, const U& b) {
- return js::detail::DefineComparisonOps<T>::get(a) == js::detail::DefineComparisonOps<U>::get(b);
-}
-
-template <typename T, typename U>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- js::detail::DefineComparisonOps<U>::value, bool>::Type
-operator!=(const T& a, const U& b) {
- return !(a == b);
-}
-
-// Case 2: comparison between a wrapper object and its unwrapped element type.
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
-operator==(const T& a, const typename T::ElementType& b) {
- return js::detail::DefineComparisonOps<T>::get(a) == b;
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
-operator!=(const T& a, const typename T::ElementType& b) {
- return !(a == b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
-operator==(const typename T::ElementType& a, const T& b) {
- return a == js::detail::DefineComparisonOps<T>::get(b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
-operator!=(const typename T::ElementType& a, const T& b) {
- return !(a == b);
-}
-
-// Case 3: For pointer wrappers, comparison between the wrapper and a const
-// element pointer.
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator==(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
- return a == js::detail::DefineComparisonOps<T>::get(b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator!=(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
- return !(a == b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator==(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
- return js::detail::DefineComparisonOps<T>::get(a) == b;
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator!=(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
- return !(a == b);
-}
-
-// Case 4: For pointer wrappers, comparison between the wrapper and nullptr.
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator==(std::nullptr_t a, const T& b) {
- return a == js::detail::DefineComparisonOps<T>::get(b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator!=(std::nullptr_t a, const T& b) {
- return !(a == b);
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator==(const T& a, std::nullptr_t b) {
- return js::detail::DefineComparisonOps<T>::get(a) == b;
-}
-
-template <typename T>
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
-operator!=(const T& a, std::nullptr_t b) {
- return !(a == b);
-}
-
#undef DELETE_ASSIGNMENT_OPS
#endif /* js_RootingAPI_h */
diff -up firefox-53.0.2/js/src/gc/Barrier.h.1337988 firefox-53.0.2/js/src/gc/Barrier.h
--- firefox-53.0.2/js/src/gc/Barrier.h.1337988 2017-04-11 06:15:17.000000000 +0200
+++ firefox-53.0.2/js/src/gc/Barrier.h 2017-05-17 13:11:24.629137700 +0200
@@ -349,8 +349,8 @@ class WriteBarrieredBase : public Barrie
explicit WriteBarrieredBase(const T& v) : BarrieredBase<T>(v) {}
public:
- using ElementType = T;
+ DECLARE_POINTER_COMPARISON_OPS(T);
DECLARE_POINTER_CONSTREF_OPS(T);
// Use this if the automatic coercion to T isn't working.
@@ -601,13 +601,14 @@ class ReadBarriered : public ReadBarrier
return *this;
}
- const T& get() const {
- if (InternalBarrierMethods<T>::isMarkable(this->value))
- this->read();
+ const T get() const {
+ if (!InternalBarrierMethods<T>::isMarkable(this->value))
+ return JS::GCPolicy<T>::initial();
+ this->read();
return this->value;
}
- const T& unbarrieredGet() const {
+ const T unbarrieredGet() const {
return this->value;
}
@@ -615,9 +616,9 @@ class ReadBarriered : public ReadBarrier
return bool(this->value);
}
- operator const T&() const { return get(); }
+ operator const T() const { return get(); }
- const T& operator->() const { return get(); }
+ const T operator->() const { return get(); }
T* unsafeGet() { return &this->value; }
T const* unsafeGet() const { return &this->value; }
@@ -944,35 +945,6 @@ typedef ReadBarriered<WasmTableObject*>
typedef ReadBarriered<Value> ReadBarrieredValue;
-namespace detail {
-
-template <typename T>
-struct DefineComparisonOps<PreBarriered<T>> : mozilla::TrueType {
- static const T& get(const PreBarriered<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<GCPtr<T>> : mozilla::TrueType {
- static const T& get(const GCPtr<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<HeapPtr<T>> : mozilla::TrueType {
- static const T& get(const HeapPtr<T>& v) { return v.get(); }
-};
-
-template <typename T>
-struct DefineComparisonOps<ReadBarriered<T>> : mozilla::TrueType {
- static const T& get(const ReadBarriered<T>& v) { return v.unbarrieredGet(); }
-};
-
-template <>
-struct DefineComparisonOps<HeapSlot> : mozilla::TrueType {
- static const Value& get(const HeapSlot& v) { return v.get(); }
-};
-
-} /* namespace detail */
-
} /* namespace js */
#endif /* gc_Barrier_h */
diff -up firefox-53.0.2/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 firefox-53.0.2/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
--- firefox-53.0.2/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 2017-04-11 06:15:18.000000000 +0200
+++ firefox-53.0.2/js/src/jsapi-tests/testGCHeapPostBarriers.cpp 2017-05-17 13:11:24.629137700 +0200
@@ -5,7 +5,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "mozilla/TypeTraits.h"
#include "mozilla/UniquePtr.h"
#include "js/RootingAPI.h"
@@ -152,111 +151,3 @@ TestHeapPostBarrierInitFailure()
}
END_TEST(testGCHeapPostBarriers)
-
-BEGIN_TEST(testUnbarrieredEquality)
-{
- // Use ArrayBuffers because they have finalizers, which allows using them
- // in ObjectPtr without awkward conversations about nursery allocatability.
- JS::RootedObject robj(cx, JS_NewArrayBuffer(cx, 20));
- JS::RootedObject robj2(cx, JS_NewArrayBuffer(cx, 30));
- cx->gc.evictNursery(); // Need tenured objects
-
- // Need some bare pointers to compare against.
- JSObject* obj = robj;
- JSObject* obj2 = robj2;
- const JSObject* constobj = robj;
- const JSObject* constobj2 = robj2;
-
- // Make them gray. We will make sure they stay gray. (For most reads, the
- // barrier will unmark gray.)
- using namespace js::gc;
- TenuredCell* cell = &obj->asTenured();
- TenuredCell* cell2 = &obj2->asTenured();
- cell->markIfUnmarked(GRAY);
- cell2->markIfUnmarked(GRAY);
- MOZ_ASSERT(cell->isMarked(GRAY));
- MOZ_ASSERT(cell2->isMarked(GRAY));
-
- {
- JS::Heap<JSObject*> heap(obj);
- JS::Heap<JSObject*> heap2(obj2);
- CHECK(TestWrapper(obj, obj2, heap, heap2));
- CHECK(TestWrapper(constobj, constobj2, heap, heap2));
- }
-
- {
- JS::TenuredHeap<JSObject*> heap(obj);
- JS::TenuredHeap<JSObject*> heap2(obj2);
- CHECK(TestWrapper(obj, obj2, heap, heap2));
- CHECK(TestWrapper(constobj, constobj2, heap, heap2));
- }
-
- {
- JS::ObjectPtr objptr(obj);
- JS::ObjectPtr objptr2(obj2);
- CHECK(TestWrapper(obj, obj2, objptr, objptr2));
- CHECK(TestWrapper(constobj, constobj2, objptr, objptr2));
- objptr.finalize(cx);
- objptr2.finalize(cx);
- }
-
- // Sanity check that the barriers normally mark things black.
- {
- JS::Heap<JSObject*> heap(obj);
- JS::Heap<JSObject*> heap2(obj2);
- heap.get();
- heap2.get();
- CHECK(cell->isMarked(BLACK));
- CHECK(cell2->isMarked(BLACK));
- }
-
- return true;
-}
-
-template <typename ObjectT, typename WrapperT>
-bool
-TestWrapper(ObjectT obj, ObjectT obj2, WrapperT& wrapper, WrapperT& wrapper2)
-{
- using namespace js::gc;
-
- const TenuredCell& cell = obj->asTenured();
- const TenuredCell& cell2 = obj2->asTenured();
-
- int x = 0;
-
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += obj == obj2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += obj == wrapper2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += wrapper == obj2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += wrapper == wrapper2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
-
- CHECK(x == 0);
-
- x += obj != obj2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += obj != wrapper2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += wrapper != obj2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
- x += wrapper != wrapper2;
- CHECK(cell.isMarked(GRAY));
- CHECK(cell2.isMarked(GRAY));
-
- CHECK(x == 4);
-
- return true;
-}
-
-END_TEST(testUnbarrieredEquality)
diff -up firefox-53.0.2/js/src/vm/SharedMem.h.1337988 firefox-53.0.2/js/src/vm/SharedMem.h
--- firefox-53.0.2/js/src/vm/SharedMem.h.1337988 2017-04-11 06:15:18.000000000 +0200
+++ firefox-53.0.2/js/src/vm/SharedMem.h 2017-05-17 13:11:24.629137700 +0200
@@ -12,8 +12,8 @@
template<typename T>
class SharedMem
{
- // static_assert(mozilla::IsPointer<T>::value,
- // "SharedMem encapsulates pointer types");
+ static_assert(mozilla::IsPointer<T>::value,
+ "SharedMem encapsulates pointer types");
enum Sharedness {
IsUnshared,
diff -up firefox-53.0.2/js/xpconnect/src/XPCInlines.h.1337988 firefox-53.0.2/js/xpconnect/src/XPCInlines.h
--- firefox-53.0.2/js/xpconnect/src/XPCInlines.h.1337988 2017-04-11 06:15:18.000000000 +0200
+++ firefox-53.0.2/js/xpconnect/src/XPCInlines.h 2017-05-17 13:11:24.629137700 +0200
@@ -471,7 +471,7 @@ inline
void XPCWrappedNativeTearOff::JSObjectMoved(JSObject* obj, const JSObject* old)
{
MOZ_ASSERT(!IsMarked());
- MOZ_ASSERT(mJSObject == old);
+ MOZ_ASSERT(mJSObject.unbarrieredGetPtr() == old);
mJSObject = obj;
}
diff -up firefox-53.0.2/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-53.0.2/js/xpconnect/src/XPCWrappedNative.cpp
--- firefox-53.0.2/js/xpconnect/src/XPCWrappedNative.cpp.1337988 2017-04-11 06:15:18.000000000 +0200
+++ firefox-53.0.2/js/xpconnect/src/XPCWrappedNative.cpp 2017-05-17 13:11:24.629137700 +0200
@@ -888,7 +888,7 @@ void
XPCWrappedNative::FlatJSObjectMoved(JSObject* obj, const JSObject* old)
{
JS::AutoAssertGCCallback inCallback(obj);
- MOZ_ASSERT(mFlatJSObject == old);
+ MOZ_ASSERT(mFlatJSObject.unbarrieredGetPtr() == old);
nsWrapperCache* cache = nullptr;
CallQueryInterface(mIdentity, &cache);
diff -up firefox-53.0.2/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 firefox-53.0.2/js/xpconnect/src/XPCWrappedNativeProto.cpp
--- firefox-53.0.2/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 2017-04-11 06:15:18.000000000 +0200
+++ firefox-53.0.2/js/xpconnect/src/XPCWrappedNativeProto.cpp 2017-05-17 13:11:24.629137700 +0200
@@ -101,7 +101,7 @@ XPCWrappedNativeProto::CallPostCreatePro
void
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
{
- MOZ_ASSERT(obj == mJSProtoObject, "huh?");
+ MOZ_ASSERT(obj == mJSProtoObject.unbarrieredGet(), "huh?");
// Only remove this proto from the map if it is the one in the map.
ClassInfo2WrappedNativeProtoMap* map = GetScope()->GetWrappedNativeProtoMap();
@@ -116,7 +116,7 @@ XPCWrappedNativeProto::JSProtoObjectFina
void
XPCWrappedNativeProto::JSProtoObjectMoved(JSObject* obj, const JSObject* old)
{
- MOZ_ASSERT(mJSProtoObject == old);
+ MOZ_ASSERT(mJSProtoObject.unbarrieredGet() == old);
mJSProtoObject.init(obj); // Update without triggering barriers.
}
|