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

Side by Side Diff: test/cctest/test-debug.cc

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-deoptimization.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 count = 0; 381 count = 0;
382 while (node) { 382 while (node) {
383 debugged_functions->set(count++, *node->debug_info()); 383 debugged_functions->set(count++, *node->debug_info());
384 node = node->next(); 384 node = node->next();
385 } 385 }
386 386
387 return debugged_functions; 387 return debugged_functions;
388 } 388 }
389 389
390 390
391 static Handle<Code> ComputeCallDebugBreak(int argc) {
392 return CcTest::i_isolate()->stub_cache()->ComputeCallDebugBreak(argc,
393 Code::CALL_IC);
394 }
395
396
397 // Check that the debugger has been fully unloaded. 391 // Check that the debugger has been fully unloaded.
398 void CheckDebuggerUnloaded(bool check_functions) { 392 void CheckDebuggerUnloaded(bool check_functions) {
399 // Check that the debugger context is cleared and that there is no debug 393 // Check that the debugger context is cleared and that there is no debug
400 // information stored for the debugger. 394 // information stored for the debugger.
401 CHECK(CcTest::i_isolate()->debug()->debug_context().is_null()); 395 CHECK(CcTest::i_isolate()->debug()->debug_context().is_null());
402 CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_); 396 CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_);
403 397
404 // Collect garbage to ensure weak handles are cleared. 398 // Collect garbage to ensure weak handles are cleared.
405 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 399 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
406 CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask); 400 CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask);
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 &env, 1071 &env,
1078 "function f6(a){return a==null;}", 1072 "function f6(a){return a==null;}",
1079 "f6", 1073 "f6",
1080 0, 1074 0,
1081 v8::internal::RelocInfo::CODE_TARGET, 1075 v8::internal::RelocInfo::CODE_TARGET,
1082 CcTest::i_isolate()->builtins()->builtin( 1076 CcTest::i_isolate()->builtins()->builtin(
1083 Builtins::kCompareNilIC_DebugBreak)); 1077 Builtins::kCompareNilIC_DebugBreak));
1084 1078
1085 // Check the debug break code stubs for call ICs with different number of 1079 // Check the debug break code stubs for call ICs with different number of
1086 // parameters. 1080 // parameters.
1087 Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); 1081 // TODO(verwaest): XXX update test.
1088 Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); 1082 // Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0);
1089 Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); 1083 // Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1);
1084 // Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4);
1090 1085
1091 CheckDebugBreakFunction(&env, 1086 // CheckDebugBreakFunction(&env,
1092 "function f4_0(){x();}", "f4_0", 1087 // "function f4_0(){x();}", "f4_0",
1093 0, 1088 // 0,
1094 v8::internal::RelocInfo::CODE_TARGET, 1089 // v8::internal::RelocInfo::CODE_TARGET,
1095 *debug_break_0); 1090 // *debug_break_0);
1096 1091
1097 CheckDebugBreakFunction(&env, 1092 // CheckDebugBreakFunction(&env,
1098 "function f4_1(){x(1);}", "f4_1", 1093 // "function f4_1(){x(1);}", "f4_1",
1099 0, 1094 // 0,
1100 v8::internal::RelocInfo::CODE_TARGET, 1095 // v8::internal::RelocInfo::CODE_TARGET,
1101 *debug_break_1); 1096 // *debug_break_1);
1102 1097
1103 CheckDebugBreakFunction(&env, 1098 // CheckDebugBreakFunction(&env,
1104 "function f4_4(){x(1,2,3,4);}", "f4_4", 1099 // "function f4_4(){x(1,2,3,4);}", "f4_4",
1105 0, 1100 // 0,
1106 v8::internal::RelocInfo::CODE_TARGET, 1101 // v8::internal::RelocInfo::CODE_TARGET,
1107 *debug_break_4); 1102 // *debug_break_4);
1108 } 1103 }
1109 1104
1110 1105
1111 // Test that the debug info in the VM is in sync with the functions being 1106 // Test that the debug info in the VM is in sync with the functions being
1112 // debugged. 1107 // debugged.
1113 TEST(DebugInfo) { 1108 TEST(DebugInfo) {
1114 DebugLocalContext env; 1109 DebugLocalContext env;
1115 v8::HandleScope scope(env->GetIsolate()); 1110 v8::HandleScope scope(env->GetIsolate());
1116 // Create a couple of functions for the test. 1111 // Create a couple of functions for the test.
1117 v8::Local<v8::Function> foo = 1112 v8::Local<v8::Function> foo =
(...skipping 6580 matching lines...) Expand 10 before | Expand all | Expand 10 after
7698 7693
7699 TEST(LiveEditDisabled) { 7694 TEST(LiveEditDisabled) {
7700 v8::internal::FLAG_allow_natives_syntax = true; 7695 v8::internal::FLAG_allow_natives_syntax = true;
7701 LocalContext env; 7696 LocalContext env;
7702 v8::HandleScope scope(env->GetIsolate()); 7697 v8::HandleScope scope(env->GetIsolate());
7703 v8::Debug::SetLiveEditEnabled(false, env->GetIsolate()); 7698 v8::Debug::SetLiveEditEnabled(false, env->GetIsolate());
7704 CompileRun("%LiveEditCompareStrings('', '')"); 7699 CompileRun("%LiveEditCompareStrings('', '')");
7705 } 7700 }
7706 7701
7707 7702
7703 TEST(PrecompiledFunction) {
7704 // Regression test for crbug.com/346207. If we have preparse data, parsing the
7705 // function in the presence of the debugger (and breakpoints) should still
7706 // succeed. The bug was that preparsing was done lazily and parsing was done
7707 // eagerly, so, the symbol streams didn't match.
7708 DebugLocalContext env;
7709 v8::HandleScope scope(env->GetIsolate());
7710 env.ExposeDebug();
7711 v8::Debug::SetDebugEventListener2(DebugBreakInlineListener);
7712
7713 v8::Local<v8::Function> break_here =
7714 CompileFunction(&env, "function break_here(){}", "break_here");
7715 SetBreakPoint(break_here, 0);
7716
7717 const char* source =
7718 "var a = b = c = 1; \n"
7719 "function this_is_lazy() { \n"
7720 // This symbol won't appear in the preparse data.
7721 " var a; \n"
7722 "} \n"
7723 "function bar() { \n"
7724 " return \"bar\"; \n"
7725 "}; \n"
7726 "a = b = c = 2; \n"
7727 "bar(); \n";
7728 v8::Local<v8::Value> result = PreCompileCompileRun(source);
7729 CHECK(result->IsString());
7730 v8::String::Utf8Value utf8(result);
7731 CHECK_EQ("bar", *utf8);
7732
7733 v8::Debug::SetDebugEventListener2(NULL);
7734 CheckDebuggerUnloaded();
7735 }
7736
7737
7708 #endif // ENABLE_DEBUGGER_SUPPORT 7738 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-deoptimization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698