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.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
(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:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index 55101d4..92df153 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -1187,11 +1187,14 @@
             printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).data());
             break;
         }
-        case op_new_error: {
-            int r0 = (++it)->u.operand;
-            int errorType = (++it)->u.operand;
+        case op_throw_reference_error: {
             int k0 = (++it)->u.operand;
-            printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(exec, r0).data(), errorType, constantName(exec, k0, getConstant(k0)).data());
+            printf("[%4d] throw_reference_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
+            break;
+        }
+        case op_throw_syntax_error: {
+            int k0 = (++it)->u.operand;
+            printf("[%4d] throw_syntax_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
             break;
         }
         case op_jsr: {
@@ -1639,7 +1642,7 @@
         else
             high = mid;
     }
-    
+
     ASSERT(low);
     if (!low) {
         startOffset = 0;