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

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

Issue 142693005: A64: Synchronize with r16918. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 v8::Script::Compile(v8::String::New(source))->Run(); 193 v8::Script::Compile(v8::String::New(source))->Run();
194 return v8::Local<v8::Function>::Cast( 194 return v8::Local<v8::Function>::Cast(
195 (*env)->Global()->Get(v8::String::New(function_name))); 195 (*env)->Global()->Get(v8::String::New(function_name)));
196 } 196 }
197 197
198 198
199 // Compile and run the supplied source and return the requested function. 199 // Compile and run the supplied source and return the requested function.
200 static v8::Local<v8::Function> CompileFunction(const char* source, 200 static v8::Local<v8::Function> CompileFunction(const char* source,
201 const char* function_name) { 201 const char* function_name) {
202 v8::Script::Compile(v8::String::New(source))->Run(); 202 v8::Script::Compile(v8::String::New(source))->Run();
203 v8::Local<v8::Object> global =
204 CcTest::isolate()->GetCurrentContext()->Global();
203 return v8::Local<v8::Function>::Cast( 205 return v8::Local<v8::Function>::Cast(
204 v8::Context::GetCurrent()->Global()->Get(v8::String::New(function_name))); 206 global->Get(v8::String::New(function_name)));
205 } 207 }
206 208
207 209
208 // Is there any debug info for the function? 210 // Is there any debug info for the function?
209 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { 211 static bool HasDebugInfo(v8::Handle<v8::Function> fun) {
210 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); 212 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun);
211 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); 213 Handle<v8::internal::SharedFunctionInfo> shared(f->shared());
212 return Debug::HasDebugInfo(shared); 214 return Debug::HasDebugInfo(shared);
213 } 215 }
214 216
(...skipping 4920 matching lines...) Expand 10 before | Expand all | Expand 10 after
5135 " while ( flag == true ) {\n" 5137 " while ( flag == true ) {\n"
5136 " if ( x == 1 ) {\n" 5138 " if ( x == 1 ) {\n"
5137 " ThreadedAtBarrier1();\n" 5139 " ThreadedAtBarrier1();\n"
5138 " }\n" 5140 " }\n"
5139 " x = x + 1;\n" 5141 " x = x + 1;\n"
5140 " }\n" 5142 " }\n"
5141 "}\n" 5143 "}\n"
5142 "\n" 5144 "\n"
5143 "foo();\n"; 5145 "foo();\n";
5144 5146
5145 v8::V8::Initialize(); 5147 v8::Isolate::Scope isolate_scope(CcTest::isolate());
5146 DebugLocalContext env; 5148 DebugLocalContext env;
5147 v8::HandleScope scope(env->GetIsolate()); 5149 v8::HandleScope scope(env->GetIsolate());
5148 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); 5150 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler);
5149 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); 5151 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
5150 global_template->Set(v8::String::New("ThreadedAtBarrier1"), 5152 global_template->Set(v8::String::New("ThreadedAtBarrier1"),
5151 v8::FunctionTemplate::New(ThreadedAtBarrier1)); 5153 v8::FunctionTemplate::New(ThreadedAtBarrier1));
5152 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(), 5154 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
5153 NULL, 5155 NULL,
5154 global_template); 5156 global_template);
5155 v8::Context::Scope context_scope(context); 5157 v8::Context::Scope context_scope(context);
(...skipping 16 matching lines...) Expand all
5172 5174
5173 v8::Isolate* isolate = CcTest::isolate(); 5175 v8::Isolate* isolate = CcTest::isolate();
5174 threaded_debugging_barriers.barrier_1.Wait(); 5176 threaded_debugging_barriers.barrier_1.Wait();
5175 v8::Debug::DebugBreak(isolate); 5177 v8::Debug::DebugBreak(isolate);
5176 threaded_debugging_barriers.barrier_2.Wait(); 5178 threaded_debugging_barriers.barrier_2.Wait();
5177 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_1, buffer)); 5179 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_1, buffer));
5178 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer)); 5180 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer));
5179 } 5181 }
5180 5182
5181 5183
5182 UNINITIALIZED_TEST(ThreadedDebugging) { 5184 TEST(ThreadedDebugging) {
5183 DebuggerThread debugger_thread; 5185 DebuggerThread debugger_thread;
5184 V8Thread v8_thread; 5186 V8Thread v8_thread;
5185 5187
5186 // Create a V8 environment 5188 // Create a V8 environment
5187 v8_thread.Start(); 5189 v8_thread.Start();
5188 debugger_thread.Start(); 5190 debugger_thread.Start();
5189 5191
5190 v8_thread.Join(); 5192 v8_thread.Join();
5191 debugger_thread.Join(); 5193 debugger_thread.Join();
5192 } 5194 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5251 " var x = 1;\n" 5253 " var x = 1;\n"
5252 " x = y_global;" 5254 " x = y_global;"
5253 " var z = 3;" 5255 " var z = 3;"
5254 " x += 100;\n" 5256 " x += 100;\n"
5255 " return x;\n" 5257 " return x;\n"
5256 "}\n" 5258 "}\n"
5257 "\n"; 5259 "\n";
5258 const char* source_2 = "cat(17);\n" 5260 const char* source_2 = "cat(17);\n"
5259 "cat(19);\n"; 5261 "cat(19);\n";
5260 5262
5261 v8::V8::Initialize(); 5263 v8::Isolate* isolate = CcTest::isolate();
5264 v8::Isolate::Scope isolate_scope(isolate);
5262 DebugLocalContext env; 5265 DebugLocalContext env;
5263 v8::HandleScope scope(env->GetIsolate()); 5266 v8::HandleScope scope(isolate);
5264 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler); 5267 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler);
5265 5268
5266 CompileRun(source_1); 5269 CompileRun(source_1);
5267 breakpoints_barriers->barrier_1.Wait(); 5270 breakpoints_barriers->barrier_1.Wait();
5268 breakpoints_barriers->barrier_2.Wait(); 5271 breakpoints_barriers->barrier_2.Wait();
5269 CompileRun(source_2); 5272 CompileRun(source_2);
5270 } 5273 }
5271 5274
5272 5275
5273 void BreakpointsDebuggerThread::Run() { 5276 void BreakpointsDebuggerThread::Run() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5326 "\"type\":\"request\"," 5329 "\"type\":\"request\","
5327 "\"command\":\"evaluate\"," 5330 "\"command\":\"evaluate\","
5328 "\"arguments\":{\"expression\":\"dog()\",\"disable_break\":true}}"; 5331 "\"arguments\":{\"expression\":\"dog()\",\"disable_break\":true}}";
5329 } 5332 }
5330 const char* command_8 = "{\"seq\":108," 5333 const char* command_8 = "{\"seq\":108,"
5331 "\"type\":\"request\"," 5334 "\"type\":\"request\","
5332 "\"command\":\"continue\"}"; 5335 "\"command\":\"continue\"}";
5333 5336
5334 5337
5335 v8::Isolate* isolate = CcTest::isolate(); 5338 v8::Isolate* isolate = CcTest::isolate();
5339 v8::Isolate::Scope isolate_scope(isolate);
5336 // v8 thread initializes, runs source_1 5340 // v8 thread initializes, runs source_1
5337 breakpoints_barriers->barrier_1.Wait(); 5341 breakpoints_barriers->barrier_1.Wait();
5338 // 1:Set breakpoint in cat() (will get id 1). 5342 // 1:Set breakpoint in cat() (will get id 1).
5339 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_1, buffer)); 5343 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_1, buffer));
5340 // 2:Set breakpoint in dog() (will get id 2). 5344 // 2:Set breakpoint in dog() (will get id 2).
5341 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer)); 5345 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer));
5342 breakpoints_barriers->barrier_2.Wait(); 5346 breakpoints_barriers->barrier_2.Wait();
5343 // V8 thread starts compiling source_2. 5347 // V8 thread starts compiling source_2.
5344 // Automatic break happens, to run queued commands 5348 // Automatic break happens, to run queued commands
5345 // breakpoints_barriers->semaphore_1.Wait(); 5349 // breakpoints_barriers->semaphore_1.Wait();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
5396 breakpoints_barriers = &stack_allocated_breakpoints_barriers; 5400 breakpoints_barriers = &stack_allocated_breakpoints_barriers;
5397 5401
5398 breakpoints_v8_thread.Start(); 5402 breakpoints_v8_thread.Start();
5399 breakpoints_debugger_thread.Start(); 5403 breakpoints_debugger_thread.Start();
5400 5404
5401 breakpoints_v8_thread.Join(); 5405 breakpoints_v8_thread.Join();
5402 breakpoints_debugger_thread.Join(); 5406 breakpoints_debugger_thread.Join();
5403 } 5407 }
5404 5408
5405 5409
5406 UNINITIALIZED_TEST(RecursiveBreakpoints) { 5410 TEST(RecursiveBreakpoints) {
5407 TestRecursiveBreakpointsGeneric(false); 5411 TestRecursiveBreakpointsGeneric(false);
5408 } 5412 }
5409 5413
5410 5414
5411 UNINITIALIZED_TEST(RecursiveBreakpointsGlobal) { 5415 TEST(RecursiveBreakpointsGlobal) {
5412 TestRecursiveBreakpointsGeneric(true); 5416 TestRecursiveBreakpointsGeneric(true);
5413 } 5417 }
5414 5418
5415 5419
5416 static void DummyDebugEventListener( 5420 static void DummyDebugEventListener(
5417 const v8::Debug::EventDetails& event_details) { 5421 const v8::Debug::EventDetails& event_details) {
5418 } 5422 }
5419 5423
5420 5424
5421 TEST(SetDebugEventListenerOnUninitializedVM) { 5425 TEST(SetDebugEventListenerOnUninitializedVM) {
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
5782 "function cat( new_value ) {\n" 5786 "function cat( new_value ) {\n"
5783 " var x = new_value;\n" 5787 " var x = new_value;\n"
5784 " y_global = 4;\n" 5788 " y_global = 4;\n"
5785 " x = 3 * x + 1;\n" 5789 " x = 3 * x + 1;\n"
5786 " y_global = 5;\n" 5790 " y_global = 5;\n"
5787 " return x;\n" 5791 " return x;\n"
5788 "}\n" 5792 "}\n"
5789 "\n"; 5793 "\n";
5790 const char* source_2 = "cat(17);\n"; 5794 const char* source_2 = "cat(17);\n";
5791 5795
5792 v8::V8::Initialize(); 5796 v8::Isolate::Scope isolate_scope(CcTest::isolate());
5793 DebugLocalContext env; 5797 DebugLocalContext env;
5794 v8::HandleScope scope(env->GetIsolate()); 5798 v8::HandleScope scope(env->GetIsolate());
5795 5799
5796 // Set up message and host dispatch handlers. 5800 // Set up message and host dispatch handlers.
5797 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler); 5801 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler);
5798 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */); 5802 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */);
5799 5803
5800 CompileRun(source_1); 5804 CompileRun(source_1);
5801 host_dispatch_barriers->barrier_1.Wait(); 5805 host_dispatch_barriers->barrier_1.Wait();
5802 host_dispatch_barriers->barrier_2.Wait(); 5806 host_dispatch_barriers->barrier_2.Wait();
(...skipping 22 matching lines...) Expand all
5825 host_dispatch_barriers->barrier_2.Wait(); 5829 host_dispatch_barriers->barrier_2.Wait();
5826 // v8 thread starts compiling source_2. 5830 // v8 thread starts compiling source_2.
5827 // Break happens, to run queued commands and host dispatches. 5831 // Break happens, to run queued commands and host dispatches.
5828 // Wait for host dispatch to be processed. 5832 // Wait for host dispatch to be processed.
5829 host_dispatch_barriers->semaphore_1.Wait(); 5833 host_dispatch_barriers->semaphore_1.Wait();
5830 // 2: Continue evaluation 5834 // 2: Continue evaluation
5831 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer)); 5835 v8::Debug::SendCommand(isolate, buffer, AsciiToUtf16(command_2, buffer));
5832 } 5836 }
5833 5837
5834 5838
5835 UNINITIALIZED_TEST(DebuggerHostDispatch) { 5839 TEST(DebuggerHostDispatch) {
5836 HostDispatchDebuggerThread host_dispatch_debugger_thread; 5840 HostDispatchDebuggerThread host_dispatch_debugger_thread;
5837 HostDispatchV8Thread host_dispatch_v8_thread; 5841 HostDispatchV8Thread host_dispatch_v8_thread;
5838 i::FLAG_debugger_auto_break = true; 5842 i::FLAG_debugger_auto_break = true;
5839 5843
5840 // Create a V8 environment 5844 // Create a V8 environment
5841 Barriers stack_allocated_host_dispatch_barriers; 5845 Barriers stack_allocated_host_dispatch_barriers;
5842 host_dispatch_barriers = &stack_allocated_host_dispatch_barriers; 5846 host_dispatch_barriers = &stack_allocated_host_dispatch_barriers;
5843 5847
5844 host_dispatch_v8_thread.Start(); 5848 host_dispatch_v8_thread.Start();
5845 host_dispatch_debugger_thread.Start(); 5849 host_dispatch_debugger_thread.Start();
(...skipping 24 matching lines...) Expand all
5870 5874
5871 Barriers* debug_message_dispatch_barriers; 5875 Barriers* debug_message_dispatch_barriers;
5872 5876
5873 5877
5874 static void DebugMessageHandler() { 5878 static void DebugMessageHandler() {
5875 debug_message_dispatch_barriers->semaphore_1.Signal(); 5879 debug_message_dispatch_barriers->semaphore_1.Signal();
5876 } 5880 }
5877 5881
5878 5882
5879 void DebugMessageDispatchV8Thread::Run() { 5883 void DebugMessageDispatchV8Thread::Run() {
5880 v8::V8::Initialize(); 5884 v8::Isolate::Scope isolate_scope(CcTest::isolate());
5881 DebugLocalContext env; 5885 DebugLocalContext env;
5882 v8::HandleScope scope(env->GetIsolate()); 5886 v8::HandleScope scope(env->GetIsolate());
5883 5887
5884 // Set up debug message dispatch handler. 5888 // Set up debug message dispatch handler.
5885 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler); 5889 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler);
5886 5890
5887 CompileRun("var y = 1 + 2;\n"); 5891 CompileRun("var y = 1 + 2;\n");
5888 debug_message_dispatch_barriers->barrier_1.Wait(); 5892 debug_message_dispatch_barriers->barrier_1.Wait();
5889 debug_message_dispatch_barriers->semaphore_1.Wait(); 5893 debug_message_dispatch_barriers->semaphore_1.Wait();
5890 debug_message_dispatch_barriers->barrier_2.Wait(); 5894 debug_message_dispatch_barriers->barrier_2.Wait();
5891 } 5895 }
5892 5896
5893 5897
5894 void DebugMessageDispatchDebuggerThread::Run() { 5898 void DebugMessageDispatchDebuggerThread::Run() {
5895 debug_message_dispatch_barriers->barrier_1.Wait(); 5899 debug_message_dispatch_barriers->barrier_1.Wait();
5896 SendContinueCommand(); 5900 SendContinueCommand();
5897 debug_message_dispatch_barriers->barrier_2.Wait(); 5901 debug_message_dispatch_barriers->barrier_2.Wait();
5898 } 5902 }
5899 5903
5900 5904
5901 UNINITIALIZED_TEST(DebuggerDebugMessageDispatch) { 5905 TEST(DebuggerDebugMessageDispatch) {
5902 DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread; 5906 DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread;
5903 DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread; 5907 DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread;
5904 5908
5905 i::FLAG_debugger_auto_break = true; 5909 i::FLAG_debugger_auto_break = true;
5906 5910
5907 // Create a V8 environment 5911 // Create a V8 environment
5908 Barriers stack_allocated_debug_message_dispatch_barriers; 5912 Barriers stack_allocated_debug_message_dispatch_barriers;
5909 debug_message_dispatch_barriers = 5913 debug_message_dispatch_barriers =
5910 &stack_allocated_debug_message_dispatch_barriers; 5914 &stack_allocated_debug_message_dispatch_barriers;
5911 5915
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
6356 last_function_hit[0] = '\0'; 6360 last_function_hit[0] = '\0';
6357 } else { 6361 } else {
6358 CHECK(result->IsString()); 6362 CHECK(result->IsString());
6359 v8::Handle<v8::String> function_name(result->ToString()); 6363 v8::Handle<v8::String> function_name(result->ToString());
6360 function_name->WriteUtf8(last_function_hit); 6364 function_name->WriteUtf8(last_function_hit);
6361 } 6365 }
6362 } 6366 }
6363 6367
6364 // Keep forcing breaks. 6368 // Keep forcing breaks.
6365 if (break_point_hit_count < 20) { 6369 if (break_point_hit_count < 20) {
6366 v8::Debug::DebugBreak(); 6370 v8::Debug::DebugBreak(CcTest::isolate());
6367 } 6371 }
6368 } 6372 }
6369 } 6373 }
6370 6374
6371 6375
6372 UNINITIALIZED_TEST(RegExpDebugBreak) { 6376 TEST(RegExpDebugBreak) {
6373 // This test only applies to native regexps. 6377 // This test only applies to native regexps.
6374 DebugLocalContext env; 6378 DebugLocalContext env;
6375 v8::HandleScope scope(env->GetIsolate()); 6379 v8::HandleScope scope(env->GetIsolate());
6376 6380
6377 // Create a function for checking the function when hitting a break point. 6381 // Create a function for checking the function when hitting a break point.
6378 frame_function_name = CompileFunction(&env, 6382 frame_function_name = CompileFunction(&env,
6379 frame_function_name_source, 6383 frame_function_name_source,
6380 "frame_function_name"); 6384 "frame_function_name");
6381 6385
6382 // Test RegExp which matches white spaces and comments at the begining of a 6386 // Test RegExp which matches white spaces and comments at the begining of a
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
6798 isolate->stack_guard()->DebugBreak(); 6802 isolate->stack_guard()->DebugBreak();
6799 } else { 6803 } else {
6800 isolate->stack_guard()->Continue(i::DEBUGBREAK); 6804 isolate->stack_guard()->Continue(i::DEBUGBREAK);
6801 } 6805 }
6802 } 6806 }
6803 } 6807 }
6804 6808
6805 6809
6806 // Test that if DebugBreak is forced it is ignored when code from 6810 // Test that if DebugBreak is forced it is ignored when code from
6807 // debug-delay.js is executed. 6811 // debug-delay.js is executed.
6808 UNINITIALIZED_TEST(NoDebugBreakInAfterCompileMessageHandler) { 6812 TEST(NoDebugBreakInAfterCompileMessageHandler) {
6809 DebugLocalContext env; 6813 DebugLocalContext env;
6810 v8::HandleScope scope(env->GetIsolate()); 6814 v8::HandleScope scope(env->GetIsolate());
6811 6815
6812 // Register a debug event listener which sets the break flag and counts. 6816 // Register a debug event listener which sets the break flag and counts.
6813 v8::Debug::SetMessageHandler2(BreakMessageHandler); 6817 v8::Debug::SetMessageHandler2(BreakMessageHandler);
6814 6818
6815 // Set the debug break flag. 6819 // Set the debug break flag.
6816 v8::Debug::DebugBreak(); 6820 v8::Debug::DebugBreak(env->GetIsolate());
6817 6821
6818 // Create a function for testing stepping. 6822 // Create a function for testing stepping.
6819 const char* src = "function f() { eval('var x = 10;'); } "; 6823 const char* src = "function f() { eval('var x = 10;'); } ";
6820 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); 6824 v8::Local<v8::Function> f = CompileFunction(&env, src, "f");
6821 6825
6822 // There should be only one break event. 6826 // There should be only one break event.
6823 CHECK_EQ(1, break_point_hit_count); 6827 CHECK_EQ(1, break_point_hit_count);
6824 6828
6825 // Set the debug break flag again. 6829 // Set the debug break flag again.
6826 v8::Debug::DebugBreak(env->GetIsolate()); 6830 v8::Debug::DebugBreak(env->GetIsolate());
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6998 v8::Handle<v8::Context> debugee_context; 7002 v8::Handle<v8::Context> debugee_context;
6999 v8::Handle<v8::Context> debugger_context; 7003 v8::Handle<v8::Context> debugger_context;
7000 7004
7001 7005
7002 // Property getter that checks that current and calling contexts 7006 // Property getter that checks that current and calling contexts
7003 // are both the debugee contexts. 7007 // are both the debugee contexts.
7004 static void NamedGetterWithCallingContextCheck( 7008 static void NamedGetterWithCallingContextCheck(
7005 v8::Local<v8::String> name, 7009 v8::Local<v8::String> name,
7006 const v8::PropertyCallbackInfo<v8::Value>& info) { 7010 const v8::PropertyCallbackInfo<v8::Value>& info) {
7007 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a")); 7011 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a"));
7008 v8::Handle<v8::Context> current = v8::Context::GetCurrent(); 7012 v8::Handle<v8::Context> current = info.GetIsolate()->GetCurrentContext();
7009 CHECK(current == debugee_context); 7013 CHECK(current == debugee_context);
7010 CHECK(current != debugger_context); 7014 CHECK(current != debugger_context);
7011 v8::Handle<v8::Context> calling = v8::Context::GetCalling(); 7015 v8::Handle<v8::Context> calling = info.GetIsolate()->GetCallingContext();
7012 CHECK(calling == debugee_context); 7016 CHECK(calling == debugee_context);
7013 CHECK(calling != debugger_context); 7017 CHECK(calling != debugger_context);
7014 info.GetReturnValue().Set(1); 7018 info.GetReturnValue().Set(1);
7015 } 7019 }
7016 7020
7017 7021
7018 // Debug event listener that checks if the first argument of a function is 7022 // Debug event listener that checks if the first argument of a function is
7019 // an object with property 'a' == 1. If the property has custom accessor 7023 // an object with property 'a' == 1. If the property has custom accessor
7020 // this handler will eventually invoke it. 7024 // this handler will eventually invoke it.
7021 static void DebugEventGetAtgumentPropertyValue( 7025 static void DebugEventGetAtgumentPropertyValue(
7022 const v8::Debug::EventDetails& event_details) { 7026 const v8::Debug::EventDetails& event_details) {
7023 v8::DebugEvent event = event_details.GetEvent(); 7027 v8::DebugEvent event = event_details.GetEvent();
7024 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); 7028 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState();
7025 if (event == v8::Break) { 7029 if (event == v8::Break) {
7026 break_point_hit_count++; 7030 break_point_hit_count++;
7027 CHECK(debugger_context == v8::Context::GetCurrent()); 7031 CHECK(debugger_context == CcTest::isolate()->GetCurrentContext());
7028 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(CompileRun( 7032 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(CompileRun(
7029 "(function(exec_state) {\n" 7033 "(function(exec_state) {\n"
7030 " return (exec_state.frame(0).argumentValue(0).property('a').\n" 7034 " return (exec_state.frame(0).argumentValue(0).property('a').\n"
7031 " value().value() == 1);\n" 7035 " value().value() == 1);\n"
7032 "})")); 7036 "})"));
7033 const int argc = 1; 7037 const int argc = 1;
7034 v8::Handle<v8::Value> argv[argc] = { exec_state }; 7038 v8::Handle<v8::Value> argv[argc] = { exec_state };
7035 v8::Handle<v8::Value> result = func->Call(exec_state, argc, argv); 7039 v8::Handle<v8::Value> result = func->Call(exec_state, argc, argv);
7036 CHECK(result->IsTrue()); 7040 CHECK(result->IsTrue());
7037 } 7041 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
7549 TEST(LiveEditDisabled) { 7553 TEST(LiveEditDisabled) {
7550 v8::internal::FLAG_allow_natives_syntax = true; 7554 v8::internal::FLAG_allow_natives_syntax = true;
7551 LocalContext env; 7555 LocalContext env;
7552 v8::HandleScope scope(env->GetIsolate()); 7556 v8::HandleScope scope(env->GetIsolate());
7553 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); 7557 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate();
7554 CompileRun("%LiveEditCompareStrings('', '')"); 7558 CompileRun("%LiveEditCompareStrings('', '')");
7555 } 7559 }
7556 7560
7557 7561
7558 #endif // ENABLE_DEBUGGER_SUPPORT 7562 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698