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