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

Side by Side Diff: src/api.cc

Issue 578163002: Implemented GetSample. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
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))
(...skipping 6715 matching lines...) Expand 10 before | Expand all | Expand 10 after
6768 i::Heap* heap = isolate->heap(); 6769 i::Heap* heap = isolate->heap();
6769 heap_statistics->total_heap_size_ = heap->CommittedMemory(); 6770 heap_statistics->total_heap_size_ = heap->CommittedMemory();
6770 heap_statistics->total_heap_size_executable_ = 6771 heap_statistics->total_heap_size_executable_ =
6771 heap->CommittedMemoryExecutable(); 6772 heap->CommittedMemoryExecutable();
6772 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); 6773 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
6773 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); 6774 heap_statistics->used_heap_size_ = heap->SizeOfObjects();
6774 heap_statistics->heap_size_limit_ = heap->MaxReserved(); 6775 heap_statistics->heap_size_limit_ = heap->MaxReserved();
6775 } 6776 }
6776 6777
6777 6778
6779 void Isolate::GetSample(void* sp, void* fp, Sample* sample) {
alph 2014/09/18 11:34:29 What about pc register? It is essential to determi
gholap 2014/09/18 23:24:14 Done.
6780 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6781 i::TickSample tick_sample;
6782 i::RegisterState state;
6783 state.sp = reinterpret_cast<i::Address>(sp);
6784 state.fp = reinterpret_cast<i::Address>(fp);
6785 tick_sample.Init(isolate, state);
6786 sample = new (sample) Sample(&tick_sample.stack[0],
6787 &tick_sample.stack[tick_sample.frames_count]);
6788 }
6789
6790
6778 void Isolate::SetEventLogger(LogEventCallback that) { 6791 void Isolate::SetEventLogger(LogEventCallback that) {
6779 // Do not overwrite the event logger if we want to log explicitly. 6792 // Do not overwrite the event logger if we want to log explicitly.
6780 if (i::FLAG_log_timer_events) return; 6793 if (i::FLAG_log_timer_events) return;
6781 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6794 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6782 isolate->set_event_logger(that); 6795 isolate->set_event_logger(that);
6783 } 6796 }
6784 6797
6785 6798
6786 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { 6799 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
6787 if (callback == NULL) return; 6800 if (callback == NULL) return;
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
7745 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7758 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7746 Address callback_address = 7759 Address callback_address =
7747 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7760 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7748 VMState<EXTERNAL> state(isolate); 7761 VMState<EXTERNAL> state(isolate);
7749 ExternalCallbackScope call_scope(isolate, callback_address); 7762 ExternalCallbackScope call_scope(isolate, callback_address);
7750 callback(info); 7763 callback(info);
7751 } 7764 }
7752 7765
7753 7766
7754 } } // namespace v8::internal 7767 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698