| 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 15314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15325 USE(ring); | 15325 USE(ring); |
| 15326 } | 15326 } |
| 15327 | 15327 |
| 15328 isolate->Dispose(); | 15328 isolate->Dispose(); |
| 15329 // Ring has been destroyed. Free Peoples of Middle-earth Rejoice. | 15329 // Ring has been destroyed. Free Peoples of Middle-earth Rejoice. |
| 15330 CHECK_EQ(1, destroyed); | 15330 CHECK_EQ(1, destroyed); |
| 15331 } | 15331 } |
| 15332 | 15332 |
| 15333 | 15333 |
| 15334 TEST(ExternalInternalizedStringCollectedAtGC) { | 15334 TEST(ExternalInternalizedStringCollectedAtGC) { |
| 15335 // TODO(mvstanton): vector ics need weak support. | |
| 15336 if (i::FLAG_vector_ics) return; | |
| 15337 | |
| 15338 int destroyed = 0; | 15335 int destroyed = 0; |
| 15339 { LocalContext env; | 15336 { LocalContext env; |
| 15340 v8::HandleScope handle_scope(env->GetIsolate()); | 15337 v8::HandleScope handle_scope(env->GetIsolate()); |
| 15341 CompileRun("var ring = 'One string to test them all';"); | 15338 CompileRun("var ring = 'One string to test them all';"); |
| 15342 const char* s = "One string to test them all"; | 15339 const char* s = "One string to test them all"; |
| 15343 TestOneByteResource* inscription = | 15340 TestOneByteResource* inscription = |
| 15344 new TestOneByteResource(i::StrDup(s), &destroyed); | 15341 new TestOneByteResource(i::StrDup(s), &destroyed); |
| 15345 v8::Local<v8::String> ring = CompileRun("ring").As<v8::String>(); | 15342 v8::Local<v8::String> ring = CompileRun("ring").As<v8::String>(); |
| 15346 CHECK(v8::Utils::OpenHandle(*ring)->IsInternalizedString()); | 15343 CHECK(v8::Utils::OpenHandle(*ring)->IsInternalizedString()); |
| 15347 ring->MakeExternal(inscription); | 15344 ring->MakeExternal(inscription); |
| (...skipping 5749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21097 CHECK(!try_catch.HasCaught()); | 21094 CHECK(!try_catch.HasCaught()); |
| 21098 } | 21095 } |
| 21099 | 21096 |
| 21100 { | 21097 { |
| 21101 v8::TryCatch try_catch; | 21098 v8::TryCatch try_catch; |
| 21102 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; | 21099 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; |
| 21103 fun->Call(v8::Undefined(isolate), arraysize(args), args); | 21100 fun->Call(v8::Undefined(isolate), arraysize(args), args); |
| 21104 CHECK(!try_catch.HasCaught()); | 21101 CHECK(!try_catch.HasCaught()); |
| 21105 } | 21102 } |
| 21106 } | 21103 } |
| OLD | NEW |