Ignore:
Timestamp:
Oct 28, 2009, 6:25:02 PM (16 years ago)
Author:
[email protected]
Message:

Improve for..in enumeration performance
https://bugs.webkit.org/show_bug.cgi?id=30887

Reviewed by Geoff Garen.

Improve indexing of an object with a for..in iterator by
identifying cases where get_by_val is being used with a iterator
as the subscript and replace it with a new get_by_pname
bytecode. get_by_pname then optimizes lookups that directly access
the base object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r49734 r50254  
    12821282RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
    12831283{
     1284    for (size_t i = m_forInContextStack.size(); i > 0; i--) {
     1285        ForInContext& context = m_forInContextStack[i - 1];
     1286        if (context.propertyRegister == property) {
     1287            emitOpcode(op_get_by_pname);
     1288            instructions().append(dst->index());
     1289            instructions().append(base->index());
     1290            instructions().append(property->index());
     1291            instructions().append(context.expectedSubscriptRegister->index());
     1292            instructions().append(context.iterRegister->index());
     1293            instructions().append(context.indexRegister->index());
     1294            return dst;
     1295        }
     1296    }
    12841297    emitOpcode(op_get_by_val);
    12851298    instructions().append(dst->index());
Note: See TracChangeset for help on using the changeset viewer.