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

Side by Side Diff: src/api.cc

Issue 2696163002: [debugger] implement inspector-facing API for code coverage. (Closed)
Patch Set: one more shared export Created 3 years, 10 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 17 matching lines...) Expand all
28 #include "src/base/utils/random-number-generator.h" 28 #include "src/base/utils/random-number-generator.h"
29 #include "src/bootstrapper.h" 29 #include "src/bootstrapper.h"
30 #include "src/char-predicates-inl.h" 30 #include "src/char-predicates-inl.h"
31 #include "src/code-stubs.h" 31 #include "src/code-stubs.h"
32 #include "src/compiler-dispatcher/compiler-dispatcher.h" 32 #include "src/compiler-dispatcher/compiler-dispatcher.h"
33 #include "src/compiler.h" 33 #include "src/compiler.h"
34 #include "src/context-measure.h" 34 #include "src/context-measure.h"
35 #include "src/contexts.h" 35 #include "src/contexts.h"
36 #include "src/conversions-inl.h" 36 #include "src/conversions-inl.h"
37 #include "src/counters.h" 37 #include "src/counters.h"
38 #include "src/debug/debug-coverage.h"
38 #include "src/debug/debug.h" 39 #include "src/debug/debug.h"
39 #include "src/deoptimizer.h" 40 #include "src/deoptimizer.h"
40 #include "src/execution.h" 41 #include "src/execution.h"
41 #include "src/frames-inl.h" 42 #include "src/frames-inl.h"
42 #include "src/gdb-jit.h" 43 #include "src/gdb-jit.h"
43 #include "src/global-handles.h" 44 #include "src/global-handles.h"
44 #include "src/globals.h" 45 #include "src/globals.h"
45 #include "src/icu_util.h" 46 #include "src/icu_util.h"
46 #include "src/isolate-inl.h" 47 #include "src/isolate-inl.h"
47 #include "src/json-parser.h" 48 #include "src/json-parser.h"
(...skipping 9446 matching lines...) Expand 10 before | Expand all | Expand 10 after
9494 return ToApiHandle<String>(name); 9495 return ToApiHandle<String>(name);
9495 } else { 9496 } else {
9496 // We do not expect this to fail. Change this if it does. 9497 // We do not expect this to fail. Change this if it does.
9497 i::Handle<i::String> cons = isolate->factory()->NewConsString( 9498 i::Handle<i::String> cons = isolate->factory()->NewConsString(
9498 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 9499 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
9499 name).ToHandleChecked(); 9500 name).ToHandleChecked();
9500 return ToApiHandle<String>(cons); 9501 return ToApiHandle<String>(cons);
9501 } 9502 }
9502 } 9503 }
9503 9504
9505 debug::Coverage::Range::Range(i::CoverageRange* range,
9506 Local<debug::Script> script)
9507 : range_(range), script_(script) {
9508 i::Handle<i::Script> i_script = v8::Utils::OpenHandle(*script);
9509 i::Script::PositionInfo start;
9510 i::Script::PositionInfo end;
9511 i::Script::GetPositionInfo(i_script, range->start, &start,
9512 i::Script::WITH_OFFSET);
9513 i::Script::GetPositionInfo(i_script, range->end, &end,
9514 i::Script::WITH_OFFSET);
9515 start_ = Location(start.line, start.column);
9516 end_ = Location(end.line, end.column);
9517 }
9518
9519 uint32_t debug::Coverage::Range::Count() { return range_->count; }
9520
9521 size_t debug::Coverage::Range::NestedCount() { return range_->inner.size(); }
9522
9523 debug::Coverage::Range debug::Coverage::Range::GetNested(size_t i) {
9524 return Range(&range_->inner[i], script_);
9525 }
9526
9527 MaybeLocal<String> debug::Coverage::Range::Name() {
9528 return ToApiHandle<String>(range_->name);
9529 }
9530
9531 debug::Coverage::~Coverage() { delete coverage_; }
9532
9533 size_t debug::Coverage::ScriptCount() { return coverage_->size(); }
9534
9535 Local<debug::Script> debug::Coverage::GetScript(size_t i) {
9536 return ToApiHandle<debug::Script>(coverage_->at(i).script);
9537 }
9538
9539 debug::Coverage::Range debug::Coverage::GetRange(size_t i) {
9540 return Range(&coverage_->at(i).toplevel, GetScript(i));
9541 }
9542
9543 debug::Coverage debug::Coverage::Collect(Isolate* isolate) {
9544 return Coverage(i::Coverage::Collect(reinterpret_cast<i::Isolate*>(isolate)));
9545 }
9546
9547 void debug::Coverage::TogglePrecise(Isolate* isolate, bool enable) {
9548 i::Coverage::TogglePrecise(reinterpret_cast<i::Isolate*>(isolate), enable);
9549 }
9550
9504 const char* CpuProfileNode::GetFunctionNameStr() const { 9551 const char* CpuProfileNode::GetFunctionNameStr() const {
9505 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9552 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9506 return node->entry()->name(); 9553 return node->entry()->name();
9507 } 9554 }
9508 9555
9509 int CpuProfileNode::GetScriptId() const { 9556 int CpuProfileNode::GetScriptId() const {
9510 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9557 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9511 const i::CodeEntry* entry = node->entry(); 9558 const i::CodeEntry* entry = node->entry();
9512 return entry->script_id(); 9559 return entry->script_id();
9513 } 9560 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
10169 Address callback_address = 10216 Address callback_address =
10170 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10217 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10171 VMState<EXTERNAL> state(isolate); 10218 VMState<EXTERNAL> state(isolate);
10172 ExternalCallbackScope call_scope(isolate, callback_address); 10219 ExternalCallbackScope call_scope(isolate, callback_address);
10173 callback(info); 10220 callback(info);
10174 } 10221 }
10175 10222
10176 10223
10177 } // namespace internal 10224 } // namespace internal
10178 } // namespace v8 10225 } // 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