1. 24 Mar, 2015 2 commits
    • marja's avatar
      [strong] Check strong mode free variables against the global object. · cb7279da
      marja authored
      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}
      cb7279da
    • aperez's avatar
      Cleanups needed for this-scoping in arrow functions · 00844d46
      aperez authored
      Remove Variable::IsValidReference(), and the Variable::is_valid_ref_
      member: This was "false" only for "this", and for internal variables.
      For the first, VariableProxy::is_this() can be used for the check
      instead; and for internal variables, it is guaranteed they they will
      not be written to (because the V8 code does not do it, and they are
      not accessible from JavaScript).
      
      The "bool is_this" parameter of VariableProxy() constructor is
      changed to use Variable::Kind. This will allow to later on adding
      a parameter to create unresolved variables of any kind, which in
      turn will be used to make references to "this" initially unresolved,
      and use the existing variable resolution mechanics for "this".
      
      BUG=v8:2700
      LOG=N
      
      Review URL: https://codereview.chromium.org/1024703004
      
      Cr-Commit-Position: refs/heads/master@{#27404}
      00844d46
  2. 26 Feb, 2015 1 commit
    • adamk's avatar
      Re-introduce ImportDeclaration to the parser · fa293dd7
      adamk authored
      This also adds a new VariableMode, IMPORT, which will be
      used to do appropriate binding for Import-declared Variables.
      
      Only named imports are handled for now. "import *" and default
      import syntaxes have had their TODOs adjusted to match the new
      code structure.
      
      BUG=v8:1569
      LOG=n
      
      Review URL: https://codereview.chromium.org/948303004
      
      Cr-Commit-Position: refs/heads/master@{#26895}
      fa293dd7
  3. 17 Feb, 2015 1 commit
  4. 12 Nov, 2014 1 commit
  5. 04 Aug, 2014 1 commit
  6. 30 Jul, 2014 1 commit
  7. 26 Jun, 2014 1 commit
  8. 24 Jun, 2014 1 commit
  9. 18 Jun, 2014 1 commit
  10. 13 Jun, 2014 1 commit
  11. 03 Jun, 2014 1 commit
  12. 29 Apr, 2014 1 commit
  13. 02 Apr, 2014 1 commit
  14. 11 Mar, 2014 1 commit
  15. 28 Feb, 2013 1 commit
  16. 22 Nov, 2012 1 commit
    • rossberg@chromium.org's avatar
      Get rid of static module allocation, do it in code. · ce05280b
      rossberg@chromium.org authored
      Modules now have their own local scope, represented by their own context.
      Module instance objects have an accessor for every export that forwards
      access to the respective slot from the module's context. (Exports that are
      modules themselves, however, are simple data properties.)
      
      All modules have a _hosting_ scope/context, which (currently) is the
      (innermost) enclosing global scope. To deal with recursion, nested modules
      are hosted by the same scope as global ones.
      
      For every (global or nested) module literal, the hosting context has an
      internal slot that points directly to the respective module context. This
      enables quick access to (statically resolved) module members by 2-dimensional
      access through the hosting context. For example,
      
        module A {
          let x;
          module B { let y; }
        }
        module C { let z; }
      
      allocates contexts as follows:
      
      [header| .A | .B | .C | A | C ]  (global)
                |    |    |
                |    |    +-- [header| z ]  (module)
                |    |
                |    +------- [header| y ]  (module)
                |
                +------------ [header| x | B ]  (module)
      
      Here, .A, .B, .C are the internal slots pointing to the hosted module
      contexts, whereas A, B, C hold the actual instance objects (note that every
      module context also points to the respective instance object through its
      extension slot in the header).
      
      To deal with arbitrary recursion and aliases between modules,
      they are created and initialized in several stages. Each stage applies to
      all modules in the hosting global scope, including nested ones.
      
      1. Allocate: for each module _literal_, allocate the module contexts and
         respective instance object and wire them up. This happens in the
         PushModuleContext runtime function, as generated by AllocateModules
         (invoked by VisitDeclarations in the hosting scope).
      
      2. Bind: for each module _declaration_ (i.e. literals as well as aliases),
         assign the respective instance object to respective local variables. This
         happens in VisitModuleDeclaration, and uses the instance objects created
         in the previous stage.
         For each module _literal_, this phase also constructs a module descriptor
         for the next stage. This happens in VisitModuleLiteral.
      
      3. Populate: invoke the DeclareModules runtime function to populate each
         _instance_ object with accessors for it exports. This is generated by
         DeclareModules (invoked by VisitDeclarations in the hosting scope again),
         and uses the descriptors generated in the previous stage.
      
      4. Initialize: execute the module bodies (and other code) in sequence. This
         happens by the separate statements generated for module bodies. To reenter
         the module scopes properly, the parser inserted ModuleStatements.
      
      R=mstarzinger@chromium.org,svenpanne@chromium.org
      BUG=
      
      Review URL: https://codereview.chromium.org/11093074
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13033 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      ce05280b
  17. 29 Aug, 2012 1 commit
  18. 28 Aug, 2012 1 commit
    • rossberg@chromium.org's avatar
      Allocate block-scoped global bindings to global context. · ccc827a6
      rossberg@chromium.org authored
      - 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=
      
      Review URL: https://chromiumcodereview.appspot.com/10872084
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12398 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      ccc827a6
  19. 08 Mar, 2012 1 commit
  20. 08 Nov, 2011 1 commit
    • keuchel@chromium.org's avatar
      Reapply r9870 "Remove some initialization checks based on source positions.". · 72dba271
      keuchel@chromium.org authored
      This reverts r9896 "Revert r9870 due to browser-test failures." See below for
      the diff from the previous version for the ia32 platform. The code for other
      platforms has been changed accordingly.
      
      TEST=mjsunit/compiler/lazy-const-lookup.js
      
      diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
      index 2cbf518..1990f2f 100644
      --- a/src/ia32/full-codegen-ia32.cc
      +++ b/src/ia32/full-codegen-ia32.cc
      @@ -1258,13 +1258,17 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
               // binding is initialized:
               //   function() { f(); let x = 1; function f() { x = 2; } }
               //
      -        // Check that we always have valid source position.
      -        ASSERT(var->initializer_position() != RelocInfo::kNoPosition);
      -        ASSERT(proxy->position() != RelocInfo::kNoPosition);
      -        bool skip_init_check =
      -            var->mode() != CONST &&
      -            var->scope()->DeclarationScope() == scope()->DeclarationScope() &&
      -            var->initializer_position() < proxy->position();
      +        bool skip_init_check;
      +        if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
      +          skip_init_check = false;
      +        } else {
      +          // Check that we always have valid source position.
      +          ASSERT(var->initializer_position() != RelocInfo::kNoPosition);
      +          ASSERT(proxy->position() != RelocInfo::kNoPosition);
      +          skip_init_check = var->mode() != CONST &&
      +              var->initializer_position() < proxy->position();
      +        }
      +
               if (!skip_init_check) {
                 // Let and const need a read barrier.
                 Label done;
      
      Review URL: http://codereview.chromium.org/8479034
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9915 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      72dba271
  21. 07 Nov, 2011 1 commit
  22. 03 Nov, 2011 4 commits
  23. 25 Oct, 2011 1 commit
  24. 11 Oct, 2011 1 commit
  25. 14 Sep, 2011 1 commit
  26. 07 Sep, 2011 1 commit
  27. 16 Aug, 2011 1 commit
  28. 11 Aug, 2011 1 commit
  29. 16 Jun, 2011 2 commits
  30. 15 Jun, 2011 1 commit
  31. 07 Apr, 2011 1 commit
  32. 26 Jan, 2011 1 commit
  33. 17 Jan, 2011 1 commit
  34. 07 Dec, 2010 2 commits