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

Side by Side Diff: src/api.cc

Issue 2733783002: [debug] change coverage API to use offset instead of line/column. (Closed)
Patch Set: rebase 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 9531 matching lines...) Expand 10 before | Expand all | Expand 10 after
9542 return ToApiHandle<String>(name); 9542 return ToApiHandle<String>(name);
9543 } else { 9543 } else {
9544 // We do not expect this to fail. Change this if it does. 9544 // We do not expect this to fail. Change this if it does.
9545 i::Handle<i::String> cons = isolate->factory()->NewConsString( 9545 i::Handle<i::String> cons = isolate->factory()->NewConsString(
9546 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 9546 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
9547 name).ToHandleChecked(); 9547 name).ToHandleChecked();
9548 return ToApiHandle<String>(cons); 9548 return ToApiHandle<String>(cons);
9549 } 9549 }
9550 } 9550 }
9551 9551
9552 debug::Coverage::FunctionData::FunctionData(i::CoverageFunction* function, 9552 int debug::Coverage::FunctionData::StartOffset() { return function_->start; }
9553 Local<debug::Script> script) 9553 int debug::Coverage::FunctionData::EndOffset() { return function_->end; }
9554 : function_(function) {
9555 i::Handle<i::Script> i_script = v8::Utils::OpenHandle(*script);
9556 i::Script::PositionInfo start;
9557 i::Script::PositionInfo end;
9558 i::Script::GetPositionInfo(i_script, function->start, &start,
9559 i::Script::WITH_OFFSET);
9560 i::Script::GetPositionInfo(i_script, function->end, &end,
9561 i::Script::WITH_OFFSET);
9562 start_ = Location(start.line, start.column);
9563 end_ = Location(end.line, end.column);
9564 }
9565
9566 uint32_t debug::Coverage::FunctionData::Count() { return function_->count; } 9554 uint32_t debug::Coverage::FunctionData::Count() { return function_->count; }
9567 9555
9568 MaybeLocal<String> debug::Coverage::FunctionData::Name() { 9556 MaybeLocal<String> debug::Coverage::FunctionData::Name() {
9569 return ToApiHandle<String>(function_->name); 9557 return ToApiHandle<String>(function_->name);
9570 } 9558 }
9571 9559
9572 Local<debug::Script> debug::Coverage::ScriptData::GetScript() { 9560 Local<debug::Script> debug::Coverage::ScriptData::GetScript() {
9573 return ToApiHandle<debug::Script>(script_->script); 9561 return ToApiHandle<debug::Script>(script_->script);
9574 } 9562 }
9575 9563
9576 size_t debug::Coverage::ScriptData::FunctionCount() { 9564 size_t debug::Coverage::ScriptData::FunctionCount() {
9577 return script_->functions.size(); 9565 return script_->functions.size();
9578 } 9566 }
9579 9567
9580 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData( 9568 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData(
9581 size_t i) { 9569 size_t i) {
9582 return FunctionData(&script_->functions.at(i), GetScript()); 9570 return FunctionData(&script_->functions.at(i));
9583 } 9571 }
9584 9572
9585 debug::Coverage::~Coverage() { delete coverage_; } 9573 debug::Coverage::~Coverage() { delete coverage_; }
9586 9574
9587 size_t debug::Coverage::ScriptCount() { return coverage_->size(); } 9575 size_t debug::Coverage::ScriptCount() { return coverage_->size(); }
9588 9576
9589 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) { 9577 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) {
9590 return ScriptData(&coverage_->at(i)); 9578 return ScriptData(&coverage_->at(i));
9591 } 9579 }
9592 9580
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
10260 Address callback_address = 10248 Address callback_address =
10261 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10249 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10262 VMState<EXTERNAL> state(isolate); 10250 VMState<EXTERNAL> state(isolate);
10263 ExternalCallbackScope call_scope(isolate, callback_address); 10251 ExternalCallbackScope call_scope(isolate, callback_address);
10264 callback(info); 10252 callback(info);
10265 } 10253 }
10266 10254
10267 10255
10268 } // namespace internal 10256 } // namespace internal
10269 } // namespace v8 10257 } // 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