| 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 8542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8553 v8::HandleScope scope; | 8553 v8::HandleScope scope; |
| 8554 | 8554 |
| 8555 context->Enter(); | 8555 context->Enter(); |
| 8556 CompileRun("function f(){eval('1')}; f()"); | 8556 CompileRun("function f(){eval('1')}; f()"); |
| 8557 context->Exit(); | 8557 context->Exit(); |
| 8558 } | 8558 } |
| 8559 context.Dispose(); | 8559 context.Dispose(); |
| 8560 for (gc_count = 1; gc_count < 10; gc_count++) { | 8560 for (gc_count = 1; gc_count < 10; gc_count++) { |
| 8561 v8::internal::Heap::CollectAllGarbage(false); | 8561 v8::internal::Heap::CollectAllGarbage(false); |
| 8562 if (GetGlobalObjectsCount() == 0) break; | 8562 if (GetGlobalObjectsCount() == 0) break; |
| 8563 } | 8563 } |
| 8564 CHECK_EQ(0, GetGlobalObjectsCount()); | 8564 CHECK_EQ(0, GetGlobalObjectsCount()); |
| 8565 | 8565 |
| 8566 // Compilation cache size is different for Android. | 8566 // Compilation cache size is different for Android. |
| 8567 #if defined(ANDROID) | 8567 #if defined(ANDROID) |
| 8568 CHECK_EQ(1, gc_count); | 8568 CHECK_EQ(1, gc_count); |
| 8569 #else | 8569 #else |
| 8570 CHECK_EQ(2, gc_count); | 8570 CHECK_EQ(2, gc_count); |
| 8571 #endif | 8571 #endif |
| 8572 | 8572 |
| 8573 // Looking up the line number for an exception creates reference from the | 8573 // Looking up the line number for an exception creates reference from the |
| 8574 // compilation cache to the global object. | 8574 // compilation cache to the global object. |
| 8575 context = Context::New(); | 8575 context = Context::New(); |
| 8576 { | 8576 { |
| 8577 v8::HandleScope scope; | 8577 v8::HandleScope scope; |
| 8578 | 8578 |
| 8579 context->Enter(); | 8579 context->Enter(); |
| 8580 v8::TryCatch try_catch; | 8580 v8::TryCatch try_catch; |
| 8581 CompileRun("function f(){throw 1;}; f()"); | 8581 CompileRun("function f(){throw 1;}; f()"); |
| 8582 CHECK(try_catch.HasCaught()); | 8582 CHECK(try_catch.HasCaught()); |
| 8583 v8::Handle<v8::Message> message = try_catch.Message(); | 8583 v8::Handle<v8::Message> message = try_catch.Message(); |
| 8584 CHECK(!message.IsEmpty()); | 8584 CHECK(!message.IsEmpty()); |
| 8585 CHECK_EQ(1, message->GetLineNumber()); | 8585 CHECK_EQ(1, message->GetLineNumber()); |
| 8586 context->Exit(); | 8586 context->Exit(); |
| 8587 } | 8587 } |
| 8588 context.Dispose(); | 8588 context.Dispose(); |
| 8589 for (gc_count = 1; gc_count < 10; gc_count++) { | 8589 for (gc_count = 1; gc_count < 10; gc_count++) { |
| 8590 v8::internal::Heap::CollectAllGarbage(false); | 8590 v8::internal::Heap::CollectAllGarbage(false); |
| 8591 if (GetGlobalObjectsCount() == 0) break; | 8591 if (GetGlobalObjectsCount() == 0) break; |
| 8592 } | 8592 } |
| 8593 CHECK_EQ(0, GetGlobalObjectsCount()); | 8593 CHECK_EQ(0, GetGlobalObjectsCount()); |
| 8594 | 8594 |
| 8595 // Compilation cache size is different for Android. | 8595 // Compilation cache size is different for Android. |
| 8596 #if defined(ANDROID) | 8596 #if defined(ANDROID) |
| 8597 CHECK_EQ(2, gc_count); | 8597 CHECK_EQ(2, gc_count); |
| 8598 #else | 8598 #else |
| 8599 CHECK_EQ(5, gc_count); | 8599 CHECK_EQ(5, gc_count); |
| 8600 #endif | 8600 #endif |
| 8601 } | 8601 } |
| OLD | NEW |