OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 8644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8655 double stored_date = date->NumberValue(); | 8655 double stored_date = date->NumberValue(); |
8656 if (!IsNaN(expected_stored_date)) { | 8656 if (!IsNaN(expected_stored_date)) { |
8657 CHECK_EQ(expected_stored_date, stored_date); | 8657 CHECK_EQ(expected_stored_date, stored_date); |
8658 } else { | 8658 } else { |
8659 uint64_t stored_bits = DoubleToBits(stored_date); | 8659 uint64_t stored_bits = DoubleToBits(stored_date); |
8660 // Check if quiet nan (bits 51..62 all set). | 8660 // Check if quiet nan (bits 51..62 all set). |
8661 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 8661 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
8662 } | 8662 } |
8663 } | 8663 } |
8664 } | 8664 } |
| 8665 |
| 8666 |
| 8667 static v8::Handle<Value> SpaghettiIncident(const v8::Arguments& args) { |
| 8668 v8::HandleScope scope; |
| 8669 v8::TryCatch tc; |
| 8670 v8::Handle<v8::String> str = args[0]->ToString(); |
| 8671 if (tc.HasCaught()) |
| 8672 return tc.ReThrow(); |
| 8673 return v8::Undefined(); |
| 8674 } |
| 8675 |
| 8676 |
| 8677 // Test that a stack overflow can be propagated down through a spaghetti |
| 8678 // stack using ReThrow. |
| 8679 THREADED_TEST(SpaghettiStackOverflow) { |
| 8680 v8::HandleScope scope; |
| 8681 LocalContext context; |
| 8682 context->Global()->Set( |
| 8683 v8::String::New("s"), |
| 8684 v8::FunctionTemplate::New(SpaghettiIncident)->GetFunction()); |
| 8685 v8::TryCatch try_catch; |
| 8686 CompileRun("var o = {toString: function () {return s(o);}}; s(o);"); |
| 8687 CHECK(try_catch.HasCaught()); |
| 8688 v8::String::Utf8Value value(try_catch.Exception()); |
| 8689 CHECK_NE(0, strstr(*value, "RangeError")); |
| 8690 } |
OLD | NEW |