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 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 } | 2099 } |
2100 | 2100 |
2101 // Make sure that the shared full code is compiled with debug | 2101 // Make sure that the shared full code is compiled with debug |
2102 // break slots. | 2102 // break slots. |
2103 if (!shared->code()->has_debug_break_slots()) { | 2103 if (!shared->code()->has_debug_break_slots()) { |
2104 // Try to compile the full code with debug break slots. If it | 2104 // Try to compile the full code with debug break slots. If it |
2105 // fails just keep the current code. | 2105 // fails just keep the current code. |
2106 bool prev_force_debugger_active = | 2106 bool prev_force_debugger_active = |
2107 isolate_->debugger()->force_debugger_active(); | 2107 isolate_->debugger()->force_debugger_active(); |
2108 isolate_->debugger()->set_force_debugger_active(true); | 2108 isolate_->debugger()->set_force_debugger_active(true); |
2109 Handle<Code> code = Compiler::GetCodeForDebugging(function); | 2109 Handle<Code> code = Compiler::GetCodeForDebugging( |
| 2110 function).ToHandleChecked(); |
2110 function->ReplaceCode(*code); | 2111 function->ReplaceCode(*code); |
2111 isolate_->debugger()->set_force_debugger_active( | 2112 isolate_->debugger()->set_force_debugger_active( |
2112 prev_force_debugger_active); | 2113 prev_force_debugger_active); |
2113 } | 2114 } |
2114 | 2115 |
2115 // Keep function code in sync with shared function info. | 2116 // Keep function code in sync with shared function info. |
2116 function->set_code(shared->code()); | 2117 function->set_code(shared->code()); |
2117 } | 2118 } |
2118 | 2119 |
2119 RedirectActivationsToRecompiledCodeOnThread(isolate_, | 2120 RedirectActivationsToRecompiledCodeOnThread(isolate_, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 has_break_points_ = true; | 2216 has_break_points_ = true; |
2216 | 2217 |
2217 // If the candidate found is compiled we are done. | 2218 // If the candidate found is compiled we are done. |
2218 done = target->is_compiled(); | 2219 done = target->is_compiled(); |
2219 if (!done) { | 2220 if (!done) { |
2220 // If the candidate is not compiled, compile it to reveal any inner | 2221 // If the candidate is not compiled, compile it to reveal any inner |
2221 // functions which might contain the requested source position. This | 2222 // functions which might contain the requested source position. This |
2222 // will compile all inner functions that cannot be compiled without a | 2223 // will compile all inner functions that cannot be compiled without a |
2223 // context, because Compiler::BuildFunctionInfo checks whether the | 2224 // context, because Compiler::BuildFunctionInfo checks whether the |
2224 // debugger is active. | 2225 // debugger is active. |
2225 Handle<Code> result = target_function.is_null() | 2226 MaybeHandle<Code> maybe_result = target_function.is_null() |
2226 ? Compiler::GetUnoptimizedCode(target) | 2227 ? Compiler::GetUnoptimizedCode(target) |
2227 : Compiler::GetUnoptimizedCode(target_function); | 2228 : Compiler::GetUnoptimizedCode(target_function); |
2228 if (result.is_null()) return isolate_->heap()->undefined_value(); | 2229 if (maybe_result.is_null()) return isolate_->heap()->undefined_value()); |
2229 } | 2230 } |
2230 } // End while loop. | 2231 } // End while loop. |
2231 | 2232 |
2232 return *target; | 2233 return *target; |
2233 } | 2234 } |
2234 | 2235 |
2235 | 2236 |
2236 // Ensures the debug information is present for shared. | 2237 // Ensures the debug information is present for shared. |
2237 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 2238 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
2238 Handle<JSFunction> function) { | 2239 Handle<JSFunction> function) { |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3735 { | 3736 { |
3736 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3737 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3737 isolate_->debugger()->CallMessageDispatchHandler(); | 3738 isolate_->debugger()->CallMessageDispatchHandler(); |
3738 } | 3739 } |
3739 } | 3740 } |
3740 } | 3741 } |
3741 | 3742 |
3742 #endif // ENABLE_DEBUGGER_SUPPORT | 3743 #endif // ENABLE_DEBUGGER_SUPPORT |
3743 | 3744 |
3744 } } // namespace v8::internal | 3745 } } // namespace v8::internal |
OLD | NEW |