@@ -682,7 +682,7 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {

// Compile the code.
if (!MakeCode(info)) {
if (!isolate->has_pending_exception()) isolate->StackOverflow();
if (!isolate->has_pending_exception()) isolate->StackOverflow(18);
return Handle<SharedFunctionInfo>::null();
}

@@ -1022,7 +1022,7 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
// Compile the code.
if (!MakeCode(info)) {
if (!isolate->has_pending_exception()) {
isolate->StackOverflow();
isolate->StackOverflow(17);
}
} else {
InstallCodeCommon(info);
@@ -944,7 +944,7 @@ MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) {
}
if (stack_guard->IsInterrupted()) {
stack_guard->Continue(INTERRUPT);
return isolate->StackOverflow();
return isolate->StackOverflow(16);
}
if (stack_guard->IsFullDeopt()) {
stack_guard->Continue(FULL_DEOPT);
@@ -5431,7 +5431,7 @@ MaybeObject* Heap::AllocateFixedArrayWithFiller(int length,
ASSERT(!InNewSpace(filler));
Object* result;
if( length > FixedArray::kMaxLength) {
fprintf(stderr, "CopyFixedArrayWithMap %d\n", length);
fprintf(stderr, "AllocateFixedArrayWithFiller %d\n", length);
fflush(stderr);
}
{ MaybeObject* maybe_result = AllocateRawFixedArray(length, pretenure);
@@ -5460,7 +5460,7 @@ MaybeObject* Heap::AllocateFixedArrayWithHoles(int length,
MaybeObject* Heap::AllocateUninitializedFixedArray(int length) {
if (length == 0) return empty_fixed_array();
if( length > FixedArray::kMaxLength) {
fprintf(stderr, "CopyFixedArrayWithMap %d\n", length);
fprintf(stderr, "AllocateUninitializedFixedArray %d\n", length);
fflush(stderr);
}

@@ -1100,7 +1100,7 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
Address re_frame) {
Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate);
if (isolate->stack_guard()->IsStackOverflow()) {
isolate->StackOverflow();
isolate->StackOverflow(8);
return EXCEPTION;
}

@@ -1089,8 +1089,8 @@ const char* const Isolate::kStackOverflowMessage =
"Uncaught RangeError: Maximum call stack size exceeded";


Failure* Isolate::StackOverflow() {
fprintf(stderr, "StackOverflow\n"); fflush(stderr);
Failure* Isolate::StackOverflow(int code) {
fprintf(stderr, "StackOverflow %d\n", code); fflush(stderr);
HandleScope scope(this);
// At this point we cannot create an Error object using its javascript
// constructor. Instead, we copy the pre-constructed boilerplate and
@@ -805,7 +805,7 @@ class Isolate {
void TraceException(bool flag);

// Out of resource exception helpers.
Failure* StackOverflow();
Failure* StackOverflow(int code = 0);
Failure* TerminateExecution();
void CancelTerminateExecution();

@@ -281,7 +281,7 @@ template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() {
StackLimitCheck stack_check(isolate_);
if (stack_check.HasOverflowed()) {
isolate_->StackOverflow();
isolate_->StackOverflow(15);
return Handle<Object>::null();
}

@@ -276,7 +276,7 @@ MaybeObject* BasicJsonStringifier::Stringify(Handle<Object> object) {
return isolate_->Throw(*factory_->NewTypeError(
"circular_structure", HandleVector<Object>(NULL, 0)));
case STACK_OVERFLOW:
return isolate_->StackOverflow();
return isolate_->StackOverflow(14);
default:
return Failure::Exception();
}
@@ -627,7 +627,7 @@ int RegExpImpl::IrregexpExecRaw(Handle<JSRegExp> regexp,
}
if (result == RE_EXCEPTION) {
ASSERT(!isolate->has_pending_exception());
isolate->StackOverflow();
isolate->StackOverflow(13);
}
return result;
#endif // V8_INTERPRETED_REGEXP
@@ -1128,7 +1128,7 @@ int RegExpMacroAssemblerMIPS::CheckStackGuardState(Address* return_address,
Address re_frame) {
Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate);
if (isolate->stack_guard()->IsStackOverflow()) {
isolate->StackOverflow();
isolate->StackOverflow(7);
return EXCEPTION;
}

@@ -5765,7 +5765,7 @@ Handle<JSObject> JSObjectWalkVisitor::StructureWalk(Handle<JSObject> object) {
Isolate* isolate = object->GetIsolate();
StackLimitCheck check(isolate);
if (check.HasOverflowed()) {
isolate->StackOverflow();
isolate->StackOverflow(12);
return Handle<JSObject>::null();
}

@@ -689,7 +689,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
result->set_dont_optimize_reason(
factory()->visitor()->dont_optimize_reason());
} else if (stack_overflow()) {
isolate()->StackOverflow();
isolate()->StackOverflow(11);
}
}

@@ -785,7 +785,7 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) {
ASSERT(target_stack_ == NULL);

if (result == NULL) {
if (stack_overflow()) isolate()->StackOverflow();
if (stack_overflow()) isolate()->StackOverflow(10);
} else {
Handle<String> inferred_name(shared_info->inferred_name());
result->set_inferred_name(inferred_name);
@@ -5790,7 +5790,7 @@ ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate,
scanner.Initialize(source);
PreParser::PreParseResult result = preparser.PreParseProgram();
if (result == PreParser::kPreParseStackOverflow) {
isolate->StackOverflow();
isolate->StackOverflow(9);
return NULL;
}

@@ -183,7 +183,7 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute(
if (result == EXCEPTION && !isolate->has_pending_exception()) {
// We detected a stack overflow (on the backtrack stack) in RegExp code,
// but haven't created the exception yet.
isolate->StackOverflow();
isolate->StackOverflow(5);
}
return static_cast<Result>(result);
}
@@ -8797,7 +8797,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) {
Handle<Object>* argv = argv_small_buffer;
if (argc > argv_small_size) {
argv = new Handle<Object>[argc];
if (argv == NULL) return isolate->StackOverflow();
if (argv == NULL) return isolate->StackOverflow(4);
argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
}

@@ -8837,7 +8837,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) {
Handle<Object>* argv = argv_small_buffer;
if (argc > argv_small_size) {
argv = new Handle<Object>[argc];
if (argv == NULL) return isolate->StackOverflow();
if (argv == NULL) return isolate->StackOverflow(3);
argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
}

@@ -9435,7 +9435,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) {

// First check if this is a real stack overflow.
if (isolate->stack_guard()->IsStackOverflow()) {
return isolate->StackOverflow();
return isolate->StackOverflow(2);
}

return Execution::HandleStackGuardInterrupt(isolate);
@@ -9450,7 +9450,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallRecompiledCode) {
// First check if this is a real stack overflow.
if (isolate->stack_guard()->IsStackOverflow()) {
SealHandleScope shs(isolate);
return isolate->StackOverflow();
return isolate->StackOverflow(1);
}

isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
@@ -1189,7 +1189,7 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
Address re_frame) {
Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate);
if (isolate->stack_guard()->IsStackOverflow()) {
isolate->StackOverflow();
isolate->StackOverflow(6);
return EXCEPTION;
}