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

Side by Side Diff: src/api.cc

Issue 1010233002: Make counter and histogram related callbacks part of the Isolate::CreateParams. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('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 6785 matching lines...) Expand 10 before | Expand all | Expand 10 after
6796 isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob()); 6796 isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());
6797 } 6797 }
6798 if (params.entry_hook) { 6798 if (params.entry_hook) {
6799 isolate->set_function_entry_hook(params.entry_hook); 6799 isolate->set_function_entry_hook(params.entry_hook);
6800 } 6800 }
6801 if (params.code_event_handler) { 6801 if (params.code_event_handler) {
6802 isolate->InitializeLoggingAndCounters(); 6802 isolate->InitializeLoggingAndCounters();
6803 isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault, 6803 isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault,
6804 params.code_event_handler); 6804 params.code_event_handler);
6805 } 6805 }
6806 if (params.counter_lookup_callback) {
6807 v8_isolate->SetCounterFunction(params.counter_lookup_callback);
6808 }
6809
6810 if (params.create_histogram_callback) {
6811 v8_isolate->SetCreateHistogramFunction(params.create_histogram_callback);
6812 }
6813
6814 if (params.add_histogram_sample_callback) {
6815 v8_isolate->SetAddHistogramSampleFunction(
6816 params.add_histogram_sample_callback);
6817 }
6806 SetResourceConstraints(isolate, params.constraints); 6818 SetResourceConstraints(isolate, params.constraints);
6807 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. 6819 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
6808 Isolate::Scope isolate_scope(v8_isolate); 6820 Isolate::Scope isolate_scope(v8_isolate);
6809 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) { 6821 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) {
6810 // If the isolate has a function entry hook, it needs to re-build all its 6822 // If the isolate has a function entry hook, it needs to re-build all its
6811 // code stubs with entry hooks embedded, so don't deserialize a snapshot. 6823 // code stubs with entry hooks embedded, so don't deserialize a snapshot.
6812 if (i::Snapshot::EmbedsScript(isolate)) { 6824 if (i::Snapshot::EmbedsScript(isolate)) {
6813 // If the snapshot embeds a script, we cannot initialize the isolate 6825 // If the snapshot embeds a script, we cannot initialize the isolate
6814 // without the snapshot as a fallback. This is unlikely to happen though. 6826 // without the snapshot as a fallback. This is unlikely to happen though.
6815 V8_Fatal(__FILE__, __LINE__, 6827 V8_Fatal(__FILE__, __LINE__,
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
8017 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8029 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8018 Address callback_address = 8030 Address callback_address =
8019 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8031 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8020 VMState<EXTERNAL> state(isolate); 8032 VMState<EXTERNAL> state(isolate);
8021 ExternalCallbackScope call_scope(isolate, callback_address); 8033 ExternalCallbackScope call_scope(isolate, callback_address);
8022 callback(info); 8034 callback(info);
8023 } 8035 }
8024 8036
8025 8037
8026 } } // namespace v8::internal 8038 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698