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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 CheckNonArrayIndex(false, "-9999999999999999"); | 406 CheckNonArrayIndex(false, "-9999999999999999"); |
407 CheckNonArrayIndex(false, "42949672964294967296429496729694966"); | 407 CheckNonArrayIndex(false, "42949672964294967296429496729694966"); |
408 } | 408 } |
409 | 409 |
410 TEST(NoHandlesForTryNumberToSize) { | 410 TEST(NoHandlesForTryNumberToSize) { |
411 i::Isolate* isolate = CcTest::i_isolate(); | 411 i::Isolate* isolate = CcTest::i_isolate(); |
412 size_t result = 0; | 412 size_t result = 0; |
413 { | 413 { |
414 SealHandleScope no_handles(isolate); | 414 SealHandleScope no_handles(isolate); |
415 Smi* smi = Smi::FromInt(1); | 415 Smi* smi = Smi::FromInt(1); |
416 CHECK(TryNumberToSize(isolate, smi, &result)); | 416 CHECK(TryNumberToSize(smi, &result)); |
417 CHECK_EQ(result, 1); | 417 CHECK_EQ(result, 1); |
418 } | 418 } |
419 result = 0; | 419 result = 0; |
420 { | 420 { |
421 HandleScope scope(isolate); | 421 HandleScope scope(isolate); |
422 Handle<HeapNumber> heap_number1 = isolate->factory()->NewHeapNumber(2.0); | 422 Handle<HeapNumber> heap_number1 = isolate->factory()->NewHeapNumber(2.0); |
423 { | 423 { |
424 SealHandleScope no_handles(isolate); | 424 SealHandleScope no_handles(isolate); |
425 CHECK(TryNumberToSize(isolate, *heap_number1, &result)); | 425 CHECK(TryNumberToSize(*heap_number1, &result)); |
426 CHECK_EQ(result, 2); | 426 CHECK_EQ(result, 2); |
427 } | 427 } |
428 Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber( | 428 Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber( |
429 static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0); | 429 static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0); |
430 { | 430 { |
431 SealHandleScope no_handles(isolate); | 431 SealHandleScope no_handles(isolate); |
432 CHECK(!TryNumberToSize(isolate, *heap_number2, &result)); | 432 CHECK(!TryNumberToSize(*heap_number2, &result)); |
433 } | 433 } |
434 } | 434 } |
435 } | 435 } |
OLD | NEW |