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

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

Issue 2589083002: [debugger] sunset --expose-debug-as flag. (Closed)
Patch Set: Created 4 years 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 | « src/flag-definitions.h ('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 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/compilation-info.h" 7 #include "src/compilation-info.h"
8 #include "src/compiler/pipeline.h" 8 #include "src/compiler/pipeline.h"
9 #include "src/execution.h" 9 #include "src/execution.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 BytecodeGraphTester tester(isolate, zone, script.start()); 3020 BytecodeGraphTester tester(isolate, zone, script.start());
3021 v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); 3021 v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get();
3022 v8::Local<v8::String> expected_string = 3022 v8::Local<v8::String> expected_string =
3023 v8_str(illegal_const_decl[i].return_value()); 3023 v8_str(illegal_const_decl[i].return_value());
3024 CHECK( 3024 CHECK(
3025 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string) 3025 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string)
3026 .FromJust()); 3026 .FromJust());
3027 } 3027 }
3028 } 3028 }
3029 3029
3030 static int debug_break_count = 0;
3031 static void DebugEventCounter(const v8::Debug::EventDetails& event_details) {
3032 if (event_details.GetEvent() == v8::Break) debug_break_count++;
3033 }
3034
3030 TEST(BytecodeGraphBuilderDebuggerStatement) { 3035 TEST(BytecodeGraphBuilderDebuggerStatement) {
3031 FLAG_expose_debug_as = "debug";
3032 HandleAndZoneScope scope; 3036 HandleAndZoneScope scope;
3033 Isolate* isolate = scope.main_isolate(); 3037 Isolate* isolate = scope.main_isolate();
3034 Zone* zone = scope.main_zone(); 3038 Zone* zone = scope.main_zone();
3035 3039
3040 v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter);
3041
3036 ExpectedSnippet<0> snippet = { 3042 ExpectedSnippet<0> snippet = {
3037 "var Debug = debug.Debug;"
3038 "var count = 0;"
3039 "function f() {" 3043 "function f() {"
3040 " debugger;" 3044 " debugger;"
3041 "}" 3045 "}"
3042 "function listener(event) {" 3046 "f();",
3043 " if (event == Debug.DebugEvent.Break) count++;" 3047 {isolate->factory()->undefined_value()}};
3044 "}"
3045 "Debug.setListener(listener);"
3046 "f();"
3047 "Debug.setListener(null);"
3048 "return count;",
3049 {handle(Smi::FromInt(1), isolate)}};
3050 3048
3051 ScopedVector<char> script(1024); 3049 BytecodeGraphTester tester(isolate, zone, snippet.code_snippet);
3052 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
3053 snippet.code_snippet, kFunctionName);
3054
3055 BytecodeGraphTester tester(isolate, zone, script.start());
3056 auto callable = tester.GetCallable<>(); 3050 auto callable = tester.GetCallable<>();
3057 Handle<Object> return_value = callable().ToHandleChecked(); 3051 Handle<Object> return_value = callable().ToHandleChecked();
3058 CHECK(return_value->SameValue(*snippet.return_value())); 3052
3053 v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr);
3054 CHECK(return_value.is_identical_to(snippet.return_value()));
3055 CHECK_EQ(2, debug_break_count);
3059 } 3056 }
3060 3057
3061 } // namespace compiler 3058 } // namespace compiler
3062 } // namespace internal 3059 } // namespace internal
3063 } // namespace v8 3060 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698