Ignore:
Timestamp:
Apr 16, 2009, 5:01:31 AM (16 years ago)
Author:
[email protected]
Message:

Optimise op_resolve_base

Reviewed by Gavin Barraclough.

If we can statically find a property we are trying to resolve
the base of, the base is guaranteed to be the global object.

File:
1 edited

Legend:

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

    r42574 r42575  
    11051105RegisterID* BytecodeGenerator::emitResolveBase(RegisterID* dst, const Identifier& property)
    11061106{
    1107     emitOpcode(op_resolve_base);
    1108     instructions().append(dst->index());
    1109     instructions().append(addConstant(property));
    1110     return dst;
     1107    size_t depth = 0;
     1108    int index = 0;
     1109    JSObject* globalObject = 0;
     1110    findScopedProperty(property, index, depth, false, globalObject);
     1111    if (!globalObject) {
     1112        // We can't optimise at all :-(
     1113        emitOpcode(op_resolve_base);
     1114        instructions().append(dst->index());
     1115        instructions().append(addConstant(property));
     1116        return dst;
     1117    }
     1118
     1119    // Global object is the base
     1120    return emitLoadGlobalObject(dst, globalObject);
    11111121}
    11121122
Note: See TracChangeset for help on using the changeset viewer.