| 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 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, | 2709 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
| 2710 snippets[i].code_snippet, kFunctionName); | 2710 snippets[i].code_snippet, kFunctionName); |
| 2711 | 2711 |
| 2712 BytecodeGraphTester tester(isolate, zone, script.start()); | 2712 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 2713 auto callable = tester.GetCallable<>(); | 2713 auto callable = tester.GetCallable<>(); |
| 2714 Handle<Object> return_value = callable().ToHandleChecked(); | 2714 Handle<Object> return_value = callable().ToHandleChecked(); |
| 2715 CHECK(return_value->SameValue(*snippets[i].return_value())); | 2715 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 2716 } | 2716 } |
| 2717 } | 2717 } |
| 2718 | 2718 |
| 2719 TEST(BytecodeGraphBuilderDebuggerStatement) { |
| 2720 FLAG_expose_debug_as = "debug"; |
| 2721 HandleAndZoneScope scope; |
| 2722 Isolate* isolate = scope.main_isolate(); |
| 2723 Zone* zone = scope.main_zone(); |
| 2724 |
| 2725 ExpectedSnippet<0> snippet = { |
| 2726 "var Debug = debug.Debug;" |
| 2727 "var count = 0;" |
| 2728 "function f() {" |
| 2729 " debugger;" |
| 2730 "}" |
| 2731 "function listener(event) {" |
| 2732 " if (event == Debug.DebugEvent.Break) count++;" |
| 2733 "}" |
| 2734 "Debug.setListener(listener);" |
| 2735 "f();" |
| 2736 "Debug.setListener(null);" |
| 2737 "return count;", |
| 2738 {handle(Smi::FromInt(1), isolate)}}; |
| 2739 |
| 2740 ScopedVector<char> script(1024); |
| 2741 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
| 2742 snippet.code_snippet, kFunctionName); |
| 2743 |
| 2744 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 2745 auto callable = tester.GetCallable<>(); |
| 2746 Handle<Object> return_value = callable().ToHandleChecked(); |
| 2747 CHECK(return_value->SameValue(*snippet.return_value())); |
| 2748 } |
| 2749 |
| 2719 } // namespace compiler | 2750 } // namespace compiler |
| 2720 } // namespace internal | 2751 } // namespace internal |
| 2721 } // namespace v8 | 2752 } // namespace v8 |
| OLD | NEW |