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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 | 2176 |
2177 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 2177 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
2178 Handle<Object> code = args.at<Object>(1); | 2178 Handle<Object> code = args.at<Object>(1); |
2179 | 2179 |
2180 if (code->IsNull()) return *target; | 2180 if (code->IsNull()) return *target; |
2181 RUNTIME_ASSERT(code->IsJSFunction()); | 2181 RUNTIME_ASSERT(code->IsJSFunction()); |
2182 Handle<JSFunction> source = Handle<JSFunction>::cast(code); | 2182 Handle<JSFunction> source = Handle<JSFunction>::cast(code); |
2183 Handle<SharedFunctionInfo> target_shared(target->shared()); | 2183 Handle<SharedFunctionInfo> target_shared(target->shared()); |
2184 Handle<SharedFunctionInfo> source_shared(source->shared()); | 2184 Handle<SharedFunctionInfo> source_shared(source->shared()); |
2185 | 2185 |
2186 if (!source->is_compiled() && | 2186 if (!JSFunction::EnsureCompiled(source, KEEP_EXCEPTION)) { |
2187 !JSFunction::CompileLazy(source, KEEP_EXCEPTION)) { | |
2188 return Failure::Exception(); | 2187 return Failure::Exception(); |
2189 } | 2188 } |
2190 | 2189 |
2191 // Set the code, scope info, formal parameter count, and the length | 2190 // Set the code, scope info, formal parameter count, and the length |
2192 // of the target shared function info. Set the source code of the | 2191 // of the target shared function info. Set the source code of the |
2193 // target function to undefined. SetCode is only used for built-in | 2192 // target function to undefined. SetCode is only used for built-in |
2194 // constructors like String, Array, and Object, and some web code | 2193 // constructors like String, Array, and Object, and some web code |
2195 // doesn't like seeing source code for constructors. | 2194 // doesn't like seeing source code for constructors. |
2196 target_shared->set_code(source_shared->code()); | 2195 target_shared->set_code(source_shared->code()); |
2197 target_shared->set_scope_info(source_shared->scope_info()); | 2196 target_shared->set_scope_info(source_shared->scope_info()); |
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4848 } | 4847 } |
4849 return isolate->heap()->true_value(); | 4848 return isolate->heap()->true_value(); |
4850 } | 4849 } |
4851 | 4850 |
4852 | 4851 |
4853 // Set one shot breakpoints for the callback function that is passed to a | 4852 // Set one shot breakpoints for the callback function that is passed to a |
4854 // built-in function such as Array.forEach to enable stepping into the callback. | 4853 // built-in function such as Array.forEach to enable stepping into the callback. |
4855 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) { | 4854 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) { |
4856 Debug* debug = isolate->debug(); | 4855 Debug* debug = isolate->debug(); |
4857 if (!debug->IsStepping()) return NULL; | 4856 if (!debug->IsStepping()) return NULL; |
4858 CONVERT_ARG_CHECKED(Object, callback, 0); | 4857 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0); |
4859 HandleScope scope(isolate); | 4858 HandleScope scope(isolate); |
4860 Handle<SharedFunctionInfo> shared_info(JSFunction::cast(callback)->shared()); | |
4861 // When leaving the callback, step out has been activated, but not performed | 4859 // When leaving the callback, step out has been activated, but not performed |
4862 // if we do not leave the builtin. To be able to step into the callback | 4860 // if we do not leave the builtin. To be able to step into the callback |
4863 // again, we need to clear the step out at this point. | 4861 // again, we need to clear the step out at this point. |
4864 debug->ClearStepOut(); | 4862 debug->ClearStepOut(); |
4865 debug->FloodWithOneShot(shared_info); | 4863 debug->FloodWithOneShot(callback); |
4866 return NULL; | 4864 return NULL; |
4867 } | 4865 } |
4868 | 4866 |
4869 | 4867 |
4870 // Set a local property, even if it is READ_ONLY. If the property does not | 4868 // Set a local property, even if it is READ_ONLY. If the property does not |
4871 // exist, it will be added with attributes NONE. | 4869 // exist, it will be added with attributes NONE. |
4872 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { | 4870 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { |
4873 NoHandleAllocation ha; | 4871 NoHandleAllocation ha; |
4874 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); | 4872 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); |
4875 CONVERT_ARG_CHECKED(JSObject, object, 0); | 4873 CONVERT_ARG_CHECKED(JSObject, object, 0); |
(...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8133 // the shared part of the function. Since the receiver is | 8131 // the shared part of the function. Since the receiver is |
8134 // ignored anyway, we use the global object as the receiver | 8132 // ignored anyway, we use the global object as the receiver |
8135 // instead of a new JSFunction object. This way, errors are | 8133 // instead of a new JSFunction object. This way, errors are |
8136 // reported the same way whether or not 'Function' is called | 8134 // reported the same way whether or not 'Function' is called |
8137 // using 'new'. | 8135 // using 'new'. |
8138 return isolate->context()->global(); | 8136 return isolate->context()->global(); |
8139 } | 8137 } |
8140 } | 8138 } |
8141 | 8139 |
8142 // The function should be compiled for the optimization hints to be | 8140 // The function should be compiled for the optimization hints to be |
8143 // available. We cannot use EnsureCompiled because that forces a | 8141 // available. |
8144 // compilation through the shared function info which makes it | 8142 JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION); |
8145 // impossible for us to optimize. | |
8146 if (!function->is_compiled()) { | |
8147 JSFunction::CompileLazy(function, CLEAR_EXCEPTION); | |
8148 } | |
8149 | 8143 |
8150 Handle<SharedFunctionInfo> shared(function->shared(), isolate); | 8144 Handle<SharedFunctionInfo> shared(function->shared(), isolate); |
8151 if (!function->has_initial_map() && | 8145 if (!function->has_initial_map() && |
8152 shared->IsInobjectSlackTrackingInProgress()) { | 8146 shared->IsInobjectSlackTrackingInProgress()) { |
8153 // The tracking is already in progress for another function. We can only | 8147 // The tracking is already in progress for another function. We can only |
8154 // track one initial_map at a time, so we force the completion before the | 8148 // track one initial_map at a time, so we force the completion before the |
8155 // function is called as a constructor for the first time. | 8149 // function is called as a constructor for the first time. |
8156 shared->CompleteInobjectSlackTracking(); | 8150 shared->CompleteInobjectSlackTracking(); |
8157 } | 8151 } |
8158 | 8152 |
(...skipping 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11148 Handle<SharedFunctionInfo> shared_info(function_->shared()); | 11142 Handle<SharedFunctionInfo> shared_info(function_->shared()); |
11149 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 11143 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
11150 if (shared_info->script() == isolate->heap()->undefined_value()) { | 11144 if (shared_info->script() == isolate->heap()->undefined_value()) { |
11151 while (context_->closure() == *function_) { | 11145 while (context_->closure() == *function_) { |
11152 context_ = Handle<Context>(context_->previous(), isolate_); | 11146 context_ = Handle<Context>(context_->previous(), isolate_); |
11153 } | 11147 } |
11154 return; | 11148 return; |
11155 } | 11149 } |
11156 | 11150 |
11157 // Get the debug info (create it if it does not exist). | 11151 // Get the debug info (create it if it does not exist). |
11158 if (!isolate->debug()->EnsureDebugInfo(shared_info)) { | 11152 if (!isolate->debug()->EnsureDebugInfo(shared_info, function_)) { |
11159 // Return if ensuring debug info failed. | 11153 // Return if ensuring debug info failed. |
11160 return; | 11154 return; |
11161 } | 11155 } |
11162 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared_info); | 11156 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared_info); |
11163 | 11157 |
11164 // Find the break point where execution has stopped. | 11158 // Find the break point where execution has stopped. |
11165 BreakLocationIterator break_location_iterator(debug_info, | 11159 BreakLocationIterator break_location_iterator(debug_info, |
11166 ALL_BREAK_LOCATIONS); | 11160 ALL_BREAK_LOCATIONS); |
11167 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); | 11161 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); |
11168 if (break_location_iterator.IsExit()) { | 11162 if (break_location_iterator.IsExit()) { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11671 Handle<SharedFunctionInfo> shared(fun->shared()); | 11665 Handle<SharedFunctionInfo> shared(fun->shared()); |
11672 // Find the number of break points | 11666 // Find the number of break points |
11673 Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared); | 11667 Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared); |
11674 if (break_locations->IsUndefined()) return isolate->heap()->undefined_value(); | 11668 if (break_locations->IsUndefined()) return isolate->heap()->undefined_value(); |
11675 // Return array as JS array | 11669 // Return array as JS array |
11676 return *isolate->factory()->NewJSArrayWithElements( | 11670 return *isolate->factory()->NewJSArrayWithElements( |
11677 Handle<FixedArray>::cast(break_locations)); | 11671 Handle<FixedArray>::cast(break_locations)); |
11678 } | 11672 } |
11679 | 11673 |
11680 | 11674 |
11681 // Set a break point in a function | |
11682 // args[0]: function | |
11683 // args[1]: number: break source position (within the function source) | |
11684 // args[2]: number: break point object | |
11685 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFunctionBreakPoint) { | |
11686 HandleScope scope(isolate); | |
11687 ASSERT(args.length() == 3); | |
11688 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | |
11689 Handle<SharedFunctionInfo> shared(fun->shared()); | |
11690 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | |
11691 RUNTIME_ASSERT(source_position >= 0); | |
11692 Handle<Object> break_point_object_arg = args.at<Object>(2); | |
11693 | |
11694 // Set break point. | |
11695 isolate->debug()->SetBreakPoint(shared, break_point_object_arg, | |
11696 &source_position); | |
11697 | |
11698 return Smi::FromInt(source_position); | |
11699 } | |
11700 | |
11701 | |
11702 Object* Runtime::FindSharedFunctionInfoInScript(Isolate* isolate, | 11675 Object* Runtime::FindSharedFunctionInfoInScript(Isolate* isolate, |
11703 Handle<Script> script, | 11676 Handle<Script> script, |
11704 int position) { | 11677 int position) { |
| 11678 // The below fix-point iteration depends on all functions that cannot be |
| 11679 // compiled lazily without a context to not be compiled at all. Compilation |
| 11680 // will be triggered at points where we do not need a context. |
| 11681 isolate->debug()->PrepareForBreakPoints(); |
| 11682 |
11705 // Iterate the heap looking for SharedFunctionInfo generated from the | 11683 // Iterate the heap looking for SharedFunctionInfo generated from the |
11706 // script. The inner most SharedFunctionInfo containing the source position | 11684 // script. The inner most SharedFunctionInfo containing the source position |
11707 // for the requested break point is found. | 11685 // for the requested break point is found. |
11708 // NOTE: This might require several heap iterations. If the SharedFunctionInfo | 11686 // NOTE: This might require several heap iterations. If the SharedFunctionInfo |
11709 // which is found is not compiled it is compiled and the heap is iterated | 11687 // which is found is not compiled it is compiled and the heap is iterated |
11710 // again as the compilation might create inner functions from the newly | 11688 // again as the compilation might create inner functions from the newly |
11711 // compiled function and the actual requested break point might be in one of | 11689 // compiled function and the actual requested break point might be in one of |
11712 // these functions. | 11690 // these functions. |
11713 bool done = false; | 11691 bool done = false; |
11714 // The current candidate for the source position: | 11692 // The current candidate for the source position: |
11715 int target_start_position = RelocInfo::kNoPosition; | 11693 int target_start_position = RelocInfo::kNoPosition; |
| 11694 Handle<JSFunction> target_function; |
11716 Handle<SharedFunctionInfo> target; | 11695 Handle<SharedFunctionInfo> target; |
11717 while (!done) { | 11696 while (!done) { |
11718 { // Extra scope for iterator and no-allocation. | 11697 { // Extra scope for iterator and no-allocation. |
11719 isolate->heap()->EnsureHeapIsIterable(); | 11698 isolate->heap()->EnsureHeapIsIterable(); |
11720 AssertNoAllocation no_alloc_during_heap_iteration; | 11699 AssertNoAllocation no_alloc_during_heap_iteration; |
11721 HeapIterator iterator; | 11700 HeapIterator iterator; |
11722 for (HeapObject* obj = iterator.next(); | 11701 for (HeapObject* obj = iterator.next(); |
11723 obj != NULL; obj = iterator.next()) { | 11702 obj != NULL; obj = iterator.next()) { |
11724 if (obj->IsSharedFunctionInfo()) { | 11703 bool found_next_candidate = false; |
11725 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(obj)); | 11704 Handle<JSFunction> function; |
11726 if (shared->script() == *script) { | 11705 Handle<SharedFunctionInfo> shared; |
11727 // If the SharedFunctionInfo found has the requested script data and | 11706 if (obj->IsJSFunction()) { |
11728 // contains the source position it is a candidate. | 11707 function = Handle<JSFunction>(JSFunction::cast(obj)); |
11729 int start_position = shared->function_token_position(); | 11708 shared = Handle<SharedFunctionInfo>(function->shared()); |
11730 if (start_position == RelocInfo::kNoPosition) { | 11709 ASSERT(shared->allows_lazy_compilation() || shared->is_compiled()); |
11731 start_position = shared->start_position(); | 11710 found_next_candidate = true; |
11732 } | 11711 } else if (obj->IsSharedFunctionInfo()) { |
11733 if (start_position <= position && | 11712 shared = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(obj)); |
11734 position <= shared->end_position()) { | 11713 // Skip functions that we cannot compile lazily without a context, |
11735 // If there is no candidate or this function is within the current | 11714 // which is not available here, because there is no closure. |
11736 // candidate this is the new candidate. | 11715 found_next_candidate = shared->is_compiled() || |
11737 if (target.is_null()) { | 11716 shared->allows_lazy_compilation_without_context(); |
11738 target_start_position = start_position; | 11717 } |
11739 target = shared; | 11718 if (!found_next_candidate) continue; |
11740 } else { | 11719 if (shared->script() == *script) { |
11741 if (target_start_position == start_position && | 11720 // If the SharedFunctionInfo found has the requested script data and |
11742 shared->end_position() == target->end_position()) { | 11721 // contains the source position it is a candidate. |
11743 // If a top-level function contain only one function | 11722 int start_position = shared->function_token_position(); |
11744 // declartion the source for the top-level and the | 11723 if (start_position == RelocInfo::kNoPosition) { |
11745 // function is the same. In that case prefer the non | 11724 start_position = shared->start_position(); |
11746 // top-level function. | 11725 } |
11747 if (!shared->is_toplevel()) { | 11726 if (start_position <= position && |
11748 target_start_position = start_position; | 11727 position <= shared->end_position()) { |
11749 target = shared; | 11728 // If there is no candidate or this function is within the current |
11750 } | 11729 // candidate this is the new candidate. |
11751 } else if (target_start_position <= start_position && | 11730 if (target.is_null()) { |
11752 shared->end_position() <= target->end_position()) { | 11731 target_start_position = start_position; |
11753 // This containment check includes equality as a function | 11732 target_function = function; |
11754 // inside a top-level function can share either start or end | 11733 target = shared; |
11755 // position with the top-level function. | 11734 } else { |
| 11735 if (target_start_position == start_position && |
| 11736 shared->end_position() == target->end_position()) { |
| 11737 // If a top-level function contains only one function |
| 11738 // declaration the source for the top-level and the function |
| 11739 // is the same. In that case prefer the non top-level function. |
| 11740 if (!shared->is_toplevel()) { |
11756 target_start_position = start_position; | 11741 target_start_position = start_position; |
| 11742 target_function = function; |
11757 target = shared; | 11743 target = shared; |
11758 } | 11744 } |
| 11745 } else if (target_start_position <= start_position && |
| 11746 shared->end_position() <= target->end_position()) { |
| 11747 // This containment check includes equality as a function |
| 11748 // inside a top-level function can share either start or end |
| 11749 // position with the top-level function. |
| 11750 target_start_position = start_position; |
| 11751 target_function = function; |
| 11752 target = shared; |
11759 } | 11753 } |
11760 } | 11754 } |
11761 } | 11755 } |
11762 } | 11756 } |
11763 } // End for loop. | 11757 } // End for loop. |
11764 } // End No allocation scope. | 11758 } // End no-allocation scope. |
11765 | 11759 |
11766 if (target.is_null()) { | 11760 if (target.is_null()) { |
11767 return isolate->heap()->undefined_value(); | 11761 return isolate->heap()->undefined_value(); |
11768 } | 11762 } |
11769 | 11763 |
11770 // If the candidate found is compiled we are done. NOTE: when lazy | 11764 // If the candidate found is compiled we are done. |
11771 // compilation of inner functions is introduced some additional checking | |
11772 // needs to be done here to compile inner functions. | |
11773 done = target->is_compiled(); | 11765 done = target->is_compiled(); |
11774 if (!done) { | 11766 if (!done) { |
11775 // If the candidate is not compiled compile it to reveal any inner | 11767 // If the candidate is not compiled, compile it to reveal any inner |
11776 // functions which might contain the requested source position. | 11768 // functions which might contain the requested source position. This |
11777 SharedFunctionInfo::CompileLazy(target, KEEP_EXCEPTION); | 11769 // will compile all inner functions that cannot be compiled without a |
| 11770 // context, because Compiler::BuildFunctionInfo checks whether the |
| 11771 // debugger is active. |
| 11772 if (target_function.is_null()) { |
| 11773 SharedFunctionInfo::CompileLazy(target, KEEP_EXCEPTION); |
| 11774 } else { |
| 11775 JSFunction::CompileLazy(target_function, KEEP_EXCEPTION); |
| 11776 } |
11778 } | 11777 } |
11779 } // End while loop. | 11778 } // End while loop. |
11780 | 11779 |
11781 return *target; | 11780 return *target; |
11782 } | 11781 } |
11783 | 11782 |
11784 | 11783 |
| 11784 // Set a break point in a function. |
| 11785 // args[0]: function |
| 11786 // args[1]: number: break source position (within the function source) |
| 11787 // args[2]: number: break point object |
| 11788 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFunctionBreakPoint) { |
| 11789 HandleScope scope(isolate); |
| 11790 ASSERT(args.length() == 3); |
| 11791 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 11792 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
| 11793 RUNTIME_ASSERT(source_position >= 0); |
| 11794 Handle<Object> break_point_object_arg = args.at<Object>(2); |
| 11795 |
| 11796 // Set break point. |
| 11797 isolate->debug()->SetBreakPoint(function, break_point_object_arg, |
| 11798 &source_position); |
| 11799 |
| 11800 return Smi::FromInt(source_position); |
| 11801 } |
| 11802 |
| 11803 |
11785 // Changes the state of a break point in a script and returns source position | 11804 // Changes the state of a break point in a script and returns source position |
11786 // where break point was set. NOTE: Regarding performance see the NOTE for | 11805 // where break point was set. NOTE: Regarding performance see the NOTE for |
11787 // GetScriptFromScriptData. | 11806 // GetScriptFromScriptData. |
11788 // args[0]: script to set break point in | 11807 // args[0]: script to set break point in |
11789 // args[1]: number: break source position (within the script source) | 11808 // args[1]: number: break source position (within the script source) |
11790 // args[2]: number: break point object | 11809 // args[2]: number: break point object |
11791 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { | 11810 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { |
11792 HandleScope scope(isolate); | 11811 HandleScope scope(isolate); |
11793 ASSERT(args.length() == 3); | 11812 ASSERT(args.length() == 3); |
11794 CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); | 11813 CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); |
11795 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 11814 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
11796 RUNTIME_ASSERT(source_position >= 0); | 11815 RUNTIME_ASSERT(source_position >= 0); |
11797 Handle<Object> break_point_object_arg = args.at<Object>(2); | 11816 Handle<Object> break_point_object_arg = args.at<Object>(2); |
11798 | 11817 |
11799 // Get the script from the script wrapper. | 11818 // Get the script from the script wrapper. |
11800 RUNTIME_ASSERT(wrapper->value()->IsScript()); | 11819 RUNTIME_ASSERT(wrapper->value()->IsScript()); |
11801 Handle<Script> script(Script::cast(wrapper->value())); | 11820 Handle<Script> script(Script::cast(wrapper->value())); |
11802 | 11821 |
11803 Object* result = Runtime::FindSharedFunctionInfoInScript( | 11822 // Set break point. |
11804 isolate, script, source_position); | 11823 if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, |
11805 if (!result->IsUndefined()) { | 11824 &source_position)) { |
11806 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result)); | 11825 return isolate->heap()->undefined_value(); |
11807 // Find position within function. The script position might be before the | |
11808 // source position of the first function. | |
11809 int position; | |
11810 if (shared->start_position() > source_position) { | |
11811 position = 0; | |
11812 } else { | |
11813 position = source_position - shared->start_position(); | |
11814 } | |
11815 isolate->debug()->SetBreakPoint(shared, break_point_object_arg, &position); | |
11816 position += shared->start_position(); | |
11817 return Smi::FromInt(position); | |
11818 } | 11826 } |
11819 return isolate->heap()->undefined_value(); | 11827 |
| 11828 return Smi::FromInt(source_position); |
11820 } | 11829 } |
11821 | 11830 |
11822 | 11831 |
11823 // Clear a break point | 11832 // Clear a break point |
11824 // args[0]: number: break point object | 11833 // args[0]: number: break point object |
11825 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) { | 11834 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) { |
11826 HandleScope scope(isolate); | 11835 HandleScope scope(isolate); |
11827 ASSERT(args.length() == 1); | 11836 ASSERT(args.length() == 1); |
11828 Handle<Object> break_point_object_arg = args.at<Object>(0); | 11837 Handle<Object> break_point_object_arg = args.at<Object>(0); |
11829 | 11838 |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12533 return isolate->heap()->undefined_value(); | 12542 return isolate->heap()->undefined_value(); |
12534 } | 12543 } |
12535 | 12544 |
12536 | 12545 |
12537 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { | 12546 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { |
12538 #ifdef DEBUG | 12547 #ifdef DEBUG |
12539 HandleScope scope(isolate); | 12548 HandleScope scope(isolate); |
12540 ASSERT(args.length() == 1); | 12549 ASSERT(args.length() == 1); |
12541 // Get the function and make sure it is compiled. | 12550 // Get the function and make sure it is compiled. |
12542 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); | 12551 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
12543 if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) { | 12552 if (!JSFunction::EnsureCompiled(func, KEEP_EXCEPTION)) { |
12544 return Failure::Exception(); | 12553 return Failure::Exception(); |
12545 } | 12554 } |
12546 func->code()->PrintLn(); | 12555 func->code()->PrintLn(); |
12547 #endif // DEBUG | 12556 #endif // DEBUG |
12548 return isolate->heap()->undefined_value(); | 12557 return isolate->heap()->undefined_value(); |
12549 } | 12558 } |
12550 | 12559 |
12551 | 12560 |
12552 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { | 12561 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { |
12553 #ifdef DEBUG | 12562 #ifdef DEBUG |
12554 HandleScope scope(isolate); | 12563 HandleScope scope(isolate); |
12555 ASSERT(args.length() == 1); | 12564 ASSERT(args.length() == 1); |
12556 // Get the function and make sure it is compiled. | 12565 // Get the function and make sure it is compiled. |
12557 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); | 12566 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
12558 if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) { | 12567 if (!JSFunction::EnsureCompiled(func, KEEP_EXCEPTION)) { |
12559 return Failure::Exception(); | 12568 return Failure::Exception(); |
12560 } | 12569 } |
12561 func->shared()->construct_stub()->PrintLn(); | 12570 func->shared()->construct_stub()->PrintLn(); |
12562 #endif // DEBUG | 12571 #endif // DEBUG |
12563 return isolate->heap()->undefined_value(); | 12572 return isolate->heap()->undefined_value(); |
12564 } | 12573 } |
12565 | 12574 |
12566 | 12575 |
12567 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { | 12576 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { |
12568 NoHandleAllocation ha; | 12577 NoHandleAllocation ha; |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13595 // Handle last resort GC and make sure to allow future allocations | 13604 // Handle last resort GC and make sure to allow future allocations |
13596 // to grow the heap without causing GCs (if possible). | 13605 // to grow the heap without causing GCs (if possible). |
13597 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13606 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13598 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13607 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13599 "Runtime::PerformGC"); | 13608 "Runtime::PerformGC"); |
13600 } | 13609 } |
13601 } | 13610 } |
13602 | 13611 |
13603 | 13612 |
13604 } } // namespace v8::internal | 13613 } } // namespace v8::internal |
OLD | NEW |