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

Issue 9425045: Support fast case for-in in Crankshaft. (Closed)

Created:
8 years, 10 months ago by Vyacheslav Egorov (Chromium)
Modified:
8 years, 10 months ago
Reviewers:
fschneider
CC:
v8-dev
Visibility:
Public.

Description

Support fast case for-in in Crankshaft. Only JSObject enumerables with enum cache (fast case properties, no interceptors, no enumerable properties on the prototype) are supported. HLoadKeyedGeneric with keys produced by for-in enumeration are recognized and rewritten into direct property load by index. For this enum-cache was extended to store property indices in a separate array (see handles.cc). New hydrogen instructions: - HForInPrepareMap: checks for-in fast case preconditions and returns map that contains enum-cache; - HForInCacheArray: extracts enum-cache array from the map; - HCheckMapValue: map check with HValue map instead of immediate; - HLoadFieldByIndex: load fast property by it's index, positive indexes denote in-object properties, negative - out of object properties; Changed hydrogen instructions: - HLoadKeyedFastElement: added hole check suppression for loads from internal FixedArrays that are knows to have no holes inside. R=fschneider@chromium.org BUG= TEST= Committed: https://code.google.com/p/v8/source/detail?r=10794

Patch Set 1 #

Total comments: 8

Patch Set 2 : port to x64&arm, cleanup #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+1298 lines, -168 lines) Patch
M src/arm/full-codegen-arm.cc View 1 7 chunks +7 lines, -45 lines 0 comments Download
M src/arm/lithium-arm.h View 1 2 chunks +62 lines, -1 line 1 comment Download
M src/arm/lithium-arm.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 1 chunk +82 lines, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 1 chunk +46 lines, -0 lines 0 comments Download
M src/ast.h View 2 chunks +7 lines, -5 lines 0 comments Download
M src/full-codegen.h View 1 chunk +1 line, -1 line 0 comments Download
M src/handles.cc View 1 1 chunk +35 lines, -4 lines 0 comments Download
M src/hydrogen.h View 3 chunks +9 lines, -3 lines 0 comments Download
M src/hydrogen.cc View 1 6 chunks +117 lines, -6 lines 0 comments Download
M src/hydrogen-instructions.h View 1 6 chunks +150 lines, -4 lines 0 comments Download
M src/hydrogen-instructions.cc View 1 3 chunks +65 lines, -0 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 8 chunks +11 lines, -50 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 1 chunk +78 lines, -0 lines 0 comments Download
M src/ia32/lithium-ia32.h View 1 2 chunks +63 lines, -1 line 1 comment Download
M src/ia32/lithium-ia32.cc View 1 1 chunk +29 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 1 chunk +40 lines, -0 lines 0 comments Download
M src/objects.h View 2 chunks +5 lines, -2 lines 0 comments Download
M src/objects.cc View 1 chunk +7 lines, -1 line 0 comments Download
M src/x64/full-codegen-x64.cc View 1 7 chunks +7 lines, -44 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 1 chunk +82 lines, -0 lines 0 comments Download
M src/x64/lithium-x64.h View 1 2 chunks +61 lines, -1 line 1 comment Download
M src/x64/lithium-x64.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 1 chunk +46 lines, -0 lines 0 comments Download
A test/mjsunit/compiler/optimized-for-in.js View 1 1 chunk +219 lines, -0 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
Vyacheslav Egorov (Chromium)
8 years, 10 months ago (2012-02-20 10:52:44 UTC) #1
fschneider
https://chromiumcodereview.appspot.com/9425045/diff/1/src/handles.cc File src/handles.cc (right): https://chromiumcodereview.appspot.com/9425045/diff/1/src/handles.cc#newcode750 src/handles.cc:750: if (!indexes.is_null()) { s/indexes/indices/g https://chromiumcodereview.appspot.com/9425045/diff/1/src/hydrogen.cc File src/hydrogen.cc (right): https://chromiumcodereview.appspot.com/9425045/diff/1/src/hydrogen.cc#newcode3259 ...
8 years, 10 months ago (2012-02-20 14:56:06 UTC) #2
Vyacheslav Egorov (Chromium)
PTAL!
8 years, 10 months ago (2012-02-21 17:05:42 UTC) #3
fschneider
8 years, 10 months ago (2012-02-22 10:16:45 UTC) #4
LGTM!

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/arm/lithium-arm.h
File src/arm/lithium-arm.h (right):

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/arm/lithium-arm....
src/arm/lithium-arm.h:2100: class LCheckMapValue: public LTemplateInstruction<1,
2, 0> {
Since there is no output operand: <0, 2, 0>

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/ia32/lithium-ia32.h
File src/ia32/lithium-ia32.h (right):

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/ia32/lithium-ia3...
src/ia32/lithium-ia32.h:2205: class LCheckMapValue: public
LTemplateInstruction<1, 2, 0> {
No output: <0, 2, 0>

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/x64/lithium-x64.h
File src/x64/lithium-x64.h (right):

https://chromiumcodereview.appspot.com/9425045/diff/4001/src/x64/lithium-x64....
src/x64/lithium-x64.h:2075: class LCheckMapValue: public LTemplateInstruction<1,
2, 0> {
Also here: <0, 2, 0>

https://chromiumcodereview.appspot.com/9425045/diff/4001/test/mjsunit/compile...
File test/mjsunit/compiler/optimized-for-in.js (right):

https://chromiumcodereview.appspot.com/9425045/diff/4001/test/mjsunit/compile...
test/mjsunit/compiler/optimized-for-in.js:101: delete t[i];
maybe use deopt.deopt to deoptimize?

https://chromiumcodereview.appspot.com/9425045/diff/4001/test/mjsunit/compile...
test/mjsunit/compiler/optimized-for-in.js:187: function mkTable(opt) { return {
a: "1", b: "2", c: "3", d: "4" }; }
Why pass in the opt parameter? it seems not used.

Powered by Google App Engine
This is Rietveld 408576698