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

Side by Side Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1667073002: [interpreter, debugger] implement debugger statement. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@sourcepositiontable
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698