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

Side by Side Diff: test/cctest/wasm/test-wasm-trap-position.cc

Issue 2493943002: [wasm] Make reported "lines" on stack frames 1-based (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « test/cctest/wasm/test-wasm-stack.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/wasm/wasm-macro-gen.h" 5 #include "src/wasm/wasm-macro-gen.h"
6 6
7 #include "test/cctest/cctest.h" 7 #include "test/cctest/cctest.h"
8 #include "test/cctest/compiler/value-helper.h" 8 #include "test/cctest/compiler/value-helper.h"
9 #include "test/cctest/wasm/wasm-run-utils.h" 9 #include "test/cctest/wasm/wasm-run-utils.h"
10 #include "test/common/wasm/test-signatures.h" 10 #include "test/common/wasm/test-signatures.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 Isolate* isolate = js_wasm_wrapper->GetIsolate(); 81 Isolate* isolate = js_wasm_wrapper->GetIsolate();
82 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, 82 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10,
83 v8::StackTrace::kOverview); 83 v8::StackTrace::kOverview);
84 Handle<Object> global(isolate->context()->global_object(), isolate); 84 Handle<Object> global(isolate->context()->global_object(), isolate);
85 MaybeHandle<Object> maybe_exc; 85 MaybeHandle<Object> maybe_exc;
86 Handle<Object> args[] = {js_wasm_wrapper}; 86 Handle<Object> args[] = {js_wasm_wrapper};
87 MaybeHandle<Object> returnObjMaybe = 87 MaybeHandle<Object> returnObjMaybe =
88 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); 88 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc);
89 CHECK(returnObjMaybe.is_null()); 89 CHECK(returnObjMaybe.is_null());
90 90
91 // The column is 1-based, so add 1 to the actual byte offset. 91 // Line and column are 1-based, so add 1 for the expected wasm output.
92 ExceptionInfo expected_exceptions[] = { 92 ExceptionInfo expected_exceptions[] = {
93 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // -- 93 {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 2}, // --
94 {"callFn", 1, 24} // -- 94 {"callFn", 1, 24} // --
95 }; 95 };
96 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); 96 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
97 } 97 }
98 98
99 // Trigger a trap for loading from out-of-bounds. 99 // Trigger a trap for loading from out-of-bounds.
100 TEST(IllegalLoad) { 100 TEST(IllegalLoad) {
101 TestSignatures sigs; 101 TestSignatures sigs;
102 TestingModule module; 102 TestingModule module;
103 103
104 WasmFunctionCompiler comp1(sigs.v_v(), &module, ArrayVector("mem_oob")); 104 WasmFunctionCompiler comp1(sigs.v_v(), &module, ArrayVector("mem_oob"));
(...skipping 18 matching lines...) Expand all
123 Isolate* isolate = js_wasm_wrapper->GetIsolate(); 123 Isolate* isolate = js_wasm_wrapper->GetIsolate();
124 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, 124 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10,
125 v8::StackTrace::kOverview); 125 v8::StackTrace::kOverview);
126 Handle<Object> global(isolate->context()->global_object(), isolate); 126 Handle<Object> global(isolate->context()->global_object(), isolate);
127 MaybeHandle<Object> maybe_exc; 127 MaybeHandle<Object> maybe_exc;
128 Handle<Object> args[] = {js_wasm_wrapper}; 128 Handle<Object> args[] = {js_wasm_wrapper};
129 MaybeHandle<Object> returnObjMaybe = 129 MaybeHandle<Object> returnObjMaybe =
130 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); 130 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc);
131 CHECK(returnObjMaybe.is_null()); 131 CHECK(returnObjMaybe.is_null());
132 132
133 // The column is 1-based, so add 1 to the actual byte offset. 133 // Line and column are 1-based, so add 1 for the expected wasm output.
134 ExceptionInfo expected_exceptions[] = { 134 ExceptionInfo expected_exceptions[] = {
135 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 8}, // -- 135 {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 8}, // --
136 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 3}, // -- 136 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 3}, // --
137 {"callFn", 1, 24} // -- 137 {"callFn", 1, 24} // --
138 }; 138 };
139 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); 139 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
140 } 140 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-wasm-stack.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698