OLD | NEW |
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 9558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9569 return ToApiHandle<String>(name); | 9569 return ToApiHandle<String>(name); |
9570 } else { | 9570 } else { |
9571 // We do not expect this to fail. Change this if it does. | 9571 // We do not expect this to fail. Change this if it does. |
9572 i::Handle<i::String> cons = isolate->factory()->NewConsString( | 9572 i::Handle<i::String> cons = isolate->factory()->NewConsString( |
9573 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), | 9573 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
9574 name).ToHandleChecked(); | 9574 name).ToHandleChecked(); |
9575 return ToApiHandle<String>(cons); | 9575 return ToApiHandle<String>(cons); |
9576 } | 9576 } |
9577 } | 9577 } |
9578 | 9578 |
9579 debug::Coverage::Range::Range(i::CoverageRange* range, | 9579 debug::Coverage::FunctionData::FunctionData(i::CoverageFunction* function, |
9580 Local<debug::Script> script) | 9580 Local<debug::Script> script) |
9581 : range_(range), script_(script) { | 9581 : function_(function) { |
9582 i::Handle<i::Script> i_script = v8::Utils::OpenHandle(*script); | 9582 i::Handle<i::Script> i_script = v8::Utils::OpenHandle(*script); |
9583 i::Script::PositionInfo start; | 9583 i::Script::PositionInfo start; |
9584 i::Script::PositionInfo end; | 9584 i::Script::PositionInfo end; |
9585 i::Script::GetPositionInfo(i_script, range->start, &start, | 9585 i::Script::GetPositionInfo(i_script, function->start, &start, |
9586 i::Script::WITH_OFFSET); | 9586 i::Script::WITH_OFFSET); |
9587 i::Script::GetPositionInfo(i_script, range->end, &end, | 9587 i::Script::GetPositionInfo(i_script, function->end, &end, |
9588 i::Script::WITH_OFFSET); | 9588 i::Script::WITH_OFFSET); |
9589 start_ = Location(start.line, start.column); | 9589 start_ = Location(start.line, start.column); |
9590 end_ = Location(end.line, end.column); | 9590 end_ = Location(end.line, end.column); |
9591 } | 9591 } |
9592 | 9592 |
9593 uint32_t debug::Coverage::Range::Count() { return range_->count; } | 9593 uint32_t debug::Coverage::FunctionData::Count() { return function_->count; } |
9594 | 9594 |
9595 size_t debug::Coverage::Range::NestedCount() { return range_->inner.size(); } | 9595 MaybeLocal<String> debug::Coverage::FunctionData::Name() { |
9596 | 9596 return ToApiHandle<String>(function_->name); |
9597 debug::Coverage::Range debug::Coverage::Range::GetNested(size_t i) { | |
9598 return Range(&range_->inner[i], script_); | |
9599 } | 9597 } |
9600 | 9598 |
9601 MaybeLocal<String> debug::Coverage::Range::Name() { | 9599 Local<debug::Script> debug::Coverage::ScriptData::GetScript() { |
9602 return ToApiHandle<String>(range_->name); | 9600 return ToApiHandle<debug::Script>(script_->script); |
| 9601 } |
| 9602 |
| 9603 size_t debug::Coverage::ScriptData::FunctionCount() { |
| 9604 return script_->functions.size(); |
| 9605 } |
| 9606 |
| 9607 debug::Coverage::FunctionData debug::Coverage::ScriptData::GetFunctionData( |
| 9608 size_t i) { |
| 9609 return FunctionData(&script_->functions.at(i), GetScript()); |
9603 } | 9610 } |
9604 | 9611 |
9605 debug::Coverage::~Coverage() { delete coverage_; } | 9612 debug::Coverage::~Coverage() { delete coverage_; } |
9606 | 9613 |
9607 size_t debug::Coverage::ScriptCount() { return coverage_->size(); } | 9614 size_t debug::Coverage::ScriptCount() { return coverage_->size(); } |
9608 | 9615 |
9609 Local<debug::Script> debug::Coverage::GetScript(size_t i) { | 9616 debug::Coverage::ScriptData debug::Coverage::GetScriptData(size_t i) { |
9610 return ToApiHandle<debug::Script>(coverage_->at(i).script); | 9617 return ScriptData(&coverage_->at(i)); |
9611 } | 9618 } |
9612 | 9619 |
9613 debug::Coverage::Range debug::Coverage::GetRange(size_t i) { | 9620 debug::Coverage debug::Coverage::Collect(Isolate* isolate, bool reset_count) { |
9614 return Range(&coverage_->at(i).toplevel, GetScript(i)); | 9621 return Coverage(i::Coverage::Collect(reinterpret_cast<i::Isolate*>(isolate), |
9615 } | 9622 reset_count)); |
9616 | |
9617 debug::Coverage debug::Coverage::Collect(Isolate* isolate) { | |
9618 return Coverage(i::Coverage::Collect(reinterpret_cast<i::Isolate*>(isolate))); | |
9619 } | 9623 } |
9620 | 9624 |
9621 void debug::Coverage::TogglePrecise(Isolate* isolate, bool enable) { | 9625 void debug::Coverage::TogglePrecise(Isolate* isolate, bool enable) { |
9622 i::Coverage::TogglePrecise(reinterpret_cast<i::Isolate*>(isolate), enable); | 9626 i::Coverage::TogglePrecise(reinterpret_cast<i::Isolate*>(isolate), enable); |
9623 } | 9627 } |
9624 | 9628 |
9625 const char* CpuProfileNode::GetFunctionNameStr() const { | 9629 const char* CpuProfileNode::GetFunctionNameStr() const { |
9626 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9630 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
9627 return node->entry()->name(); | 9631 return node->entry()->name(); |
9628 } | 9632 } |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10290 Address callback_address = | 10294 Address callback_address = |
10291 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10295 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10292 VMState<EXTERNAL> state(isolate); | 10296 VMState<EXTERNAL> state(isolate); |
10293 ExternalCallbackScope call_scope(isolate, callback_address); | 10297 ExternalCallbackScope call_scope(isolate, callback_address); |
10294 callback(info); | 10298 callback(info); |
10295 } | 10299 } |
10296 | 10300 |
10297 | 10301 |
10298 } // namespace internal | 10302 } // namespace internal |
10299 } // namespace v8 | 10303 } // namespace v8 |
OLD | NEW |