Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 8c878b178a19ffe66b5d54428af94f7bbce5b796..5f74b7b2f1e72b8c7351c8fd225d338f950ad917 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -9290,7 +9290,9 @@ debug::Location::Location(int line_number, int column_number) |
CHECK(column_number >= 0); |
} |
-debug::Location::Location() : line_number_(-1), column_number_(-1) {} |
+debug::Location::Location() |
+ : line_number_(v8::Function::kLineOffsetNotFound), |
+ column_number_(v8::Function::kLineOffsetNotFound) {} |
int debug::Location::GetLineNumber() const { |
CHECK(line_number_ >= 0); |
@@ -9414,6 +9416,43 @@ v8::MaybeLocal<v8::Array> debug::EntriesPreview(Isolate* v8_isolate, |
return v8::MaybeLocal<v8::Array>(); |
} |
+MaybeLocal<debug::Script> debug::GeneratorObject::Script() { |
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this); |
+ if (!obj->function()->shared()->script()->IsScript()) |
jgruber
2017/02/07 08:32:28
Nit: I think this'd be more readable if we store o
kozy
2017/02/07 17:09:45
Done.
|
+ return MaybeLocal<debug::Script>(); |
+ i::Handle<i::Script> script( |
+ i::Script::cast(obj->function()->shared()->script()), obj->GetIsolate()); |
+ return ToApiHandle<debug::Script>(script); |
+} |
+ |
+Local<Function> debug::GeneratorObject::Function() { |
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this); |
+ return Utils::ToLocal(handle(obj->function())); |
+} |
+ |
+debug::Location debug::GeneratorObject::SuspendedLocation() { |
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this); |
+ CHECK(obj->is_suspended()); |
+ if (!obj->function()->shared()->script()->IsScript()) |
+ return debug::Location(); |
+ i::Handle<i::Script> script( |
+ i::Script::cast(obj->function()->shared()->script()), obj->GetIsolate()); |
+ i::Script::PositionInfo info; |
+ i::Script::GetPositionInfo(script, obj->source_position(), &info, |
+ i::Script::WITH_OFFSET); |
+ return debug::Location(info.line, info.column); |
+} |
+ |
+bool debug::GeneratorObject::IsSuspended() { |
+ return Utils::OpenHandle(this)->is_suspended(); |
+} |
+ |
+v8::Local<debug::GeneratorObject> debug::GeneratorObject::Cast( |
+ v8::Local<v8::Value> value) { |
+ CHECK(value->IsGeneratorObject()); |
+ return ToApiHandle<debug::GeneratorObject>(Utils::OpenHandle(*value)); |
+} |
+ |
Local<String> CpuProfileNode::GetFunctionName() const { |
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
i::Isolate* isolate = node->isolate(); |