Wednesday, June 9, 2010

Re: Safari 5 - (RangeError): Maximum call stack size exceeded

This is occurring for us in the Arrays.mergeSort() code. A reduced
testcase (which looks like the binarySearch code) is in the webkit bug
tracking system at:

https://bugs.webkit.org/show_bug.cgi?id=40355

It appears that in some complex expressions the right shift operator
is not evaluating correctly. Assigning the result of the right shift
to a temporary variable and then using it appears to make the problem
go away.

As a temporary fix, we're patching Arrays.java:mergeSort() to assign
the result of the right shift to a temporary variable before using it.
If you're using binary search you'd need to patch those functions as
well. It's a bit of a hack, but it seems to work. I've included our
patch below, in case it is helpful to someone.


diff --git a/super/com/google/gwt/emul/java/util/Arrays.java b/super/
com/google/
index 89dcc33..b7ba6fa 100644
--- a/super/com/google/gwt/emul/java/util/Arrays.java
+++ b/super/com/google/gwt/emul/java/util/Arrays.java
@@ -1322,7 +1322,8 @@ public class Arrays {
// recursively sort both halves, using the array as temp space
int tempLow = low + ofs;
int tempHigh = high + ofs;
- int tempMid = tempLow + ((tempHigh - tempLow) >> 1);
+ int half = length >> 1;
+ int tempMid = tempLow + half;
mergeSort(array, temp, tempLow, tempMid, -ofs, comp);
mergeSort(array, temp, tempMid, tempHigh, -ofs, comp);

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate