| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 TEST(Name##WithProfiler) { \ | 89 TEST(Name##WithProfiler) { \ |
| 90 RunWithProfiler(&Test##Name); \ | 90 RunWithProfiler(&Test##Name); \ |
| 91 } \ | 91 } \ |
| 92 THREADED_TEST(Name) | 92 THREADED_TEST(Name) |
| 93 | 93 |
| 94 | 94 |
| 95 void RunWithProfiler(void (*test)()) { | 95 void RunWithProfiler(void (*test)()) { |
| 96 LocalContext env; | 96 LocalContext env; |
| 97 v8::HandleScope scope(env->GetIsolate()); | 97 v8::HandleScope scope(env->GetIsolate()); |
| 98 v8::Local<v8::String> profile_name = v8_str("my_profile1"); | 98 v8::Local<v8::String> profile_name = v8_str("my_profile1"); |
| 99 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 99 v8::CpuProfiler* cpu_profiler = v8::CpuProfiler::New(env->GetIsolate()); |
| 100 | |
| 101 cpu_profiler->StartProfiling(profile_name); | 100 cpu_profiler->StartProfiling(profile_name); |
| 102 (*test)(); | 101 (*test)(); |
| 103 reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); | 102 reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); |
| 103 cpu_profiler->Dispose(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 static int signature_callback_count; | 107 static int signature_callback_count; |
| 108 static Local<Value> signature_expected_receiver; | 108 static Local<Value> signature_expected_receiver; |
| 109 static void IncrementingSignatureCallback( | 109 static void IncrementingSignatureCallback( |
| 110 const v8::FunctionCallbackInfo<v8::Value>& args) { | 110 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 111 ApiTestFuzzer::Fuzz(); | 111 ApiTestFuzzer::Fuzz(); |
| 112 signature_callback_count++; | 112 signature_callback_count++; |
| 113 CHECK(signature_expected_receiver->Equals( | 113 CHECK(signature_expected_receiver->Equals( |
| (...skipping 25256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25370 CHECK(object->SetPrototype(context.local(), v8::Null(isolate)).IsNothing()); | 25370 CHECK(object->SetPrototype(context.local(), v8::Null(isolate)).IsNothing()); |
| 25371 | 25371 |
| 25372 // The original prototype is still there | 25372 // The original prototype is still there |
| 25373 Local<Value> new_proto = | 25373 Local<Value> new_proto = |
| 25374 object->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); | 25374 object->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); |
| 25375 CHECK(new_proto->IsObject()); | 25375 CHECK(new_proto->IsObject()); |
| 25376 CHECK(new_proto.As<v8::Object>() | 25376 CHECK(new_proto.As<v8::Object>() |
| 25377 ->Equals(context.local(), original_proto) | 25377 ->Equals(context.local(), original_proto) |
| 25378 .FromJust()); | 25378 .FromJust()); |
| 25379 } | 25379 } |
| OLD | NEW |