Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: test/cctest/test-api.cc

Issue 649563006: Introduce phantom weak handles in the API and use them internally for debug info (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Actually make available through the API and fix scavenge Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/global-handles.cc ('K') | « src/globals.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7461 matching lines...) Expand 10 before | Expand all | Expand 10 after
7472 FlagAndPersistent object_a, object_b; 7472 FlagAndPersistent object_a, object_b;
7473 7473
7474 { 7474 {
7475 v8::HandleScope handle_scope(iso); 7475 v8::HandleScope handle_scope(iso);
7476 object_a.handle.Reset(iso, v8::Object::New(iso)); 7476 object_a.handle.Reset(iso, v8::Object::New(iso));
7477 object_b.handle.Reset(iso, v8::Object::New(iso)); 7477 object_b.handle.Reset(iso, v8::Object::New(iso));
7478 } 7478 }
7479 7479
7480 object_a.flag = false; 7480 object_a.flag = false;
7481 object_b.flag = false; 7481 object_b.flag = false;
7482 object_a.handle.SetWeak(&object_a, &DisposeAndSetFlag); 7482 object_a.handle.SetPhantom(&object_a, &DisposeAndSetFlag);
7483 object_b.handle.SetWeak(&object_b, &DisposeAndSetFlag); 7483 object_b.handle.SetPhantom(&object_b, &DisposeAndSetFlag);
7484 CHECK(!object_b.handle.IsIndependent()); 7484 CHECK(!object_b.handle.IsIndependent());
7485 object_a.handle.MarkIndependent(); 7485 object_a.handle.MarkIndependent();
7486 object_b.handle.MarkIndependent(); 7486 object_b.handle.MarkIndependent();
7487 CHECK(object_b.handle.IsIndependent()); 7487 CHECK(object_b.handle.IsIndependent());
7488 CcTest::heap()->CollectGarbage(i::NEW_SPACE); 7488 CcTest::heap()->CollectGarbage(i::NEW_SPACE);
7489 CHECK(object_a.flag); 7489 CHECK(object_a.flag);
7490 CHECK(object_b.flag); 7490 CHECK(object_b.flag);
7491 } 7491 }
7492 7492
ulan 2014/10/20 14:26:02 Could you please also test we don't mark through a
Erik Corry 2014/10/22 13:21:00 I haven't done this yet.
7493 7493
7494 static void InvokeScavenge() { 7494 static void InvokeScavenge() {
7495 CcTest::heap()->CollectGarbage(i::NEW_SPACE); 7495 CcTest::heap()->CollectGarbage(i::NEW_SPACE);
7496 } 7496 }
7497 7497
7498 7498
7499 static void InvokeMarkSweep() { 7499 static void InvokeMarkSweep() {
7500 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 7500 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
7501 } 7501 }
7502 7502
(...skipping 16290 matching lines...) Expand 10 before | Expand all | Expand 10 after
23793 char chunk2[] = 23793 char chunk2[] =
23794 "XXr = 13;\n" 23794 "XXr = 13;\n"
23795 " return foob\xeb\x91\x80\xeb\x91\x80r;\n" 23795 " return foob\xeb\x91\x80\xeb\x91\x80r;\n"
23796 "}\n"; 23796 "}\n";
23797 chunk1[strlen(chunk1) - 1] = reference[0]; 23797 chunk1[strlen(chunk1) - 1] = reference[0];
23798 chunk2[0] = reference[1]; 23798 chunk2[0] = reference[1];
23799 chunk2[1] = reference[2]; 23799 chunk2[1] = reference[2];
23800 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; 23800 const char* chunks[] = {chunk1, chunk2, "foo();", NULL};
23801 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); 23801 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8);
23802 } 23802 }
OLDNEW
« src/global-handles.cc ('K') | « src/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698