Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Issue 11783006: Intrinsify Uint8ClampedArray's store and load indexed, inline load indexed. (Closed)

Created:
7 years, 11 months ago by srdjan
Modified:
7 years, 11 months ago
Reviewers:
regis, sra1
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Intrinsify Uint8ClampedArray's store and load indexed, inline load indexed. Committed: https://code.google.com/p/dart/source/detail?r=16666

Patch Set 1 #

Patch Set 2 : #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -3 lines) Patch
M runtime/vm/flow_graph_compiler.cc View 1 2 chunks +8 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 5 chunks +7 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/intrinsifier.h View 1 chunk +2 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_ia32.cc View 1 chunk +37 lines, -0 lines 6 comments Download
M runtime/vm/intrinsifier_x64.cc View 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
srdjan
7 years, 11 months ago (2013-01-05 00:08:13 UTC) #1
regis
LGTM
7 years, 11 months ago (2013-01-05 00:53:36 UTC) #2
sra1
https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia32.cc File runtime/vm/intrinsifier_ia32.cc (right): https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia32.cc#newcode614 runtime/vm/intrinsifier_ia32.cc:614: // Free EBX for the value since we want ...
7 years, 11 months ago (2013-01-05 01:34:49 UTC) #3
srdjan
Thanks for comments, will do it in a next CL. https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia32.cc File runtime/vm/intrinsifier_ia32.cc (right): https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia32.cc#newcode614 ...
7 years, 11 months ago (2013-01-08 00:34:06 UTC) #4
sra1
7 years, 11 months ago (2013-01-08 02:31:14 UTC) #5
Message was sent while issue was closed.
These ideas might be more important if you are open-coding the operation.

https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia...
File runtime/vm/intrinsifier_ia32.cc (right):

https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia...
runtime/vm/intrinsifier_ia32.cc:614: // Free EBX for the value since we want a
byte register.
On 2013/01/08 00:34:06, srdjan wrote:
> On 2013/01/05 01:34:50, sra1 wrote:
> > Could you free EAX and EBX here by generating the address with lea(EDX,
...)?
> 
> I cannot use EDX (must be preserved, see comment on the top), using EAX
instead.

Sorry, I mis-wrote - EDI.  EDI is used below.

https://codereview.chromium.org/11783006/diff/8001/runtime/vm/intrinsifier_ia...
runtime/vm/intrinsifier_ia32.cc:623: __ j(GREATER, &load_0xff, 
Assembler::kNearJump);
On 2013/01/08 00:34:06, srdjan wrote:
> On 2013/01/05 01:34:50, sra1 wrote:
> > Instead of jumping on carry with data dependent branch mispredicts, we could
> > compute the value based on the carry flag:
> > 
> > __ sbbl(EBX, EBX);
> > __ notl(EBX);
> > // store
> > 
> > 
> 
> I do not think that can work. If compare sets CF we will always jump to
> 'store_value' label [BELOW_EQUAL = (CF OR ZF) = 1]/

You are right!  I'm getting my signed and unsigned comparisons mixed up.
I think at this point the value is actually a function of sign bit:

__ sarl(EBX, 31);
__ notl(EBX);
// store.

Some other thoughts:

If it is worth doing this, it is probably worth making the in-range case be
fall-through.

I wonder of going completely branch free would work?  I guess it would depend on
having data that needs clamping.

lea edi,[eax+ebx*1+k]   // free EAX,EBX
mov ebx, [esp+4]
test ebx,1
jnz fall_through

SmiUntag(ebx) 
mov eax,ebx
sar eax,31
not eax
cmp ebx,0xff
cmova ebx,eax
mov [edi],bl
ret

Powered by Google App Engine
This is Rietveld 408576698