Commit c984efe6 authored by ishell's avatar ishell Committed by Commit bot

Reland "Fixed a couple of failing DCHECK(has_pending_exception()). (patchset...

Reland "Fixed a couple of failing DCHECK(has_pending_exception()). (patchset #1 id:1 of https://codereview.chromium.org/1151373002/ )"

BUG=chromium:491062
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28699}
parent 6edc3e31
......@@ -1499,7 +1499,10 @@ bool Genesis::CompileNative(Isolate* isolate, Vector<const char> name,
// environment has been at least partially initialized. Add a stack check
// before entering JS code to catch overflow early.
StackLimitCheck check(isolate);
if (check.HasOverflowed()) return false;
if (check.HasOverflowed()) {
isolate->StackOverflow();
return false;
}
Handle<Context> context(isolate->context());
......@@ -2980,7 +2983,10 @@ Genesis::Genesis(Isolate* isolate,
// environment has been at least partially initialized. Add a stack check
// before entering JS code to catch overflow early.
StackLimitCheck check(isolate);
if (check.HasOverflowed()) return;
if (check.HasOverflowed()) {
isolate->StackOverflow();
return;
}
// The deserializer needs to hook up references to the global proxy.
// Create an uninitialized global proxy now if we don't have one
......
......@@ -608,13 +608,7 @@ bool Debug::CompileDebuggerScript(Isolate* isolate, int index) {
source_code, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE,
false);
// Silently ignore stack overflows during compilation.
if (function_info.is_null()) {
DCHECK(isolate->has_pending_exception());
isolate->clear_pending_exception();
return false;
}
if (function_info.is_null()) return false;
// Execute the shared function in the debugger context.
Handle<JSFunction> function =
......
......@@ -849,9 +849,13 @@ Object* Isolate::StackOverflow() {
// constructor. Instead, we copy the pre-constructed boilerplate and
// attach the stack trace as a hidden property.
Handle<String> key = factory()->stack_overflow_string();
Handle<JSObject> boilerplate = Handle<JSObject>::cast(
Object::GetProperty(js_builtins_object(), key).ToHandleChecked());
Handle<JSObject> exception = factory()->CopyJSObject(boilerplate);
Handle<Object> boilerplate =
Object::GetProperty(js_builtins_object(), key).ToHandleChecked();
if (boilerplate->IsUndefined()) {
return Throw(heap()->undefined_value(), nullptr);
}
Handle<JSObject> exception =
factory()->CopyJSObject(Handle<JSObject>::cast(boilerplate));
Throw(*exception, nullptr);
CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value());
......
......@@ -2748,6 +2748,10 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
Handle<FixedArray> instances;
{
DebugScope debug_scope(isolate->debug());
if (debug_scope.failed()) {
DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception();
}
// Fill the script objects.
instances = isolate->debug()->GetLoadedScripts();
}
......
......@@ -178,6 +178,9 @@
# Issue 488: this test sometimes times out.
'array-constructor': [PASS, TIMEOUT],
# Run only on fast architectures, contains no architecture dependent code.
'regress/regress-crbug-491062': [PASS, ['arch != ia32 and arch != x64', SKIP], NO_VARIANTS],
# Very slow on ARM and MIPS, contains no architecture dependent code.
'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', TIMEOUT]],
'regress/regress-3976': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', SKIP]],
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --stack-limit=32
function g() {}
var count = 0;
function f() {
try {
f();
} catch(e) {
print(e.stack);
}
if (count < 50) {
count++;
%DebugGetLoadedScripts();
}
}
f();
g();
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