OLD | NEW |
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/assembler-inl.h" | 5 #include "src/assembler-inl.h" |
6 #include "src/debug/debug-interface.h" | 6 #include "src/debug/debug-interface.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/property-descriptor.h" | 8 #include "src/property-descriptor.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
11 #include "src/wasm/wasm-objects.h" | 11 #include "src/wasm/wasm-objects.h" |
12 | 12 |
13 #include "test/cctest/cctest.h" | 13 #include "test/cctest/cctest.h" |
14 #include "test/cctest/compiler/value-helper.h" | 14 #include "test/cctest/compiler/value-helper.h" |
15 #include "test/cctest/wasm/wasm-run-utils.h" | 15 #include "test/cctest/wasm/wasm-run-utils.h" |
16 #include "test/common/wasm/test-signatures.h" | 16 #include "test/common/wasm/test-signatures.h" |
17 | 17 |
18 using namespace v8::internal; | 18 using namespace v8::internal; |
19 using namespace v8::internal::wasm; | 19 using namespace v8::internal::wasm; |
20 namespace debug = v8::debug; | 20 namespace debug = v8::debug; |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void CheckLocations( | 24 void CheckLocations( |
25 WasmCompiledModule *compiled_module, debug::Location start, | 25 WasmCompiledModule *compiled_module, debug::Location start, |
26 debug::Location end, | 26 debug::Location end, |
27 std::initializer_list<debug::Location> expected_locations_init) { | 27 std::initializer_list<debug::Location> expected_locations_init) { |
28 std::vector<debug::Location> locations; | 28 std::vector<debug::BreakLocation> locations; |
29 bool success = | 29 bool success = |
30 compiled_module->GetPossibleBreakpoints(start, end, &locations); | 30 compiled_module->GetPossibleBreakpoints(start, end, &locations); |
31 CHECK(success); | 31 CHECK(success); |
32 | 32 |
33 printf("got %d locations: ", static_cast<int>(locations.size())); | 33 printf("got %d locations: ", static_cast<int>(locations.size())); |
34 for (size_t i = 0, e = locations.size(); i != e; ++i) { | 34 for (size_t i = 0, e = locations.size(); i != e; ++i) { |
35 printf("%s<%d,%d>", i == 0 ? "" : ", ", locations[i].GetLineNumber(), | 35 printf("%s<%d,%d>", i == 0 ? "" : ", ", locations[i].GetLineNumber(), |
36 locations[i].GetColumnNumber()); | 36 locations[i].GetColumnNumber()); |
37 } | 37 } |
38 printf("\n"); | 38 printf("\n"); |
39 | 39 |
40 std::vector<debug::Location> expected_locations(expected_locations_init); | 40 std::vector<debug::Location> expected_locations(expected_locations_init); |
41 CHECK_EQ(expected_locations.size(), locations.size()); | 41 CHECK_EQ(expected_locations.size(), locations.size()); |
42 for (size_t i = 0, e = locations.size(); i != e; ++i) { | 42 for (size_t i = 0, e = locations.size(); i != e; ++i) { |
43 CHECK_EQ(expected_locations[i].GetLineNumber(), | 43 CHECK_EQ(expected_locations[i].GetLineNumber(), |
44 locations[i].GetLineNumber()); | 44 locations[i].GetLineNumber()); |
45 CHECK_EQ(expected_locations[i].GetColumnNumber(), | 45 CHECK_EQ(expected_locations[i].GetColumnNumber(), |
46 locations[i].GetColumnNumber()); | 46 locations[i].GetColumnNumber()); |
47 } | 47 } |
48 } | 48 } |
49 void CheckLocationsFail(WasmCompiledModule *compiled_module, | 49 void CheckLocationsFail(WasmCompiledModule *compiled_module, |
50 debug::Location start, debug::Location end) { | 50 debug::Location start, debug::Location end) { |
51 std::vector<debug::Location> locations; | 51 std::vector<debug::BreakLocation> locations; |
52 bool success = | 52 bool success = |
53 compiled_module->GetPossibleBreakpoints(start, end, &locations); | 53 compiled_module->GetPossibleBreakpoints(start, end, &locations); |
54 CHECK(!success); | 54 CHECK(!success); |
55 } | 55 } |
56 | 56 |
57 class BreakHandler { | 57 class BreakHandler { |
58 public: | 58 public: |
59 enum Action { | 59 enum Action { |
60 Continue = StepAction::LastStepAction + 1, | 60 Continue = StepAction::LastStepAction + 1, |
61 StepNext = StepAction::StepNext, | 61 StepNext = StepAction::StepNext, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 {19, BreakHandler::StepIn}, // GetLocal | 280 {19, BreakHandler::StepIn}, // GetLocal |
281 {21, BreakHandler::StepIn}, // Call | 281 {21, BreakHandler::StepIn}, // Call |
282 {1, BreakHandler::StepOut}, // in f2 | 282 {1, BreakHandler::StepOut}, // in f2 |
283 {23, BreakHandler::Continue} // After Call | 283 {23, BreakHandler::Continue} // After Call |
284 }); | 284 }); |
285 | 285 |
286 Handle<Object> global(isolate->context()->global_object(), isolate); | 286 Handle<Object> global(isolate->context()->global_object(), isolate); |
287 CHECK(!Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr) | 287 CHECK(!Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr) |
288 .is_null()); | 288 .is_null()); |
289 } | 289 } |
OLD | NEW |