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

Side by Side Diff: src/api.cc

Issue 2766573003: [debug] introduce precise binary code coverage. (Closed)
Patch Set: fix test 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') | 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 9593 matching lines...) Expand 10 before | Expand all | Expand 10 after
9604 return ToApiHandle<String>(name); 9604 return ToApiHandle<String>(name);
9605 } else { 9605 } else {
9606 // We do not expect this to fail. Change this if it does. 9606 // We do not expect this to fail. Change this if it does.
9607 i::Handle<i::String> cons = isolate->factory()->NewConsString( 9607 i::Handle<i::String> cons = isolate->factory()->NewConsString(
9608 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 9608 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
9609 name).ToHandleChecked(); 9609 name).ToHandleChecked();
9610 return ToApiHandle<String>(cons); 9610 return ToApiHandle<String>(cons);
9611 } 9611 }
9612 } 9612 }
9613 9613
9614 int debug::Coverage::FunctionData::StartOffset() { return function_->start; } 9614 int debug::Coverage::FunctionData::StartOffset() const {
9615 int debug::Coverage::FunctionData::EndOffset() { return function_->end; } 9615 return function_->start;
9616 uint32_t debug::Coverage::FunctionData::Count() { return function_->count; } 9616 }
9617 int debug::Coverage::FunctionData::EndOffset() const { return function_->end; }
9618 uint32_t debug::Coverage::FunctionData::Count() const {
9619 return function_->count;
9620 }
9617 9621
9618 MaybeLocal<String> debug::Coverage::FunctionData::Name() { 9622 MaybeLocal<String> debug::Coverage::FunctionData::Name() const {
9619 return ToApiHandle<String>(function_->name); 9623 return ToApiHandle<String>(function_->name);
9620 } 9624 }
9621 9625
9622 Local<debug::Script> debug::Coverage::ScriptData::GetScript() { 9626 Local<debug::Script> debug::Coverage::ScriptData::GetScript() const {
9623 return ToApiHandle<debug::Script>(script_->script); 9627 return ToApiHandle<debug::Script>(script_->script);
9624 } 9628 }
9625 9629
9626 size_t debug::Coverage::ScriptData::FunctionCount() { 9630 size_t debug::Coverage::ScriptData::FunctionCount() const {
9627 return script_->functions.size(); 9631 return script_->functions.size();
9628 } 9632 }
9629 9633
9630 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData( 9634 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData(
9631 size_t i) { 9635 size_t i) const {
9632 return FunctionData(&script_->functions.at(i)); 9636 return FunctionData(&script_->functions.at(i));
9633 } 9637 }
9634 9638
9635 debug::Coverage::~Coverage() { delete coverage_; } 9639 debug::Coverage::~Coverage() { delete coverage_; }
9636 9640
9637 size_t debug::Coverage::ScriptCount() { return coverage_->size(); } 9641 size_t debug::Coverage::ScriptCount() const { return coverage_->size(); }
9638 9642
9639 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) { 9643 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) const {
9640 return ScriptData(&coverage_->at(i)); 9644 return ScriptData(&coverage_->at(i));
9641 } 9645 }
9642 9646
9643 debug::Coverage debug::Coverage::Collect(Isolate* isolate, bool reset_count) { 9647 debug::Coverage debug::Coverage::CollectPrecise(Isolate* isolate) {
9644 return Coverage(i::Coverage::Collect(reinterpret_cast<i::Isolate*>(isolate), 9648 return Coverage(
9645 reset_count)); 9649 i::Coverage::CollectPrecise(reinterpret_cast<i::Isolate*>(isolate)));
9650 }
9651
9652 debug::Coverage debug::Coverage::CollectBestEffort(Isolate* isolate) {
9653 return Coverage(
9654 i::Coverage::CollectBestEffort(reinterpret_cast<i::Isolate*>(isolate)));
9646 } 9655 }
9647 9656
9648 void debug::Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) { 9657 void debug::Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) {
9649 i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode); 9658 i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode);
9650 } 9659 }
9651 9660
9652 const char* CpuProfileNode::GetFunctionNameStr() const { 9661 const char* CpuProfileNode::GetFunctionNameStr() const {
9653 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9662 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9654 return node->entry()->name(); 9663 return node->entry()->name();
9655 } 9664 }
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
10310 Address callback_address = 10319 Address callback_address =
10311 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10320 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10312 VMState<EXTERNAL> state(isolate); 10321 VMState<EXTERNAL> state(isolate);
10313 ExternalCallbackScope call_scope(isolate, callback_address); 10322 ExternalCallbackScope call_scope(isolate, callback_address);
10314 callback(info); 10323 callback(info);
10315 } 10324 }
10316 10325
10317 10326
10318 } // namespace internal 10327 } // namespace internal
10319 } // namespace v8 10328 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698