| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 4ce2e1ed5c446cc58b49e94c17cfa295473715ab..48022b049c0790f18292984843e39aaa3872e9db 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -11421,115 +11421,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) {
|
| }
|
|
|
|
|
| -Object* Runtime::FindSharedFunctionInfoInScript(Isolate* isolate,
|
| - Handle<Script> script,
|
| - int position) {
|
| - // The below fix-point iteration depends on all functions that cannot be
|
| - // compiled lazily without a context to not be compiled at all. Compilation
|
| - // will be triggered at points where we do not need a context.
|
| - isolate->debug()->PrepareForBreakPoints();
|
| -
|
| - // Iterate the heap looking for SharedFunctionInfo generated from the
|
| - // script. The inner most SharedFunctionInfo containing the source position
|
| - // for the requested break point is found.
|
| - // NOTE: This might require several heap iterations. If the SharedFunctionInfo
|
| - // which is found is not compiled it is compiled and the heap is iterated
|
| - // again as the compilation might create inner functions from the newly
|
| - // compiled function and the actual requested break point might be in one of
|
| - // these functions.
|
| - bool done = false;
|
| - // The current candidate for the source position:
|
| - int target_start_position = RelocInfo::kNoPosition;
|
| - Handle<JSFunction> target_function;
|
| - Handle<SharedFunctionInfo> target;
|
| - while (!done) {
|
| - { // Extra scope for iterator and no-allocation.
|
| - isolate->heap()->EnsureHeapIsIterable();
|
| - AssertNoAllocation no_alloc_during_heap_iteration;
|
| - HeapIterator iterator;
|
| - for (HeapObject* obj = iterator.next();
|
| - obj != NULL; obj = iterator.next()) {
|
| - bool found_next_candidate = false;
|
| - Handle<JSFunction> function;
|
| - Handle<SharedFunctionInfo> shared;
|
| - if (obj->IsJSFunction()) {
|
| - function = Handle<JSFunction>(JSFunction::cast(obj));
|
| - shared = Handle<SharedFunctionInfo>(function->shared());
|
| - ASSERT(shared->allows_lazy_compilation() || shared->is_compiled());
|
| - found_next_candidate = true;
|
| - } else if (obj->IsSharedFunctionInfo()) {
|
| - shared = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(obj));
|
| - // Skip functions that we cannot compile lazily without a context,
|
| - // which is not available here, because there is no closure.
|
| - found_next_candidate = shared->is_compiled() ||
|
| - shared->allows_lazy_compilation_without_context();
|
| - }
|
| - if (!found_next_candidate) continue;
|
| - if (shared->script() == *script) {
|
| - // If the SharedFunctionInfo found has the requested script data and
|
| - // contains the source position it is a candidate.
|
| - int start_position = shared->function_token_position();
|
| - if (start_position == RelocInfo::kNoPosition) {
|
| - start_position = shared->start_position();
|
| - }
|
| - if (start_position <= position &&
|
| - position <= shared->end_position()) {
|
| - // If there is no candidate or this function is within the current
|
| - // candidate this is the new candidate.
|
| - if (target.is_null()) {
|
| - target_start_position = start_position;
|
| - target_function = function;
|
| - target = shared;
|
| - } else {
|
| - if (target_start_position == start_position &&
|
| - shared->end_position() == target->end_position()) {
|
| - // If a top-level function contains only one function
|
| - // declaration the source for the top-level and the function
|
| - // is the same. In that case prefer the non top-level function.
|
| - if (!shared->is_toplevel()) {
|
| - target_start_position = start_position;
|
| - target_function = function;
|
| - target = shared;
|
| - }
|
| - } else if (target_start_position <= start_position &&
|
| - shared->end_position() <= target->end_position()) {
|
| - // This containment check includes equality as a function
|
| - // inside a top-level function can share either start or end
|
| - // position with the top-level function.
|
| - target_start_position = start_position;
|
| - target_function = function;
|
| - target = shared;
|
| - }
|
| - }
|
| - }
|
| - }
|
| - } // End for loop.
|
| - } // End no-allocation scope.
|
| -
|
| - if (target.is_null()) {
|
| - return isolate->heap()->undefined_value();
|
| - }
|
| -
|
| - // If the candidate found is compiled we are done.
|
| - done = target->is_compiled();
|
| - if (!done) {
|
| - // If the candidate is not compiled, compile it to reveal any inner
|
| - // functions which might contain the requested source position. This
|
| - // will compile all inner functions that cannot be compiled without a
|
| - // context, because Compiler::BuildFunctionInfo checks whether the
|
| - // debugger is active.
|
| - if (target_function.is_null()) {
|
| - SharedFunctionInfo::CompileLazy(target, KEEP_EXCEPTION);
|
| - } else {
|
| - JSFunction::CompileLazy(target_function, KEEP_EXCEPTION);
|
| - }
|
| - }
|
| - } // End while loop.
|
| -
|
| - return *target;
|
| -}
|
| -
|
| -
|
| // Set a break point in a function.
|
| // args[0]: function
|
| // args[1]: number: break source position (within the function source)
|
|
|