OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 bool* caught_exception) { | 1391 bool* caught_exception) { |
1392 // Create the new function event object. | 1392 // Create the new function event object. |
1393 const int argc = 1; | 1393 const int argc = 1; |
1394 Object** argv[argc] = { function.location() }; | 1394 Object** argv[argc] = { function.location() }; |
1395 return MakeJSObject(CStrVector("MakeNewFunctionEvent"), | 1395 return MakeJSObject(CStrVector("MakeNewFunctionEvent"), |
1396 argc, argv, caught_exception); | 1396 argc, argv, caught_exception); |
1397 } | 1397 } |
1398 | 1398 |
1399 | 1399 |
1400 Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script, | 1400 Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script, |
1401 Handle<Object> script_function, | 1401 bool before, |
1402 bool* caught_exception) { | 1402 bool* caught_exception) { |
1403 // Create the compile event object. | 1403 // Create the compile event object. |
1404 Handle<Object> exec_state = MakeExecutionState(caught_exception); | 1404 Handle<Object> exec_state = MakeExecutionState(caught_exception); |
1405 Handle<Object> script_source(script->source()); | 1405 Handle<Object> script_wrapper = GetScriptWrapper(script); |
1406 Handle<Object> script_name(script->name()); | |
1407 const int argc = 3; | 1406 const int argc = 3; |
1408 Object** argv[argc] = { script_source.location(), | 1407 Object** argv[argc] = { exec_state.location(), |
1409 script_name.location(), | 1408 script_wrapper.location(), |
1410 script_function.location() }; | 1409 before ? Factory::true_value().location() : |
| 1410 Factory::false_value().location() }; |
| 1411 |
1411 return MakeJSObject(CStrVector("MakeCompileEvent"), | 1412 return MakeJSObject(CStrVector("MakeCompileEvent"), |
1412 argc, | 1413 argc, |
1413 argv, | 1414 argv, |
1414 caught_exception); | 1415 caught_exception); |
1415 } | 1416 } |
1416 | 1417 |
1417 | 1418 |
1418 void Debugger::OnException(Handle<Object> exception, bool uncaught) { | 1419 void Debugger::OnException(Handle<Object> exception, bool uncaught) { |
1419 HandleScope scope; | 1420 HandleScope scope; |
1420 | 1421 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 if (Debug::InDebugger()) return; | 1495 if (Debug::InDebugger()) return; |
1495 if (compiling_natives()) return; | 1496 if (compiling_natives()) return; |
1496 if (!EventActive(v8::BeforeCompile)) return; | 1497 if (!EventActive(v8::BeforeCompile)) return; |
1497 | 1498 |
1498 // Enter the debugger. | 1499 // Enter the debugger. |
1499 EnterDebugger debugger; | 1500 EnterDebugger debugger; |
1500 if (debugger.FailedToEnter()) return; | 1501 if (debugger.FailedToEnter()) return; |
1501 | 1502 |
1502 // Create the event data object. | 1503 // Create the event data object. |
1503 bool caught_exception = false; | 1504 bool caught_exception = false; |
1504 Handle<Object> event_data = MakeCompileEvent(script, | 1505 Handle<Object> event_data = MakeCompileEvent(script, true, &caught_exception); |
1505 Factory::undefined_value(), | |
1506 &caught_exception); | |
1507 // Bail out and don't call debugger if exception. | 1506 // Bail out and don't call debugger if exception. |
1508 if (caught_exception) { | 1507 if (caught_exception) { |
1509 return; | 1508 return; |
1510 } | 1509 } |
1511 | 1510 |
1512 // Process debug event | 1511 // Process debug event |
1513 ProcessDebugEvent(v8::BeforeCompile, event_data); | 1512 ProcessDebugEvent(v8::BeforeCompile, event_data); |
1514 } | 1513 } |
1515 | 1514 |
1516 | 1515 |
1517 // Handle debugger actions when a new script is compiled. | 1516 // Handle debugger actions when a new script is compiled. |
1518 void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun) { | 1517 void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun) { |
1519 HandleScope scope; | 1518 HandleScope scope; |
1520 | 1519 |
1521 // No compile events while compiling natives. | 1520 // No compile events while compiling natives. |
1522 if (compiling_natives()) return; | 1521 if (compiling_natives()) return; |
1523 | 1522 |
1524 // No more to do if not debugging. | 1523 // No more to do if not debugging. |
1525 if (!debugger_active()) return; | 1524 if (!debugger_active()) return; |
1526 | 1525 |
| 1526 // Store whether in debugger before entering debugger. |
| 1527 bool in_debugger = Debug::InDebugger(); |
| 1528 |
1527 // Enter the debugger. | 1529 // Enter the debugger. |
1528 EnterDebugger debugger; | 1530 EnterDebugger debugger; |
1529 if (debugger.FailedToEnter()) return; | 1531 if (debugger.FailedToEnter()) return; |
1530 | 1532 |
1531 // If debugging there might be script break points registered for this | 1533 // If debugging there might be script break points registered for this |
1532 // script. Make sure that these break points are set. | 1534 // script. Make sure that these break points are set. |
1533 | 1535 |
1534 // Get the function UpdateScriptBreakPoints (defined in debug-delay.js). | 1536 // Get the function UpdateScriptBreakPoints (defined in debug-delay.js). |
1535 Handle<Object> update_script_break_points = | 1537 Handle<Object> update_script_break_points = |
1536 Handle<Object>(Debug::debug_context()->global()->GetProperty( | 1538 Handle<Object>(Debug::debug_context()->global()->GetProperty( |
(...skipping 12 matching lines...) Expand all Loading... |
1549 const int argc = 1; | 1551 const int argc = 1; |
1550 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; | 1552 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; |
1551 Handle<Object> result = Execution::TryCall( | 1553 Handle<Object> result = Execution::TryCall( |
1552 Handle<JSFunction>::cast(update_script_break_points), | 1554 Handle<JSFunction>::cast(update_script_break_points), |
1553 Top::builtins(), argc, argv, | 1555 Top::builtins(), argc, argv, |
1554 &caught_exception); | 1556 &caught_exception); |
1555 if (caught_exception) { | 1557 if (caught_exception) { |
1556 return; | 1558 return; |
1557 } | 1559 } |
1558 // Bail out based on state or if there is no listener for this event | 1560 // Bail out based on state or if there is no listener for this event |
1559 if (Debug::InDebugger()) return; | 1561 if (in_debugger) return; |
1560 if (!Debugger::EventActive(v8::AfterCompile)) return; | 1562 if (!Debugger::EventActive(v8::AfterCompile)) return; |
1561 | 1563 |
1562 // Create the compile state object. | 1564 // Create the compile state object. |
1563 Handle<Object> event_data = MakeCompileEvent(script, | 1565 Handle<Object> event_data = MakeCompileEvent(script, |
1564 Factory::undefined_value(), | 1566 false, |
1565 &caught_exception); | 1567 &caught_exception); |
1566 // Bail out and don't call debugger if exception. | 1568 // Bail out and don't call debugger if exception. |
1567 if (caught_exception) { | 1569 if (caught_exception) { |
1568 return; | 1570 return; |
1569 } | 1571 } |
1570 // Process debug event | 1572 // Process debug event |
1571 ProcessDebugEvent(v8::AfterCompile, event_data); | 1573 ProcessDebugEvent(v8::AfterCompile, event_data); |
1572 } | 1574 } |
1573 | 1575 |
1574 | 1576 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 } | 2035 } |
2034 | 2036 |
2035 | 2037 |
2036 void LockingMessageQueue::Clear() { | 2038 void LockingMessageQueue::Clear() { |
2037 ScopedLock sl(lock_); | 2039 ScopedLock sl(lock_); |
2038 queue_.Clear(); | 2040 queue_.Clear(); |
2039 } | 2041 } |
2040 | 2042 |
2041 | 2043 |
2042 } } // namespace v8::internal | 2044 } } // namespace v8::internal |
OLD | NEW |