From cb7279da811f7add2f2f6a3bfbf0528834354fa3 Mon Sep 17 00:00:00 2001 From: marja Date: Tue, 24 Mar 2015 09:46:53 -0700 Subject: [PATCH] [strong] Check strong mode free variables against the global object. Gather references to unbound variables where the reference (VariableProxy) is inside strong mode. Check them against the global object when a script is bound to a context (during compilation). This CL only checks unbound variables which are not inside lazy functions - TBD how do we solve that; alternatives: add developer mode which disables laziness / do the check whenever lazy functions are really compiled. BUG=v8:3956 LOG=N Review URL: https://codereview.chromium.org/1005063002 Cr-Commit-Position: refs/heads/master@{#27422} --- src/api.cc | 35 ++++- src/messages.js | 1 + src/objects.h | 24 ++- src/parser.cc | 4 + src/pending-compilation-error-handler.cc | 4 +- src/pending-compilation-error-handler.h | 18 ++- src/scopeinfo.cc | 77 +++++++++- src/scopes.cc | 16 +- src/scopes.h | 5 +- src/variables.cc | 3 + src/variables.h | 24 +++ test/cctest/test-parsing.cc | 150 +++++++++++++++++++ test/mjsunit/strong/declaration-after-use.js | 3 + 13 files changed, 344 insertions(+), 20 deletions(-) diff --git a/src/api.cc b/src/api.cc index 78328b74f..af164514b 100644 --- a/src/api.cc +++ b/src/api.cc @@ -22,6 +22,7 @@ #include "src/bootstrapper.h" #include "src/code-stubs.h" #include "src/compiler.h" +#include "src/contexts.h" #include "src/conversions-inl.h" #include "src/counters.h" #include "src/cpu-profiler.h" @@ -36,6 +37,7 @@ #include "src/messages.h" #include "src/natives.h" #include "src/parser.h" +#include "src/pending-compilation-error-handler.h" #include "src/profile-generator-inl.h" #include "src/property.h" #include "src/property-details.h" @@ -1497,9 +1499,36 @@ Local