Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
index 85dfd13..9d3cbf6 100644
--- a/test/cctest/test-thread-termination.cc
+++ b/test/cctest/test-thread-termination.cc
@@ -204,6 +204,31 @@
semaphore = NULL;
}
+// Test that execution can be terminated from within JSON.stringify.
+TEST(TerminateJsonStringify) {
+ semaphore = new v8::base::Semaphore(0);
+ TerminatorThread thread(CcTest::i_isolate());
+ thread.Start();
+
+ v8::HandleScope scope(CcTest::isolate());
+ v8::Local<v8::ObjectTemplate> global =
+ CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
+ v8::Local<v8::Context> context =
+ v8::Context::New(CcTest::isolate(), NULL, global);
+ v8::Context::Scope context_scope(context);
+ CHECK(!CcTest::isolate()->IsExecutionTerminating());
+ v8::MaybeLocal<v8::Value> result =
+ CompileRun(CcTest::isolate()->GetCurrentContext(),
+ "var x = [];"
+ "x[2**31]=1;"
+ "terminate();"
+ "JSON.stringify(x);"
+ "fail();");
+ CHECK(result.IsEmpty());
+ thread.Join();
+ delete semaphore;
+ semaphore = NULL;
+}
int call_count = 0;