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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 | 1253 |
1254 | 1254 |
1255 void Debug::SetBreak(StackFrame::Id break_frame_id, int break_id) { | 1255 void Debug::SetBreak(StackFrame::Id break_frame_id, int break_id) { |
1256 thread_local_.break_frame_id_ = break_frame_id; | 1256 thread_local_.break_frame_id_ = break_frame_id; |
1257 thread_local_.break_id_ = break_id; | 1257 thread_local_.break_id_ = break_id; |
1258 } | 1258 } |
1259 | 1259 |
1260 | 1260 |
1261 // Handle stepping into a function. | 1261 // Handle stepping into a function. |
1262 void Debug::HandleStepIn(Handle<JSFunction> function, | 1262 void Debug::HandleStepIn(Handle<JSFunction> function, |
| 1263 Handle<Object> holder, |
1263 Address fp, | 1264 Address fp, |
1264 bool is_constructor) { | 1265 bool is_constructor) { |
1265 // If the frame pointer is not supplied by the caller find it. | 1266 // If the frame pointer is not supplied by the caller find it. |
1266 if (fp == 0) { | 1267 if (fp == 0) { |
1267 StackFrameIterator it; | 1268 StackFrameIterator it; |
1268 it.Advance(); | 1269 it.Advance(); |
1269 // For constructor functions skip another frame. | 1270 // For constructor functions skip another frame. |
1270 if (is_constructor) { | 1271 if (is_constructor) { |
1271 ASSERT(it.frame()->is_construct()); | 1272 ASSERT(it.frame()->is_construct()); |
1272 it.Advance(); | 1273 it.Advance(); |
1273 } | 1274 } |
1274 fp = it.frame()->fp(); | 1275 fp = it.frame()->fp(); |
1275 } | 1276 } |
1276 | 1277 |
1277 // Flood the function with one-shot break points if it is called from where | 1278 // Flood the function with one-shot break points if it is called from where |
1278 // step into was requested. | 1279 // step into was requested. |
1279 if (fp == Debug::step_in_fp()) { | 1280 if (fp == Debug::step_in_fp()) { |
1280 // Don't allow step into functions in the native context. | 1281 // Don't allow step into functions in the native context. |
1281 if (function->context()->global() != Top::context()->builtins()) { | 1282 if (function->context()->global() != Top::context()->builtins()) { |
1282 if (function->shared()->code() == | 1283 if (function->shared()->code() == |
1283 Builtins::builtin(Builtins::FunctionApply) || | 1284 Builtins::builtin(Builtins::FunctionApply) || |
1284 function->shared()->code() == | 1285 function->shared()->code() == |
1285 Builtins::builtin(Builtins::FunctionCall)) { | 1286 Builtins::builtin(Builtins::FunctionCall)) { |
1286 // Handle function.apply and function.call separately to flood the | 1287 // Handle function.apply and function.call separately to flood the |
1287 // function to be called and not the code for Builtins::FunctionApply or | 1288 // function to be called and not the code for Builtins::FunctionApply or |
1288 // Builtins::FunctionCall. At the point of the call IC to call either | 1289 // Builtins::FunctionCall. The receiver of call/apply is the target |
1289 // Builtins::FunctionApply or Builtins::FunctionCall the expression | 1290 // function. |
1290 // stack has the following content: | 1291 if (!holder.is_null() && holder->IsJSFunction()) { |
1291 // symbol "apply" or "call" | 1292 Handle<SharedFunctionInfo> shared_info( |
1292 // function apply or call was called on | 1293 JSFunction::cast(*holder)->shared()); |
1293 // receiver for apply or call (first parameter to apply or call) | 1294 Debug::FloodWithOneShot(shared_info); |
1294 // ... further arguments to apply or call. | |
1295 JavaScriptFrameIterator it; | |
1296 ASSERT(it.frame()->fp() == fp); | |
1297 ASSERT(it.frame()->GetExpression(1)->IsJSFunction()); | |
1298 if (it.frame()->GetExpression(1)->IsJSFunction()) { | |
1299 Handle<JSFunction> | |
1300 actual_function(JSFunction::cast(it.frame()->GetExpression(1))); | |
1301 Handle<SharedFunctionInfo> actual_shared(actual_function->shared()); | |
1302 Debug::FloodWithOneShot(actual_shared); | |
1303 } | 1295 } |
1304 } else { | 1296 } else { |
1305 Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared())); | 1297 Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared())); |
1306 } | 1298 } |
1307 } | 1299 } |
1308 } | 1300 } |
1309 } | 1301 } |
1310 | 1302 |
1311 | 1303 |
1312 void Debug::ClearStepping() { | 1304 void Debug::ClearStepping() { |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 | 2540 |
2549 | 2541 |
2550 void LockingCommandMessageQueue::Clear() { | 2542 void LockingCommandMessageQueue::Clear() { |
2551 ScopedLock sl(lock_); | 2543 ScopedLock sl(lock_); |
2552 queue_.Clear(); | 2544 queue_.Clear(); |
2553 } | 2545 } |
2554 | 2546 |
2555 #endif // ENABLE_DEBUGGER_SUPPORT | 2547 #endif // ENABLE_DEBUGGER_SUPPORT |
2556 | 2548 |
2557 } } // namespace v8::internal | 2549 } } // namespace v8::internal |
OLD | NEW |