| 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 4528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4539 return Smi::FromInt(id >> 2); | 4539 return Smi::FromInt(id >> 2); |
| 4540 } | 4540 } |
| 4541 | 4541 |
| 4542 | 4542 |
| 4543 static StackFrame::Id UnwrapFrameId(Smi* wrapped) { | 4543 static StackFrame::Id UnwrapFrameId(Smi* wrapped) { |
| 4544 return static_cast<StackFrame::Id>(wrapped->value() << 2); | 4544 return static_cast<StackFrame::Id>(wrapped->value() << 2); |
| 4545 } | 4545 } |
| 4546 | 4546 |
| 4547 | 4547 |
| 4548 // Adds a JavaScript function as a debug event listener. | 4548 // Adds a JavaScript function as a debug event listener. |
| 4549 // args[0]: debug event listener function | 4549 // args[0]: debug event listener function to set or null or undefined for |
| 4550 // clearing the event listener function |
| 4550 // args[1]: object supplied during callback | 4551 // args[1]: object supplied during callback |
| 4551 static Object* Runtime_AddDebugEventListener(Arguments args) { | 4552 static Object* Runtime_SetDebugEventListener(Arguments args) { |
| 4552 ASSERT(args.length() == 2); | 4553 ASSERT(args.length() == 2); |
| 4553 // Convert the parameters to API objects to call the API function for adding | 4554 RUNTIME_ASSERT(args[0]->IsJSFunction() || |
| 4554 // a JavaScript function as debug event listener. | 4555 args[0]->IsUndefined() || |
| 4555 CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0); | 4556 args[0]->IsNull()); |
| 4556 v8::Handle<v8::Function> fun(ToApi<v8::Function>(raw_fun)); | 4557 Handle<Object> callback = args.at<Object>(0); |
| 4557 v8::Handle<v8::Value> data(ToApi<v8::Value>(args.at<Object>(0))); | 4558 Handle<Object> data = args.at<Object>(1); |
| 4558 v8::Debug::AddDebugEventListener(fun, data); | 4559 Debugger::SetEventListener(callback, data); |
| 4559 | |
| 4560 return Heap::undefined_value(); | |
| 4561 } | |
| 4562 | |
| 4563 | |
| 4564 // Removes a JavaScript function debug event listener. | |
| 4565 // args[0]: debug event listener function | |
| 4566 static Object* Runtime_RemoveDebugEventListener(Arguments args) { | |
| 4567 ASSERT(args.length() == 1); | |
| 4568 // Convert the parameter to an API object to call the API function for | |
| 4569 // removing a JavaScript function debug event listener. | |
| 4570 CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0); | |
| 4571 v8::Handle<v8::Function> fun(ToApi<v8::Function>(raw_fun)); | |
| 4572 v8::Debug::RemoveDebugEventListener(fun); | |
| 4573 | 4560 |
| 4574 return Heap::undefined_value(); | 4561 return Heap::undefined_value(); |
| 4575 } | 4562 } |
| 4576 | 4563 |
| 4577 | 4564 |
| 4578 static Object* Runtime_Break(Arguments args) { | 4565 static Object* Runtime_Break(Arguments args) { |
| 4579 ASSERT(args.length() == 0); | 4566 ASSERT(args.length() == 0); |
| 4580 StackGuard::DebugBreak(); | 4567 StackGuard::DebugBreak(); |
| 4581 return Heap::undefined_value(); | 4568 return Heap::undefined_value(); |
| 4582 } | 4569 } |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6091 } else { | 6078 } else { |
| 6092 // Handle last resort GC and make sure to allow future allocations | 6079 // Handle last resort GC and make sure to allow future allocations |
| 6093 // to grow the heap without causing GCs (if possible). | 6080 // to grow the heap without causing GCs (if possible). |
| 6094 Counters::gc_last_resort_from_js.Increment(); | 6081 Counters::gc_last_resort_from_js.Increment(); |
| 6095 Heap::CollectAllGarbage(); | 6082 Heap::CollectAllGarbage(); |
| 6096 } | 6083 } |
| 6097 } | 6084 } |
| 6098 | 6085 |
| 6099 | 6086 |
| 6100 } } // namespace v8::internal | 6087 } } // namespace v8::internal |
| OLD | NEW |