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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ScopedVector<char> data(s->Length() + 1); | 55 ScopedVector<char> data(s->Length() + 1); |
56 if (data.start() == NULL) { | 56 if (data.start() == NULL) { |
57 V8::FatalProcessOutOfMemory("PrintLn"); | 57 V8::FatalProcessOutOfMemory("PrintLn"); |
58 return; | 58 return; |
59 } | 59 } |
60 s->WriteAscii(data.start()); | 60 s->WriteAscii(data.start()); |
61 PrintF("%s\n", data.start()); | 61 PrintF("%s\n", data.start()); |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 static Handle<Code> ComputeCallDebugBreak(int argc) { | 65 static Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind) { |
66 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc), Code); | 66 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc, kind), Code); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc) { | 70 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) { |
71 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugPrepareStepIn(argc), Code); | 71 CALL_HEAP_FUNCTION( |
| 72 StubCache::ComputeCallDebugPrepareStepIn(argc, kind), Code); |
72 } | 73 } |
73 | 74 |
74 | 75 |
75 static v8::Handle<v8::Context> GetDebugEventContext() { | 76 static v8::Handle<v8::Context> GetDebugEventContext() { |
76 Handle<Context> context = Debug::debugger_entry()->GetContext(); | 77 Handle<Context> context = Debug::debugger_entry()->GetContext(); |
77 // Top::context() may have been NULL when "script collected" event occured. | 78 // Top::context() may have been NULL when "script collected" event occured. |
78 if (*context == NULL) { | 79 if (*context == NULL) { |
79 return v8::Local<v8::Context>(); | 80 return v8::Local<v8::Context>(); |
80 } | 81 } |
81 Handle<Context> global_context(context->global_context()); | 82 Handle<Context> global_context(context->global_context()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 354 } |
354 | 355 |
355 | 356 |
356 void BreakLocationIterator::PrepareStepIn() { | 357 void BreakLocationIterator::PrepareStepIn() { |
357 HandleScope scope; | 358 HandleScope scope; |
358 | 359 |
359 // Step in can only be prepared if currently positioned on an IC call, | 360 // Step in can only be prepared if currently positioned on an IC call, |
360 // construct call or CallFunction stub call. | 361 // construct call or CallFunction stub call. |
361 Address target = rinfo()->target_address(); | 362 Address target = rinfo()->target_address(); |
362 Handle<Code> code(Code::GetCodeFromTargetAddress(target)); | 363 Handle<Code> code(Code::GetCodeFromTargetAddress(target)); |
363 if (code->is_call_stub()) { | 364 if (code->is_call_stub() || code->is_keyed_call_stub()) { |
364 // Step in through IC call is handled by the runtime system. Therefore make | 365 // Step in through IC call is handled by the runtime system. Therefore make |
365 // sure that the any current IC is cleared and the runtime system is | 366 // sure that the any current IC is cleared and the runtime system is |
366 // called. If the executing code has a debug break at the location change | 367 // called. If the executing code has a debug break at the location change |
367 // the call in the original code as it is the code there that will be | 368 // the call in the original code as it is the code there that will be |
368 // executed in place of the debug break call. | 369 // executed in place of the debug break call. |
369 Handle<Code> stub = ComputeCallDebugPrepareStepIn(code->arguments_count()); | 370 Handle<Code> stub = ComputeCallDebugPrepareStepIn(code->arguments_count(), |
| 371 code->kind()); |
370 if (IsDebugBreak()) { | 372 if (IsDebugBreak()) { |
371 original_rinfo()->set_target_address(stub->entry()); | 373 original_rinfo()->set_target_address(stub->entry()); |
372 } else { | 374 } else { |
373 rinfo()->set_target_address(stub->entry()); | 375 rinfo()->set_target_address(stub->entry()); |
374 } | 376 } |
375 } else { | 377 } else { |
376 #ifdef DEBUG | 378 #ifdef DEBUG |
377 // All the following stuff is needed only for assertion checks so the code | 379 // All the following stuff is needed only for assertion checks so the code |
378 // is wrapped in ifdef. | 380 // is wrapped in ifdef. |
379 Handle<Code> maybe_call_function_stub = code; | 381 Handle<Code> maybe_call_function_stub = code; |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 it.FindBreakLocationFromAddress(frame->pc()); | 1182 it.FindBreakLocationFromAddress(frame->pc()); |
1181 | 1183 |
1182 // Compute whether or not the target is a call target. | 1184 // Compute whether or not the target is a call target. |
1183 bool is_call_target = false; | 1185 bool is_call_target = false; |
1184 bool is_load_or_store = false; | 1186 bool is_load_or_store = false; |
1185 bool is_inline_cache_stub = false; | 1187 bool is_inline_cache_stub = false; |
1186 Handle<Code> call_function_stub; | 1188 Handle<Code> call_function_stub; |
1187 if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) { | 1189 if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) { |
1188 Address target = it.rinfo()->target_address(); | 1190 Address target = it.rinfo()->target_address(); |
1189 Code* code = Code::GetCodeFromTargetAddress(target); | 1191 Code* code = Code::GetCodeFromTargetAddress(target); |
1190 if (code->is_call_stub()) { | 1192 if (code->is_call_stub() || code->is_keyed_call_stub()) { |
1191 is_call_target = true; | 1193 is_call_target = true; |
1192 } | 1194 } |
1193 if (code->is_inline_cache_stub()) { | 1195 if (code->is_inline_cache_stub()) { |
1194 is_inline_cache_stub = true; | 1196 is_inline_cache_stub = true; |
1195 is_load_or_store = !is_call_target; | 1197 is_load_or_store = !is_call_target; |
1196 } | 1198 } |
1197 | 1199 |
1198 // Check if target code is CallFunction stub. | 1200 // Check if target code is CallFunction stub. |
1199 Code* maybe_call_function_stub = code; | 1201 Code* maybe_call_function_stub = code; |
1200 // If there is a breakpoint at this line look at the original code to | 1202 // If there is a breakpoint at this line look at the original code to |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 } | 1368 } |
1367 | 1369 |
1368 | 1370 |
1369 // Find the builtin to use for invoking the debug break | 1371 // Find the builtin to use for invoking the debug break |
1370 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { | 1372 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { |
1371 // Find the builtin debug break function matching the calling convention | 1373 // Find the builtin debug break function matching the calling convention |
1372 // used by the call site. | 1374 // used by the call site. |
1373 if (code->is_inline_cache_stub()) { | 1375 if (code->is_inline_cache_stub()) { |
1374 switch (code->kind()) { | 1376 switch (code->kind()) { |
1375 case Code::CALL_IC: | 1377 case Code::CALL_IC: |
1376 return ComputeCallDebugBreak(code->arguments_count()); | 1378 case Code::KEYED_CALL_IC: |
| 1379 return ComputeCallDebugBreak(code->arguments_count(), code->kind()); |
1377 | 1380 |
1378 case Code::LOAD_IC: | 1381 case Code::LOAD_IC: |
1379 return Handle<Code>(Builtins::builtin(Builtins::LoadIC_DebugBreak)); | 1382 return Handle<Code>(Builtins::builtin(Builtins::LoadIC_DebugBreak)); |
1380 | 1383 |
1381 case Code::STORE_IC: | 1384 case Code::STORE_IC: |
1382 return Handle<Code>(Builtins::builtin(Builtins::StoreIC_DebugBreak)); | 1385 return Handle<Code>(Builtins::builtin(Builtins::StoreIC_DebugBreak)); |
1383 | 1386 |
1384 case Code::KEYED_LOAD_IC: | 1387 case Code::KEYED_LOAD_IC: |
1385 return Handle<Code>( | 1388 return Handle<Code>( |
1386 Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak)); | 1389 Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak)); |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 { | 2853 { |
2851 Locker locker; | 2854 Locker locker; |
2852 Debugger::CallMessageDispatchHandler(); | 2855 Debugger::CallMessageDispatchHandler(); |
2853 } | 2856 } |
2854 } | 2857 } |
2855 } | 2858 } |
2856 | 2859 |
2857 #endif // ENABLE_DEBUGGER_SUPPORT | 2860 #endif // ENABLE_DEBUGGER_SUPPORT |
2858 | 2861 |
2859 } } // namespace v8::internal | 2862 } } // namespace v8::internal |
OLD | NEW |