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

Issue 10872084: Allocate block-scoped global bindings to global context. (Closed)

Created:
8 years, 3 months ago by rossberg
Modified:
8 years, 3 months ago
Reviewers:
Sven Panne
CC:
v8-dev
Visibility:
Public.

Description

Allocate block-scoped global bindings to global context. - The global object has a reference to the current global scope chain. Running a script adds to the chain if it contains global lexical declarations. - Scripts are executed relative to a global, not a native context. - Harmony let and const bindings are allocated to the innermost global context; var and function still live on the global object. (Lexical bindings are not reflected on the global object at all, but that will probably change later using accessors, as for modules.) - Compilation of scripts now needs a (global) context (previously only eval did). - The global scope chain represents one logical scope, so collision tests take the chain into account. R=svenpanne@chromium.org BUG= Committed: https://code.google.com/p/v8/source/detail?r=12398

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+147 lines, -111 lines) Patch
M src/api.cc View 4 chunks +6 lines, -6 lines 0 comments Download
M src/bootstrapper.h View 1 chunk +1 line, -1 line 0 comments Download
M src/bootstrapper.cc View 3 chunks +10 lines, -11 lines 0 comments Download
M src/compiler.h View 4 chunks +7 lines, -8 lines 0 comments Download
M src/compiler.cc View 4 chunks +4 lines, -1 line 0 comments Download
M src/heap.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/isolate.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/isolate.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M src/objects.h View 2 chunks +5 lines, -1 line 0 comments Download
M src/objects.cc View 1 chunk +4 lines, -6 lines 2 comments Download
M src/objects-inl.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.cc View 5 chunks +51 lines, -39 lines 2 comments Download
M src/rewriter.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M src/runtime.cc View 2 chunks +4 lines, -1 line 0 comments Download
M src/scopes.cc View 4 chunks +9 lines, -9 lines 0 comments Download
M src/variables.h View 2 chunks +1 line, -1 line 0 comments Download
M src/variables.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M test/cctest/test-decls.cc View 3 chunks +27 lines, -21 lines 0 comments Download
M test/mjsunit/harmony/block-conflicts.js View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
rossberg
8 years, 3 months ago (2012-08-27 15:10:39 UTC) #1
Sven Panne
lgtm http://codereview.chromium.org/10872084/diff/1/src/objects.cc File src/objects.cc (right): http://codereview.chromium.org/10872084/diff/1/src/objects.cc#newcode12005 src/objects.cc:12005: reinterpret_cast<CompilationCacheTable*>(obj); Do we really need the reinterpret_cast here ...
8 years, 3 months ago (2012-08-28 07:35:00 UTC) #2
rossberg
8 years, 3 months ago (2012-08-28 11:09:39 UTC) #3
https://chromiumcodereview.appspot.com/10872084/diff/1/src/objects.cc
File src/objects.cc (right):

https://chromiumcodereview.appspot.com/10872084/diff/1/src/objects.cc#newcode...
src/objects.cc:12005: reinterpret_cast<CompilationCacheTable*>(obj);
On 2012/08/28 07:35:00, Sven Panne wrote:
> Do we really need the reinterpret_cast here or would
CompilationCacheTable::cast
> work, too? If the latter works, using a templatized To would be better
(probably
> below, too, but there it doesn't really make a difference).

Indeed, it's not needed. Changed.

> Another point: Removing the tiny scopes is a bad idea IMHO, one should keep
the
> scopes/lifetimes as small as possible to help readability. Furthermore, the
tiny
> scopes are a common v8 idiom.

Yeah, in principle, I agree with you. Except that in C++, I have been so
conditioned to have all flags go up when I encounter a scope like that that I
find seeing one where no RAII hack is in play more irritating than helpful... ;)

https://chromiumcodereview.appspot.com/10872084/diff/1/src/parser.cc
File src/parser.cc (right):

https://chromiumcodereview.appspot.com/10872084/diff/1/src/parser.cc#newcode1805
src/parser.cc:1805: (mode != VAR && mode != CONST) ||
On 2012/08/28 07:35:00, Sven Panne wrote:
> o_O

You gotta love the beauty of semantic incoherence and backwards compatibility
hacks in our all's favorite language.

Powered by Google App Engine
This is Rietveld 408576698