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 6331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6342 bool capture, | 6342 bool capture, |
6343 int frame_limit, | 6343 int frame_limit, |
6344 StackTrace::StackTraceOptions options) { | 6344 StackTrace::StackTraceOptions options) { |
6345 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions( | 6345 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions( |
6346 capture, | 6346 capture, |
6347 frame_limit, | 6347 frame_limit, |
6348 options); | 6348 options); |
6349 } | 6349 } |
6350 | 6350 |
6351 | 6351 |
6352 void V8::SetCounterFunction(CounterLookupCallback callback) { | |
6353 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | |
6354 // TODO(svenpanne) The Isolate should really be a parameter. | |
6355 if (isolate == NULL) return; | |
6356 isolate->stats_table()->SetCounterFunction(callback); | |
6357 } | |
6358 | |
6359 | |
6360 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { | |
6361 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | |
6362 // TODO(svenpanne) The Isolate should really be a parameter. | |
6363 if (isolate == NULL) return; | |
6364 isolate->stats_table()->SetCreateHistogramFunction(callback); | |
6365 isolate->InitializeLoggingAndCounters(); | |
6366 isolate->counters()->ResetHistograms(); | |
6367 } | |
6368 | |
6369 | |
6370 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) { | |
6371 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | |
6372 // TODO(svenpanne) The Isolate should really be a parameter. | |
6373 if (isolate == NULL) return; | |
6374 isolate->stats_table()-> | |
6375 SetAddHistogramSampleFunction(callback); | |
6376 } | |
6377 | |
6378 void V8::SetFailedAccessCheckCallbackFunction( | 6352 void V8::SetFailedAccessCheckCallbackFunction( |
6379 FailedAccessCheckCallback callback) { | 6353 FailedAccessCheckCallback callback) { |
6380 i::Isolate* isolate = i::Isolate::Current(); | 6354 i::Isolate* isolate = i::Isolate::Current(); |
6381 isolate->SetFailedAccessCheckCallback(callback); | 6355 isolate->SetFailedAccessCheckCallback(callback); |
6382 } | 6356 } |
6383 | 6357 |
6384 | 6358 |
6385 void Isolate::CollectAllGarbage(const char* gc_reason) { | 6359 void Isolate::CollectAllGarbage(const char* gc_reason) { |
6386 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( | 6360 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( |
6387 i::Heap::kNoGCFlags, gc_reason); | 6361 i::Heap::kNoGCFlags, gc_reason); |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7685 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7659 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7686 Address callback_address = | 7660 Address callback_address = |
7687 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7661 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7688 VMState<EXTERNAL> state(isolate); | 7662 VMState<EXTERNAL> state(isolate); |
7689 ExternalCallbackScope call_scope(isolate, callback_address); | 7663 ExternalCallbackScope call_scope(isolate, callback_address); |
7690 callback(info); | 7664 callback(info); |
7691 } | 7665 } |
7692 | 7666 |
7693 | 7667 |
7694 } } // namespace v8::internal | 7668 } } // namespace v8::internal |
OLD | NEW |