Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1429)

Unified Diff: test/cctest/test-strings.cc

Issue 199583007: Reland "Throw exception on invalid string length instead of OOM." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: change Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/uri.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-strings.cc
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc
index 129e6cf3d6263613b30cc43816f8e252e9c03583..8e63cb0d4716593da925135014244e8c96f43ada 100644
--- a/test/cctest/test-strings.cc
+++ b/test/cctest/test-strings.cc
@@ -1209,24 +1209,17 @@ TEST(AsciiArrayJoin) {
// starting with 'bad', followed by 2^14 times the string s. That means the
// total length of the concatenated strings is 2^31 + 3. So on 32bit systems
// summing the lengths of the strings (as Smis) overflows and wraps.
- static const char* join_causing_out_of_memory =
+ LocalContext context;
+ v8::HandleScope scope(CcTest::isolate());
+ v8::TryCatch try_catch;
+ CHECK(CompileRun(
"var two_14 = Math.pow(2, 14);"
"var two_17 = Math.pow(2, 17);"
"var s = Array(two_17 + 1).join('c');"
"var a = ['bad'];"
"for (var i = 1; i <= two_14; i++) a.push(s);"
- "a.join("");";
-
- v8::HandleScope scope(CcTest::isolate());
- LocalContext context;
- v8::V8::IgnoreOutOfMemoryException();
- v8::Local<v8::Script> script = v8::Script::Compile(
- v8::String::NewFromUtf8(CcTest::isolate(), join_causing_out_of_memory));
- v8::Local<v8::Value> result = script->Run();
-
- // Check for out of memory state.
- CHECK(result.IsEmpty());
- CHECK(context->HasOutOfMemoryException());
+ "a.join("");").IsEmpty());
+ CHECK(try_catch.HasCaught());
}
« no previous file with comments | « src/uri.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698