OLD | NEW |
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 7682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7693 | 7693 |
7694 TEST(LiveEditDisabled) { | 7694 TEST(LiveEditDisabled) { |
7695 v8::internal::FLAG_allow_natives_syntax = true; | 7695 v8::internal::FLAG_allow_natives_syntax = true; |
7696 LocalContext env; | 7696 LocalContext env; |
7697 v8::HandleScope scope(env->GetIsolate()); | 7697 v8::HandleScope scope(env->GetIsolate()); |
7698 v8::Debug::SetLiveEditEnabled(false, env->GetIsolate()); | 7698 v8::Debug::SetLiveEditEnabled(false, env->GetIsolate()); |
7699 CompileRun("%LiveEditCompareStrings('', '')"); | 7699 CompileRun("%LiveEditCompareStrings('', '')"); |
7700 } | 7700 } |
7701 | 7701 |
7702 | 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 |
7703 #endif // ENABLE_DEBUGGER_SUPPORT | 7738 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |