mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1073652 - Baseline-compile JSOP_THROWING. r=bhackett
This commit is contained in:
parent
9aa0d3ba40
commit
3f4c3e3d5e
@ -94,3 +94,18 @@ for (var i = 0; i < 100; i++) {
|
||||
assertEq(getException(test4_4), count-1);
|
||||
}
|
||||
assertEq(count, 4500);
|
||||
|
||||
function test5() {
|
||||
var res = 0;
|
||||
for (var i=0; i<40; i++) {
|
||||
try {
|
||||
throw i;
|
||||
} catch (e if e % 2) {
|
||||
res += e;
|
||||
} catch (e) {
|
||||
res += e * 3;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
assertEq(test5(), 1540);
|
||||
|
@ -2776,6 +2776,21 @@ BaselineCompiler::emit_JSOP_THROW()
|
||||
return callVM(ThrowInfo);
|
||||
}
|
||||
|
||||
typedef bool (*ThrowingFn)(JSContext *, HandleValue);
|
||||
static const VMFunction ThrowingInfo = FunctionInfo<ThrowingFn>(js::ThrowingOperation);
|
||||
|
||||
bool
|
||||
BaselineCompiler::emit_JSOP_THROWING()
|
||||
{
|
||||
// Keep value to throw in R0.
|
||||
frame.popRegsAndSync(1);
|
||||
|
||||
prepareVMCall();
|
||||
pushArg(R0);
|
||||
|
||||
return callVM(ThrowingInfo);
|
||||
}
|
||||
|
||||
bool
|
||||
BaselineCompiler::emit_JSOP_TRY()
|
||||
{
|
||||
|
@ -154,6 +154,7 @@ namespace jit {
|
||||
_(JSOP_TYPEOFEXPR) \
|
||||
_(JSOP_SETCALL) \
|
||||
_(JSOP_THROW) \
|
||||
_(JSOP_THROWING) \
|
||||
_(JSOP_TRY) \
|
||||
_(JSOP_FINALLY) \
|
||||
_(JSOP_GOSUB) \
|
||||
|
@ -3290,10 +3290,9 @@ END_CASE(JSOP_FINALLY)
|
||||
|
||||
CASE(JSOP_THROWING)
|
||||
{
|
||||
JS_ASSERT(!cx->isExceptionPending());
|
||||
Value v;
|
||||
RootedValue &v = rootValue0;
|
||||
POP_COPY_TO(v);
|
||||
cx->setPendingException(v);
|
||||
MOZ_ALWAYS_TRUE(ThrowingOperation(cx, v));
|
||||
}
|
||||
END_CASE(JSOP_THROWING)
|
||||
|
||||
@ -3503,6 +3502,17 @@ js::Throw(JSContext *cx, HandleValue v)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
js::ThrowingOperation(JSContext *cx, HandleValue v)
|
||||
{
|
||||
// Like js::Throw, but returns |true| instead of |false| to continue
|
||||
// execution instead of calling the (JIT) exception handler.
|
||||
|
||||
MOZ_ASSERT(!cx->isExceptionPending());
|
||||
cx->setPendingException(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::GetProperty(JSContext *cx, HandleValue v, HandlePropertyName name, MutableHandleValue vp)
|
||||
{
|
||||
|
@ -366,6 +366,9 @@ class TryNoteIter
|
||||
bool
|
||||
Throw(JSContext *cx, HandleValue v);
|
||||
|
||||
bool
|
||||
ThrowingOperation(JSContext *cx, HandleValue v);
|
||||
|
||||
bool
|
||||
GetProperty(JSContext *cx, HandleValue value, HandlePropertyName name, MutableHandleValue vp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user