Home | History | Annotate | Download | only in cctest

Lines Matching refs:v8

1 // Copyright 2010 the V8 project authors. All rights reserved.
5 #include "v8.h"
8 #include "../include/v8-profiler.h"
29 static v8::Persistent<v8::Context> env;
32 if (env.IsEmpty()) env = v8::Context::New();
33 v8::HandleScope scope;
228 // http://code.google.com/p/v8/issues/detail?id=1398
301 v8::HandleScope scope;
304 CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount());
305 v8::Local<v8::String> name1 = v8::String::New("1");
306 v8::CpuProfiler::StartProfiling(name1);
307 const v8::CpuProfile* p1 = v8::CpuProfiler::StopProfiling(name1);
309 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
311 CHECK_EQ(p1, v8::CpuProfiler::FindProfile(uid1));
312 const_cast<v8::CpuProfile*>(p1)->Delete();
314 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1));
316 v8::Local<v8::String> name2 = v8::String::New("2");
317 v8::CpuProfiler::StartProfiling(name2);
318 const v8::CpuProfile* p2 = v8::CpuProfiler::StopProfiling(name2);
320 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
323 CHECK_EQ(p2, v8::CpuProfiler::FindProfile(uid2));
324 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1));
325 v8::Local<v8::String> name3 = v8::String::New("3");
326 v8::CpuProfiler::StartProfiling(name3);
327 const v8::CpuProfile* p3 = v8::CpuProfiler::StopProfiling(name3);
329 CHECK_EQ(2, v8::CpuProfiler::GetProfilesCount());
332 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
333 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1));
334 const_cast<v8::CpuProfile*>(p2)->Delete();
335 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
336 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
337 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
338 const_cast<v8::CpuProfile*>(p3)->Delete();
340 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3));
341 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
342 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1));
347 v8::HandleScope scope;
350 CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount());
351 v8::Local<v8::String> name1 = v8::String::New("1");
352 v8::CpuProfiler::StartProfiling(name1);
353 const v8::CpuProfile* p1 = v8::CpuProfiler::StopProfiling(name1);
355 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
357 CHECK_EQ(p1, v8::CpuProfiler::FindProfile(uid1));
358 v8::Local<v8::String> token1 = v8::String::New("token1");
359 const v8::CpuProfile* p1_t1 = v8::CpuProfiler::FindProfile(uid1, token1);
362 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
363 const_cast<v8::CpuProfile*>(p1)->Delete();
365 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1));
366 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1, token1));
367 const_cast<v8::CpuProfile*>(p1_t1)->Delete();
370 v8::Local<v8::String> name2 = v8::String::New("2");
371 v8::CpuProfiler::StartProfiling(name2);
372 v8::Local<v8::String> token2 = v8::String::New("token2");
373 const v8::CpuProfile* p2_t2 = v8::CpuProfiler::StopProfiling(name2, token2);
375 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
378 const v8::CpuProfile* p2 = v8::CpuProfiler::FindProfile(uid2);
380 v8::Local<v8::String> name3 = v8::String::New("3");
381 v8::CpuProfiler::StartProfiling(name3);
382 const v8::CpuProfile* p3 = v8::CpuProfiler::StopProfiling(name3);
384 CHECK_EQ(2, v8::CpuProfiler::GetProfilesCount());
387 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
388 const_cast<v8::CpuProfile*>(p2_t2)->Delete();
389 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
390 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
391 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
392 const_cast<v8::CpuProfile*>(p2)->Delete();
393 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
394 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
395 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
396 const_cast<v8::CpuProfile*>(p3)->Delete();
398 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3));