Hi

Given an object

var  obj1 = {
'x': 'foo',
'y': 'bar',
'z': 'baz'
};

When I access a property with dot-notation in a function

function getPropDot1() {
return obj1.x;
}
getPropDot1();

the function gets optimized.
When I access the property with bracket-notation

function getPropBrackets1(id) {
return obj1[id];
}
getPropBrackets1('x');

a deopt will happen.

Inspecting the IR produced by Hydrogen I found a 'Change' code that seems 
to try to convert the property name 'x' to an int32, fails (NaN) and thus 
deoptimizes.

a) Why is this?
b) How can it be prevented?

Thanks for clarification.
Regards, Mathias

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to