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 |
(...skipping 22 matching lines...) Expand all Loading... |
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 6617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6684 i::Heap* heap = isolate->heap(); | 6685 i::Heap* heap = isolate->heap(); |
6685 heap_statistics->total_heap_size_ = heap->CommittedMemory(); | 6686 heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
6686 heap_statistics->total_heap_size_executable_ = | 6687 heap_statistics->total_heap_size_executable_ = |
6687 heap->CommittedMemoryExecutable(); | 6688 heap->CommittedMemoryExecutable(); |
6688 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); | 6689 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
6689 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); | 6690 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); |
6690 heap_statistics->heap_size_limit_ = heap->MaxReserved(); | 6691 heap_statistics->heap_size_limit_ = heap->MaxReserved(); |
6691 } | 6692 } |
6692 | 6693 |
6693 | 6694 |
| 6695 void Isolate::GetStackSample(const RegisterState& state, void** frames, |
| 6696 size_t frames_limit, SampleInfo* sample_info) { |
| 6697 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6698 i::TickSample::GetStackSample(isolate, state, frames, frames_limit, |
| 6699 sample_info); |
| 6700 } |
| 6701 |
| 6702 |
6694 void Isolate::SetEventLogger(LogEventCallback that) { | 6703 void Isolate::SetEventLogger(LogEventCallback that) { |
6695 // Do not overwrite the event logger if we want to log explicitly. | 6704 // Do not overwrite the event logger if we want to log explicitly. |
6696 if (i::FLAG_log_timer_events) return; | 6705 if (i::FLAG_log_timer_events) return; |
6697 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6706 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6698 isolate->set_event_logger(that); | 6707 isolate->set_event_logger(that); |
6699 } | 6708 } |
6700 | 6709 |
6701 | 6710 |
6702 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { | 6711 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { |
6703 if (callback == NULL) return; | 6712 if (callback == NULL) return; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7169 } | 7178 } |
7170 | 7179 |
7171 | 7180 |
7172 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { | 7181 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { |
7173 return StopProfiling(title); | 7182 return StopProfiling(title); |
7174 } | 7183 } |
7175 | 7184 |
7176 | 7185 |
7177 void CpuProfiler::SetIdle(bool is_idle) { | 7186 void CpuProfiler::SetIdle(bool is_idle) { |
7178 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); | 7187 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); |
7179 i::StateTag state = isolate->current_vm_state(); | 7188 v8::StateTag state = isolate->current_vm_state(); |
7180 DCHECK(state == i::EXTERNAL || state == i::IDLE); | 7189 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); |
7181 if (isolate->js_entry_sp() != NULL) return; | 7190 if (isolate->js_entry_sp() != NULL) return; |
7182 if (is_idle) { | 7191 if (is_idle) { |
7183 isolate->set_current_vm_state(i::IDLE); | 7192 isolate->set_current_vm_state(v8::IDLE); |
7184 } else if (state == i::IDLE) { | 7193 } else if (state == v8::IDLE) { |
7185 isolate->set_current_vm_state(i::EXTERNAL); | 7194 isolate->set_current_vm_state(v8::EXTERNAL); |
7186 } | 7195 } |
7187 } | 7196 } |
7188 | 7197 |
7189 | 7198 |
7190 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { | 7199 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { |
7191 return const_cast<i::HeapGraphEdge*>( | 7200 return const_cast<i::HeapGraphEdge*>( |
7192 reinterpret_cast<const i::HeapGraphEdge*>(edge)); | 7201 reinterpret_cast<const i::HeapGraphEdge*>(edge)); |
7193 } | 7202 } |
7194 | 7203 |
7195 | 7204 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7667 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7659 Address callback_address = | 7668 Address callback_address = |
7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7669 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7661 VMState<EXTERNAL> state(isolate); | 7670 VMState<EXTERNAL> state(isolate); |
7662 ExternalCallbackScope call_scope(isolate, callback_address); | 7671 ExternalCallbackScope call_scope(isolate, callback_address); |
7663 callback(info); | 7672 callback(info); |
7664 } | 7673 } |
7665 | 7674 |
7666 | 7675 |
7667 } } // namespace v8::internal | 7676 } } // namespace v8::internal |
OLD | NEW |