Comment #13 on issue 2160 by bugdro...@chromium.org: Add support for
default parameters
https://code.google.com/p/v8/issues/detail?id=2160#c13
The following revision refers to this bug:
https://chromium.googlesource.com/v8/v8.git/+/365fd7bc351705e4fb181741829f89e580549daf
commit 365fd7bc351705e4fb181741829f89e580549daf
Author: rossberg <rossb...@chromium.org>
Date: Fri Aug 21 10:58:35 2015
[es6] Parameter scopes for sloppy eval
This CL is a nightmare! For the utterly irrelevant edge case of a sloppy
function with non-simple parameters and a call to direct eval, like here,
let x = 1;
function f(g = () => x) {
var y
eval("var x = 2")
return g() + x // f() = 3
}
we have to do all of the following, on top of the declaration block
("varblock") contexts we already introduce around the body:
- Introduce the ability for varblock contexts to have both a ScopeInfo and
an extension object (e.g., the body varblock in the example will contain
both a static var y and a dynamic var x). No other scope needs that. Since
there are no context slots left, a special new struct is introduced that
pairs up scope info and extension object.
- When declaring lookup slots in the runtime, this new struct is allocated
in the case where an extension object has to be added to a block scope (at
which point the block's extension slot still contains a plain ScopeInfo).
- While at it, introduce some abstraction to access context extension slots
in a more controlled manner, in order to keep special-casing to a minimum.
- Make sure that even empty varblock contexts do not get optimised away
when they contain a sloppy eval, so that they can host the potential
extension object.
- Extend dynamic search for declaration contexts (used by sloppy direct
eval) to recognize varblock contexts.
- In the parser, if a function has a sloppy direct eval, introduce an
additional varblock scope around each non-simple (desugared) parameter, as
required by the spec to contain possible dynamic var bindings.
- In the pattern rewriter, add the ability to hoist the named variables the
pattern declares to an outer scope. That is required because the actual
destructuring has to be evaluated inside the protecting varblock scope, but
the bindings that the desugaring introduces are in the outer scope.
- ScopeInfos need to save the information whether a block is a varblock, to
make sloppy eval calls work correctly that deserialise them as part of the
scope chain.
- Add the ability to materialize block scopes with extension objects in the
debugger. Likewise, enable setting extension variables in block scopes via
the debugger interface.
- While at it, refactor and unify some respective code in the debugger.
Sorry, this CL is large. I could try to split it up, but everything is
rather entangled.
@mstarzinger: Please review the changes to contexts.
@yangguo: Please have a look at the debugger stuff.
R=little...@chromium.org, mstarzin...@chromium.org, yang...@chromium.org
BUG=v8:811,v8:2160
LOG=N
Review URL: https://codereview.chromium.org/1292753007
Cr-Commit-Position: refs/heads/master@{#30295}
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/include/v8.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/bootstrapper.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/compiler/ast-graph-builder.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/contexts.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/contexts.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/debug/debug-scopes.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/debug/debug-scopes.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/factory.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/factory.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/full-codegen/full-codegen.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/hydrogen.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/objects-debug.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/objects-inl.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/objects-printer.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/objects.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/objects.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/parser.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/parser.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/pattern-rewriter.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/runtime/runtime-object.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/runtime/runtime-scopes.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/scopeinfo.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/scopes.cc
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/src/scopes.h
[modify]
http://crrev.com/365fd7bc351705e4fb181741829f89e580549daf/test/mjsunit/harmony/default-parameters.js
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.