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

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

Issue 399044: Merge r3285, r3313, and r3318 to branches/1.3. (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.3/
Patch Set: Created 11 years, 1 month 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
« no previous file with comments | « src/version.cc ('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 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 6433 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 { 6444 {
6445 v8::HandleScope scope; 6445 v8::HandleScope scope;
6446 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New()); 6446 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
6447 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New()); 6447 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
6448 } 6448 }
6449 handle1.MakeWeak(NULL, DisposeAndForceGcCallback); 6449 handle1.MakeWeak(NULL, DisposeAndForceGcCallback);
6450 to_be_disposed = handle2; 6450 to_be_disposed = handle2;
6451 i::Heap::CollectAllGarbage(false); 6451 i::Heap::CollectAllGarbage(false);
6452 } 6452 }
6453 6453
6454 void DisposingCallback(v8::Persistent<v8::Value> handle, void*) {
6455 handle.Dispose();
6456 }
6457
6458 void HandleCreatingCallback(v8::Persistent<v8::Value> handle, void*) {
6459 v8::HandleScope scope;
6460 v8::Persistent<v8::Object>::New(v8::Object::New());
6461 }
6462
6463
6464 THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) {
6465 LocalContext context;
6466
6467 v8::Persistent<v8::Object> handle1, handle2, handle3;
6468 {
6469 v8::HandleScope scope;
6470 handle3 = v8::Persistent<v8::Object>::New(v8::Object::New());
6471 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
6472 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
6473 }
6474 handle2.MakeWeak(NULL, DisposingCallback);
6475 handle3.MakeWeak(NULL, HandleCreatingCallback);
6476 i::Heap::CollectAllGarbage(false);
6477 }
6478
6454 6479
6455 THREADED_TEST(CheckForCrossContextObjectLiterals) { 6480 THREADED_TEST(CheckForCrossContextObjectLiterals) {
6456 v8::V8::Initialize(); 6481 v8::V8::Initialize();
6457 6482
6458 const int nof = 2; 6483 const int nof = 2;
6459 const char* sources[nof] = { 6484 const char* sources[nof] = {
6460 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }", 6485 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }",
6461 "Object()" 6486 "Object()"
6462 }; 6487 };
6463 6488
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
8637 " i++;" 8662 " i++;"
8638 " return s(o);" 8663 " return s(o);"
8639 " }" 8664 " }"
8640 " }" 8665 " }"
8641 "};" 8666 "};"
8642 "s(o);"); 8667 "s(o);");
8643 CHECK(try_catch.HasCaught()); 8668 CHECK(try_catch.HasCaught());
8644 v8::String::Utf8Value value(try_catch.Exception()); 8669 v8::String::Utf8Value value(try_catch.Exception());
8645 CHECK_EQ(0, strcmp(*value, "Hey!")); 8670 CHECK_EQ(0, strcmp(*value, "Hey!"));
8646 } 8671 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698