| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 v8::Local<v8::Function> func = func_template->GetFunction(); | 1294 v8::Local<v8::Function> func = func_template->GetFunction(); |
| 1295 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction")); | 1295 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction")); |
| 1296 env->Global()->Set( | 1296 env->Global()->Set( |
| 1297 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); | 1297 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); |
| 1298 | 1298 |
| 1299 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 1299 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 1300 js_native_js_test_source))->Run(); | 1300 js_native_js_test_source))->Run(); |
| 1301 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( | 1301 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( |
| 1302 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); | 1302 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); |
| 1303 | 1303 |
| 1304 int32_t duration_ms = 20; | 1304 int32_t duration_ms = 200; |
| 1305 v8::Handle<v8::Value> args[] = { | 1305 v8::Handle<v8::Value> args[] = { |
| 1306 v8::Integer::New(env->GetIsolate(), duration_ms) | 1306 v8::Integer::New(env->GetIsolate(), duration_ms) |
| 1307 }; | 1307 }; |
| 1308 v8::CpuProfile* profile = | 1308 v8::CpuProfile* profile = |
| 1309 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); | 1309 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); |
| 1310 | 1310 |
| 1311 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1311 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1312 { | 1312 { |
| 1313 ScopedVector<v8::Handle<v8::String> > names(3); | 1313 ScopedVector<v8::Handle<v8::String> > names(3); |
| 1314 names[0] = v8::String::NewFromUtf8( | 1314 names[0] = v8::String::NewFromUtf8( |
| 1315 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); | 1315 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); |
| 1316 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), | 1316 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), |
| 1317 ProfileGenerator::kProgramEntryName); | 1317 ProfileGenerator::kProgramEntryName); |
| 1318 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); | 1318 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); |
| 1319 CheckChildrenNames(root, names); | 1319 CheckChildrenNames(root, names); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction")); | 1379 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction")); |
| 1380 env->Global()->Set( | 1380 env->Global()->Set( |
| 1381 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); | 1381 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); |
| 1382 | 1382 |
| 1383 v8::Script::Compile( | 1383 v8::Script::Compile( |
| 1384 v8::String::NewFromUtf8(env->GetIsolate(), | 1384 v8::String::NewFromUtf8(env->GetIsolate(), |
| 1385 js_native_js_runtime_js_test_source))->Run(); | 1385 js_native_js_runtime_js_test_source))->Run(); |
| 1386 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( | 1386 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( |
| 1387 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); | 1387 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); |
| 1388 | 1388 |
| 1389 int32_t duration_ms = 20; | 1389 int32_t duration_ms = 200; |
| 1390 v8::Handle<v8::Value> args[] = { | 1390 v8::Handle<v8::Value> args[] = { |
| 1391 v8::Integer::New(env->GetIsolate(), duration_ms) | 1391 v8::Integer::New(env->GetIsolate(), duration_ms) |
| 1392 }; | 1392 }; |
| 1393 v8::CpuProfile* profile = | 1393 v8::CpuProfile* profile = |
| 1394 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); | 1394 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); |
| 1395 | 1395 |
| 1396 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1396 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1397 ScopedVector<v8::Handle<v8::String> > names(3); | 1397 ScopedVector<v8::Handle<v8::String> > names(3); |
| 1398 names[0] = v8::String::NewFromUtf8( | 1398 names[0] = v8::String::NewFromUtf8( |
| 1399 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); | 1399 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); |
| 1400 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), | 1400 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), |
| 1401 ProfileGenerator::kProgramEntryName); | 1401 ProfileGenerator::kProgramEntryName); |
| 1402 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); | 1402 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); |
| 1403 CheckChildrenNames(root, names); | 1403 CheckChildrenNames(root, names); |
| 1404 | 1404 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 func2->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2")); | 1477 func2->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2")); |
| 1478 env->Global()->Set( | 1478 env->Global()->Set( |
| 1479 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"), func2); | 1479 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"), func2); |
| 1480 | 1480 |
| 1481 v8::Script::Compile( | 1481 v8::Script::Compile( |
| 1482 v8::String::NewFromUtf8(env->GetIsolate(), | 1482 v8::String::NewFromUtf8(env->GetIsolate(), |
| 1483 js_native1_js_native2_js_test_source))->Run(); | 1483 js_native1_js_native2_js_test_source))->Run(); |
| 1484 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( | 1484 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( |
| 1485 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); | 1485 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); |
| 1486 | 1486 |
| 1487 int32_t duration_ms = 20; | 1487 int32_t duration_ms = 200; |
| 1488 v8::Handle<v8::Value> args[] = { | 1488 v8::Handle<v8::Value> args[] = { |
| 1489 v8::Integer::New(env->GetIsolate(), duration_ms) | 1489 v8::Integer::New(env->GetIsolate(), duration_ms) |
| 1490 }; | 1490 }; |
| 1491 v8::CpuProfile* profile = | 1491 v8::CpuProfile* profile = |
| 1492 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); | 1492 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); |
| 1493 | 1493 |
| 1494 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1494 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
| 1495 ScopedVector<v8::Handle<v8::String> > names(3); | 1495 ScopedVector<v8::Handle<v8::String> > names(3); |
| 1496 names[0] = v8::String::NewFromUtf8( | 1496 names[0] = v8::String::NewFromUtf8( |
| 1497 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); | 1497 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); |
| 1498 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), | 1498 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), |
| 1499 ProfileGenerator::kProgramEntryName); | 1499 ProfileGenerator::kProgramEntryName); |
| 1500 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); | 1500 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); |
| 1501 CheckChildrenNames(root, names); | 1501 CheckChildrenNames(root, names); |
| 1502 | 1502 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 inner_profile = NULL; | 1660 inner_profile = NULL; |
| 1661 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1661 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 1662 | 1662 |
| 1663 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); | 1663 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); |
| 1664 CHECK(outer_profile); | 1664 CHECK(outer_profile); |
| 1665 CHECK_EQ(1, iprofiler->GetProfilesCount()); | 1665 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
| 1666 outer_profile->Delete(); | 1666 outer_profile->Delete(); |
| 1667 outer_profile = NULL; | 1667 outer_profile = NULL; |
| 1668 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1668 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 1669 } | 1669 } |
| OLD | NEW |