Great. Thank you for the update. I had a feeling it was in the
javascript engine, but I had problems narrowing it down to a small
test.

Thanks,
Bob

On Oct 21, 11:57 am, Chris Conroy <con...@google.com> wrote:
> This is a known bug in V8. It was fixed 
> here:http://code.google.com/p/v8/source/detail?r=5631. Which made its way 
> into V8
> trunk in version 2.5.1. Chrome DevChannel is still affected AFAIK, though I
> would expect an update to 2.5.1 in the next week or two.
>
> On Thu, Oct 21, 2010 at 11:35 AM, recun...@gmail.com 
> <recun...@gmail.com>wrote:
>
>
>
>
>
>
>
> > When running Collection.sort weird behavior is occurring inside of the
> > javascript mergeSort function which is generated by GWT. Here is the
> > GWT generated javascript with some additional console.logs
>
> > function sort(x, c){
> >  mergeSort(x, 0, x.length, c?c:($clinit_2603() , $clinit_2603() ,
> > NATURAL));
> > }
>
> > function mergeSort(x, fromIndex, toIndex, comp){
> >  console.log('mergeSort: fromIndex = ' + fromIndex);
> >  console.log('mergesort: -fromIndex: ' + (-fromIndex));
> >  var temp_0, a, result;
> >  temp_0 = (a = x , result = a.slice(fromIndex, toIndex) ,
> > initValues(a.arrayClass$, a.typeId$, a.queryId$, result) , result);
> >  mergeSort_0(temp_0, x, fromIndex, toIndex, -fromIndex, comp);
> > }
>
> > function mergeSort_0(temp_0, array, low, high, ofs, comp){
> >  console.log('mergeSort_0: ofs = ' + (ofs));
> >  var length_0, tempHigh, tempLow, tempMid;
> >  length_0 = high - low;
> >  if (length_0 < 7) {
> >    insertionSort(array, low, high, comp);
> >    return;
> >  }
> >  tempLow = low + ofs;
> >  tempHigh = high + ofs;
> >  tempMid = tempLow + (~~(tempHigh - tempLow) >> 1);
> >  mergeSort_0(array, temp_0, tempLow, tempMid, -ofs, comp);
> >  mergeSort_0(array, temp_0, tempMid, tempHigh, -ofs, comp);
> >  if (comp.compare(temp_0[tempMid - 1], temp_0[tempMid]) <= 0) {
> >    while (low < high) {
> >      setCheck(array, low++, temp_0[tempLow++]);
> >    }
> >    return;
> >  }
> >  merge(temp_0, tempLow, tempMid, tempHigh, array, low, high, comp);
> > }
>
> > When sort is run on an array, the argument ofs of mergeSort_0
> > mysteriously becomes a large negative number when it is passed -0,
> > such as -4419.
>
> > Output of the console.log calls:
>
> > mergeSort: fromIndex = 0
> > mergeSort: -fromIndex: -4419
> > mergeSort_0: ofs = -4419
> > ...
> > ...
>
> > Now, if the same code is run, with a modified call to mergeSort_0, so
> > that instead of passing -fromIndex we pass -1*fromIndex ofs properly
> > becomes 0:
>
> > function mergeSort(x, fromIndex, toIndex, comp){
> >  console.log('mergeSort: fromIndex = ' + fromIndex);
> >  console.log('mergesort: -fromIndex: ' + (-1*fromIndex));
> >  var temp_0, a, result;
> >  temp_0 = (a = x , result = a.slice(fromIndex, toIndex) ,
> > initValues(a.arrayClass$, a.typeId$, a.queryId$, result) , result);
> >  mergeSort_0(temp_0, x, fromIndex, toIndex, -1*fromIndex, comp);
> > }
>
> > Output of the console.log calls:
> > mergeSort: fromIndex = 0
> > mergeSort: -fromIndex: 0
> > mergeSort_0: ofs = 0
> > ...
> > ...
>
> > Also note the unmodified GWT code will work (pass -fromIndex to ofs)
> > if our page is run as
> > a top level application inside of Chrome. Ofs only becomes -4419 when
> > it is run inside the Iframe of an another GWT page or inside the popup
> > which is opened by another GWT page. Also the number is not always
> > -4419. Sometimes other negative numbers were seen. But once that
> > number appears once it always appears until the browser is restarted.
>
> > This error is not seen on Chrome 6 or Firefox of any version. Untested
> > on IE.
>
> > Test Configurations:
> > Ubuntu 10.04 32bit and 64bit and 10.10 64bit were tested
> > Chrome build 7.0.517.41
>
> > Thanks,
> > Bob
>
> > --
> > 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-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2Bunsubs 
> > cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to