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

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

Issue 113625: Disable compilation cache when debugger is active (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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 | « 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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 f->Call(env->Global(), 0, NULL); 1672 f->Call(env->Global(), 0, NULL);
1673 CHECK_EQ(1, break_point_hit_count); 1673 CHECK_EQ(1, break_point_hit_count);
1674 1674
1675 ChangeScriptBreakPointIgnoreCountFromJS(sbp, 5); 1675 ChangeScriptBreakPointIgnoreCountFromJS(sbp, 5);
1676 break_point_hit_count = 0; 1676 break_point_hit_count = 0;
1677 for (int i = 0; i < 10; i++) { 1677 for (int i = 0; i < 10; i++) {
1678 f->Call(env->Global(), 0, NULL); 1678 f->Call(env->Global(), 0, NULL);
1679 } 1679 }
1680 CHECK_EQ(5, break_point_hit_count); 1680 CHECK_EQ(5, break_point_hit_count);
1681 1681
1682 // BUG(343): It should not really be necessary to clear the
1683 // compilation cache here, but right now the debugger relies on the
1684 // script being recompiled, not just fetched from the cache.
1685 i::CompilationCache::Clear();
1686
1687 // Reload the script and get f again checking that the ignore survives. 1682 // Reload the script and get f again checking that the ignore survives.
1688 v8::Script::Compile(script, &origin)->Run(); 1683 v8::Script::Compile(script, &origin)->Run();
1689 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); 1684 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
1690 1685
1691 break_point_hit_count = 0; 1686 break_point_hit_count = 0;
1692 for (int i = 0; i < 10; i++) { 1687 for (int i = 0; i < 10; i++) {
1693 f->Call(env->Global(), 0, NULL); 1688 f->Call(env->Global(), 0, NULL);
1694 } 1689 }
1695 CHECK_EQ(5, break_point_hit_count); 1690 CHECK_EQ(5, break_point_hit_count);
1696 1691
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after
4585 // Test function source. 4580 // Test function source.
4586 v8::Local<v8::String> script = v8::String::New( 4581 v8::Local<v8::String> script = v8::String::New(
4587 "function f() {\n" 4582 "function f() {\n"
4588 " debugger;\n" 4583 " debugger;\n"
4589 "}\n"); 4584 "}\n");
4590 4585
4591 v8::ScriptOrigin origin1 = v8::ScriptOrigin(v8::String::New("name")); 4586 v8::ScriptOrigin origin1 = v8::ScriptOrigin(v8::String::New("name"));
4592 v8::Handle<v8::Script> script1 = v8::Script::Compile(script, &origin1); 4587 v8::Handle<v8::Script> script1 = v8::Script::Compile(script, &origin1);
4593 script1->SetData(v8::String::New("data")); 4588 script1->SetData(v8::String::New("data"));
4594 script1->Run(); 4589 script1->Run();
4595 v8::Script::Compile(script, &origin1)->Run();
4596 v8::Local<v8::Function> f; 4590 v8::Local<v8::Function> f;
4597 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); 4591 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
4598 4592
4599 f->Call(env->Global(), 0, NULL); 4593 f->Call(env->Global(), 0, NULL);
4600 CHECK_EQ(1, break_point_hit_count); 4594 CHECK_EQ(1, break_point_hit_count);
4601 CHECK_EQ("name", last_script_name_hit); 4595 CHECK_EQ("name", last_script_name_hit);
4602 CHECK_EQ("data", last_script_data_hit); 4596 CHECK_EQ("data", last_script_data_hit);
4603 4597
4598 // Compile the same script again without setting data. As the compilation
4599 // cache is disabled when debugging expect the data to be missing.
4600 v8::Script::Compile(script, &origin1)->Run();
4601 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
4602 f->Call(env->Global(), 0, NULL);
4603 CHECK_EQ(2, break_point_hit_count);
4604 CHECK_EQ("name", last_script_name_hit);
4605 CHECK_EQ("", last_script_data_hit); // Undefined results in empty string.
4606
4604 v8::Local<v8::String> data_obj_source = v8::String::New( 4607 v8::Local<v8::String> data_obj_source = v8::String::New(
4605 "({ a: 'abc',\n" 4608 "({ a: 'abc',\n"
4606 " b: 123,\n" 4609 " b: 123,\n"
4607 " toString: function() { return this.a + ' ' + this.b; }\n" 4610 " toString: function() { return this.a + ' ' + this.b; }\n"
4608 "})\n"); 4611 "})\n");
4609 v8::Local<v8::Value> data_obj = v8::Script::Compile(data_obj_source)->Run(); 4612 v8::Local<v8::Value> data_obj = v8::Script::Compile(data_obj_source)->Run();
4610 v8::ScriptOrigin origin2 = v8::ScriptOrigin(v8::String::New("new name")); 4613 v8::ScriptOrigin origin2 = v8::ScriptOrigin(v8::String::New("new name"));
4611 v8::Handle<v8::Script> script2 = v8::Script::Compile(script, &origin2); 4614 v8::Handle<v8::Script> script2 = v8::Script::Compile(script, &origin2);
4612 script2->Run(); 4615 script2->Run();
4613 script2->SetData(data_obj); 4616 script2->SetData(data_obj);
4614 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); 4617 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
4615 f->Call(env->Global(), 0, NULL); 4618 f->Call(env->Global(), 0, NULL);
4616 CHECK_EQ(2, break_point_hit_count); 4619 CHECK_EQ(3, break_point_hit_count);
4617 CHECK_EQ("new name", last_script_name_hit); 4620 CHECK_EQ("new name", last_script_name_hit);
4618 CHECK_EQ("abc 123", last_script_data_hit); 4621 CHECK_EQ("abc 123", last_script_data_hit);
4619 } 4622 }
4620 4623
4621 4624
4622 static v8::Persistent<v8::Context> expected_context; 4625 static v8::Persistent<v8::Context> expected_context;
4623 static v8::Handle<v8::Value> expected_context_data; 4626 static v8::Handle<v8::Value> expected_context_data;
4624 4627
4625 4628
4626 // Check that the expected context is the one generating the debug event. 4629 // Check that the expected context is the one generating the debug event.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 4834
4832 // Do garbage collection to collect the script above which is no longer 4835 // Do garbage collection to collect the script above which is no longer
4833 // referenced. 4836 // referenced.
4834 Heap::CollectAllGarbage(); 4837 Heap::CollectAllGarbage();
4835 4838
4836 CHECK_EQ(2, script_collected_count); 4839 CHECK_EQ(2, script_collected_count);
4837 4840
4838 v8::Debug::SetDebugEventListener(NULL); 4841 v8::Debug::SetDebugEventListener(NULL);
4839 CheckDebuggerUnloaded(); 4842 CheckDebuggerUnloaded();
4840 } 4843 }
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