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 7355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7366 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), | 7366 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), |
7367 uid)); | 7367 uid)); |
7368 } | 7368 } |
7369 | 7369 |
7370 | 7370 |
7371 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { | 7371 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { |
7372 i::Isolate* isolate = i::Isolate::Current(); | 7372 i::Isolate* isolate = i::Isolate::Current(); |
7373 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); | 7373 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); |
7374 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7374 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
7375 ASSERT(profiler != NULL); | 7375 ASSERT(profiler != NULL); |
| 7376 v8::Local<v8::Context> context = v8::Context::New( |
| 7377 reinterpret_cast<v8::Isolate*>(isolate)); |
| 7378 v8::Context::Scope contextScope(context); |
7376 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples); | 7379 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples); |
7377 } | 7380 } |
7378 | 7381 |
7379 | 7382 |
7380 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { | 7383 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { |
| 7384 i::Isolate* isolate = i::Isolate::Current(); |
| 7385 v8::Local<v8::Context> context = v8::Context::New( |
| 7386 reinterpret_cast<v8::Isolate*>(isolate)); |
| 7387 v8::Context::Scope contextScope(context); |
7381 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( | 7388 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( |
7382 *Utils::OpenHandle(*title), record_samples); | 7389 *Utils::OpenHandle(*title), record_samples); |
7383 } | 7390 } |
7384 | 7391 |
7385 | 7392 |
7386 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, | 7393 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, |
7387 Handle<Value> security_token) { | 7394 Handle<Value> security_token) { |
7388 i::Isolate* isolate = i::Isolate::Current(); | 7395 i::Isolate* isolate = i::Isolate::Current(); |
7389 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); | 7396 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); |
7390 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7397 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8050 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8057 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8051 Address callback_address = | 8058 Address callback_address = |
8052 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8059 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8053 VMState<EXTERNAL> state(isolate); | 8060 VMState<EXTERNAL> state(isolate); |
8054 ExternalCallbackScope call_scope(isolate, callback_address); | 8061 ExternalCallbackScope call_scope(isolate, callback_address); |
8055 return callback(info); | 8062 return callback(info); |
8056 } | 8063 } |
8057 | 8064 |
8058 | 8065 |
8059 } } // namespace v8::internal | 8066 } } // namespace v8::internal |
OLD | NEW |