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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); | 190 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); |
191 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); | 191 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); |
192 return Debug::HasDebugInfo(shared); | 192 return Debug::HasDebugInfo(shared); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 // Set a break point in a function and return the associated break point | 196 // Set a break point in a function and return the associated break point |
197 // number. | 197 // number. |
198 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { | 198 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { |
199 static int break_point = 0; | 199 static int break_point = 0; |
| 200 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); |
200 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 201 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); |
201 debug->SetBreakPoint( | 202 debug->SetBreakPoint( |
202 fun, | 203 shared, |
203 Handle<Object>(v8::internal::Smi::FromInt(++break_point)), | 204 Handle<Object>(v8::internal::Smi::FromInt(++break_point)), |
204 &position); | 205 &position); |
205 return break_point; | 206 return break_point; |
206 } | 207 } |
207 | 208 |
208 | 209 |
209 // Set a break point in a function and return the associated break point | 210 // Set a break point in a function and return the associated break point |
210 // number. | 211 // number. |
211 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { | 212 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { |
212 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); | 213 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 CHECK_EQ(debug_break, | 508 CHECK_EQ(debug_break, |
508 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); | 509 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); |
509 } else { | 510 } else { |
510 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); | 511 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); |
511 } | 512 } |
512 | 513 |
513 // Clear the break point and check that the debug break function is no longer | 514 // Clear the break point and check that the debug break function is no longer |
514 // there | 515 // there |
515 ClearBreakPoint(bp); | 516 ClearBreakPoint(bp); |
516 CHECK(!debug->HasDebugInfo(shared)); | 517 CHECK(!debug->HasDebugInfo(shared)); |
517 CHECK(debug->EnsureDebugInfo(shared, fun)); | 518 CHECK(debug->EnsureDebugInfo(shared)); |
518 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); | 519 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); |
519 it2.FindBreakLocationFromPosition(position); | 520 it2.FindBreakLocationFromPosition(position); |
520 actual_mode = it2.it()->rinfo()->rmode(); | 521 actual_mode = it2.it()->rinfo()->rmode(); |
521 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { | 522 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { |
522 actual_mode = v8::internal::RelocInfo::CODE_TARGET; | 523 actual_mode = v8::internal::RelocInfo::CODE_TARGET; |
523 } | 524 } |
524 CHECK_EQ(mode, actual_mode); | 525 CHECK_EQ(mode, actual_mode); |
525 if (mode == v8::internal::RelocInfo::JS_RETURN) { | 526 if (mode == v8::internal::RelocInfo::JS_RETURN) { |
526 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); | 527 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); |
527 } | 528 } |
(...skipping 6815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7343 "g(false); \n" | 7344 "g(false); \n" |
7344 "%OptimizeFunctionOnNextCall(g); \n" | 7345 "%OptimizeFunctionOnNextCall(g); \n" |
7345 "g(true);"; | 7346 "g(true);"; |
7346 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); | 7347 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); |
7347 inline_script = v8::Script::Compile(v8::String::New(source)); | 7348 inline_script = v8::Script::Compile(v8::String::New(source)); |
7348 inline_script->Run(); | 7349 inline_script->Run(); |
7349 } | 7350 } |
7350 | 7351 |
7351 | 7352 |
7352 #endif // ENABLE_DEBUGGER_SUPPORT | 7353 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |