Title: [111826] trunk/Source/_javascript_Core
- Revision
- 111826
- Author
- [email protected]
- Date
- 2012-03-22 21:55:21 -0700 (Thu, 22 Mar 2012)
Log Message
ExecutableAllocator::memoryPressureMultiplier() might can return NaN
https://bugs.webkit.org/show_bug.cgi?id=82002
Reviewed by Filip Pizlo.
Guard against divide by zero and then make sure the return
value is >= 1.0.
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::memoryPressureMultiplier):
* jit/ExecutableAllocatorFixedVMPool.cpp:
(JSC::ExecutableAllocator::memoryPressureMultiplier):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (111825 => 111826)
--- trunk/Source/_javascript_Core/ChangeLog 2012-03-23 04:31:32 UTC (rev 111825)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-03-23 04:55:21 UTC (rev 111826)
@@ -1,3 +1,18 @@
+2012-03-22 Michael Saboff <[email protected]>
+
+ ExecutableAllocator::memoryPressureMultiplier() might can return NaN
+ https://bugs.webkit.org/show_bug.cgi?id=82002
+
+ Reviewed by Filip Pizlo.
+
+ Guard against divide by zero and then make sure the return
+ value is >= 1.0.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::memoryPressureMultiplier):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::ExecutableAllocator::memoryPressureMultiplier):
+
2012-03-22 Jessie Berlin <[email protected]>
Windows build fix after r111778.
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (111825 => 111826)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2012-03-23 04:31:32 UTC (rev 111825)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2012-03-23 04:55:21 UTC (rev 111826)
@@ -196,16 +196,21 @@
double ExecutableAllocator::memoryPressureMultiplier(size_t addedMemoryUsage)
{
+ double result;
#ifdef EXECUTABLE_MEMORY_LIMIT
size_t bytesAllocated = DemandExecutableAllocator::bytesAllocatedByAllAllocators() + addedMemoryUsage;
if (bytesAllocated >= EXECUTABLE_MEMORY_LIMIT)
bytesAllocated = EXECUTABLE_MEMORY_LIMIT;
- return static_cast<double>(EXECUTABLE_MEMORY_LIMIT) /
+ result = static_cast<double>(EXECUTABLE_MEMORY_LIMIT) /
(EXECUTABLE_MEMORY_LIMIT - bytesAllocated);
#else
UNUSED_PARAM(addedMemoryUsage);
- return 1.0;
+ result = 1.0;
#endif
+ if (result < 1.0)
+ result = 1.0;
+ return result;
+
}
PassRefPtr<ExecutableMemoryHandle> ExecutableAllocator::allocate(JSGlobalData&, size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp (111825 => 111826)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp 2012-03-23 04:31:32 UTC (rev 111825)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp 2012-03-23 04:55:21 UTC (rev 111826)
@@ -126,8 +126,13 @@
size_t bytesAllocated = statistics.bytesAllocated + addedMemoryUsage;
if (bytesAllocated >= statistics.bytesReserved)
bytesAllocated = statistics.bytesReserved;
- return static_cast<double>(statistics.bytesReserved) /
- (statistics.bytesReserved - bytesAllocated);
+ double result = 1.0;
+ size_t divisor = statistics.bytesReserved - bytesAllocated;
+ if (divisor)
+ result = static_cast<double>(statistics.bytesReserved) / divisor;
+ if (result < 1.0)
+ result = 1.0;
+ return result;
}
PassRefPtr<ExecutableMemoryHandle> ExecutableAllocator::allocate(JSGlobalData& globalData, size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes