OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "src/compiler/pipeline.h" | 7 #include "src/compiler/pipeline.h" |
8 #include "src/execution.h" | 8 #include "src/execution.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/interpreter/bytecode-array-builder.h" | 10 #include "src/interpreter/bytecode-array-builder.h" |
(...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2662 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, | 2662 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
2663 snippets[i].code_snippet, kFunctionName); | 2663 snippets[i].code_snippet, kFunctionName); |
2664 | 2664 |
2665 BytecodeGraphTester tester(isolate, zone, script.start()); | 2665 BytecodeGraphTester tester(isolate, zone, script.start()); |
2666 auto callable = tester.GetCallable<>(); | 2666 auto callable = tester.GetCallable<>(); |
2667 Handle<Object> return_value = callable().ToHandleChecked(); | 2667 Handle<Object> return_value = callable().ToHandleChecked(); |
2668 CHECK(return_value->SameValue(*snippets[i].return_value())); | 2668 CHECK(return_value->SameValue(*snippets[i].return_value())); |
2669 } | 2669 } |
2670 } | 2670 } |
2671 | 2671 |
| 2672 TEST(BytecodeGraphBuilderDebuggerStatement) { |
| 2673 FLAG_expose_debug_as = "debug"; |
| 2674 HandleAndZoneScope scope; |
| 2675 Isolate* isolate = scope.main_isolate(); |
| 2676 Zone* zone = scope.main_zone(); |
| 2677 |
| 2678 ExpectedSnippet<0> snippet = { |
| 2679 "var Debug = debug.Debug;" |
| 2680 "var count = 0;" |
| 2681 "function f() {" |
| 2682 " debugger;" |
| 2683 "}" |
| 2684 "function listener(event) {" |
| 2685 " if (event == Debug.DebugEvent.Break) count++;" |
| 2686 "}" |
| 2687 "Debug.setListener(listener);" |
| 2688 "f();" |
| 2689 "Debug.setListener(null);" |
| 2690 "return count;", |
| 2691 {handle(Smi::FromInt(1), isolate)}}; |
| 2692 |
| 2693 ScopedVector<char> script(1024); |
| 2694 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
| 2695 snippet.code_snippet, kFunctionName); |
| 2696 |
| 2697 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 2698 auto callable = tester.GetCallable<>(); |
| 2699 Handle<Object> return_value = callable().ToHandleChecked(); |
| 2700 CHECK(return_value->SameValue(*snippet.return_value())); |
| 2701 } |
| 2702 |
2672 } // namespace compiler | 2703 } // namespace compiler |
2673 } // namespace internal | 2704 } // namespace internal |
2674 } // namespace v8 | 2705 } // namespace v8 |
OLD | NEW |