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 7687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7698 | 7698 |
7699 FlagAndPersistent object_a, object_b; | 7699 FlagAndPersistent object_a, object_b; |
7700 | 7700 |
7701 { | 7701 { |
7702 v8::HandleScope handle_scope(iso); | 7702 v8::HandleScope handle_scope(iso); |
7703 Local<Object> a(v8::Object::New(iso)); | 7703 Local<Object> a(v8::Object::New(iso)); |
7704 Local<Object> b(v8::Object::New(iso)); | 7704 Local<Object> b(v8::Object::New(iso)); |
7705 object_a.handle.Reset(iso, a); | 7705 object_a.handle.Reset(iso, a); |
7706 object_b.handle.Reset(iso, b); | 7706 object_b.handle.Reset(iso, b); |
7707 if (global_gc) { | 7707 if (global_gc) { |
7708 CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags); | 7708 CcTest::heap()->CollectAllAvailableGarbage(); |
7709 } else { | 7709 } else { |
7710 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 7710 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7711 } | 7711 } |
7712 } | 7712 } |
7713 | 7713 |
7714 object_a.flag = false; | 7714 object_a.flag = false; |
7715 object_b.flag = false; | 7715 object_b.flag = false; |
7716 object_a.handle.SetWeak(&object_a, &ResetUseValueAndSetFlag); | 7716 object_a.handle.SetWeak(&object_a, &ResetUseValueAndSetFlag); |
7717 object_b.handle.SetWeak(&object_b, &ResetUseValueAndSetFlag); | 7717 object_b.handle.SetWeak(&object_b, &ResetUseValueAndSetFlag); |
7718 if (!global_gc) { | 7718 if (!global_gc) { |
7719 object_a.handle.MarkIndependent(); | 7719 object_a.handle.MarkIndependent(); |
7720 object_b.handle.MarkIndependent(); | 7720 object_b.handle.MarkIndependent(); |
7721 CHECK(object_b.handle.IsIndependent()); | 7721 CHECK(object_b.handle.IsIndependent()); |
7722 } | 7722 } |
7723 if (global_gc) { | 7723 if (global_gc) { |
7724 CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags); | 7724 CcTest::heap()->CollectAllAvailableGarbage(); |
7725 } else { | 7725 } else { |
7726 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 7726 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7727 } | 7727 } |
7728 CHECK(object_a.flag); | 7728 CHECK(object_a.flag); |
7729 CHECK(object_b.flag); | 7729 CHECK(object_b.flag); |
7730 } | 7730 } |
7731 | 7731 |
7732 | 7732 |
7733 THREADED_TEST(ResetWeakHandle) { | 7733 THREADED_TEST(ResetWeakHandle) { |
7734 ResetWeakHandle(false); | 7734 ResetWeakHandle(false); |
(...skipping 16647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24382 v8::HandleScope scope(CcTest::isolate()); | 24382 v8::HandleScope scope(CcTest::isolate()); |
24383 RandomLengthOneByteResource* r = | 24383 RandomLengthOneByteResource* r = |
24384 new RandomLengthOneByteResource(i::String::kMaxLength); | 24384 new RandomLengthOneByteResource(i::String::kMaxLength); |
24385 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); | 24385 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); |
24386 CHECK(!str.IsEmpty()); | 24386 CHECK(!str.IsEmpty()); |
24387 v8::TryCatch try_catch; | 24387 v8::TryCatch try_catch; |
24388 v8::Local<v8::String> result = v8::String::Concat(str, str); | 24388 v8::Local<v8::String> result = v8::String::Concat(str, str); |
24389 CHECK(result.IsEmpty()); | 24389 CHECK(result.IsEmpty()); |
24390 CHECK(!try_catch.HasCaught()); | 24390 CHECK(!try_catch.HasCaught()); |
24391 } | 24391 } |
OLD | NEW |