Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| 11 #include <cmath> // For isnan. | 11 #include <cmath> // For isnan. |
| 12 #include "include/v8-debug.h" | 12 #include "include/v8-debug.h" |
| 13 #include "include/v8-profiler.h" | 13 #include "include/v8-profiler.h" |
| 14 #include "include/v8-sampler.h" | |
| 14 #include "include/v8-testing.h" | 15 #include "include/v8-testing.h" |
| 15 #include "src/assert-scope.h" | 16 #include "src/assert-scope.h" |
| 16 #include "src/base/platform/platform.h" | 17 #include "src/base/platform/platform.h" |
| 17 #include "src/base/platform/time.h" | 18 #include "src/base/platform/time.h" |
| 18 #include "src/base/utils/random-number-generator.h" | 19 #include "src/base/utils/random-number-generator.h" |
| 19 #include "src/bootstrapper.h" | 20 #include "src/bootstrapper.h" |
| 20 #include "src/code-stubs.h" | 21 #include "src/code-stubs.h" |
| 21 #include "src/compiler.h" | 22 #include "src/compiler.h" |
| 22 #include "src/conversions-inl.h" | 23 #include "src/conversions-inl.h" |
| 23 #include "src/counters.h" | 24 #include "src/counters.h" |
| (...skipping 7394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7418 return reinterpret_cast<i::HeapProfiler*>(this)-> | 7419 return reinterpret_cast<i::HeapProfiler*>(this)-> |
| 7419 GetMemorySizeUsedByProfiler(); | 7420 GetMemorySizeUsedByProfiler(); |
| 7420 } | 7421 } |
| 7421 | 7422 |
| 7422 | 7423 |
| 7423 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, | 7424 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, |
| 7424 RetainedObjectInfo* info) { | 7425 RetainedObjectInfo* info) { |
| 7425 reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); | 7426 reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); |
| 7426 } | 7427 } |
| 7427 | 7428 |
| 7429 Sample* Sampler::GetSample(Isolate* isolate, | |
| 7430 Sample* sample) { | |
| 7431 i::Isolate* isolate_ = reinterpret_cast<i::Isolate*>(isolate); | |
| 7432 | |
| 7433 i::CpuProfiler* profiler_ = isolate_->cpu_profiler(); | |
| 7434 if (profiler_ == NULL) return NULL; | |
| 7435 | |
| 7436 i::ProfilerEventsProcessor* processor_ = profiler_->processor(); | |
| 7437 if (processor_ == NULL) return NULL; | |
| 7438 | |
| 7439 i::Sampler* sampler_ = processor_->sampler(); | |
| 7440 if (sampler_ == NULL) return NULL; | |
|
fmeawad
2014/07/29 18:30:50
Can you cache those between calls?
i.e. check and
gholap
2014/07/29 23:25:20
Acknowledged.
| |
| 7441 | |
| 7442 return reinterpret_cast<Sample*>( | |
| 7443 sampler_->GetSample(reinterpret_cast<i::TickSample*>(sample))); | |
| 7444 } | |
| 7428 | 7445 |
| 7429 v8::Testing::StressType internal::Testing::stress_type_ = | 7446 v8::Testing::StressType internal::Testing::stress_type_ = |
| 7430 v8::Testing::kStressTypeOpt; | 7447 v8::Testing::kStressTypeOpt; |
| 7431 | 7448 |
| 7432 | 7449 |
| 7433 void Testing::SetStressRunType(Testing::StressType type) { | 7450 void Testing::SetStressRunType(Testing::StressType type) { |
| 7434 internal::Testing::set_stress_type(type); | 7451 internal::Testing::set_stress_type(type); |
| 7435 } | 7452 } |
| 7436 | 7453 |
| 7437 | 7454 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7675 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7659 Address callback_address = | 7676 Address callback_address = |
| 7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7677 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7661 VMState<EXTERNAL> state(isolate); | 7678 VMState<EXTERNAL> state(isolate); |
| 7662 ExternalCallbackScope call_scope(isolate, callback_address); | 7679 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7663 callback(info); | 7680 callback(info); |
| 7664 } | 7681 } |
| 7665 | 7682 |
| 7666 | 7683 |
| 7667 } } // namespace v8::internal | 7684 } } // namespace v8::internal |
| OLD | NEW |