Title: [216547] trunk/Source/_javascript_Core
Revision
216547
Author
fpi...@apple.com
Date
2017-05-09 15:27:06 -0700 (Tue, 09 May 2017)

Log Message

Heap::heap() should behave gracefully for null pointers
https://bugs.webkit.org/show_bug.cgi?id=171888
<rdar://problem/32005315>

Reviewed by Mark Lam.
        
Some callers of Heap::heap() can pass a null cell and they will behave gracefully if we
return a null Heap. So, let's do that.
        
This fixes a crash and it does not hurt performance. I'm seeing a possible 0.5% regression
with 74% probability. That's a neutral result by our usual 95% standard.

* heap/HeapInlines.h:
(JSC::Heap::heap):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (216546 => 216547)


--- trunk/Source/_javascript_Core/ChangeLog	2017-05-09 22:18:53 UTC (rev 216546)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-05-09 22:27:06 UTC (rev 216547)
@@ -1,3 +1,20 @@
+2017-05-09  Filip Pizlo  <fpi...@apple.com>
+
+        Heap::heap() should behave gracefully for null pointers
+        https://bugs.webkit.org/show_bug.cgi?id=171888
+        <rdar://problem/32005315>
+
+        Reviewed by Mark Lam.
+        
+        Some callers of Heap::heap() can pass a null cell and they will behave gracefully if we
+        return a null Heap. So, let's do that.
+        
+        This fixes a crash and it does not hurt performance. I'm seeing a possible 0.5% regression
+        with 74% probability. That's a neutral result by our usual 95% standard.
+
+        * heap/HeapInlines.h:
+        (JSC::Heap::heap):
+
 2017-05-09  Yusuke Suzuki  <utatane....@gmail.com>
 
         Handle IDLPromise<> properly

Modified: trunk/Source/_javascript_Core/heap/HeapInlines.h (216546 => 216547)


--- trunk/Source/_javascript_Core/heap/HeapInlines.h	2017-05-09 22:18:53 UTC (rev 216546)
+++ trunk/Source/_javascript_Core/heap/HeapInlines.h	2017-05-09 22:27:06 UTC (rev 216547)
@@ -46,6 +46,8 @@
 
 ALWAYS_INLINE Heap* Heap::heap(const HeapCell* cell)
 {
+    if (!cell)
+        return nullptr;
     return cell->heap();
 }
 
@@ -52,7 +54,7 @@
 inline Heap* Heap::heap(const JSValue v)
 {
     if (!v.isCell())
-        return 0;
+        return nullptr;
     return heap(v.asCell());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to