1. 19 Apr, 2017 1 commit
  2. 18 Apr, 2017 1 commit
    • bmeurer's avatar
      [turbofan] Introduce a dedicated Array type. · 199e543f
      bmeurer authored
      Use Type::Array to constant-fold Array.isArray builtin based on the
      value input type. Also use it to improve type based alias analysis,
      where we know that stores to an object of type Array don't affect stores
      to an object of type OtherObject, and vice versa.
      
      R=jarin@chromium.org
      BUG=v8:6262
      
      Review-Url: https://codereview.chromium.org/2819583002
      Cr-Commit-Position: refs/heads/master@{#44681}
      199e543f
  3. 12 Apr, 2017 2 commits
    • bmeurer's avatar
      [turbofan] Properly represent the float64 hole. · 8c0c5e81
      bmeurer authored
      The hole NaN should also have proper Type::Hole, and not silently hide
      in the Type::Number. This way we can remove all the special casing for
      the hole NaN, and we also finally get the CheckNumber right.
      
      This also allows us to remove some ducktape from the Deoptimizer, as for
      escape analyzed FixedDoubleArrays we always pass the hole value now to
      represent the actual holes.
      
      Also-By: jarin@chromium.org
      BUG=chromium:684208,chromium:709753,v8:5267
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2814013003
      Cr-Commit-Position: refs/heads/master@{#44603}
      8c0c5e81
    • bmeurer's avatar
      [turbofan] Fix typing rule for CheckBounds. · 483812d4
      bmeurer authored
      As of crrev.com/2760213003, the CheckBounds operator passes a truncation
      that identfies zero and minus zero. However that was not reflected in
      the typing rule, and as such the type of CheckBounds(-0,length) was
      always Type::None. That confused the typed alias analysis in the
      LoadElimination and led to ignoring StoreElement nodes.
      
      BUG=chromium:708050
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2812013006
      Cr-Commit-Position: refs/heads/master@{#44598}
      483812d4
  4. 07 Apr, 2017 2 commits
    • bmeurer's avatar
      [turbofan] Introduce a SpeculativeToNumber operator. · e6ca0146
      bmeurer authored
      Add a dedicated operator for ToNumber(x) with feedback instead of
      translating to SpeculativeNumberMultiply(x,1), which allows us to
      treat the case where x is already a Number specially, ignoring the
      feedback on the operator. This recovers most of the regression in
      the crypto benchmark.
      
      BUG=chromium:709398,v8:6214,v8:5267
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2802113003
      Cr-Commit-Position: refs/heads/master@{#44484}
      e6ca0146
    • jarin's avatar
      [turbofan] Add type to the allocation operator. · e97b29a4
      jarin authored
      This gives us more precise type information, so we can avoid some type
      guards to refine the type information back.
      
      The motivation for this is to help escape analysis by not introducing
      redundant type guards (which escape analysis cannot handle yet even
      though it could and should do).
      
      Motivating example:
      
      In the example below, the out-of-object property array for properties
      fld5 and fld6 gets type Any when it is created by "o.fld5 = 5" (for
      object literals, we store 4 properties in-objeca, the rest goes out
      of object).
      
      When we run load elimination for the load the out-of-object property
      array (to store 6 into o.fld6), load elimination inserts TypeGuard to
      enforce the Type::Internal() type. This makes escape analysis bail out
      on this object, and we do not eliminate the object creation.
      
      function f() {
        var o = {};
        o.fld1 = 1;
        o.fld2 = 2;
        o.fld3 = 3;
        o.fld4 = 4;
        o.fld5 = 5;
        o.fld6 = 6;
      }
      
      f();
      f();
      %OptimizeFunctionOnNextCall(f);
      f();
      
      Review-Url: https://codereview.chromium.org/2797993006
      Cr-Commit-Position: refs/heads/master@{#44470}
      e97b29a4
  5. 17 Mar, 2017 1 commit
    • neis's avatar
      [compiler] Fix typing of ToLength. · 1b696f3c
      neis authored
      Typer::Visitor::ToLength was unsound (and non-monotonic).  For instance,
      if the input type was Range(2^53, 2^53+1), the result type was
      Constant(2^53).  Now the result is type Constant(2^53-1).  (The result
      of ToLength is guaranteed to be between 0 and 2^53-1.)
      
      BUG=
      
      Review-Url: https://codereview.chromium.org/2753773010
      Cr-Commit-Position: refs/heads/master@{#43914}
      1b696f3c
  6. 15 Mar, 2017 1 commit
  7. 14 Mar, 2017 1 commit
  8. 07 Mar, 2017 1 commit
  9. 03 Mar, 2017 3 commits
  10. 28 Feb, 2017 1 commit
    • tebbi's avatar
      [turbofan] escape analysis supports arguments object and rest elements · 7467f16d
      tebbi authored
      The new NewUnmappedArgumentsElements node now takes two inputs:
      - the frame holding the arguments (current frame or arguments adaptor frame)
      - the length of the suffix of passed arguments to be copied into the backing store
      
      These inputs are computed with two new node types:
      ArgumentsFrame()
      ArgumentsLength[formal_parameter_count,is_rest_length](Node* arguments_frame)
      The node type NewRestParameterElements can now be expressed with NewUnmappedArgumentsElements and an appropriate length and is thus not needed anymore.
      
      In escape analysis, we lower loads from the length field of NewUnmappedArgumentsElements with its length input and if we find out that no write access to the arguments elements exists, we replace element loads with direct stack access and replace the NewUnmappedArgumentsElements node with a node of the new node type ArgumentsElementsState. This corresponds to an ObjectState node and gets translated into a deoptimizer instruction to allocate the backing store. Together with the already existing deoptimizer support for the actual arguments object/rest parameters, this allows to remove all allocations for arguments objects/rest parameters in this case.
      In the deoptimizer, we read the actual parameters from the stack while transforming the static deopt info into TranslatedValue objects.
      
      If escape analysis cannot remove the backing store allocation, NewUnmappedArgumentsElements gets lo
      
      BUG=v8:5726
      
      Review-Url: https://codereview.chromium.org/2692753004
      Cr-Commit-Position: refs/heads/master@{#43475}
      7467f16d
  11. 27 Feb, 2017 1 commit
  12. 18 Feb, 2017 1 commit
    • vabr's avatar
      Fix typeof optimization for undetectable · 6302753e
      vabr authored
      Currently, typeof o, where o is an undetectable
      callable object (such as document.all), returns 'function' if
      optimised. It should, however, return 'undefined'.
      
      This CL excludes undetectable objects from the optimization
      resulting in type 'function' and renames the related code to
      reflect that.
      
      BUG=v8:5972
      R=bmeurer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2697063002
      Cr-Commit-Position: refs/heads/master@{#43298}
      6302753e
  13. 17 Feb, 2017 1 commit
  14. 09 Feb, 2017 1 commit
    • bmeurer's avatar
      [turbofan] Utilize the fact that empty string is canonicalized. · cd9724d4
      bmeurer authored
      Since the empty string is canonical HeapObject now, we can use
      this fact to optimize
      
        - strict equality comparisons with the empty string to a
          simple ReferenceEqual operation, and
        - optimize ToBoolean to avoid instance type checks completely.
      
      Drive-by-fix: Allow InternalizedString for Type::HeapConstant
      in the type system. This is safe, since InternalizedStrings
      can be compared to other heap constants by reference (except
      for non-InternalizedStrings, which are excluded from the
      HeapConstant type).
      
      BUG=v8:5267
      R=yangguo@chromium.org
      
      Review-Url: https://codereview.chromium.org/2681273002
      Cr-Commit-Position: refs/heads/master@{#43050}
      cd9724d4
  15. 01 Feb, 2017 2 commits
  16. 30 Jan, 2017 1 commit
  17. 27 Jan, 2017 2 commits
    • bmeurer's avatar
      [turbofan] Introduce dedicated StringIndexOf operator. · b975441e
      bmeurer authored
      The StringIndexOf operation is pure on the JS level, but the actual stub
      call must be in the effect chain later so that the Scheduler doesn't
      place it inside some allocation region (The %StringIndexOf runtime
      function may trigger a GC for string flattening).
      
      BUG=chromium:685580
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2657243002
      Cr-Commit-Position: refs/heads/master@{#42736}
      b975441e
    • yangguo's avatar
      [liveedit] reimplement frame restarting. · 3f47c63d
      yangguo authored
      Previously, when restarting a frame, we would rewrite all frames
      between the debugger activation and the frame to restart to squash
      them, and replace the return address with that of a builtin to
      leave that rewritten frame, and restart the function by calling it.
      
      We now simply remember the frame to drop to, and upon returning
      from the debugger, we check whether to drop the frame, load the
      new FP, and restart the function.
      
      R=jgruber@chromium.org, mstarzinger@chromium.org
      BUG=v8:5587
      
      Review-Url: https://codereview.chromium.org/2636913002
      Cr-Commit-Position: refs/heads/master@{#42725}
      3f47c63d
  18. 26 Jan, 2017 2 commits
    • bmeurer's avatar
      [turbofan] Assign proper type to Object.prototype.toString(). · ec00a78f
      bmeurer authored
      BUG=v8:5267
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2652273003
      Cr-Commit-Position: refs/heads/master@{#42691}
      ec00a78f
    • bmeurer's avatar
      [turbofan] Introduce JSCallForwardVarargs operator. · 69747e26
      bmeurer authored
      We turn a JSCallFunction node for
      
        f.apply(receiver, arguments)
      
      into a JSCallForwardVarargs node, when the arguments refers to the
      arguments of the outermost optimized code object, i.e. not an inlined
      arguments, and the apply method refers to Function.prototype.apply,
      and there's no other user of arguments except in frame states.
      
      We also replace the arguments node in the graph with a marker for
      the Deoptimizer similar to Crankshaft to make sure we don't materialize
      unused arguments just for the sake of deoptimization. We plan to replace
      this with a saner EscapeAnalysis based solution soon.
      
      R=jarin@chromium.org
      BUG=v8:5267,v8:5726
      
      Review-Url: https://codereview.chromium.org/2655233002
      Cr-Commit-Position: refs/heads/master@{#42680}
      69747e26
  19. 23 Jan, 2017 1 commit
  20. 20 Jan, 2017 2 commits
    • bmeurer's avatar
      [turbofan] Assign proper types to various builtins. · f23819ef
      bmeurer authored
      Let the Typer assign proper types to Map, Set, WeakMap and WeakSet
      builtins. Also assign a proper type to Array.isArray, Object.assign
      and Object.create.
      
      R=yangguo@chromium.org
      
      Review-Url: https://codereview.chromium.org/2640783006
      Cr-Commit-Position: refs/heads/master@{#42535}
      f23819ef
    • bmeurer's avatar
      [turbofan] Properly implement %_ClassOf intrinsic. · 3e407093
      bmeurer authored
      The %_ClassOf intrinsic roughly corresponds to the deprecated ES5
      [[Class]] internal property, and should not be used anymore ideally.
      However since we still have quite a couple of uses of this intrinsic
      in the self hosted JavaScript builtins, we would tank some builtins
      like Map, Set, WeakMap, WeakSet, etc. quite significantly unless we
      also support this intrinsic until the builtins are all migrated to
      C++/CSA builtins.
      
      R=yangguo@chromium.org
      BUG=v8:5267
      
      Review-Url: https://codereview.chromium.org/2647833004
      Cr-Commit-Position: refs/heads/master@{#42530}
      3e407093
  21. 19 Jan, 2017 2 commits
  22. 18 Jan, 2017 1 commit
  23. 02 Jan, 2017 1 commit
  24. 22 Dec, 2016 1 commit
    • bmeurer's avatar
      [turbofan] Introduce a dedicated StringCharAt operator. · 05f5ebce
      bmeurer authored
      Previously String element access and String.prototype.charAt were
      lowered to a subgraph StringFromCharCode(StringCharCodeAt(s, k)),
      however that can be fairly expensive both runtime and compile time
      wise. The dedicated StringCharAt operator is implemented via a call
      to a builtin that does exactly this.
      
      R=yangguo@chromium.org
      
      Review-Url: https://codereview.chromium.org/2599683002
      Cr-Commit-Position: refs/heads/master@{#41909}
      05f5ebce
  25. 19 Dec, 2016 1 commit
  26. 15 Dec, 2016 1 commit
    • ahaas's avatar
      [wasm] Introduce the TrapIf and TrapUnless operators to generate trap code. · 7bd61b60
      ahaas authored
      Some instructions in WebAssembly trap for some inputs, which means that the
      execution is terminated and (at least at the moment) a JavaScript exception is
      thrown. Examples for traps are out-of-bounds memory accesses, or integer
      divisions by zero.
      
      Without the TrapIf and TrapUnless operators trap check in WebAssembly introduces 5
      TurboFan nodes (branch, if_true, if_false, trap-reason constant, trap-position
      constant), in addition to the trap condition itself. Additionally, each
      WebAssembly function has four TurboFan nodes (merge, effect_phi, 2 phis) whose
      number of inputs is linear to the number of trap checks in the function.
      Especially for functions with high numbers of trap checks we observe a
      significant slowdown in compilation time, down to 0.22 MiB/s in the sqlite
      benchmark instead of the average of 3 MiB/s in other benchmarks. By introducing
      a TrapIf common operator only a single node is necessary per trap check, in
      addition to the trap condition. Also the nodes which are shared between trap
      checks (merge, effect_phi, 2 phis) would disappear. First measurements suggest a
      speedup of 30-50% on average.
      
      This CL only implements TrapIf and TrapUnless on x64. The implementation is also
      hidden behind the --wasm-trap-if flag.
      
      Please take a special look at how the source position is transfered from the
      instruction selector to the code generator, and at the context that is used for
      the runtime call.
      
      R=titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2562393002
      Cr-Commit-Position: refs/heads/master@{#41720}
      7bd61b60
  27. 12 Dec, 2016 1 commit
  28. 08 Dec, 2016 1 commit
  29. 29 Nov, 2016 1 commit
    • bmeurer's avatar
      [turbofan] Add appropriate types to express Callable. · 777e142c
      bmeurer authored
      This introduces three new types OtherCallable, CallableProxy (and OtherProxy),
      and BoundFunction to make it possible to express Callable in the Type system.
      It also forces all undetectable receivers to be Callable, which matches the
      use case for undetectable, namely document.all (guarded by proper checks and
      tests).
      
      It also uses these new types to properly optimize instanceof (indirectly via
      OrdinaryHasInstance) based on the type of the constructor and the object. So
      we are able to constant-fold certain instanceof expressions based on types
      and completely avoid the builtin call.
      
      R=jarin@chromium.org
      BUG=v8:5267
      
      Review-Url: https://codereview.chromium.org/2535753004
      Cr-Commit-Position: refs/heads/master@{#41345}
      777e142c
  30. 28 Nov, 2016 1 commit
  31. 27 Nov, 2016 1 commit