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

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

Issue 2106083002: Remove SealHandleScope from TryNumberToSize conversion (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/conversions-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-conversions.cc
diff --git a/test/cctest/test-conversions.cc b/test/cctest/test-conversions.cc
index 463a4abe3fa96bfbcec52a3b78378968e8575724..84bbc59d8a1627a9616f6f5c0eb320b8c7120264 100644
--- a/test/cctest/test-conversions.cc
+++ b/test/cctest/test-conversions.cc
@@ -406,3 +406,30 @@ TEST(SpecialIndexParsing) {
CheckNonArrayIndex(false, "-9999999999999999");
CheckNonArrayIndex(false, "42949672964294967296429496729694966");
}
+
+TEST(NoHandlesForTryNumberToSize) {
+ i::Isolate* isolate = CcTest::i_isolate();
+ size_t result = 0;
+ {
+ SealHandleScope no_handles(isolate);
+ Smi* smi = Smi::FromInt(1);
+ CHECK(TryNumberToSize(isolate, smi, &result));
+ CHECK_EQ(result, 1);
+ }
+ result = 0;
+ {
+ HandleScope scope(isolate);
+ Handle<HeapNumber> heap_number1 = isolate->factory()->NewHeapNumber(2.0);
+ {
+ SealHandleScope no_handles(isolate);
+ CHECK(TryNumberToSize(isolate, *heap_number1, &result));
+ CHECK_EQ(result, 2);
+ }
+ Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber(
+ static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0);
+ {
+ SealHandleScope no_handles(isolate);
+ CHECK(!TryNumberToSize(isolate, *heap_number2, &result));
+ }
+ }
+}
« no previous file with comments | « src/conversions-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698