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

Side by Side Diff: src/api.cc

Issue 2766573003: [debug] introduce precise binary code coverage. (Closed)
Patch Set: address comments Created 3 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 | « no previous file | src/d8.cc » ('j') | src/inspector/js_protocol.json » ('J')
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 9573 matching lines...) Expand 10 before | Expand all | Expand 10 after
9584 return ToApiHandle<String>(name); 9584 return ToApiHandle<String>(name);
9585 } else { 9585 } else {
9586 // We do not expect this to fail. Change this if it does. 9586 // We do not expect this to fail. Change this if it does.
9587 i::Handle<i::String> cons = isolate->factory()->NewConsString( 9587 i::Handle<i::String> cons = isolate->factory()->NewConsString(
9588 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 9588 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
9589 name).ToHandleChecked(); 9589 name).ToHandleChecked();
9590 return ToApiHandle<String>(cons); 9590 return ToApiHandle<String>(cons);
9591 } 9591 }
9592 } 9592 }
9593 9593
9594 int debug::Coverage::FunctionData::StartOffset() { return function_->start; } 9594 int debug::Coverage::FunctionData::StartOffset() const {
9595 int debug::Coverage::FunctionData::EndOffset() { return function_->end; } 9595 return function_->start;
9596 uint32_t debug::Coverage::FunctionData::Count() { return function_->count; } 9596 }
9597 int debug::Coverage::FunctionData::EndOffset() const { return function_->end; }
9598 uint32_t debug::Coverage::FunctionData::Count() const {
9599 return function_->count;
9600 }
9597 9601
9598 MaybeLocal<String> debug::Coverage::FunctionData::Name() { 9602 MaybeLocal<String> debug::Coverage::FunctionData::Name() const {
9599 return ToApiHandle<String>(function_->name); 9603 return ToApiHandle<String>(function_->name);
9600 } 9604 }
9601 9605
9602 Local<debug::Script> debug::Coverage::ScriptData::GetScript() { 9606 Local<debug::Script> debug::Coverage::ScriptData::GetScript() const {
9603 return ToApiHandle<debug::Script>(script_->script); 9607 return ToApiHandle<debug::Script>(script_->script);
9604 } 9608 }
9605 9609
9606 size_t debug::Coverage::ScriptData::FunctionCount() { 9610 size_t debug::Coverage::ScriptData::FunctionCount() const {
9607 return script_->functions.size(); 9611 return script_->functions.size();
9608 } 9612 }
9609 9613
9610 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData( 9614 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData(
9611 size_t i) { 9615 size_t i) const {
9612 return FunctionData(&script_->functions.at(i)); 9616 return FunctionData(&script_->functions.at(i));
9613 } 9617 }
9614 9618
9615 debug::Coverage::~Coverage() { delete coverage_; } 9619 debug::Coverage::~Coverage() { delete coverage_; }
9616 9620
9617 size_t debug::Coverage::ScriptCount() { return coverage_->size(); } 9621 size_t debug::Coverage::ScriptCount() const { return coverage_->size(); }
9618 9622
9619 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) { 9623 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) const {
9620 return ScriptData(&coverage_->at(i)); 9624 return ScriptData(&coverage_->at(i));
9621 } 9625 }
9622 9626
9623 debug::Coverage debug::Coverage::Collect(Isolate* isolate, bool reset_count) { 9627 debug::Coverage debug::Coverage::CollectPrecise(Isolate* isolate) {
9624 return Coverage(i::Coverage::Collect(reinterpret_cast<i::Isolate*>(isolate), 9628 return Coverage(
9625 reset_count)); 9629 i::Coverage::CollectPrecise(reinterpret_cast<i::Isolate*>(isolate)));
9630 }
9631
9632 debug::Coverage debug::Coverage::CollectBestEffort(Isolate* isolate) {
9633 return Coverage(
9634 i::Coverage::CollectBestEffort(reinterpret_cast<i::Isolate*>(isolate)));
9626 } 9635 }
9627 9636
9628 void debug::Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) { 9637 void debug::Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) {
9629 i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode); 9638 i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode);
9630 } 9639 }
9631 9640
9632 const char* CpuProfileNode::GetFunctionNameStr() const { 9641 const char* CpuProfileNode::GetFunctionNameStr() const {
9633 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9642 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9634 return node->entry()->name(); 9643 return node->entry()->name();
9635 } 9644 }
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
10290 Address callback_address = 10299 Address callback_address =
10291 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10300 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10292 VMState<EXTERNAL> state(isolate); 10301 VMState<EXTERNAL> state(isolate);
10293 ExternalCallbackScope call_scope(isolate, callback_address); 10302 ExternalCallbackScope call_scope(isolate, callback_address);
10294 callback(info); 10303 callback(info);
10295 } 10304 }
10296 10305
10297 10306
10298 } // namespace internal 10307 } // namespace internal
10299 } // namespace v8 10308 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/d8.cc » ('j') | src/inspector/js_protocol.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698