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

Unified Diff: src/runtime/runtime-internal.cc

Issue 2230953002: Use a custom Struct for stack trace storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 4 years, 4 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
« no previous file with comments | « src/objects-printer.cc ('k') | src/types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 5b46b974a5e397758fa65072987b334b6be5a71a..abec8e199e6481fd05e021d14384fc4be69a3242 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -117,20 +117,26 @@ RUNTIME_FUNCTION(Runtime_ThrowWasmError) {
Handle<JSObject> error = Handle<JSObject>::cast(error_obj);
Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty(
error, isolate->factory()->stack_trace_symbol());
+
// Patch the stack trace (array of <receiver, function, code, position>).
if (stack_trace_obj->IsJSArray()) {
+ using ESTF = EncodedStackTraceFrame;
+
Handle<FixedArray> stack_elements(
FixedArray::cast(JSArray::cast(*stack_trace_obj)->elements()));
- DCHECK_EQ(1, stack_elements->length() % 4);
- DCHECK(Code::cast(stack_elements->get(3))->kind() == Code::WASM_FUNCTION);
- DCHECK(stack_elements->get(4)->IsSmi() &&
- Smi::cast(stack_elements->get(4))->value() >= 0);
- stack_elements->set(4, Smi::FromInt(-1 - byte_offset));
+ DCHECK_EQ(0, stack_elements->length() % ESTF::kElementsPerFrame);
+ DCHECK(Code::cast(stack_elements->get(ESTF::kCodeOffset))->kind() ==
+ Code::WASM_FUNCTION);
+ DCHECK(stack_elements->get(ESTF::kWasmFunctionIndexOffset)->IsSmi() &&
+ Smi::cast(stack_elements->get(ESTF::kWasmFunctionIndexOffset))
+ ->value() >= 0);
+ stack_elements->set(ESTF::kOffsetOffset, Smi::FromInt(-1 - byte_offset));
}
- Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
- error, isolate->factory()->detailed_stack_trace_symbol());
+
// Patch the detailed stack trace (array of JSObjects with various
// properties).
+ Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
+ error, isolate->factory()->detailed_stack_trace_symbol());
if (detailed_stack_trace_obj->IsJSArray()) {
Handle<FixedArray> stack_elements(
FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements()));
« no previous file with comments | « src/objects-printer.cc ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698