OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 CheckNonArrayIndex(true, "429496.7295"); | 399 CheckNonArrayIndex(true, "429496.7295"); |
400 CheckNonArrayIndex(false, "43s3"); | 400 CheckNonArrayIndex(false, "43s3"); |
401 CheckNonArrayIndex(true, "4294967296"); | 401 CheckNonArrayIndex(true, "4294967296"); |
402 CheckNonArrayIndex(true, "-4294967296"); | 402 CheckNonArrayIndex(true, "-4294967296"); |
403 CheckNonArrayIndex(true, "999999999999999"); | 403 CheckNonArrayIndex(true, "999999999999999"); |
404 CheckNonArrayIndex(false, "9999999999999999"); | 404 CheckNonArrayIndex(false, "9999999999999999"); |
405 CheckNonArrayIndex(true, "-999999999999999"); | 405 CheckNonArrayIndex(true, "-999999999999999"); |
406 CheckNonArrayIndex(false, "-9999999999999999"); | 406 CheckNonArrayIndex(false, "-9999999999999999"); |
407 CheckNonArrayIndex(false, "42949672964294967296429496729694966"); | 407 CheckNonArrayIndex(false, "42949672964294967296429496729694966"); |
408 } | 408 } |
| 409 |
| 410 TEST(NoHandlesForTryNumberToSize) { |
| 411 i::Isolate* isolate = CcTest::i_isolate(); |
| 412 size_t result = 0; |
| 413 { |
| 414 SealHandleScope no_handles(isolate); |
| 415 Smi* smi = Smi::FromInt(1); |
| 416 CHECK(TryNumberToSize(isolate, smi, &result)); |
| 417 CHECK_EQ(result, 1); |
| 418 } |
| 419 result = 0; |
| 420 { |
| 421 HandleScope scope(isolate); |
| 422 Handle<HeapNumber> heap_number1 = isolate->factory()->NewHeapNumber(2.0); |
| 423 { |
| 424 SealHandleScope no_handles(isolate); |
| 425 CHECK(TryNumberToSize(isolate, *heap_number1, &result)); |
| 426 CHECK_EQ(result, 2); |
| 427 } |
| 428 Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber( |
| 429 static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0); |
| 430 { |
| 431 SealHandleScope no_handles(isolate); |
| 432 CHECK(!TryNumberToSize(isolate, *heap_number2, &result)); |
| 433 } |
| 434 } |
| 435 } |
OLD | NEW |