In V8 currently most assumptions are made and checked at uses, not at
definitions.

Consider for example:

var p = new Point(1, 2);

function add(p) {
  return p.x + p.y
}

add(p);

Here the fact that p.x and p.y is numbers is checked at the +
operation. If add is optimized for these assumptions and you pass
point that contains strings in x and y then function add will
deoptimize. But this will happen when you execute add not when you
create point with string values in x and y.
Vyacheslav Egorov


On Tue, Nov 6, 2012 at 3:44 PM, Wyatt <[email protected]> wrote:
> Interesting! But wouldn't each of these cases nullify any assumptions
> made by the type-specializing JIT?
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to