| 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 13546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13557 double test_value = test_values[i]; | 13557 double test_value = test_values[i]; |
| 13558 | 13558 |
| 13559 // Check that Number::New preserves non-NaNs and quiets SNaNs. | 13559 // Check that Number::New preserves non-NaNs and quiets SNaNs. |
| 13560 v8::Handle<v8::Value> number = v8::Number::New(test_value); | 13560 v8::Handle<v8::Value> number = v8::Number::New(test_value); |
| 13561 double stored_number = number->NumberValue(); | 13561 double stored_number = number->NumberValue(); |
| 13562 if (!IsNaN(test_value)) { | 13562 if (!IsNaN(test_value)) { |
| 13563 CHECK_EQ(test_value, stored_number); | 13563 CHECK_EQ(test_value, stored_number); |
| 13564 } else { | 13564 } else { |
| 13565 uint64_t stored_bits = DoubleToBits(stored_number); | 13565 uint64_t stored_bits = DoubleToBits(stored_number); |
| 13566 // Check if quiet nan (bits 51..62 all set). | 13566 // Check if quiet nan (bits 51..62 all set). |
| 13567 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) |
| 13568 // Most significant fraction bit for quiet nan is set to 0 |
| 13569 // on MIPS architecture. Allowed by IEEE-754. |
| 13570 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
| 13571 #else |
| 13567 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 13572 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
| 13573 #endif |
| 13568 } | 13574 } |
| 13569 | 13575 |
| 13570 // Check that Date::New preserves non-NaNs in the date range and | 13576 // Check that Date::New preserves non-NaNs in the date range and |
| 13571 // quiets SNaNs. | 13577 // quiets SNaNs. |
| 13572 v8::Handle<v8::Value> date = v8::Date::New(test_value); | 13578 v8::Handle<v8::Value> date = v8::Date::New(test_value); |
| 13573 double expected_stored_date = DoubleToDateTime(test_value); | 13579 double expected_stored_date = DoubleToDateTime(test_value); |
| 13574 double stored_date = date->NumberValue(); | 13580 double stored_date = date->NumberValue(); |
| 13575 if (!IsNaN(expected_stored_date)) { | 13581 if (!IsNaN(expected_stored_date)) { |
| 13576 CHECK_EQ(expected_stored_date, stored_date); | 13582 CHECK_EQ(expected_stored_date, stored_date); |
| 13577 } else { | 13583 } else { |
| 13578 uint64_t stored_bits = DoubleToBits(stored_date); | 13584 uint64_t stored_bits = DoubleToBits(stored_date); |
| 13579 // Check if quiet nan (bits 51..62 all set). | 13585 // Check if quiet nan (bits 51..62 all set). |
| 13586 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) |
| 13587 // Most significant fraction bit for quiet nan is set to 0 |
| 13588 // on MIPS architecture. Allowed by IEEE-754. |
| 13589 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
| 13590 #else |
| 13580 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 13591 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
| 13592 #endif |
| 13581 } | 13593 } |
| 13582 } | 13594 } |
| 13583 } | 13595 } |
| 13584 | 13596 |
| 13585 | 13597 |
| 13586 static v8::Handle<Value> SpaghettiIncident(const v8::Arguments& args) { | 13598 static v8::Handle<Value> SpaghettiIncident(const v8::Arguments& args) { |
| 13587 v8::HandleScope scope; | 13599 v8::HandleScope scope; |
| 13588 v8::TryCatch tc; | 13600 v8::TryCatch tc; |
| 13589 v8::Handle<v8::String> str(args[0]->ToString()); | 13601 v8::Handle<v8::String> str(args[0]->ToString()); |
| 13590 if (tc.HasCaught()) | 13602 if (tc.HasCaught()) |
| (...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15489 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); | 15501 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); |
| 15490 | 15502 |
| 15491 // TODO(1547): Make the following also return "i". | 15503 // TODO(1547): Make the following also return "i". |
| 15492 // Calling with environment record as base. | 15504 // Calling with environment record as base. |
| 15493 TestReceiver(o, context->Global(), "func()"); | 15505 TestReceiver(o, context->Global(), "func()"); |
| 15494 // Calling with no base. | 15506 // Calling with no base. |
| 15495 TestReceiver(o, context->Global(), "(1,func)()"); | 15507 TestReceiver(o, context->Global(), "(1,func)()"); |
| 15496 | 15508 |
| 15497 foreign_context.Dispose(); | 15509 foreign_context.Dispose(); |
| 15498 } | 15510 } |
| OLD | NEW |