| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 v8::Handle<v8::String> str = v8::String::New(buffer.start()); | 295 v8::Handle<v8::String> str = v8::String::New(buffer.start()); |
| 296 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); | 296 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); |
| 297 CHECK(!try_catch.HasCaught()); | 297 CHECK(!try_catch.HasCaught()); |
| 298 return value->Int32Value(); | 298 return value->Int32Value(); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| 303 // Clear a break point. | 303 // Clear a break point. |
| 304 static void ClearBreakPoint(int break_point) { | 304 static void ClearBreakPoint(int break_point) { |
| 305 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); | 305 v8::internal::Isolate* isolate = CcTest::i_isolate(); |
| 306 v8::internal::Debug* debug = isolate->debug(); | 306 v8::internal::Debug* debug = isolate->debug(); |
| 307 debug->ClearBreakPoint( | 307 debug->ClearBreakPoint( |
| 308 Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate)); | 308 Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate)); |
| 309 } | 309 } |
| 310 | 310 |
| 311 | 311 |
| 312 // Clear a break point using the global Debug object. | 312 // Clear a break point using the global Debug object. |
| 313 static void ClearBreakPointFromJS(int break_point_number) { | 313 static void ClearBreakPointFromJS(int break_point_number) { |
| 314 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 314 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
| 315 OS::SNPrintF(buffer, | 315 OS::SNPrintF(buffer, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 OS::SNPrintF(buffer, | 357 OS::SNPrintF(buffer, |
| 358 "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)", | 358 "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)", |
| 359 break_point_number, ignoreCount); | 359 break_point_number, ignoreCount); |
| 360 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 360 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
| 361 v8::Script::Compile(v8::String::New(buffer.start()))->Run(); | 361 v8::Script::Compile(v8::String::New(buffer.start()))->Run(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| 365 // Change break on exception. | 365 // Change break on exception. |
| 366 static void ChangeBreakOnException(bool caught, bool uncaught) { | 366 static void ChangeBreakOnException(bool caught, bool uncaught) { |
| 367 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 367 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 368 debug->ChangeBreakOnException(v8::internal::BreakException, caught); | 368 debug->ChangeBreakOnException(v8::internal::BreakException, caught); |
| 369 debug->ChangeBreakOnException(v8::internal::BreakUncaughtException, uncaught); | 369 debug->ChangeBreakOnException(v8::internal::BreakUncaughtException, uncaught); |
| 370 } | 370 } |
| 371 | 371 |
| 372 | 372 |
| 373 // Change break on exception using the global Debug object. | 373 // Change break on exception using the global Debug object. |
| 374 static void ChangeBreakOnExceptionFromJS(bool caught, bool uncaught) { | 374 static void ChangeBreakOnExceptionFromJS(bool caught, bool uncaught) { |
| 375 if (caught) { | 375 if (caught) { |
| 376 v8::Script::Compile( | 376 v8::Script::Compile( |
| 377 v8::String::New("debug.Debug.setBreakOnException()"))->Run(); | 377 v8::String::New("debug.Debug.setBreakOnException()"))->Run(); |
| 378 } else { | 378 } else { |
| 379 v8::Script::Compile( | 379 v8::Script::Compile( |
| 380 v8::String::New("debug.Debug.clearBreakOnException()"))->Run(); | 380 v8::String::New("debug.Debug.clearBreakOnException()"))->Run(); |
| 381 } | 381 } |
| 382 if (uncaught) { | 382 if (uncaught) { |
| 383 v8::Script::Compile( | 383 v8::Script::Compile( |
| 384 v8::String::New("debug.Debug.setBreakOnUncaughtException()"))->Run(); | 384 v8::String::New("debug.Debug.setBreakOnUncaughtException()"))->Run(); |
| 385 } else { | 385 } else { |
| 386 v8::Script::Compile( | 386 v8::Script::Compile( |
| 387 v8::String::New("debug.Debug.clearBreakOnUncaughtException()"))->Run(); | 387 v8::String::New("debug.Debug.clearBreakOnUncaughtException()"))->Run(); |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 // Prepare to step to next break location. | 392 // Prepare to step to next break location. |
| 393 static void PrepareStep(StepAction step_action) { | 393 static void PrepareStep(StepAction step_action) { |
| 394 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 394 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 395 debug->PrepareStep(step_action, 1, StackFrame::NO_ID); | 395 debug->PrepareStep(step_action, 1, StackFrame::NO_ID); |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 // This function is in namespace v8::internal to be friend with class | 399 // This function is in namespace v8::internal to be friend with class |
| 400 // v8::internal::Debug. | 400 // v8::internal::Debug. |
| 401 namespace v8 { | 401 namespace v8 { |
| 402 namespace internal { | 402 namespace internal { |
| 403 | 403 |
| 404 // Collect the currently debugged functions. | 404 // Collect the currently debugged functions. |
| 405 Handle<FixedArray> GetDebuggedFunctions() { | 405 Handle<FixedArray> GetDebuggedFunctions() { |
| 406 Debug* debug = Isolate::Current()->debug(); | 406 Debug* debug = CcTest::i_isolate()->debug(); |
| 407 | 407 |
| 408 v8::internal::DebugInfoListNode* node = debug->debug_info_list_; | 408 v8::internal::DebugInfoListNode* node = debug->debug_info_list_; |
| 409 | 409 |
| 410 // Find the number of debugged functions. | 410 // Find the number of debugged functions. |
| 411 int count = 0; | 411 int count = 0; |
| 412 while (node) { | 412 while (node) { |
| 413 count++; | 413 count++; |
| 414 node = node->next(); | 414 node = node->next(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 // Allocate array for the debugged functions | 417 // Allocate array for the debugged functions |
| 418 Handle<FixedArray> debugged_functions = | 418 Handle<FixedArray> debugged_functions = |
| 419 Isolate::Current()->factory()->NewFixedArray(count); | 419 CcTest::i_isolate()->factory()->NewFixedArray(count); |
| 420 | 420 |
| 421 // Run through the debug info objects and collect all functions. | 421 // Run through the debug info objects and collect all functions. |
| 422 count = 0; | 422 count = 0; |
| 423 while (node) { | 423 while (node) { |
| 424 debugged_functions->set(count++, *node->debug_info()); | 424 debugged_functions->set(count++, *node->debug_info()); |
| 425 node = node->next(); | 425 node = node->next(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 return debugged_functions; | 428 return debugged_functions; |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 static Handle<Code> ComputeCallDebugBreak(int argc) { | 432 static Handle<Code> ComputeCallDebugBreak(int argc) { |
| 433 return Isolate::Current()->stub_cache()->ComputeCallDebugBreak(argc, | 433 return CcTest::i_isolate()->stub_cache()->ComputeCallDebugBreak(argc, |
| 434 Code::CALL_IC); | 434 Code::CALL_IC); |
| 435 } | 435 } |
| 436 | 436 |
| 437 | 437 |
| 438 // Check that the debugger has been fully unloaded. | 438 // Check that the debugger has been fully unloaded. |
| 439 void CheckDebuggerUnloaded(bool check_functions) { | 439 void CheckDebuggerUnloaded(bool check_functions) { |
| 440 // Check that the debugger context is cleared and that there is no debug | 440 // Check that the debugger context is cleared and that there is no debug |
| 441 // information stored for the debugger. | 441 // information stored for the debugger. |
| 442 CHECK(Isolate::Current()->debug()->debug_context().is_null()); | 442 CHECK(CcTest::i_isolate()->debug()->debug_context().is_null()); |
| 443 CHECK_EQ(NULL, Isolate::Current()->debug()->debug_info_list_); | 443 CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_); |
| 444 | 444 |
| 445 // Collect garbage to ensure weak handles are cleared. | 445 // Collect garbage to ensure weak handles are cleared. |
| 446 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 446 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 447 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | 447 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); |
| 448 | 448 |
| 449 // Iterate the head and check that there are no debugger related objects left. | 449 // Iterate the head and check that there are no debugger related objects left. |
| 450 HeapIterator iterator(HEAP); | 450 HeapIterator iterator(HEAP); |
| 451 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 451 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 452 CHECK(!obj->IsDebugInfo()); | 452 CHECK(!obj->IsDebugInfo()); |
| 453 CHECK(!obj->IsBreakPointInfo()); | 453 CHECK(!obj->IsBreakPointInfo()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 465 CHECK(!Debug::IsDebugBreakAtReturn(it.rinfo())); | 465 CHECK(!Debug::IsDebugBreakAtReturn(it.rinfo())); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 | 473 |
| 474 void ForceUnloadDebugger() { | 474 void ForceUnloadDebugger() { |
| 475 Isolate::Current()->debugger()->never_unload_debugger_ = false; | 475 CcTest::i_isolate()->debugger()->never_unload_debugger_ = false; |
| 476 Isolate::Current()->debugger()->UnloadDebugger(); | 476 CcTest::i_isolate()->debugger()->UnloadDebugger(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 | 479 |
| 480 } } // namespace v8::internal | 480 } } // namespace v8::internal |
| 481 | 481 |
| 482 | 482 |
| 483 // Check that the debugger has been fully unloaded. | 483 // Check that the debugger has been fully unloaded. |
| 484 static void CheckDebuggerUnloaded(bool check_functions = false) { | 484 static void CheckDebuggerUnloaded(bool check_functions = false) { |
| 485 // Let debugger to unload itself synchronously | 485 // Let debugger to unload itself synchronously |
| 486 v8::Debug::ProcessDebugMessages(); | 486 v8::Debug::ProcessDebugMessages(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 501 } | 501 } |
| 502 }; | 502 }; |
| 503 | 503 |
| 504 | 504 |
| 505 // Compile a function, set a break point and check that the call at the break | 505 // Compile a function, set a break point and check that the call at the break |
| 506 // location in the code is the expected debug_break function. | 506 // location in the code is the expected debug_break function. |
| 507 void CheckDebugBreakFunction(DebugLocalContext* env, | 507 void CheckDebugBreakFunction(DebugLocalContext* env, |
| 508 const char* source, const char* name, | 508 const char* source, const char* name, |
| 509 int position, v8::internal::RelocInfo::Mode mode, | 509 int position, v8::internal::RelocInfo::Mode mode, |
| 510 Code* debug_break) { | 510 Code* debug_break) { |
| 511 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 511 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 512 | 512 |
| 513 // Create function and set the break point. | 513 // Create function and set the break point. |
| 514 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( | 514 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( |
| 515 *CompileFunction(env, source, name)); | 515 *CompileFunction(env, source, name)); |
| 516 int bp = SetBreakPoint(fun, position); | 516 int bp = SetBreakPoint(fun, position); |
| 517 | 517 |
| 518 // Check that the debug break function is as expected. | 518 // Check that the debug break function is as expected. |
| 519 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); | 519 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); |
| 520 CHECK(Debug::HasDebugInfo(shared)); | 520 CHECK(Debug::HasDebugInfo(shared)); |
| 521 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); | 521 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 int last_source_column = -1; | 667 int last_source_column = -1; |
| 668 | 668 |
| 669 // Debug event handler which counts the break points which have been hit. | 669 // Debug event handler which counts the break points which have been hit. |
| 670 int break_point_hit_count = 0; | 670 int break_point_hit_count = 0; |
| 671 int break_point_hit_count_deoptimize = 0; | 671 int break_point_hit_count_deoptimize = 0; |
| 672 static void DebugEventBreakPointHitCount( | 672 static void DebugEventBreakPointHitCount( |
| 673 const v8::Debug::EventDetails& event_details) { | 673 const v8::Debug::EventDetails& event_details) { |
| 674 v8::DebugEvent event = event_details.GetEvent(); | 674 v8::DebugEvent event = event_details.GetEvent(); |
| 675 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); | 675 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); |
| 676 v8::Handle<v8::Object> event_data = event_details.GetEventData(); | 676 v8::Handle<v8::Object> event_data = event_details.GetEventData(); |
| 677 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); | 677 v8::internal::Isolate* isolate = CcTest::i_isolate(); |
| 678 Debug* debug = isolate->debug(); | 678 Debug* debug = isolate->debug(); |
| 679 // When hitting a debug event listener there must be a break set. | 679 // When hitting a debug event listener there must be a break set. |
| 680 CHECK_NE(debug->break_id(), 0); | 680 CHECK_NE(debug->break_id(), 0); |
| 681 | 681 |
| 682 // Count the number of breaks. | 682 // Count the number of breaks. |
| 683 if (event == v8::Break) { | 683 if (event == v8::Break) { |
| 684 break_point_hit_count++; | 684 break_point_hit_count++; |
| 685 if (!frame_function_name.IsEmpty()) { | 685 if (!frame_function_name.IsEmpty()) { |
| 686 // Get the name of the function. | 686 // Get the name of the function. |
| 687 const int argc = 2; | 687 const int argc = 2; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 break_point_hit_count = 0; | 780 break_point_hit_count = 0; |
| 781 exception_hit_count = 0; | 781 exception_hit_count = 0; |
| 782 uncaught_exception_hit_count = 0; | 782 uncaught_exception_hit_count = 0; |
| 783 } | 783 } |
| 784 | 784 |
| 785 static void DebugEventCounter( | 785 static void DebugEventCounter( |
| 786 const v8::Debug::EventDetails& event_details) { | 786 const v8::Debug::EventDetails& event_details) { |
| 787 v8::DebugEvent event = event_details.GetEvent(); | 787 v8::DebugEvent event = event_details.GetEvent(); |
| 788 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); | 788 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); |
| 789 v8::Handle<v8::Object> event_data = event_details.GetEventData(); | 789 v8::Handle<v8::Object> event_data = event_details.GetEventData(); |
| 790 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 790 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 791 | 791 |
| 792 // When hitting a debug event listener there must be a break set. | 792 // When hitting a debug event listener there must be a break set. |
| 793 CHECK_NE(debug->break_id(), 0); | 793 CHECK_NE(debug->break_id(), 0); |
| 794 | 794 |
| 795 // Count the number of breaks. | 795 // Count the number of breaks. |
| 796 if (event == v8::Break) { | 796 if (event == v8::Break) { |
| 797 break_point_hit_count++; | 797 break_point_hit_count++; |
| 798 } else if (event == v8::Exception) { | 798 } else if (event == v8::Exception) { |
| 799 exception_hit_count++; | 799 exception_hit_count++; |
| 800 | 800 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 "function evaluate_check(exec_state, expr, expected) {" | 842 "function evaluate_check(exec_state, expr, expected) {" |
| 843 " return exec_state.frame(0).evaluate(expr).value() === expected;" | 843 " return exec_state.frame(0).evaluate(expr).value() === expected;" |
| 844 "}"; | 844 "}"; |
| 845 v8::Local<v8::Function> evaluate_check_function; | 845 v8::Local<v8::Function> evaluate_check_function; |
| 846 | 846 |
| 847 // The actual debug event described by the longer comment above. | 847 // The actual debug event described by the longer comment above. |
| 848 static void DebugEventEvaluate( | 848 static void DebugEventEvaluate( |
| 849 const v8::Debug::EventDetails& event_details) { | 849 const v8::Debug::EventDetails& event_details) { |
| 850 v8::DebugEvent event = event_details.GetEvent(); | 850 v8::DebugEvent event = event_details.GetEvent(); |
| 851 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); | 851 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); |
| 852 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 852 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 853 // When hitting a debug event listener there must be a break set. | 853 // When hitting a debug event listener there must be a break set. |
| 854 CHECK_NE(debug->break_id(), 0); | 854 CHECK_NE(debug->break_id(), 0); |
| 855 | 855 |
| 856 if (event == v8::Break) { | 856 if (event == v8::Break) { |
| 857 for (int i = 0; checks[i].expr != NULL; i++) { | 857 for (int i = 0; checks[i].expr != NULL; i++) { |
| 858 const int argc = 3; | 858 const int argc = 3; |
| 859 v8::Handle<v8::Value> argv[argc] = { exec_state, | 859 v8::Handle<v8::Value> argv[argc] = { exec_state, |
| 860 v8::String::New(checks[i].expr), | 860 v8::String::New(checks[i].expr), |
| 861 checks[i].expected }; | 861 checks[i].expected }; |
| 862 v8::Handle<v8::Value> result = | 862 v8::Handle<v8::Value> result = |
| 863 evaluate_check_function->Call(exec_state, argc, argv); | 863 evaluate_check_function->Call(exec_state, argc, argv); |
| 864 if (!result->IsTrue()) { | 864 if (!result->IsTrue()) { |
| 865 v8::String::Utf8Value utf8(checks[i].expected->ToString()); | 865 v8::String::Utf8Value utf8(checks[i].expected->ToString()); |
| 866 V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8); | 866 V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8); |
| 867 } | 867 } |
| 868 } | 868 } |
| 869 } | 869 } |
| 870 } | 870 } |
| 871 | 871 |
| 872 | 872 |
| 873 // This debug event listener removes a breakpoint in a function | 873 // This debug event listener removes a breakpoint in a function |
| 874 int debug_event_remove_break_point = 0; | 874 int debug_event_remove_break_point = 0; |
| 875 static void DebugEventRemoveBreakPoint( | 875 static void DebugEventRemoveBreakPoint( |
| 876 const v8::Debug::EventDetails& event_details) { | 876 const v8::Debug::EventDetails& event_details) { |
| 877 v8::DebugEvent event = event_details.GetEvent(); | 877 v8::DebugEvent event = event_details.GetEvent(); |
| 878 v8::Handle<v8::Value> data = event_details.GetCallbackData(); | 878 v8::Handle<v8::Value> data = event_details.GetCallbackData(); |
| 879 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 879 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 880 // When hitting a debug event listener there must be a break set. | 880 // When hitting a debug event listener there must be a break set. |
| 881 CHECK_NE(debug->break_id(), 0); | 881 CHECK_NE(debug->break_id(), 0); |
| 882 | 882 |
| 883 if (event == v8::Break) { | 883 if (event == v8::Break) { |
| 884 break_point_hit_count++; | 884 break_point_hit_count++; |
| 885 CHECK(data->IsFunction()); | 885 CHECK(data->IsFunction()); |
| 886 ClearBreakPoint(debug_event_remove_break_point); | 886 ClearBreakPoint(debug_event_remove_break_point); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 | 890 |
| 891 // Debug event handler which counts break points hit and performs a step | 891 // Debug event handler which counts break points hit and performs a step |
| 892 // afterwards. | 892 // afterwards. |
| 893 StepAction step_action = StepIn; // Step action to perform when stepping. | 893 StepAction step_action = StepIn; // Step action to perform when stepping. |
| 894 static void DebugEventStep( | 894 static void DebugEventStep( |
| 895 const v8::Debug::EventDetails& event_details) { | 895 const v8::Debug::EventDetails& event_details) { |
| 896 v8::DebugEvent event = event_details.GetEvent(); | 896 v8::DebugEvent event = event_details.GetEvent(); |
| 897 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 897 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 898 // When hitting a debug event listener there must be a break set. | 898 // When hitting a debug event listener there must be a break set. |
| 899 CHECK_NE(debug->break_id(), 0); | 899 CHECK_NE(debug->break_id(), 0); |
| 900 | 900 |
| 901 if (event == v8::Break) { | 901 if (event == v8::Break) { |
| 902 break_point_hit_count++; | 902 break_point_hit_count++; |
| 903 PrepareStep(step_action); | 903 PrepareStep(step_action); |
| 904 } | 904 } |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 // Debug event handler which counts break points hit and performs a step | 908 // Debug event handler which counts break points hit and performs a step |
| 909 // afterwards. For each call the expected function is checked. | 909 // afterwards. For each call the expected function is checked. |
| 910 // For this debug event handler to work the following two global varaibles | 910 // For this debug event handler to work the following two global varaibles |
| 911 // must be initialized. | 911 // must be initialized. |
| 912 // expected_step_sequence: An array of the expected function call sequence. | 912 // expected_step_sequence: An array of the expected function call sequence. |
| 913 // frame_function_name: A JavaScript function (see below). | 913 // frame_function_name: A JavaScript function (see below). |
| 914 | 914 |
| 915 // String containing the expected function call sequence. Note: this only works | 915 // String containing the expected function call sequence. Note: this only works |
| 916 // if functions have name length of one. | 916 // if functions have name length of one. |
| 917 const char* expected_step_sequence = NULL; | 917 const char* expected_step_sequence = NULL; |
| 918 | 918 |
| 919 // The actual debug event described by the longer comment above. | 919 // The actual debug event described by the longer comment above. |
| 920 static void DebugEventStepSequence( | 920 static void DebugEventStepSequence( |
| 921 const v8::Debug::EventDetails& event_details) { | 921 const v8::Debug::EventDetails& event_details) { |
| 922 v8::DebugEvent event = event_details.GetEvent(); | 922 v8::DebugEvent event = event_details.GetEvent(); |
| 923 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); | 923 v8::Handle<v8::Object> exec_state = event_details.GetExecutionState(); |
| 924 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 924 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 925 // When hitting a debug event listener there must be a break set. | 925 // When hitting a debug event listener there must be a break set. |
| 926 CHECK_NE(debug->break_id(), 0); | 926 CHECK_NE(debug->break_id(), 0); |
| 927 | 927 |
| 928 if (event == v8::Break || event == v8::Exception) { | 928 if (event == v8::Break || event == v8::Exception) { |
| 929 // Check that the current function is the expected. | 929 // Check that the current function is the expected. |
| 930 CHECK(break_point_hit_count < | 930 CHECK(break_point_hit_count < |
| 931 StrLength(expected_step_sequence)); | 931 StrLength(expected_step_sequence)); |
| 932 const int argc = 2; | 932 const int argc = 2; |
| 933 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 933 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
| 934 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, | 934 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, |
| 935 argc, argv); | 935 argc, argv); |
| 936 CHECK(result->IsString()); | 936 CHECK(result->IsString()); |
| 937 v8::String::Utf8Value function_name(result->ToString()); | 937 v8::String::Utf8Value function_name(result->ToString()); |
| 938 CHECK_EQ(1, StrLength(*function_name)); | 938 CHECK_EQ(1, StrLength(*function_name)); |
| 939 CHECK_EQ((*function_name)[0], | 939 CHECK_EQ((*function_name)[0], |
| 940 expected_step_sequence[break_point_hit_count]); | 940 expected_step_sequence[break_point_hit_count]); |
| 941 | 941 |
| 942 // Perform step. | 942 // Perform step. |
| 943 break_point_hit_count++; | 943 break_point_hit_count++; |
| 944 PrepareStep(step_action); | 944 PrepareStep(step_action); |
| 945 } | 945 } |
| 946 } | 946 } |
| 947 | 947 |
| 948 | 948 |
| 949 // Debug event handler which performs a garbage collection. | 949 // Debug event handler which performs a garbage collection. |
| 950 static void DebugEventBreakPointCollectGarbage( | 950 static void DebugEventBreakPointCollectGarbage( |
| 951 const v8::Debug::EventDetails& event_details) { | 951 const v8::Debug::EventDetails& event_details) { |
| 952 v8::DebugEvent event = event_details.GetEvent(); | 952 v8::DebugEvent event = event_details.GetEvent(); |
| 953 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 953 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 954 // When hitting a debug event listener there must be a break set. | 954 // When hitting a debug event listener there must be a break set. |
| 955 CHECK_NE(debug->break_id(), 0); | 955 CHECK_NE(debug->break_id(), 0); |
| 956 | 956 |
| 957 // Perform a garbage collection when break point is hit and continue. Based | 957 // Perform a garbage collection when break point is hit and continue. Based |
| 958 // on the number of break points hit either scavenge or mark compact | 958 // on the number of break points hit either scavenge or mark compact |
| 959 // collector is used. | 959 // collector is used. |
| 960 if (event == v8::Break) { | 960 if (event == v8::Break) { |
| 961 break_point_hit_count++; | 961 break_point_hit_count++; |
| 962 if (break_point_hit_count % 2 == 0) { | 962 if (break_point_hit_count % 2 == 0) { |
| 963 // Scavenge. | 963 // Scavenge. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 | 1069 |
| 1070 CheckDebugBreakFunction(&env, | 1070 CheckDebugBreakFunction(&env, |
| 1071 "function f1(){}", "f1", | 1071 "function f1(){}", "f1", |
| 1072 0, | 1072 0, |
| 1073 v8::internal::RelocInfo::JS_RETURN, | 1073 v8::internal::RelocInfo::JS_RETURN, |
| 1074 NULL); | 1074 NULL); |
| 1075 CheckDebugBreakFunction(&env, | 1075 CheckDebugBreakFunction(&env, |
| 1076 "function f2(){x=1;}", "f2", | 1076 "function f2(){x=1;}", "f2", |
| 1077 0, | 1077 0, |
| 1078 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, | 1078 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, |
| 1079 Isolate::Current()->builtins()->builtin( | 1079 CcTest::i_isolate()->builtins()->builtin( |
| 1080 Builtins::kStoreIC_DebugBreak)); | 1080 Builtins::kStoreIC_DebugBreak)); |
| 1081 CheckDebugBreakFunction(&env, | 1081 CheckDebugBreakFunction(&env, |
| 1082 "function f3(){var a=x;}", "f3", | 1082 "function f3(){var a=x;}", "f3", |
| 1083 0, | 1083 0, |
| 1084 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, | 1084 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, |
| 1085 Isolate::Current()->builtins()->builtin( | 1085 CcTest::i_isolate()->builtins()->builtin( |
| 1086 Builtins::kLoadIC_DebugBreak)); | 1086 Builtins::kLoadIC_DebugBreak)); |
| 1087 | 1087 |
| 1088 // TODO(1240753): Make the test architecture independent or split | 1088 // TODO(1240753): Make the test architecture independent or split |
| 1089 // parts of the debugger into architecture dependent files. This | 1089 // parts of the debugger into architecture dependent files. This |
| 1090 // part currently disabled as it is not portable between IA32/ARM. | 1090 // part currently disabled as it is not portable between IA32/ARM. |
| 1091 // Currently on ICs for keyed store/load on ARM. | 1091 // Currently on ICs for keyed store/load on ARM. |
| 1092 #if !defined (__arm__) && !defined(__thumb__) | 1092 #if !defined (__arm__) && !defined(__thumb__) |
| 1093 CheckDebugBreakFunction( | 1093 CheckDebugBreakFunction( |
| 1094 &env, | 1094 &env, |
| 1095 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", | 1095 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", |
| 1096 "f4", | 1096 "f4", |
| 1097 0, | 1097 0, |
| 1098 v8::internal::RelocInfo::CODE_TARGET, | 1098 v8::internal::RelocInfo::CODE_TARGET, |
| 1099 Isolate::Current()->builtins()->builtin( | 1099 CcTest::i_isolate()->builtins()->builtin( |
| 1100 Builtins::kKeyedStoreIC_DebugBreak)); | 1100 Builtins::kKeyedStoreIC_DebugBreak)); |
| 1101 CheckDebugBreakFunction( | 1101 CheckDebugBreakFunction( |
| 1102 &env, | 1102 &env, |
| 1103 "function f5(){var index='propertyName'; var a={}; return a[index];}", | 1103 "function f5(){var index='propertyName'; var a={}; return a[index];}", |
| 1104 "f5", | 1104 "f5", |
| 1105 0, | 1105 0, |
| 1106 v8::internal::RelocInfo::CODE_TARGET, | 1106 v8::internal::RelocInfo::CODE_TARGET, |
| 1107 Isolate::Current()->builtins()->builtin( | 1107 CcTest::i_isolate()->builtins()->builtin( |
| 1108 Builtins::kKeyedLoadIC_DebugBreak)); | 1108 Builtins::kKeyedLoadIC_DebugBreak)); |
| 1109 #endif | 1109 #endif |
| 1110 | 1110 |
| 1111 CheckDebugBreakFunction( | 1111 CheckDebugBreakFunction( |
| 1112 &env, | 1112 &env, |
| 1113 "function f6(a){return a==null;}", | 1113 "function f6(a){return a==null;}", |
| 1114 "f6", | 1114 "f6", |
| 1115 0, | 1115 0, |
| 1116 v8::internal::RelocInfo::CODE_TARGET, | 1116 v8::internal::RelocInfo::CODE_TARGET, |
| 1117 Isolate::Current()->builtins()->builtin( | 1117 CcTest::i_isolate()->builtins()->builtin( |
| 1118 Builtins::kCompareNilIC_DebugBreak)); | 1118 Builtins::kCompareNilIC_DebugBreak)); |
| 1119 | 1119 |
| 1120 // Check the debug break code stubs for call ICs with different number of | 1120 // Check the debug break code stubs for call ICs with different number of |
| 1121 // parameters. | 1121 // parameters. |
| 1122 Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); | 1122 Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); |
| 1123 Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); | 1123 Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); |
| 1124 Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); | 1124 Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); |
| 1125 | 1125 |
| 1126 CheckDebugBreakFunction(&env, | 1126 CheckDebugBreakFunction(&env, |
| 1127 "function f4_0(){x();}", "f4_0", | 1127 "function f4_0(){x();}", "f4_0", |
| (...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3840 // of debug event exception callbacks and message callbacks are collected. The | 3840 // of debug event exception callbacks and message callbacks are collected. The |
| 3841 // number of debug event exception callbacks are used to check that the | 3841 // number of debug event exception callbacks are used to check that the |
| 3842 // debugger is called correctly and the number of message callbacks is used to | 3842 // debugger is called correctly and the number of message callbacks is used to |
| 3843 // check that uncaught exceptions are still returned even if there is a break | 3843 // check that uncaught exceptions are still returned even if there is a break |
| 3844 // for them. | 3844 // for them. |
| 3845 TEST(BreakOnException) { | 3845 TEST(BreakOnException) { |
| 3846 DebugLocalContext env; | 3846 DebugLocalContext env; |
| 3847 v8::HandleScope scope(env->GetIsolate()); | 3847 v8::HandleScope scope(env->GetIsolate()); |
| 3848 env.ExposeDebug(); | 3848 env.ExposeDebug(); |
| 3849 | 3849 |
| 3850 v8::internal::Isolate::Current()->TraceException(false); | 3850 CcTest::i_isolate()->TraceException(false); |
| 3851 | 3851 |
| 3852 // Create functions for testing break on exception. | 3852 // Create functions for testing break on exception. |
| 3853 CompileFunction(&env, "function throws(){throw 1;}", "throws"); | 3853 CompileFunction(&env, "function throws(){throw 1;}", "throws"); |
| 3854 v8::Local<v8::Function> caught = | 3854 v8::Local<v8::Function> caught = |
| 3855 CompileFunction(&env, | 3855 CompileFunction(&env, |
| 3856 "function caught(){try {throws();} catch(e) {};}", | 3856 "function caught(){try {throws();} catch(e) {};}", |
| 3857 "caught"); | 3857 "caught"); |
| 3858 v8::Local<v8::Function> notCaught = | 3858 v8::Local<v8::Function> notCaught = |
| 3859 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); | 3859 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); |
| 3860 | 3860 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 // Test break on exception from compiler errors. When compiling using | 3986 // Test break on exception from compiler errors. When compiling using |
| 3987 // v8::Script::Compile there is no JavaScript stack whereas when compiling using | 3987 // v8::Script::Compile there is no JavaScript stack whereas when compiling using |
| 3988 // eval there are JavaScript frames. | 3988 // eval there are JavaScript frames. |
| 3989 TEST(BreakOnCompileException) { | 3989 TEST(BreakOnCompileException) { |
| 3990 DebugLocalContext env; | 3990 DebugLocalContext env; |
| 3991 v8::HandleScope scope(env->GetIsolate()); | 3991 v8::HandleScope scope(env->GetIsolate()); |
| 3992 | 3992 |
| 3993 // For this test, we want to break on uncaught exceptions: | 3993 // For this test, we want to break on uncaught exceptions: |
| 3994 ChangeBreakOnException(false, true); | 3994 ChangeBreakOnException(false, true); |
| 3995 | 3995 |
| 3996 v8::internal::Isolate::Current()->TraceException(false); | 3996 CcTest::i_isolate()->TraceException(false); |
| 3997 | 3997 |
| 3998 // Create a function for checking the function when hitting a break point. | 3998 // Create a function for checking the function when hitting a break point. |
| 3999 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); | 3999 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); |
| 4000 | 4000 |
| 4001 v8::V8::AddMessageListener(MessageCallbackCount); | 4001 v8::V8::AddMessageListener(MessageCallbackCount); |
| 4002 v8::Debug::SetDebugEventListener2(DebugEventCounter); | 4002 v8::Debug::SetDebugEventListener2(DebugEventCounter); |
| 4003 | 4003 |
| 4004 DebugEventCounterClear(); | 4004 DebugEventCounterClear(); |
| 4005 MessageCallbackCountClear(); | 4005 MessageCallbackCountClear(); |
| 4006 | 4006 |
| (...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5912 debug_message_dispatch_v8_thread.Start(); | 5912 debug_message_dispatch_v8_thread.Start(); |
| 5913 debug_message_dispatch_debugger_thread.Start(); | 5913 debug_message_dispatch_debugger_thread.Start(); |
| 5914 | 5914 |
| 5915 debug_message_dispatch_v8_thread.Join(); | 5915 debug_message_dispatch_v8_thread.Join(); |
| 5916 debug_message_dispatch_debugger_thread.Join(); | 5916 debug_message_dispatch_debugger_thread.Join(); |
| 5917 } | 5917 } |
| 5918 | 5918 |
| 5919 | 5919 |
| 5920 TEST(DebuggerAgent) { | 5920 TEST(DebuggerAgent) { |
| 5921 v8::V8::Initialize(); | 5921 v8::V8::Initialize(); |
| 5922 i::Debugger* debugger = i::Isolate::Current()->debugger(); | 5922 i::Debugger* debugger = CcTest::i_isolate()->debugger(); |
| 5923 // Make sure these ports is not used by other tests to allow tests to run in | 5923 // Make sure these ports is not used by other tests to allow tests to run in |
| 5924 // parallel. | 5924 // parallel. |
| 5925 const int kPort1 = 5858 + FlagDependentPortOffset(); | 5925 const int kPort1 = 5858 + FlagDependentPortOffset(); |
| 5926 const int kPort2 = 5857 + FlagDependentPortOffset(); | 5926 const int kPort2 = 5857 + FlagDependentPortOffset(); |
| 5927 const int kPort3 = 5856 + FlagDependentPortOffset(); | 5927 const int kPort3 = 5856 + FlagDependentPortOffset(); |
| 5928 | 5928 |
| 5929 // Make a string with the port2 number. | 5929 // Make a string with the port2 number. |
| 5930 const int kPortBufferLen = 6; | 5930 const int kPortBufferLen = 6; |
| 5931 char port2_str[kPortBufferLen]; | 5931 char port2_str[kPortBufferLen]; |
| 5932 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2); | 5932 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6529 v8::DebugEvent event = event_details.GetEvent(); | 6529 v8::DebugEvent event = event_details.GetEvent(); |
| 6530 // Count the number of breaks. | 6530 // Count the number of breaks. |
| 6531 if (event == v8::ScriptCollected) { | 6531 if (event == v8::ScriptCollected) { |
| 6532 script_collected_count++; | 6532 script_collected_count++; |
| 6533 } | 6533 } |
| 6534 } | 6534 } |
| 6535 | 6535 |
| 6536 | 6536 |
| 6537 // Test that scripts collected are reported through the debug event listener. | 6537 // Test that scripts collected are reported through the debug event listener. |
| 6538 TEST(ScriptCollectedEvent) { | 6538 TEST(ScriptCollectedEvent) { |
| 6539 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 6539 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 6540 break_point_hit_count = 0; | 6540 break_point_hit_count = 0; |
| 6541 script_collected_count = 0; | 6541 script_collected_count = 0; |
| 6542 DebugLocalContext env; | 6542 DebugLocalContext env; |
| 6543 v8::HandleScope scope(env->GetIsolate()); | 6543 v8::HandleScope scope(env->GetIsolate()); |
| 6544 | 6544 |
| 6545 // Request the loaded scripts to initialize the debugger script cache. | 6545 // Request the loaded scripts to initialize the debugger script cache. |
| 6546 debug->GetLoadedScripts(); | 6546 debug->GetLoadedScripts(); |
| 6547 | 6547 |
| 6548 // Do garbage collection to ensure that only the script in this test will be | 6548 // Do garbage collection to ensure that only the script in this test will be |
| 6549 // collected afterwards. | 6549 // collected afterwards. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6767 // sent. | 6767 // sent. |
| 6768 CHECK_EQ(1, after_compile_message_count); | 6768 CHECK_EQ(1, after_compile_message_count); |
| 6769 | 6769 |
| 6770 ClearBreakPointFromJS(sbp1); | 6770 ClearBreakPointFromJS(sbp1); |
| 6771 ClearBreakPointFromJS(sbp2); | 6771 ClearBreakPointFromJS(sbp2); |
| 6772 v8::Debug::SetMessageHandler2(NULL); | 6772 v8::Debug::SetMessageHandler2(NULL); |
| 6773 } | 6773 } |
| 6774 | 6774 |
| 6775 | 6775 |
| 6776 static void BreakMessageHandler(const v8::Debug::Message& message) { | 6776 static void BreakMessageHandler(const v8::Debug::Message& message) { |
| 6777 i::Isolate* isolate = i::Isolate::Current(); | 6777 i::Isolate* isolate = CcTest::i_isolate(); |
| 6778 if (message.IsEvent() && message.GetEvent() == v8::Break) { | 6778 if (message.IsEvent() && message.GetEvent() == v8::Break) { |
| 6779 // Count the number of breaks. | 6779 // Count the number of breaks. |
| 6780 break_point_hit_count++; | 6780 break_point_hit_count++; |
| 6781 | 6781 |
| 6782 i::HandleScope scope(isolate); | 6782 i::HandleScope scope(isolate); |
| 6783 message.GetJSON(); | 6783 message.GetJSON(); |
| 6784 | 6784 |
| 6785 SendContinueCommand(); | 6785 SendContinueCommand(); |
| 6786 } else if (message.IsEvent() && message.GetEvent() == v8::AfterCompile) { | 6786 } else if (message.IsEvent() && message.GetEvent() == v8::AfterCompile) { |
| 6787 i::HandleScope scope(isolate); | 6787 i::HandleScope scope(isolate); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7032 "})")); | 7032 "})")); |
| 7033 const int argc = 1; | 7033 const int argc = 1; |
| 7034 v8::Handle<v8::Value> argv[argc] = { exec_state }; | 7034 v8::Handle<v8::Value> argv[argc] = { exec_state }; |
| 7035 v8::Handle<v8::Value> result = func->Call(exec_state, argc, argv); | 7035 v8::Handle<v8::Value> result = func->Call(exec_state, argc, argv); |
| 7036 CHECK(result->IsTrue()); | 7036 CHECK(result->IsTrue()); |
| 7037 } | 7037 } |
| 7038 } | 7038 } |
| 7039 | 7039 |
| 7040 | 7040 |
| 7041 TEST(CallingContextIsNotDebugContext) { | 7041 TEST(CallingContextIsNotDebugContext) { |
| 7042 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 7042 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
| 7043 // Create and enter a debugee context. | 7043 // Create and enter a debugee context. |
| 7044 DebugLocalContext env; | 7044 DebugLocalContext env; |
| 7045 v8::HandleScope scope(env->GetIsolate()); | 7045 v8::HandleScope scope(env->GetIsolate()); |
| 7046 env.ExposeDebug(); | 7046 env.ExposeDebug(); |
| 7047 | 7047 |
| 7048 // Save handles to the debugger and debugee contexts to be used in | 7048 // Save handles to the debugger and debugee contexts to be used in |
| 7049 // NamedGetterWithCallingContextCheck. | 7049 // NamedGetterWithCallingContextCheck. |
| 7050 debugee_context = env.context(); | 7050 debugee_context = env.context(); |
| 7051 debugger_context = v8::Utils::ToLocal(debug->debug_context()); | 7051 debugger_context = v8::Utils::ToLocal(debug->debug_context()); |
| 7052 | 7052 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7188 const int argc = 2; | 7188 const int argc = 2; |
| 7189 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 7189 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
| 7190 v8::Handle<v8::Value> result = | 7190 v8::Handle<v8::Value> result = |
| 7191 frame_function_name->Call(exec_state, argc, argv); | 7191 frame_function_name->Call(exec_state, argc, argv); |
| 7192 if (!result->IsUndefined()) { | 7192 if (!result->IsUndefined()) { |
| 7193 char fn[80]; | 7193 char fn[80]; |
| 7194 CHECK(result->IsString()); | 7194 CHECK(result->IsString()); |
| 7195 v8::Handle<v8::String> function_name(result->ToString()); | 7195 v8::Handle<v8::String> function_name(result->ToString()); |
| 7196 function_name->WriteUtf8(fn); | 7196 function_name->WriteUtf8(fn); |
| 7197 if (strcmp(fn, "bar") == 0) { | 7197 if (strcmp(fn, "bar") == 0) { |
| 7198 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); | 7198 i::Deoptimizer::DeoptimizeAll(CcTest::i_isolate()); |
| 7199 debug_event_break_deoptimize_done = true; | 7199 debug_event_break_deoptimize_done = true; |
| 7200 } | 7200 } |
| 7201 } | 7201 } |
| 7202 } | 7202 } |
| 7203 | 7203 |
| 7204 v8::Debug::DebugBreak(CcTest::isolate()); | 7204 v8::Debug::DebugBreak(CcTest::isolate()); |
| 7205 } | 7205 } |
| 7206 } | 7206 } |
| 7207 | 7207 |
| 7208 | 7208 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7549 TEST(LiveEditDisabled) { | 7549 TEST(LiveEditDisabled) { |
| 7550 v8::internal::FLAG_allow_natives_syntax = true; | 7550 v8::internal::FLAG_allow_natives_syntax = true; |
| 7551 LocalContext env; | 7551 LocalContext env; |
| 7552 v8::HandleScope scope(env->GetIsolate()); | 7552 v8::HandleScope scope(env->GetIsolate()); |
| 7553 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); | 7553 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); |
| 7554 CompileRun("%LiveEditCompareStrings('', '')"); | 7554 CompileRun("%LiveEditCompareStrings('', '')"); |
| 7555 } | 7555 } |
| 7556 | 7556 |
| 7557 | 7557 |
| 7558 #endif // ENABLE_DEBUGGER_SUPPORT | 7558 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |