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