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

Unified Diff: src/api.cc

Issue 1909353002: [wasm] Make wasm info available on the stack trace (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-3
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « include/v8.h ('k') | src/frames.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 47fc1ce1b2f62ba22dd739aeba225c14da1b9230..a71c02e46ca58e5876225e7e10bc65457b4863b3 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2579,22 +2579,19 @@ static int getIntProperty(const StackFrame* f, const char* propertyName,
return obj->IsSmi() ? i::Smi::cast(*obj)->value() : defaultValue;
}
-
-int StackFrame::GetLineNumber() const {
- return getIntProperty(this, "lineNumber", Message::kNoLineNumberInfo);
-}
-
-
-int StackFrame::GetColumn() const {
- return getIntProperty(this, "column", Message::kNoColumnInfo);
-}
-
-
-int StackFrame::GetScriptId() const {
- return getIntProperty(this, "scriptId", Message::kNoScriptIdInfo);
+static uint32_t getUintProperty(const StackFrame* f, const char* propertyName,
+ uint32_t defaultValue) {
+ i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::JSObject> self = Utils::OpenHandle(f);
+ i::Handle<i::Object> obj =
+ i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked();
+ uint32_t val = defaultValue;
+ obj->ToUint32(&val);
+ return val;
}
-
static Local<String> getStringProperty(const StackFrame* f,
const char* propertyName) {
i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
@@ -2608,6 +2605,40 @@ static Local<String> getStringProperty(const StackFrame* f,
: Local<String>();
}
+static Local<Object> getObjectProperty(const StackFrame* f,
+ const char* propertyName) {
+ i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
+ ENTER_V8(isolate);
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ i::Handle<i::JSObject> self = Utils::OpenHandle(f);
+ i::Handle<i::Object> obj =
+ i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked();
+ return obj->IsObject()
+ ? scope.Escape(Local<Object>::Cast(Utils::ToLocal(obj)))
+ : Local<Object>();
+}
+
+static bool getBoolProperty(const StackFrame* f, const char* propertyName) {
+ i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::JSObject> self = Utils::OpenHandle(f);
+ i::Handle<i::Object> obj =
+ i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked();
+ return obj->IsTrue();
+}
+
+int StackFrame::GetLineNumber() const {
+ return getIntProperty(this, "lineNumber", Message::kNoLineNumberInfo);
+}
+
+int StackFrame::GetColumn() const {
+ return getIntProperty(this, "column", Message::kNoColumnInfo);
+}
+
+int StackFrame::GetScriptId() const {
+ return getIntProperty(this, "scriptId", Message::kNoScriptIdInfo);
+}
Local<String> StackFrame::GetScriptName() const {
return getStringProperty(this, "scriptName");
@@ -2623,17 +2654,6 @@ Local<String> StackFrame::GetFunctionName() const {
return getStringProperty(this, "functionName");
}
-
-static bool getBoolProperty(const StackFrame* f, const char* propertyName) {
- i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
- ENTER_V8(isolate);
- i::HandleScope scope(isolate);
- i::Handle<i::JSObject> self = Utils::OpenHandle(f);
- i::Handle<i::Object> obj =
- i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked();
- return obj->IsTrue();
-}
-
bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); }
@@ -2641,6 +2661,16 @@ bool StackFrame::IsConstructor() const {
return getBoolProperty(this, "isConstructor");
}
+bool StackFrame::IsWasm() const { return getBoolProperty(this, "isWasm"); }
+
+Local<Object> StackFrame::GetWasmObject() const {
+ return getObjectProperty(this, "wasmObject");
Yang 2016/04/28 13:08:43 This should also not be called if IsWasm() returns
+}
+
+uint32_t StackFrame::GetWasmByteOffset() const {
+ return getUintProperty(this, "wasmByteOffset",
+ Message::kNoWasmByteOffsetInfo);
+}
// --- N a t i v e W e a k M a p ---
« include/v8.h ('K') | « include/v8.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698