Ignore:
Timestamp:
Sep 17, 2008, 11:20:42 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-17 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
<https://bugs.webkit.org/show_bug.cgi?id=20876>

r36417 and r36427 caused an get_by_id opcode to be emitted before the
instanceof and construct opcodes, in order to enable inline caching of
the prototype property. Unfortunately, this regressed some tests dealing
with exceptions thrown by 'instanceof' and the 'new' operator. We fix
these problems by detecting whether an "is not an object" exception is
thrown before op_instanceof or op_construct, and emit the proper
exception in those cases.

  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitConstruct):
  • VM/CodeGenerator.h:
  • VM/ExceptionHelpers.cpp: (JSC::createInvalidParamError): (JSC::createNotAConstructorError): (JSC::createNotAnObjectError):
  • VM/ExceptionHelpers.h:
  • VM/Machine.cpp: (JSC::Machine::getOpcode): (JSC::Machine::privateExecute):
  • VM/Machine.h:
  • kjs/nodes.cpp: (JSC::NewExprNode::emitCode): (JSC::InstanceOfNode::emitCode):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r36528 r36604  
    11101110}
    11111111
    1112 RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode)
     1112RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
    11131113{
    11141114    ASSERT(func->refCount());
     
    11301130    }
    11311131
     1132    emitExpressionInfo(divot, startOffset, endOffset);
    11321133    emitGetById(funcProto.get(), func, globalExec()->propertyNames().prototype);
    11331134
     1135    emitExpressionInfo(divot, startOffset, endOffset);
    11341136    emitOpcode(op_construct);
    11351137    instructions().append(dst->index());
Note: See TracChangeset for help on using the changeset viewer.