Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 91f37367dae9d0ec815cbd4738bc62484e1df80f..c2917470d569a381556db29b31cd2228effa1275 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -4400,6 +4400,11 @@ TEST(OutOfMemoryNested) { |
} |
+void OOMCallback(const char* location, const char* message) { |
+ exit(0); |
+} |
+ |
+ |
TEST(HugeConsStringOutOfMemory) { |
// It's not possible to read a snapshot into a heap with different dimensions. |
if (i::Snapshot::IsEnabled()) return; |
@@ -4411,19 +4416,17 @@ TEST(HugeConsStringOutOfMemory) { |
v8::SetResourceConstraints(CcTest::isolate(), &constraints); |
// Execute a script that causes out of memory. |
- v8::V8::IgnoreOutOfMemoryException(); |
+ v8::V8::SetFatalErrorHandler(OOMCallback); |
LocalContext context; |
v8::HandleScope scope(context->GetIsolate()); |
// Build huge string. This should fail with out of memory exception. |
- Local<Value> result = CompileRun( |
+ CompileRun( |
"var str = Array.prototype.join.call({length: 513}, \"A\").toUpperCase();" |
"for (var i = 0; i < 22; i++) { str = str + str; }"); |
- // Check for out of memory state. |
- CHECK(result.IsEmpty()); |
- CHECK(context->HasOutOfMemoryException()); |
+ CHECK(false); // Should not return. |
} |
@@ -6925,11 +6928,6 @@ static const char* js_code_causing_huge_string_flattening = |
"str.match(/X/);"; |
-void OOMCallback(const char* location, const char* message) { |
- exit(0); |
-} |
- |
- |
TEST(RegexpOutOfMemory) { |
// Execute a script that causes out of memory when flattening a string. |
v8::HandleScope scope(CcTest::isolate()); |