OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 | 3337 |
3338 int32_t int32_value = obj->Int32Value(); | 3338 int32_t int32_value = obj->Int32Value(); |
3339 CHECK_EQ(0, int32_value); | 3339 CHECK_EQ(0, int32_value); |
3340 CheckUncle(&try_catch); | 3340 CheckUncle(&try_catch); |
3341 | 3341 |
3342 uint32_t uint32_value = obj->Uint32Value(); | 3342 uint32_t uint32_value = obj->Uint32Value(); |
3343 CHECK_EQ(0, uint32_value); | 3343 CHECK_EQ(0, uint32_value); |
3344 CheckUncle(&try_catch); | 3344 CheckUncle(&try_catch); |
3345 | 3345 |
3346 double number_value = obj->NumberValue(); | 3346 double number_value = obj->NumberValue(); |
3347 CHECK_NE(0, isnan(number_value)); | 3347 CHECK_NE(0, std::isnan(number_value)); |
3348 CheckUncle(&try_catch); | 3348 CheckUncle(&try_catch); |
3349 | 3349 |
3350 int64_t integer_value = obj->IntegerValue(); | 3350 int64_t integer_value = obj->IntegerValue(); |
3351 CHECK_EQ(0.0, static_cast<double>(integer_value)); | 3351 CHECK_EQ(0.0, static_cast<double>(integer_value)); |
3352 CheckUncle(&try_catch); | 3352 CheckUncle(&try_catch); |
3353 } | 3353 } |
3354 | 3354 |
3355 | 3355 |
3356 v8::Handle<Value> ThrowFromC(const v8::Arguments& args) { | 3356 v8::Handle<Value> ThrowFromC(const v8::Arguments& args) { |
3357 ApiTestFuzzer::Fuzz(); | 3357 ApiTestFuzzer::Fuzz(); |
(...skipping 12080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15438 | 15438 |
15439 static uint64_t DoubleToBits(double value) { | 15439 static uint64_t DoubleToBits(double value) { |
15440 uint64_t target; | 15440 uint64_t target; |
15441 i::OS::MemCopy(&target, &value, sizeof(target)); | 15441 i::OS::MemCopy(&target, &value, sizeof(target)); |
15442 return target; | 15442 return target; |
15443 } | 15443 } |
15444 | 15444 |
15445 | 15445 |
15446 static double DoubleToDateTime(double input) { | 15446 static double DoubleToDateTime(double input) { |
15447 double date_limit = 864e13; | 15447 double date_limit = 864e13; |
15448 if (isnan(input) || input < -date_limit || input > date_limit) { | 15448 if (std::isnan(input) || input < -date_limit || input > date_limit) { |
15449 return i::OS::nan_value(); | 15449 return i::OS::nan_value(); |
15450 } | 15450 } |
15451 return (input < 0) ? -(floor(-input)) : floor(input); | 15451 return (input < 0) ? -(floor(-input)) : floor(input); |
15452 } | 15452 } |
15453 | 15453 |
15454 // We don't have a consistent way to write 64-bit constants syntactically, so we | 15454 // We don't have a consistent way to write 64-bit constants syntactically, so we |
15455 // split them into two 32-bit constants and combine them programmatically. | 15455 // split them into two 32-bit constants and combine them programmatically. |
15456 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { | 15456 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { |
15457 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); | 15457 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); |
15458 } | 15458 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15499 -snan | 15499 -snan |
15500 }; | 15500 }; |
15501 int num_test_values = 20; | 15501 int num_test_values = 20; |
15502 | 15502 |
15503 for (int i = 0; i < num_test_values; i++) { | 15503 for (int i = 0; i < num_test_values; i++) { |
15504 double test_value = test_values[i]; | 15504 double test_value = test_values[i]; |
15505 | 15505 |
15506 // Check that Number::New preserves non-NaNs and quiets SNaNs. | 15506 // Check that Number::New preserves non-NaNs and quiets SNaNs. |
15507 v8::Handle<v8::Value> number = v8::Number::New(test_value); | 15507 v8::Handle<v8::Value> number = v8::Number::New(test_value); |
15508 double stored_number = number->NumberValue(); | 15508 double stored_number = number->NumberValue(); |
15509 if (!isnan(test_value)) { | 15509 if (!std::isnan(test_value)) { |
15510 CHECK_EQ(test_value, stored_number); | 15510 CHECK_EQ(test_value, stored_number); |
15511 } else { | 15511 } else { |
15512 uint64_t stored_bits = DoubleToBits(stored_number); | 15512 uint64_t stored_bits = DoubleToBits(stored_number); |
15513 // Check if quiet nan (bits 51..62 all set). | 15513 // Check if quiet nan (bits 51..62 all set). |
15514 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) | 15514 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) |
15515 // Most significant fraction bit for quiet nan is set to 0 | 15515 // Most significant fraction bit for quiet nan is set to 0 |
15516 // on MIPS architecture. Allowed by IEEE-754. | 15516 // on MIPS architecture. Allowed by IEEE-754. |
15517 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 15517 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
15518 #else | 15518 #else |
15519 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 15519 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
15520 #endif | 15520 #endif |
15521 } | 15521 } |
15522 | 15522 |
15523 // Check that Date::New preserves non-NaNs in the date range and | 15523 // Check that Date::New preserves non-NaNs in the date range and |
15524 // quiets SNaNs. | 15524 // quiets SNaNs. |
15525 v8::Handle<v8::Value> date = v8::Date::New(test_value); | 15525 v8::Handle<v8::Value> date = v8::Date::New(test_value); |
15526 double expected_stored_date = DoubleToDateTime(test_value); | 15526 double expected_stored_date = DoubleToDateTime(test_value); |
15527 double stored_date = date->NumberValue(); | 15527 double stored_date = date->NumberValue(); |
15528 if (!isnan(expected_stored_date)) { | 15528 if (!std::isnan(expected_stored_date)) { |
15529 CHECK_EQ(expected_stored_date, stored_date); | 15529 CHECK_EQ(expected_stored_date, stored_date); |
15530 } else { | 15530 } else { |
15531 uint64_t stored_bits = DoubleToBits(stored_date); | 15531 uint64_t stored_bits = DoubleToBits(stored_date); |
15532 // Check if quiet nan (bits 51..62 all set). | 15532 // Check if quiet nan (bits 51..62 all set). |
15533 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) | 15533 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) |
15534 // Most significant fraction bit for quiet nan is set to 0 | 15534 // Most significant fraction bit for quiet nan is set to 0 |
15535 // on MIPS architecture. Allowed by IEEE-754. | 15535 // on MIPS architecture. Allowed by IEEE-754. |
15536 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 15536 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
15537 #else | 15537 #else |
15538 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 15538 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
(...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18394 i::Semaphore* sem_; | 18394 i::Semaphore* sem_; |
18395 volatile int sem_value_; | 18395 volatile int sem_value_; |
18396 }; | 18396 }; |
18397 | 18397 |
18398 | 18398 |
18399 THREADED_TEST(SemaphoreInterruption) { | 18399 THREADED_TEST(SemaphoreInterruption) { |
18400 ThreadInterruptTest().RunTest(); | 18400 ThreadInterruptTest().RunTest(); |
18401 } | 18401 } |
18402 | 18402 |
18403 #endif // WIN32 | 18403 #endif // WIN32 |
OLD | NEW |