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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)

Created:
4 years, 2 months ago by Dan Ehrenberg
Modified:
4 years ago
CC:
Hannes Payer (out of office), ulan, v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Use a different map to distinguish eval contexts eval() may introduce a scope which needs to be represented as a context at runtime, e.g., eval('var x; let y; ()=>y') introduces a variable y which needs to have a context allocated for it. However, when traversing upwards to find the declaration context for a variable which leaks, as the declaration of x does above, this context has to be understood to not be a declaration context in sloppy mode. This patch makes that distinction by introducing a different map for eval-introduced contexts. A dynamic search for the appropriate context will continue past an eval context to find the appropriate context. Marking contexts as eval contexts rather than function contexts required updates in each compiler backend. BUG=v8:5295, chromium:648719 Review-Url: https://codereview.chromium.org/2435023002 Cr-Commit-Position: refs/heads/master@{#41869} Committed: https://chromium.googlesource.com/v8/v8/+/53fdf9d1926c6a6f9a2d2acf0c303ae4c71210a1

Patch Set 1 #

Patch Set 2 : Fix interpreter, crankshaft; TF and other FCG backends still needed #

Patch Set 3 : Porting to more backends #

Patch Set 4 : Crankshaft backends and scope deserialization #

Total comments: 2

Patch Set 5 : Rebase (other non-x64 backends are broken) #

Patch Set 6 : A couple fixups #

Patch Set 7 : Use an eval scope for strict and sloppy, and fix up some tests. Still need to update ports #

Patch Set 8 : Fix up a port, back out other broken ports #

Patch Set 9 : x87 #

Patch Set 10 : back out x87 #

Patch Set 11 : Add regression test from user #

Patch Set 12 : relax dchecks #

Total comments: 18

Patch Set 13 : Fix ia32 port #

Total comments: 2

Patch Set 14 : Rebase and fix various aspects for review #

Patch Set 15 : Reduce duplication #

Patch Set 16 : Fix TF bug and format #

Patch Set 17 : Port to all platforms #

Patch Set 18 : Fix arm port #

Patch Set 19 : Rename back to NewFunctionContext #

Patch Set 20 : Rename factory method and format #

Patch Set 21 : Revert an unnecessary rename #

Patch Set 22 : Formatting #

Patch Set 23 : Revert unnecessary part #

Patch Set 24 : Fix unit test #

Patch Set 25 : Add test which doesn't blow up memory #

Patch Set 26 : Undo unnecessary renaming #

Patch Set 27 : Rebase #

Patch Set 28 : Clean up test #

Total comments: 10

Patch Set 29 : Changes based on review commnets #

Total comments: 6

Patch Set 30 : Changes from review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+365 lines, -115 lines) Patch
M src/ast/scopes.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +4 lines, -5 lines 0 comments Download
M src/code-factory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +2 lines, -1 line 0 comments Download
M src/code-factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +3 lines, -2 lines 0 comments Download
M src/code-stubs.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +16 lines, -5 lines 0 comments Download
M src/code-stubs.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3 chunks +21 lines, -4 lines 0 comments Download
M src/compiler/ast-graph-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +2 lines, -1 line 0 comments Download
M src/compiler/bytecode-graph-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +9 lines, -1 line 0 comments Download
M src/compiler/js-create-lowering.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +16 lines, -2 lines 0 comments Download
M src/compiler/js-generic-lowering.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +8 lines, -3 lines 0 comments Download
M src/compiler/js-operator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +28 lines, -1 line 0 comments Download
M src/compiler/js-operator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +40 lines, -9 lines 0 comments Download
M src/contexts.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +1 line, -0 lines 0 comments Download
M src/contexts.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 8 chunks +11 lines, -9 lines 0 comments Download
M src/contexts-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +4 lines, -0 lines 0 comments Download
M src/crankshaft/arm/lithium-codegen-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +4 lines, -2 lines 0 comments Download
M src/crankshaft/arm64/lithium-codegen-arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +4 lines, -2 lines 0 comments Download
M src/crankshaft/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +5 lines, -3 lines 0 comments Download
M src/crankshaft/mips/lithium-codegen-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +4 lines, -2 lines 0 comments Download
M src/crankshaft/mips64/lithium-codegen-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +4 lines, -2 lines 0 comments Download
M src/crankshaft/ppc/lithium-codegen-ppc.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +4 lines, -2 lines 0 comments Download
M src/crankshaft/s390/lithium-codegen-s390.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +4 lines, -2 lines 0 comments Download
M src/crankshaft/x64/lithium-codegen-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +4 lines, -2 lines 0 comments Download
M src/crankshaft/x87/lithium-codegen-x87.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +4 lines, -2 lines 0 comments Download
M src/debug/debug-scopes.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 5 chunks +7 lines, -7 lines 0 comments Download
M src/factory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +3 lines, -2 lines 0 comments Download
M src/factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +15 lines, -4 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +3 lines, -0 lines 0 comments Download
M src/full-codegen/arm/full-codegen-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/full-codegen/arm64/full-codegen-arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +3 lines, -2 lines 0 comments Download
M src/full-codegen/ia32/full-codegen-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/full-codegen/mips/full-codegen-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/full-codegen/mips64/full-codegen-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/full-codegen/ppc/full-codegen-ppc.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +4 lines, -4 lines 0 comments Download
M src/full-codegen/s390/full-codegen-s390.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/full-codegen/x64/full-codegen-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +3 lines, -2 lines 0 comments Download
M src/full-codegen/x87/full-codegen-x87.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +3 lines, -2 lines 0 comments Download
M src/heap/heap.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +2 lines, -0 lines 0 comments Download
M src/heap/heap.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 29 1 chunk +1 line, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +3 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +5 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +18 lines, -4 lines 0 comments Download
M src/interpreter/bytecodes.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -0 lines 0 comments Download
M src/interpreter/interpreter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +14 lines, -2 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/runtime-scopes.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3 chunks +11 lines, -9 lines 0 comments Download
A test/mjsunit/regress/regress-5295.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +18 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-5295-2.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +20 lines, -0 lines 0 comments Download
M test/mjsunit/regress/regress-5736.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +3 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-648719.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -0 lines 0 comments Download
M test/unittests/compiler/js-create-lowering-unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +3 lines, -3 lines 0 comments Download
M test/unittests/interpreter/bytecode-array-builder-unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 104 (80 generated)
adamk
https://codereview.chromium.org/2435023002/diff/60001/src/contexts.cc File src/contexts.cc (right): https://codereview.chromium.org/2435023002/diff/60001/src/contexts.cc#newcode116 src/contexts.cc:116: if (IsFunctionContext() || IsModuleContext()) { I think you want ...
4 years, 1 month ago (2016-11-10 19:32:07 UTC) #16
Dan Ehrenberg
Not ported to all backends yet, but I'd like some feedback about this approach, the ...
4 years, 1 month ago (2016-11-11 23:51:57 UTC) #22
adamk
I hope mstarzinger might have some suggestion about how to refactor in a less verbose ...
4 years, 1 month ago (2016-11-12 00:26:06 UTC) #32
adamk
https://codereview.chromium.org/2435023002/diff/240001/src/ast/scopes.cc File src/ast/scopes.cc (right): https://codereview.chromium.org/2435023002/diff/240001/src/ast/scopes.cc#newcode369 src/ast/scopes.cc:369: outer_scope = new (zone) Scope(zone, EVAL_SCOPE, handle(scope_info)); Actually looking ...
4 years, 1 month ago (2016-11-12 00:32:05 UTC) #33
neis
On 2016/11/12 00:26:06, adamk ooo until nov 28 wrote: > https://codereview.chromium.org/2435023002/diff/220001/src/factory.cc#newcode895 > src/factory.cc:895: DCHECK(function->shared()->scope_info()->scope_type() == ...
4 years, 1 month ago (2016-11-14 16:12:23 UTC) #34
Dan Ehrenberg
Rebased and fixed things where comments were made in the review. Offline, Adam gave me ...
4 years ago (2016-12-07 05:41:26 UTC) #35
Dan Ehrenberg
The new version has much less duplication, and more tests, per review comments. PTAL.
4 years ago (2016-12-13 07:24:20 UTC) #69
Dan Ehrenberg
+marja, neis (for a closely related bug) Could someone take a look please?
4 years ago (2016-12-13 17:15:31 UTC) #73
marja
Unfortunately I don't have the expertise to review this. The frontend changes (scopes.cc) trivially LG.
4 years ago (2016-12-14 10:52:54 UTC) #74
adamk
Looking good, but I'm not qualified to sign off on the code stub/TF stuff. mstarzinger, ...
4 years ago (2016-12-14 12:23:31 UTC) #75
neis
https://codereview.chromium.org/2435023002/diff/540001/src/runtime/runtime-scopes.cc File src/runtime/runtime-scopes.cc (right): https://codereview.chromium.org/2435023002/diff/540001/src/runtime/runtime-scopes.cc#newcode230 src/runtime/runtime-scopes.cc:230: // not the declaration context. Comment needs an update.
4 years ago (2016-12-14 13:59:37 UTC) #76
Dan Ehrenberg
https://codereview.chromium.org/2435023002/diff/540001/src/contexts.cc File src/contexts.cc (right): https://codereview.chromium.org/2435023002/diff/540001/src/contexts.cc#newcode230 src/contexts.cc:230: context->IsFunctionContext() || context->IsEvalContext() || On 2016/12/14 12:23:31, adamk wrote: ...
4 years ago (2016-12-14 22:53:31 UTC) #79
adamk
https://codereview.chromium.org/2435023002/diff/540001/src/factory.h File src/factory.h (right): https://codereview.chromium.org/2435023002/diff/540001/src/factory.h#newcode299 src/factory.h:299: // Create a function or eval context. On 2016/12/14 ...
4 years ago (2016-12-15 08:46:53 UTC) #82
Michael Starzinger
LGTM, cool stuff, just nits. https://codereview.chromium.org/2435023002/diff/560001/src/code-stubs.h File src/code-stubs.h (right): https://codereview.chromium.org/2435023002/diff/560001/src/code-stubs.h#newcode844 src/code-stubs.h:844: class ScopeTypeBits : public ...
4 years ago (2016-12-15 09:42:59 UTC) #83
neis
Dan, please add the test from https://bugs.chromium.org/p/v8/issues/detail?id=5736 to your CL, as the other bugfix has ...
4 years ago (2016-12-15 15:09:39 UTC) #84
neis
BTW, what do you think of renaming CreateFunctionContext to CreateFunctionOrEvalContext? I find it confusing that ...
4 years ago (2016-12-15 15:14:52 UTC) #85
Dan Ehrenberg
PTAL https://codereview.chromium.org/2435023002/diff/560001/src/code-stubs.h File src/code-stubs.h (right): https://codereview.chromium.org/2435023002/diff/560001/src/code-stubs.h#newcode844 src/code-stubs.h:844: class ScopeTypeBits : public BitField<bool, 0, 8> {}; ...
4 years ago (2016-12-15 23:51:50 UTC) #90
marja
neis@ is ooo so you shouldn't block this on his review. Is there anybody else ...
4 years ago (2016-12-19 11:51:03 UTC) #91
adamk
lgtm I think the only thing neis@ was looking for was a rename, but I ...
4 years ago (2016-12-19 17:59:26 UTC) #92
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2435023002/580001
4 years ago (2016-12-19 21:17:08 UTC) #95
commit-bot: I haz the power
Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/30999)
4 years ago (2016-12-19 21:20:40 UTC) #97
Benedikt Meurer
LGTM (rubber-stamped)
4 years ago (2016-12-20 16:12:00 UTC) #99
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2435023002/580001
4 years ago (2016-12-20 16:20:56 UTC) #101
commit-bot: I haz the power
4 years ago (2016-12-20 16:23:27 UTC) #104
Message was sent while issue was closed.
Committed patchset #30 (id:580001) as
https://chromium.googlesource.com/v8/v8/+/53fdf9d1926c6a6f9a2d2acf0c303ae4c71...

Powered by Google App Engine
This is Rietveld 408576698