The interpreter engine for the core JavaScript language, independent of the browser's object model. File ONLY core JavaScript language bugs in this category. For bugs involving browser objects such as "window" and "document", use the "DOM" component. For bugs involving calls between JavaScript and C++, use the "XPConnect" component.

This code is super hot and yet it's much slower than necessary:
* When we are enumerating own properties and have a newEnumerate hook, we get paranoid and always check for duplicates. This is unnecessary for unboxed objects because we know these hooks don't return duplicates. This shows up quite a lot on Speedometer.
* In Enumerate (called for each property we see), we decide if we need to check for duplicates. It's faster (and simpler even) to hoist this check all the way up into Snapshot.
Initially I passed this as bool argument but then I decided to make it a CheckForDuplicates template parameter so the compiler can inline Enumerate into the callers and generate much better code.
I also had to factor out the proxy enumeration code into EnumerateProxyProperties so we can templatize it.
Below is a simple micro-benchmark for both unboxed object enumeration and native objects. I get the following results:
before:
- unboxed: 255
- native: 161
after:
- unboxed: 117
- native: 121
function f() {
var t = new Date;
for (var i = 0; i < 1000000; i++)
Object.getOwnPropertyNames({x: 1, y: 2, z: 3});
print(new Date - t);
}
f();
function g() {
var t = new Date;
for (var i = 0; i < 1000000; i++) {
Object.keys(Object.prototype);
}
print(new Date - t);
}
g();