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

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

Issue 3058048: Add RelocInfo::DEBUG_BREAK_SLOT to RelocInfo::kApplyMask on ia32/x64. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « src/x64/assembler-x64.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 SetBreakPoint(foo, 0); 1237 SetBreakPoint(foo, 0);
1238 CallWithBreakPoints(env->Global(), foo, 1, 25); 1238 CallWithBreakPoints(env->Global(), foo, 1, 25);
1239 1239
1240 v8::Debug::SetDebugEventListener(NULL); 1240 v8::Debug::SetDebugEventListener(NULL);
1241 CheckDebuggerUnloaded(); 1241 CheckDebuggerUnloaded();
1242 } 1242 }
1243 1243
1244 1244
1245 // Call the function three times with different garbage collections in between 1245 // Call the function three times with different garbage collections in between
1246 // and make sure that the break point survives. 1246 // and make sure that the break point survives.
1247 static void CallAndGC(v8::Local<v8::Object> recv, v8::Local<v8::Function> f) { 1247 static void CallAndGC(v8::Local<v8::Object> recv,
1248 v8::Local<v8::Function> f,
1249 bool force_compaction) {
1248 break_point_hit_count = 0; 1250 break_point_hit_count = 0;
1249 1251
1250 for (int i = 0; i < 3; i++) { 1252 for (int i = 0; i < 3; i++) {
1251 // Call function. 1253 // Call function.
1252 f->Call(recv, 0, NULL); 1254 f->Call(recv, 0, NULL);
1253 CHECK_EQ(1 + i * 3, break_point_hit_count); 1255 CHECK_EQ(1 + i * 3, break_point_hit_count);
1254 1256
1255 // Scavenge and call function. 1257 // Scavenge and call function.
1256 Heap::CollectGarbage(0, v8::internal::NEW_SPACE); 1258 Heap::CollectGarbage(0, v8::internal::NEW_SPACE);
1257 f->Call(recv, 0, NULL); 1259 f->Call(recv, 0, NULL);
1258 CHECK_EQ(2 + i * 3, break_point_hit_count); 1260 CHECK_EQ(2 + i * 3, break_point_hit_count);
1259 1261
1260 // Mark sweep (and perhaps compact) and call function. 1262 // Mark sweep (and perhaps compact) and call function.
1261 Heap::CollectAllGarbage(false); 1263 Heap::CollectAllGarbage(force_compaction);
1262 f->Call(recv, 0, NULL); 1264 f->Call(recv, 0, NULL);
1263 CHECK_EQ(3 + i * 3, break_point_hit_count); 1265 CHECK_EQ(3 + i * 3, break_point_hit_count);
1264 } 1266 }
1265 } 1267 }
1266 1268
1267 1269
1268 // Test that a break point can be set at a return store location. 1270 static void TestBreakPointSurviveGC(bool force_compaction) {
1269 TEST(BreakPointSurviveGC) {
1270 break_point_hit_count = 0; 1271 break_point_hit_count = 0;
1271 v8::HandleScope scope; 1272 v8::HandleScope scope;
1272 DebugLocalContext env; 1273 DebugLocalContext env;
1273 1274
1274 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, 1275 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
1275 v8::Undefined()); 1276 v8::Undefined());
1276 v8::Local<v8::Function> foo; 1277 v8::Local<v8::Function> foo;
1277 1278
1278 // Test IC store break point with garbage collection. 1279 // Test IC store break point with garbage collection.
1279 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); 1280 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
1280 SetBreakPoint(foo, 0); 1281 SetBreakPoint(foo, 0);
1281 CallAndGC(env->Global(), foo); 1282 CallAndGC(env->Global(), foo, force_compaction);
1282 1283
1283 // Test IC load break point with garbage collection. 1284 // Test IC load break point with garbage collection.
1284 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo"); 1285 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
1285 SetBreakPoint(foo, 0); 1286 SetBreakPoint(foo, 0);
1286 CallAndGC(env->Global(), foo); 1287 CallAndGC(env->Global(), foo, force_compaction);
1287 1288
1288 // Test IC call break point with garbage collection. 1289 // Test IC call break point with garbage collection.
1289 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo"); 1290 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo");
1290 SetBreakPoint(foo, 0); 1291 SetBreakPoint(foo, 0);
1291 CallAndGC(env->Global(), foo); 1292 CallAndGC(env->Global(), foo, force_compaction);
1292 1293
1293 // Test return break point with garbage collection. 1294 // Test return break point with garbage collection.
1294 foo = CompileFunction(&env, "function foo(){}", "foo"); 1295 foo = CompileFunction(&env, "function foo(){}", "foo");
1295 SetBreakPoint(foo, 0); 1296 SetBreakPoint(foo, 0);
1296 CallAndGC(env->Global(), foo); 1297 CallAndGC(env->Global(), foo, force_compaction);
1297 1298
1298 v8::Debug::SetDebugEventListener(NULL); 1299 v8::Debug::SetDebugEventListener(NULL);
1299 CheckDebuggerUnloaded(); 1300 CheckDebuggerUnloaded();
1300 } 1301 }
1301 1302
1302 1303
1304 // Test that a break point can be set at a return store location.
1305 TEST(BreakPointSurviveGC) {
1306 TestBreakPointSurviveGC(false);
1307 TestBreakPointSurviveGC(true);
1308 }
1309
1310
1303 // Test that break points can be set using the global Debug object. 1311 // Test that break points can be set using the global Debug object.
1304 TEST(BreakPointThroughJavaScript) { 1312 TEST(BreakPointThroughJavaScript) {
1305 break_point_hit_count = 0; 1313 break_point_hit_count = 0;
1306 v8::HandleScope scope; 1314 v8::HandleScope scope;
1307 DebugLocalContext env; 1315 DebugLocalContext env;
1308 env.ExposeDebug(); 1316 env.ExposeDebug();
1309 1317
1310 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, 1318 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
1311 v8::Undefined()); 1319 v8::Undefined());
1312 v8::Script::Compile(v8::String::New("function bar(){}"))->Run(); 1320 v8::Script::Compile(v8::String::New("function bar(){}"))->Run();
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after
6709 6717
6710 CHECK_EQ(2, TestClientData::constructor_call_counter); 6718 CHECK_EQ(2, TestClientData::constructor_call_counter);
6711 CHECK_EQ(TestClientData::constructor_call_counter, 6719 CHECK_EQ(TestClientData::constructor_call_counter,
6712 TestClientData::destructor_call_counter); 6720 TestClientData::destructor_call_counter);
6713 6721
6714 v8::Debug::SetDebugEventListener(NULL); 6722 v8::Debug::SetDebugEventListener(NULL);
6715 CheckDebuggerUnloaded(); 6723 CheckDebuggerUnloaded();
6716 } 6724 }
6717 6725
6718 #endif // ENABLE_DEBUGGER_SUPPORT 6726 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698