Bug 1208819 - Fix irregexp overrecursion check to ignore interrupts. r=bhackett

This commit is contained in:
Jan de Mooij 2015-10-14 15:13:21 +02:00
Родитель 57e8826009
Коммит 55e8001287
3 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -154,9 +154,11 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
masm.reserveStack(frameSize);
masm.checkStackAlignment();
// Check if we have space on the stack.
// Check if we have space on the stack. Use the *NoInterrupt stack limit to
// avoid failing repeatedly when the regex code is called from Ion JIT code,
// see bug 1208819.
Label stack_ok;
void* stack_limit = runtime->addressOfJitStackLimit();
void* stack_limit = runtime->addressOfJitStackLimitNoInterrupt();
masm.branchStackPtrRhs(Assembler::Below, AbsoluteAddress(stack_limit), &stack_ok);
// Exit with an exception. There is not enough space on the stack

Просмотреть файл

@ -130,6 +130,7 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
jitJSContext(nullptr),
jitActivation(nullptr),
jitStackLimit_(0xbad),
jitStackLimitNoInterrupt_(0xbad),
activation_(nullptr),
profilingActivation_(nullptr),
profilerSampleBufferGen_(0),
@ -623,6 +624,7 @@ JSRuntime::resetJitStackLimit()
#else
jitStackLimit_ = mainThread.nativeStackLimit[StackForUntrustedScript];
#endif
jitStackLimitNoInterrupt_ = jitStackLimit_;
}
void

Просмотреть файл

@ -632,6 +632,9 @@ struct JSRuntime : public JS::shadow::Runtime,
mozilla::Atomic<uintptr_t, mozilla::Relaxed> jitStackLimit_;
void resetJitStackLimit();
// Like jitStackLimit_, but not reset to trigger interrupts.
uintptr_t jitStackLimitNoInterrupt_;
public:
void initJitStackLimit();
@ -641,6 +644,8 @@ struct JSRuntime : public JS::shadow::Runtime,
void* addressOfJitStackLimit() { return &jitStackLimit_; }
static size_t offsetOfJitStackLimit() { return offsetof(JSRuntime, jitStackLimit_); }
void* addressOfJitStackLimitNoInterrupt() { return &jitStackLimitNoInterrupt_; }
// Information about the heap allocated backtrack stack used by RegExp JIT code.
js::irregexp::RegExpStack regexpStack;