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

Issue 1115263004: [strong] Check arity of functions (Closed)

Created:
5 years, 7 months ago by arv (Not doing code reviews)
Modified:
5 years, 7 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[strong] Check arity of functions In strong mode it is an error to call a function with too few arguments. This is enforced inside the ArgumentsAdaptorTrampoline. This does not yet handle rest parameters BUG=v8:3956 LOG=N R=rossberg@chromium.org, dslomov@chromium.org Committed: https://crrev.com/3226e980200035f37c86fef4b11fb307e17764a2 Cr-Commit-Position: refs/heads/master@{#28346}

Patch Set 1 #

Patch Set 2 : Add construct tests #

Patch Set 3 : Do not inline in case of too few arguments #

Patch Set 4 : cleanup #

Total comments: 11

Patch Set 5 : Addded tons of more tests #

Patch Set 6 : Added and disabled super tests #

Patch Set 7 : moar tests #

Patch Set 8 : Fix Crankshaft and change to use codegen for tests #

Patch Set 9 : Fix style nits #

Total comments: 2

Patch Set 10 : Ports done and even more tests #

Total comments: 5

Patch Set 11 : more tests #

Patch Set 12 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+607 lines, -5 lines) Patch
M src/arm/builtins-arm.cc View 1 2 3 4 5 6 7 8 9 1 chunk +16 lines, -0 lines 0 comments Download
M src/arm64/builtins-arm64.cc View 1 2 3 4 5 6 7 8 9 1 chunk +19 lines, -1 line 0 comments Download
M src/compiler/js-inlining.cc View 1 2 3 2 chunks +7 lines, -1 line 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 1 chunk +9 lines, -0 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 2 3 4 5 6 7 8 9 1 chunk +15 lines, -0 lines 0 comments Download
M src/messages.js View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M src/mips/builtins-mips.cc View 1 2 3 4 5 6 7 8 9 1 chunk +16 lines, -0 lines 0 comments Download
M src/mips64/builtins-mips64.cc View 1 2 3 4 5 6 7 8 9 1 chunk +15 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -0 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime/runtime-function.cc View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -0 lines 0 comments Download
M src/x64/builtins-x64.cc View 1 2 3 4 5 6 7 8 9 1 chunk +17 lines, -0 lines 0 comments Download
M test/cctest/compiler/test-run-inlining.cc View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
M test/cctest/test-api.cc View 1 2 3 4 5 6 7 8 9 1 chunk +75 lines, -0 lines 0 comments Download
M test/mjsunit/strong/declaration-after-use.js View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -3 lines 0 comments Download
A test/mjsunit/strong/function-arity.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +368 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (3 generated)
arv (Not doing code reviews)
PTAL Other ports will be done once this approach has been approved of.
5 years, 7 months ago (2015-05-01 18:38:10 UTC) #1
arv (Not doing code reviews)
+ mstarzinger for input on what needs to be done (if anything) for TF.
5 years, 7 months ago (2015-05-01 18:38:48 UTC) #3
Michael Starzinger
The only thing I can think of right now is that the JSInliner needs to ...
5 years, 7 months ago (2015-05-04 08:27:04 UTC) #4
Michael Starzinger
Can we also add some tests for constructor calls with mismatching arguments counts?
5 years, 7 months ago (2015-05-04 09:50:24 UTC) #5
arv (Not doing code reviews)
Add construct tests
5 years, 7 months ago (2015-05-04 14:05:04 UTC) #6
arv (Not doing code reviews)
Do not inline in case of too few arguments
5 years, 7 months ago (2015-05-04 15:59:58 UTC) #7
arv (Not doing code reviews)
cleanup
5 years, 7 months ago (2015-05-04 16:08:26 UTC) #8
rossberg
https://codereview.chromium.org/1115263004/diff/60001/src/compiler/js-inlining.cc File src/compiler/js-inlining.cc (right): https://codereview.chromium.org/1115263004/diff/60001/src/compiler/js-inlining.cc#newcode368 src/compiler/js-inlining.cc:368: if (is_strong(info.language_mode()) && Is this checking the right language ...
5 years, 7 months ago (2015-05-05 14:26:20 UTC) #9
Michael Starzinger
https://codereview.chromium.org/1115263004/diff/60001/src/compiler/js-inlining.cc File src/compiler/js-inlining.cc (right): https://codereview.chromium.org/1115263004/diff/60001/src/compiler/js-inlining.cc#newcode368 src/compiler/js-inlining.cc:368: if (is_strong(info.language_mode()) && On 2015/05/05 14:26:19, rossberg wrote: > ...
5 years, 7 months ago (2015-05-05 14:31:16 UTC) #10
arv (Not doing code reviews)
Addded tons of more tests
5 years, 7 months ago (2015-05-05 16:46:17 UTC) #11
arv (Not doing code reviews)
PTAL https://codereview.chromium.org/1115263004/diff/60001/src/messages.js File src/messages.js (right): https://codereview.chromium.org/1115263004/diff/60001/src/messages.js#newcode185 src/messages.js:185: strong_mode_too_few_arguments: ["In strong mode, calling a function with ...
5 years, 7 months ago (2015-05-05 16:46:29 UTC) #12
rossberg
https://codereview.chromium.org/1115263004/diff/60001/test/mjsunit/strong/function-arity.js File test/mjsunit/strong/function-arity.js (right): https://codereview.chromium.org/1115263004/diff/60001/test/mjsunit/strong/function-arity.js#newcode23 test/mjsunit/strong/function-arity.js:23: f.apply(undefined, [undefined]); On 2015/05/05 14:26:20, rossberg wrote: > Also ...
5 years, 7 months ago (2015-05-05 16:51:57 UTC) #13
arv (Not doing code reviews)
Added and disabled super tests
5 years, 7 months ago (2015-05-05 17:12:58 UTC) #14
arv (Not doing code reviews)
So super is broken in strong mode... I'll also add some spread call tests after ...
5 years, 7 months ago (2015-05-05 17:13:36 UTC) #15
arv (Not doing code reviews)
moar tests
5 years, 7 months ago (2015-05-05 18:07:53 UTC) #16
rossberg
On 2015/05/05 17:13:36, arv wrote: > So super is broken in strong mode... > > ...
5 years, 7 months ago (2015-05-06 10:31:25 UTC) #17
arv (Not doing code reviews)
Fix Crankshaft and change to use codegen for tests
5 years, 7 months ago (2015-05-06 18:15:53 UTC) #18
arv (Not doing code reviews)
PTAL Is this ready for other ports?
5 years, 7 months ago (2015-05-06 18:19:01 UTC) #19
arv (Not doing code reviews)
Fix style nits
5 years, 7 months ago (2015-05-06 18:21:40 UTC) #20
rossberg
Yes, looks good, ready for ports. https://codereview.chromium.org/1115263004/diff/160001/test/mjsunit/strong/function-arity.js File test/mjsunit/strong/function-arity.js (right): https://codereview.chromium.org/1115263004/diff/160001/test/mjsunit/strong/function-arity.js#newcode5 test/mjsunit/strong/function-arity.js:5: // Flags: --strong-mode ...
5 years, 7 months ago (2015-05-07 08:29:17 UTC) #21
rossberg
Actually, we should have a few explicit tests for optimised functions.
5 years, 7 months ago (2015-05-07 09:33:11 UTC) #22
rossberg
On 2015/05/07 09:33:11, rossberg wrote: > Actually, we should have a few explicit tests for ...
5 years, 7 months ago (2015-05-07 09:35:03 UTC) #23
arv (Not doing code reviews)
Ports done and even more tests
5 years, 7 months ago (2015-05-08 00:39:59 UTC) #24
arv (Not doing code reviews)
PTAL
5 years, 7 months ago (2015-05-08 00:45:42 UTC) #25
arv (Not doing code reviews)
Ping
5 years, 7 months ago (2015-05-08 15:24:21 UTC) #26
rossberg
https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/function-arity.js File test/mjsunit/strong/function-arity.js (right): https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/function-arity.js#newcode5 test/mjsunit/strong/function-arity.js:5: // Flags: --strong-mode --harmony-arrow-functions --harmony-reflect --harmony-spreadcalls --allow-natives-syntax Nit: line ...
5 years, 7 months ago (2015-05-11 15:39:28 UTC) #27
rossberg
Forgot the LGTM modulo last comments
5 years, 7 months ago (2015-05-11 15:40:57 UTC) #28
arv (Not doing code reviews)
more tests
5 years, 7 months ago (2015-05-11 16:51:45 UTC) #29
arv (Not doing code reviews)
Thanks for the review Andreas. All done, CQ'ing... https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/function-arity.js File test/mjsunit/strong/function-arity.js (right): https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/function-arity.js#newcode5 test/mjsunit/strong/function-arity.js:5: // ...
5 years, 7 months ago (2015-05-11 16:54:02 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1115263004/220001
5 years, 7 months ago (2015-05-11 16:54:30 UTC) #33
commit-bot: I haz the power
Committed patchset #12 (id:220001)
5 years, 7 months ago (2015-05-11 17:20:51 UTC) #34
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/3226e980200035f37c86fef4b11fb307e17764a2 Cr-Commit-Position: refs/heads/master@{#28346}
5 years, 7 months ago (2015-05-11 17:21:10 UTC) #35
rossberg
5 years, 7 months ago (2015-05-12 06:02:16 UTC) #36
Message was sent while issue was closed.
https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/fu...
File test/mjsunit/strong/function-arity.js (right):

https://codereview.chromium.org/1115263004/diff/180001/test/mjsunit/strong/fu...
test/mjsunit/strong/function-arity.js:269: function f(x, y) {}
On 2015/05/11 16:54:02, arv wrote:
> On 2015/05/11 15:39:28, rossberg wrote:
> > It's also worth testing the case where the callee is weak (and does not
> throw).
> 
> Done.

Sorry for the misunderstanding, I meant the case where a strong function calls a
weak one, i.e., variations of:

function f(x, y) {}
function g() { 'use strong'; f(1) }

which should not throw, of course.

Powered by Google App Engine
This is Rietveld 408576698