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

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

Issue 395024: Restore invariant (next of first deallocated must point to the head) before c... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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/global-handles.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 6208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6219 { 6219 {
6220 v8::HandleScope scope; 6220 v8::HandleScope scope;
6221 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New()); 6221 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
6222 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New()); 6222 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
6223 } 6223 }
6224 handle1.MakeWeak(NULL, DisposeAndForceGcCallback); 6224 handle1.MakeWeak(NULL, DisposeAndForceGcCallback);
6225 to_be_disposed = handle2; 6225 to_be_disposed = handle2;
6226 i::Heap::CollectAllGarbage(false); 6226 i::Heap::CollectAllGarbage(false);
6227 } 6227 }
6228 6228
6229 void DisposingCallback(v8::Persistent<v8::Value> handle, void*) {
6230 handle.Dispose();
6231 }
6232
6233 void HandleCreatingCallback(v8::Persistent<v8::Value> handle, void*) {
6234 v8::HandleScope scope;
6235 v8::Persistent<v8::Object>::New(v8::Object::New());
6236 }
6237
6238
6239 THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) {
6240 LocalContext context;
6241
6242 v8::Persistent<v8::Object> handle1, handle2, handle3;
6243 {
6244 v8::HandleScope scope;
6245 handle3 = v8::Persistent<v8::Object>::New(v8::Object::New());
6246 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
6247 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
6248 }
6249 handle2.MakeWeak(NULL, DisposingCallback);
6250 handle3.MakeWeak(NULL, HandleCreatingCallback);
6251 i::Heap::CollectAllGarbage(false);
6252 }
6253
6229 6254
6230 THREADED_TEST(CheckForCrossContextObjectLiterals) { 6255 THREADED_TEST(CheckForCrossContextObjectLiterals) {
6231 v8::V8::Initialize(); 6256 v8::V8::Initialize();
6232 6257
6233 const int nof = 2; 6258 const int nof = 2;
6234 const char* sources[nof] = { 6259 const char* sources[nof] = {
6235 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }", 6260 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }",
6236 "Object()" 6261 "Object()"
6237 }; 6262 };
6238 6263
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
8368 " i++;" 8393 " i++;"
8369 " return s(o);" 8394 " return s(o);"
8370 " }" 8395 " }"
8371 " }" 8396 " }"
8372 "};" 8397 "};"
8373 "s(o);"); 8398 "s(o);");
8374 CHECK(try_catch.HasCaught()); 8399 CHECK(try_catch.HasCaught());
8375 v8::String::Utf8Value value(try_catch.Exception()); 8400 v8::String::Utf8Value value(try_catch.Exception());
8376 CHECK_EQ(0, strcmp(*value, "Hey!")); 8401 CHECK_EQ(0, strcmp(*value, "Hey!"));
8377 } 8402 }
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698