1. 08 Dec, 2014 1 commit
  2. 16 Oct, 2014 1 commit
    • wingo@igalia.com's avatar
      Track usage of "this" and "arguments" in Scope · 0841f724
      wingo@igalia.com authored
      This adds flags in Scope to track wheter a Scope uses "this" and,
      "arguments". The information is exposed via Scope::uses_this(),
      and Scope::uses_arguments(), respectively. Flags for tracking
      usage on any inner scope uses are available as well via
      Scope::inner_uses_this(), and Scope::inner_uses_arguments().
      
      Knowing whether scopes use "this" and "arguments" will be handy
      to generate the code needed to capture their values when generating
      the code for arrow functions.
      
      BUG=v8:2700
      LOG=
      R=rossberg@chromium.org
      
      Review URL: https://codereview.chromium.org/422923004
      
      Patch from Adrian Perez de Castro <aperez@igalia.com>.
      
      git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24663 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      0841f724
  3. 19 Sep, 2014 1 commit
  4. 04 Aug, 2014 1 commit
  5. 30 Jul, 2014 1 commit
  6. 27 Jun, 2014 1 commit
  7. 24 Jun, 2014 1 commit
  8. 18 Jun, 2014 1 commit
  9. 13 Jun, 2014 1 commit
  10. 03 Jun, 2014 1 commit
  11. 22 May, 2014 1 commit
  12. 30 Apr, 2014 3 commits
  13. 29 Apr, 2014 1 commit
  14. 23 Apr, 2014 1 commit
  15. 04 Apr, 2014 1 commit
  16. 11 Mar, 2014 2 commits
  17. 20 Nov, 2013 1 commit
  18. 07 Nov, 2013 1 commit
  19. 02 Oct, 2013 1 commit
  20. 11 Sep, 2013 1 commit
  21. 03 Sep, 2013 1 commit
  22. 06 Jun, 2013 1 commit
  23. 04 Jun, 2013 1 commit
  24. 28 Feb, 2013 1 commit
  25. 27 Feb, 2013 1 commit
  26. 25 Feb, 2013 2 commits
  27. 20 Feb, 2013 1 commit
  28. 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
  29. 09 Jul, 2012 1 commit
    • rossberg@chromium.org's avatar
      Implement proper module linking. · 98db1a36
      rossberg@chromium.org authored
      Specifically:
      
      - In parser, check that all exports are defined.
      - Move JSModule allocation from parser to scope resolution.
      - Move JSModule linking from full codegen to scope resolution.
      - Implement module accessors for exported value members.
      - Allocate module contexts statically along with JSModules
        (to allow static linking), but chain them when module literal is evaluated.
      - Make module contexts' extension slot refer to resp. JSModule
        (makes modules' ScopeInfo accessible from context).
      - Some other tweaks to context handling in general.
      - Make any code containing module literals (and thus embedding
        static references to JSModules) non-cacheable.
      
      This enables accessing module instance objects as expected.
      Import declarations are a separate feature and do not work yet.
      
      R=mstarzinger@chromium.org
      BUG=v8:1569
      TEST=
      
      Review URL: https://chromiumcodereview.appspot.com/10690043
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12010 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      98db1a36
  30. 11 Jun, 2012 1 commit
  31. 16 Apr, 2012 2 commits
    • rossberg@chromium.org's avatar
      Implement rudimentary module linking. · ab26fb6b
      rossberg@chromium.org authored
      Constructs the (generally cyclic) graph of module instance objects
      and populates their exports. Any exports other than nested modules
      are currently set to 'undefined' (but already present as properties).
      
      Details:
      - Added new type JSModule for instance objects: a JSObject carrying a context.
      - Statically allocate instance objects for all module literals (in parser 8-}).
      - Extend interfaces to record and unify concrete instance objects,
        and to support iteration over members.
      - Introduce new runtime function for pushing module contexts.
      - Generate code for allocating, initializing, and setting module contexts,
        and for populating instance objects from module literals.
        Currently, all non-module exports are still initialized with 'undefined'.
      - Module aliases are resolved statically, so no special code is required.
      - Make sure that code containing module constructs is never optimized
        (macrofy AST node construction flag setting while we're at it).
      - Add test case checking linkage.
      
      Baseline: http://codereview.chromium.org/9722043/
      
      R=svenpanne@chromium.org,mstarzinger@chromium.org
      BUG=
      TEST=
      
      Review URL: https://chromiumcodereview.appspot.com/9844002
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      ab26fb6b
    • rossberg@chromium.org's avatar
      Refactoring of code generation for declarations, in preparation for modules. · 43a52c4c
      rossberg@chromium.org authored
      Do proper dispatch on declaration type instead of mingling together
      different code generation paths. Once we add more declaration forms,
      this is more scalable.
      
      In separate steps, I'd like to (1) clean up the logic for DeclareGlobal,
      and (2) try to reduce the special handling of the name function var if
      possible.
      
      R=fschneider@chromium.org
      BUG=
      TEST=
      
      Review URL: https://chromiumcodereview.appspot.com/9704054
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11331 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      43a52c4c
  32. 24 Nov, 2011 1 commit
    • keuchel@chromium.org's avatar
      Introduce extended mode. · 1e9a7267
      keuchel@chromium.org authored
      This CL introduces a third mode next to the non-strict
      (henceforth called 'classic mode') and 'strict mode'
      which is called 'extended mode' as in the current
      ES.next specification drafts. The extended mode is based on
      the 'strict mode' and adds new functionality to it. This
      means that most of the semantics of these two modes
      coincide.
      
      The 'extended mode' is entered instead of the 'strict mode'
      during parsing when using the 'strict mode' directive
      "use strict" and when the the harmony-scoping flag is
      active. This should be changed once it is fully specified how the 'extended mode' is entered.
      
      This change introduces a new 3 valued enum LanguageMode
      (see globals.h) corresponding to the modes which is mostly
      used by the frontend code. This includes the following
      components:
      * (Pre)Parser
      * Compiler
      * SharedFunctionInfo, Scope and ScopeInfo
      * runtime functions: StoreContextSlot,
        ResolvePossiblyDirectEval, InitializeVarGlobal,
        DeclareGlobals
      
      The old enum StrictModeFlag is still used in the backend
      when the distinction between the 'strict mode' and the 'extended mode' does not matter. This includes:
      * SetProperty runtime function, Delete builtin
      * StoreIC and KeyedStoreIC
      * StubCache
      
      Review URL: http://codereview.chromium.org/8417035
      
      git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10062 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
      1e9a7267
  33. 03 Nov, 2011 3 commits