OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 THREADED_TEST(Name) | 86 THREADED_TEST(Name) |
87 | 87 |
88 | 88 |
89 void RunWithProfiler(void (*test)()) { | 89 void RunWithProfiler(void (*test)()) { |
90 LocalContext env; | 90 LocalContext env; |
91 v8::HandleScope scope(env->GetIsolate()); | 91 v8::HandleScope scope(env->GetIsolate()); |
92 v8::Local<v8::String> profile_name = | 92 v8::Local<v8::String> profile_name = |
93 v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1"); | 93 v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1"); |
94 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 94 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
95 | 95 |
96 cpu_profiler->StartCpuProfiling(profile_name); | 96 cpu_profiler->StartProfiling(profile_name); |
97 (*test)(); | 97 (*test)(); |
98 reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); | 98 reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 static void ExpectString(const char* code, const char* expected) { | 102 static void ExpectString(const char* code, const char* expected) { |
103 Local<Value> result = CompileRun(code); | 103 Local<Value> result = CompileRun(code); |
104 CHECK(result->IsString()); | 104 CHECK(result->IsString()); |
105 String::Utf8Value utf8(result); | 105 String::Utf8Value utf8(result); |
106 CHECK_EQ(expected, *utf8); | 106 CHECK_EQ(expected, *utf8); |
(...skipping 22278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22385 CompileRun("x1 = x2 = 0;"); | 22385 CompileRun("x1 = x2 = 0;"); |
22386 rr = v8::Promise::Resolver::New(isolate); | 22386 rr = v8::Promise::Resolver::New(isolate); |
22387 rr->GetPromise()->Catch(f1)->Chain(f2); | 22387 rr->GetPromise()->Catch(f1)->Chain(f2); |
22388 rr->Reject(v8::Integer::New(isolate, 3)); | 22388 rr->Reject(v8::Integer::New(isolate, 3)); |
22389 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); | 22389 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); |
22390 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); | 22390 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); |
22391 V8::RunMicrotasks(isolate); | 22391 V8::RunMicrotasks(isolate); |
22392 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); | 22392 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); |
22393 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); | 22393 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); |
22394 } | 22394 } |
OLD | NEW |