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 6689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6700 void Isolate::SetAutorunMicrotasks(bool autorun) { | 6700 void Isolate::SetAutorunMicrotasks(bool autorun) { |
6701 reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun); | 6701 reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun); |
6702 } | 6702 } |
6703 | 6703 |
6704 | 6704 |
6705 bool Isolate::WillAutorunMicrotasks() const { | 6705 bool Isolate::WillAutorunMicrotasks() const { |
6706 return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks(); | 6706 return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks(); |
6707 } | 6707 } |
6708 | 6708 |
6709 | 6709 |
| 6710 void Isolate::SetCounterFunction(CounterLookupCallback callback) { |
| 6711 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6712 isolate->stats_table()->SetCounterFunction(callback); |
| 6713 isolate->InitializeLoggingAndCounters(); |
| 6714 isolate->counters()->ResetCounters(); |
| 6715 } |
| 6716 |
| 6717 |
| 6718 void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) { |
| 6719 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6720 isolate->stats_table()->SetCreateHistogramFunction(callback); |
| 6721 isolate->InitializeLoggingAndCounters(); |
| 6722 isolate->counters()->ResetHistograms(); |
| 6723 } |
| 6724 |
| 6725 |
| 6726 void Isolate::SetAddHistogramSampleFunction( |
| 6727 AddHistogramSampleCallback callback) { |
| 6728 reinterpret_cast<i::Isolate*>(this) |
| 6729 ->stats_table() |
| 6730 ->SetAddHistogramSampleFunction(callback); |
| 6731 } |
| 6732 |
| 6733 |
6710 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 6734 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
6711 : str_(NULL), length_(0) { | 6735 : str_(NULL), length_(0) { |
6712 i::Isolate* isolate = i::Isolate::Current(); | 6736 i::Isolate* isolate = i::Isolate::Current(); |
6713 if (obj.IsEmpty()) return; | 6737 if (obj.IsEmpty()) return; |
6714 ENTER_V8(isolate); | 6738 ENTER_V8(isolate); |
6715 i::HandleScope scope(isolate); | 6739 i::HandleScope scope(isolate); |
6716 TryCatch try_catch; | 6740 TryCatch try_catch; |
6717 Handle<String> str = obj->ToString(); | 6741 Handle<String> str = obj->ToString(); |
6718 if (str.IsEmpty()) return; | 6742 if (str.IsEmpty()) return; |
6719 i::Handle<i::String> i_str = Utils::OpenHandle(*str); | 6743 i::Handle<i::String> i_str = Utils::OpenHandle(*str); |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7599 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7623 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7600 Address callback_address = | 7624 Address callback_address = |
7601 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7625 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7602 VMState<EXTERNAL> state(isolate); | 7626 VMState<EXTERNAL> state(isolate); |
7603 ExternalCallbackScope call_scope(isolate, callback_address); | 7627 ExternalCallbackScope call_scope(isolate, callback_address); |
7604 callback(info); | 7628 callback(info); |
7605 } | 7629 } |
7606 | 7630 |
7607 | 7631 |
7608 } } // namespace v8::internal | 7632 } } // namespace v8::internal |
OLD | NEW |