Move StackGuard::InterruptRequested into StackLimitCheck.
R=yangguo@chromium.org Review URL: https://codereview.chromium.org/1310253002 Cr-Commit-Position: refs/heads/master@{#30333}
This commit is contained in:
parent
c75af23299
commit
c9f3d892b2
@ -626,7 +626,7 @@ Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
|
||||
}
|
||||
|
||||
|
||||
void StackGuard::CheckAndHandleGCInterrupt() {
|
||||
void StackGuard::HandleGCInterrupt() {
|
||||
if (CheckAndClearInterrupt(GC_REQUEST)) {
|
||||
isolate_->heap()->HandleGCRequest();
|
||||
}
|
||||
|
@ -195,10 +195,7 @@ class StackGuard final {
|
||||
// If the stack guard is triggered, but it is not an actual
|
||||
// stack overflow, then handle the interruption accordingly.
|
||||
Object* HandleInterrupts();
|
||||
|
||||
bool InterruptRequested() { return GetCurrentStackPosition() < climit(); }
|
||||
|
||||
void CheckAndHandleGCInterrupt();
|
||||
void HandleGCInterrupt();
|
||||
|
||||
private:
|
||||
StackGuard();
|
||||
|
@ -1478,11 +1478,17 @@ class StackLimitCheck BASE_EMBEDDED {
|
||||
explicit StackLimitCheck(Isolate* isolate) : isolate_(isolate) { }
|
||||
|
||||
// Use this to check for stack-overflows in C++ code.
|
||||
inline bool HasOverflowed() const {
|
||||
bool HasOverflowed() const {
|
||||
StackGuard* stack_guard = isolate_->stack_guard();
|
||||
return GetCurrentStackPosition() < stack_guard->real_climit();
|
||||
}
|
||||
|
||||
// Use this to check for interrupt request in C++ code.
|
||||
bool InterruptRequested() {
|
||||
StackGuard* stack_guard = isolate_->stack_guard();
|
||||
return GetCurrentStackPosition() < stack_guard->climit();
|
||||
}
|
||||
|
||||
// Use this to check for stack-overflow when entering runtime from JS code.
|
||||
bool JsHasOverflowed(uintptr_t gap = 0) const;
|
||||
|
||||
|
@ -263,10 +263,10 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() {
|
||||
return Handle<Object>::null();
|
||||
}
|
||||
|
||||
if (isolate_->stack_guard()->InterruptRequested()) {
|
||||
if (stack_check.InterruptRequested()) {
|
||||
ExecutionAccess access(isolate_);
|
||||
// Avoid blocking GC in long running parser (v8:3974).
|
||||
isolate_->stack_guard()->CheckAndHandleGCInterrupt();
|
||||
isolate_->stack_guard()->HandleGCInterrupt();
|
||||
}
|
||||
|
||||
if (c0_ == '"') return ParseJsonString();
|
||||
|
Loading…
Reference in New Issue
Block a user