| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 848435f670b056a72dadb1c03d92091f889bef20..0941d2462385fdaf354a6e3c91a983fe7517060b 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -8829,6 +8829,134 @@ void DebugInterface::ClearStepping(Isolate* v8_isolate) {
|
| isolate->debug()->ClearStepping();
|
| }
|
|
|
| +ScriptOriginOptions DebugInterface::Script::OriginOptions() const {
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + return script->origin_options();
|
| +}
|
| +
|
| +bool DebugInterface::Script::WasCompiled() const {
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + return script->compilation_state() == i::Script::COMPILATION_STATE_COMPILED;
|
| +}
|
| +
|
| +int DebugInterface::Script::Id() const {
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + return script->id();
|
| +}
|
| +
|
| +int DebugInterface::Script::LineOffset() const {
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + return script->line_offset();
|
| +}
|
| +
|
| +int DebugInterface::Script::ColumnOffset() const {
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + return script->column_offset();
|
| +}
|
| +
|
| +MaybeLocal<Array> DebugInterface::Script::LineEnds(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Script::InitLineEnds(script);
|
| + i::Handle<i::Object> line_ends_obj(script->line_ends(), isolate);
|
| + if (!line_ends_obj->IsFixedArray()) return MaybeLocal<Array>();
|
| + i::Handle<i::FixedArray> line_ends =
|
| + i::Handle<i::FixedArray>::cast(line_ends_obj);
|
| + auto result = isolate->factory()->NewJSArrayWithElements(line_ends);
|
| + CHECK(!result.is_null());
|
| + return Utils::ToLocal(handle_scope.CloseAndEscape(result));
|
| +}
|
| +
|
| +MaybeLocal<String> DebugInterface::Script::Name(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Handle<i::Object> value(script->name(), isolate);
|
| + if (!value->IsString()) return MaybeLocal<String>();
|
| + return Utils::ToLocal(
|
| + handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value)));
|
| +}
|
| +
|
| +MaybeLocal<String> DebugInterface::Script::SourceURL(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Handle<i::Object> value(script->source_url(), isolate);
|
| + if (!value->IsString()) return MaybeLocal<String>();
|
| + return Utils::ToLocal(
|
| + handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value)));
|
| +}
|
| +
|
| +MaybeLocal<String> DebugInterface::Script::SourceMappingURL(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Handle<i::Object> value(script->source_mapping_url(), isolate);
|
| + if (!value->IsString()) return MaybeLocal<String>();
|
| + return Utils::ToLocal(
|
| + handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value)));
|
| +}
|
| +
|
| +MaybeLocal<String> DebugInterface::Script::ContextData(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Handle<i::Object> value(script->context_data(), isolate);
|
| + if (!value->IsString()) return MaybeLocal<String>();
|
| + return Utils::ToLocal(
|
| + handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value)));
|
| +}
|
| +
|
| +MaybeLocal<String> DebugInterface::Script::Source(
|
| + v8::Local<v8::Context> context) const {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| + i::Handle<i::Object> value(script->source(), isolate);
|
| + if (!value->IsString()) return MaybeLocal<String>();
|
| + return Utils::ToLocal(
|
| + handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value)));
|
| +}
|
| +
|
| +MaybeLocal<DebugInterface::Script> DebugInterface::Script::Wrap(
|
| + v8::Local<v8::Context> context, v8::Local<v8::Object> script) {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
| + ENTER_V8(isolate);
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::JSReceiver> script_receiver(Utils::OpenHandle(*script));
|
| + if (!script_receiver->IsJSValue()) return MaybeLocal<Script>();
|
| + i::Handle<i::Object> script_value(
|
| + i::Handle<i::JSValue>::cast(script_receiver)->value(), isolate);
|
| + if (!script_value->IsScript()) {
|
| + return MaybeLocal<Script>();
|
| + }
|
| + i::Handle<i::Script> script_obj = i::Handle<i::Script>::cast(script_value);
|
| + if (script_obj->type() != i::Script::TYPE_NORMAL) return MaybeLocal<Script>();
|
| + return ToApiHandle<DebugInterface::Script>(
|
| + handle_scope.CloseAndEscape(script_obj));
|
| +}
|
| +
|
| +void DebugInterface::GetLoadedScripts(
|
| + v8::Isolate* v8_isolate,
|
| + PersistentValueVector<DebugInterface::Script>& scripts) {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
| + ENTER_V8(isolate);
|
| + i::HandleScope handle_scope(isolate);
|
| + i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts();
|
| + for (int i = 0; i < instances->length(); i++) {
|
| + i::Handle<i::Script> script =
|
| + i::Handle<i::Script>(i::Script::cast(instances->get(i)));
|
| + if (script->type() != i::Script::TYPE_NORMAL) continue;
|
| + scripts.Append(ToApiHandle<Script>(script));
|
| + }
|
| +}
|
| +
|
| Local<String> CpuProfileNode::GetFunctionName() const {
|
| const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
|
| i::Isolate* isolate = node->isolate();
|
|
|