Sorry that example code was gibberish. I'm so used to being able to edit 
posts I make (and use syntax highlighting) that I'm very sloppy. The 
correct example code was:

function buildIfStatement(test, consequent, alternate) {
  return {
    type: 'IfStatement',
    prop1: test,
    prop2: consequent,
    prop3: alternate,
    prop4: null,
    prop5: null,
  }
}

But actually I think it was utterly pointless code as it misunderstands the 
real impact of the problem. Ast-handling code tends to look like:

function print() {
  switch(node.type) { // <-- only this access is needlessly megamorphic
    case 'IfStatement': return 'if (' + node.test + ')' + ... // <-- this 
access is monomorphic
  }
}

Thus while there is megamorphism it is not likely to be dominant in the 
total costs of real execution.

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/129f769e-069a-40bc-b716-6636d4873dc4n%40googlegroups.com.

Reply via email to