Commit 16ff37db authored by ulan's avatar ulan Committed by Commit bot

Check for GC interrupt in JSON parser.

BUG=v8:3974
LOG=NO

Review URL: https://codereview.chromium.org/1021523002

Cr-Commit-Position: refs/heads/master@{#27334}
parent d5893cad
......@@ -651,6 +651,13 @@ Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
}
void StackGuard::CheckAndHandleGCInterrupt() {
if (CheckAndClearInterrupt(GC_REQUEST)) {
isolate_->heap()->HandleGCRequest();
}
}
Object* StackGuard::HandleInterrupts() {
if (CheckAndClearInterrupt(GC_REQUEST)) {
isolate_->heap()->HandleGCRequest();
......
......@@ -197,6 +197,10 @@ class StackGuard FINAL {
// stack overflow, then handle the interruption accordingly.
Object* HandleInterrupts();
bool InterruptRequested() { return GetCurrentStackPosition() < climit(); }
void CheckAndHandleGCInterrupt();
private:
StackGuard();
......
......@@ -261,6 +261,11 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() {
return Handle<Object>::null();
}
if (isolate_->stack_guard()->InterruptRequested()) {
// Avoid blocking GC in long running parser (v8:3974).
isolate_->stack_guard()->CheckAndHandleGCInterrupt();
}
if (c0_ == '"') return ParseJsonString();
if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber();
if (c0_ == '{') return ParseJsonObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment