Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/api.cc

Issue 596533002: Initial implementation of GetStackSample sampling profiler API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ARM32 build. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/globals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 22 matching lines...) Expand all
33 #include "src/json-parser.h" 33 #include "src/json-parser.h"
34 #include "src/messages.h" 34 #include "src/messages.h"
35 #include "src/natives.h" 35 #include "src/natives.h"
36 #include "src/parser.h" 36 #include "src/parser.h"
37 #include "src/profile-generator-inl.h" 37 #include "src/profile-generator-inl.h"
38 #include "src/property.h" 38 #include "src/property.h"
39 #include "src/property-details.h" 39 #include "src/property-details.h"
40 #include "src/prototype.h" 40 #include "src/prototype.h"
41 #include "src/runtime.h" 41 #include "src/runtime.h"
42 #include "src/runtime-profiler.h" 42 #include "src/runtime-profiler.h"
43 #include "src/sampler.h"
43 #include "src/scanner-character-streams.h" 44 #include "src/scanner-character-streams.h"
44 #include "src/simulator.h" 45 #include "src/simulator.h"
45 #include "src/snapshot.h" 46 #include "src/snapshot.h"
46 #include "src/unicode-inl.h" 47 #include "src/unicode-inl.h"
47 #include "src/v8threads.h" 48 #include "src/v8threads.h"
48 #include "src/version.h" 49 #include "src/version.h"
49 #include "src/vm-state-inl.h" 50 #include "src/vm-state-inl.h"
50 51
51 52
52 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) 53 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
53 54
54 #define ENTER_V8(isolate) \ 55 #define ENTER_V8(isolate) \
55 DCHECK((isolate)->IsInitialized()); \ 56 DCHECK((isolate)->IsInitialized()); \
56 i::VMState<i::OTHER> __state__((isolate)) 57 i::VMState<v8::OTHER> __state__((isolate))
57 58
58 namespace v8 { 59 namespace v8 {
59 60
60 #define ON_BAILOUT(isolate, location, code) \ 61 #define ON_BAILOUT(isolate, location, code) \
61 if (IsExecutionTerminatingCheck(isolate)) { \ 62 if (IsExecutionTerminatingCheck(isolate)) { \
62 code; \ 63 code; \
63 UNREACHABLE(); \ 64 UNREACHABLE(); \
64 } 65 }
65 66
66 67
(...skipping 6614 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 i::Heap* heap = isolate->heap(); 6682 i::Heap* heap = isolate->heap();
6682 heap_statistics->total_heap_size_ = heap->CommittedMemory(); 6683 heap_statistics->total_heap_size_ = heap->CommittedMemory();
6683 heap_statistics->total_heap_size_executable_ = 6684 heap_statistics->total_heap_size_executable_ =
6684 heap->CommittedMemoryExecutable(); 6685 heap->CommittedMemoryExecutable();
6685 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); 6686 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
6686 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); 6687 heap_statistics->used_heap_size_ = heap->SizeOfObjects();
6687 heap_statistics->heap_size_limit_ = heap->MaxReserved(); 6688 heap_statistics->heap_size_limit_ = heap->MaxReserved();
6688 } 6689 }
6689 6690
6690 6691
6692 void Isolate::GetStackSample(const RegisterState& state, void** frames,
6693 size_t frames_limit, SampleInfo* sample_info) {
6694 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6695 i::TickSample::GetStackSample(isolate, state, frames, frames_limit,
6696 sample_info);
6697 }
6698
6699
6691 void Isolate::SetEventLogger(LogEventCallback that) { 6700 void Isolate::SetEventLogger(LogEventCallback that) {
6692 // Do not overwrite the event logger if we want to log explicitly. 6701 // Do not overwrite the event logger if we want to log explicitly.
6693 if (i::FLAG_log_timer_events) return; 6702 if (i::FLAG_log_timer_events) return;
6694 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6703 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6695 isolate->set_event_logger(that); 6704 isolate->set_event_logger(that);
6696 } 6705 }
6697 6706
6698 6707
6699 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { 6708 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
6700 if (callback == NULL) return; 6709 if (callback == NULL) return;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
7166 } 7175 }
7167 7176
7168 7177
7169 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { 7178 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) {
7170 return StopProfiling(title); 7179 return StopProfiling(title);
7171 } 7180 }
7172 7181
7173 7182
7174 void CpuProfiler::SetIdle(bool is_idle) { 7183 void CpuProfiler::SetIdle(bool is_idle) {
7175 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); 7184 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
7176 i::StateTag state = isolate->current_vm_state(); 7185 v8::StateTag state = isolate->current_vm_state();
7177 DCHECK(state == i::EXTERNAL || state == i::IDLE); 7186 DCHECK(state == v8::EXTERNAL || state == v8::IDLE);
7178 if (isolate->js_entry_sp() != NULL) return; 7187 if (isolate->js_entry_sp() != NULL) return;
7179 if (is_idle) { 7188 if (is_idle) {
7180 isolate->set_current_vm_state(i::IDLE); 7189 isolate->set_current_vm_state(v8::IDLE);
7181 } else if (state == i::IDLE) { 7190 } else if (state == v8::IDLE) {
7182 isolate->set_current_vm_state(i::EXTERNAL); 7191 isolate->set_current_vm_state(v8::EXTERNAL);
7183 } 7192 }
7184 } 7193 }
7185 7194
7186 7195
7187 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 7196 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
7188 return const_cast<i::HeapGraphEdge*>( 7197 return const_cast<i::HeapGraphEdge*>(
7189 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 7198 reinterpret_cast<const i::HeapGraphEdge*>(edge));
7190 } 7199 }
7191 7200
7192 7201
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
7655 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7664 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7656 Address callback_address = 7665 Address callback_address =
7657 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7666 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7658 VMState<EXTERNAL> state(isolate); 7667 VMState<EXTERNAL> state(isolate);
7659 ExternalCallbackScope call_scope(isolate, callback_address); 7668 ExternalCallbackScope call_scope(isolate, callback_address);
7660 callback(info); 7669 callback(info);
7661 } 7670 }
7662 7671
7663 7672
7664 } } // namespace v8::internal 7673 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698