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

Side by Side Diff: src/api.cc

Issue 2328673003: [profiler] Add two CpuProfileNode API functions to allow thread safe access to the node. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « include/v8-profiler.h ('k') | test/cctest/test-cpu-profiler.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 8561 matching lines...) Expand 10 before | Expand all | Expand 10 after
8572 return ToApiHandle<String>(name); 8572 return ToApiHandle<String>(name);
8573 } else { 8573 } else {
8574 // We do not expect this to fail. Change this if it does. 8574 // We do not expect this to fail. Change this if it does.
8575 i::Handle<i::String> cons = isolate->factory()->NewConsString( 8575 i::Handle<i::String> cons = isolate->factory()->NewConsString(
8576 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 8576 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
8577 name).ToHandleChecked(); 8577 name).ToHandleChecked();
8578 return ToApiHandle<String>(cons); 8578 return ToApiHandle<String>(cons);
8579 } 8579 }
8580 } 8580 }
8581 8581
8582 const char* CpuProfileNode::GetFunctionNameStr() const {
8583 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
8584 return node->entry()->name();
8585 }
8582 8586
8583 int CpuProfileNode::GetScriptId() const { 8587 int CpuProfileNode::GetScriptId() const {
8584 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 8588 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
8585 const i::CodeEntry* entry = node->entry(); 8589 const i::CodeEntry* entry = node->entry();
8586 return entry->script_id(); 8590 return entry->script_id();
8587 } 8591 }
8588 8592
8589
8590 Local<String> CpuProfileNode::GetScriptResourceName() const { 8593 Local<String> CpuProfileNode::GetScriptResourceName() const {
8591 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 8594 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
8592 i::Isolate* isolate = node->isolate(); 8595 i::Isolate* isolate = node->isolate();
8593 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( 8596 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String(
8594 node->entry()->resource_name())); 8597 node->entry()->resource_name()));
8595 } 8598 }
8596 8599
8600 const char* CpuProfileNode::GetScriptResourceNameStr() const {
8601 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
8602 return node->entry()->resource_name();
8603 }
8597 8604
8598 int CpuProfileNode::GetLineNumber() const { 8605 int CpuProfileNode::GetLineNumber() const {
8599 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); 8606 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number();
8600 } 8607 }
8601 8608
8602 8609
8603 int CpuProfileNode::GetColumnNumber() const { 8610 int CpuProfileNode::GetColumnNumber() const {
8604 return reinterpret_cast<const i::ProfileNode*>(this)-> 8611 return reinterpret_cast<const i::ProfileNode*>(this)->
8605 entry()->column_number(); 8612 entry()->column_number();
8606 } 8613 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
9236 Address callback_address = 9243 Address callback_address =
9237 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9244 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9238 VMState<EXTERNAL> state(isolate); 9245 VMState<EXTERNAL> state(isolate);
9239 ExternalCallbackScope call_scope(isolate, callback_address); 9246 ExternalCallbackScope call_scope(isolate, callback_address);
9240 callback(info); 9247 callback(info);
9241 } 9248 }
9242 9249
9243 9250
9244 } // namespace internal 9251 } // namespace internal
9245 } // namespace v8 9252 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698