Changeset 71878 in webkit for trunk/JavaScriptCore/parser/Nodes.h


Ignore:
Timestamp:
Nov 11, 2010, 7:06:07 PM (15 years ago)
Author:
[email protected]
Message:

Bug 49420 - Clean up syntax/reference error throw.

Reviewed by Oliver Hunt.

Some errors detected at compile time are thrown at runtime. We currently do so using a op_new_error/op_throw bytecode pair.
This is not ideal. op_throw is used for explicit user throw statements, and has different requirements in terms or meta data
attached to the exception (controlled by the explicitThrow parameter passed to Interpreter::throwException). To work around
this, op_new_error has to add the meta data at an early stage, which is unlike other VM exceptions being raised.

We can simplify this and bring into line with other exception behaviour by changing new_error from just allocating an
Exception instance to also throwing it – but as a regular VM throw, correctly passing explicitThrow as false.

(JSC::CodeBlock::dump):
(JSC::CodeBlock::expressionRangeForBytecodeOffset):

  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitThrowReferenceError):
(JSC::BytecodeGenerator::emitThrowSyntaxError):
(JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitNodeInConditionContext):

  • bytecompiler/NodesCodegen.cpp:

(JSC::ThrowableExpressionData::emitThrowReferenceError):
(JSC::ThrowableExpressionData::emitThrowSyntaxError):
(JSC::RegExpNode::emitBytecode):
(JSC::PostfixErrorNode::emitBytecode):
(JSC::PrefixErrorNode::emitBytecode):
(JSC::AssignErrorNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ContinueNode::emitBytecode):
(JSC::BreakNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::LabelNode::emitBytecode):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_throw_reference_error):
(JSC::JIT::emit_op_throw_syntax_error):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_throw_reference_error):
(JSC::JIT::emit_op_throw_syntax_error):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:
  • parser/Nodes.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.h

    r69516 r71878  
    270270
    271271    protected:
    272         RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message);
    273         RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const UString&);
    274         RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const Identifier&);
     272        RegisterID* emitThrowReferenceError(BytecodeGenerator&, const UString& message);
     273        RegisterID* emitThrowSyntaxError(BytecodeGenerator&, const UString& message);
    275274
    276275    private:
Note: See TracChangeset for help on using the changeset viewer.