OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 9638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9649 old_script->set_line_offset(original_script->line_offset()); | 9649 old_script->set_line_offset(original_script->line_offset()); |
9650 old_script->set_column_offset(original_script->column_offset()); | 9650 old_script->set_column_offset(original_script->column_offset()); |
9651 old_script->set_data(original_script->data()); | 9651 old_script->set_data(original_script->data()); |
9652 old_script->set_type(original_script->type()); | 9652 old_script->set_type(original_script->type()); |
9653 old_script->set_context_data(original_script->context_data()); | 9653 old_script->set_context_data(original_script->context_data()); |
9654 old_script->set_compilation_type(original_script->compilation_type()); | 9654 old_script->set_compilation_type(original_script->compilation_type()); |
9655 old_script->set_eval_from_shared(original_script->eval_from_shared()); | 9655 old_script->set_eval_from_shared(original_script->eval_from_shared()); |
9656 old_script->set_eval_from_instructions_offset( | 9656 old_script->set_eval_from_instructions_offset( |
9657 original_script->eval_from_instructions_offset()); | 9657 original_script->eval_from_instructions_offset()); |
9658 | 9658 |
| 9659 // Drop line ends so that they will be recalculated. |
| 9660 original_script->set_line_ends(Heap::undefined_value()); |
9659 | 9661 |
9660 Debugger::OnAfterCompile(old_script, Debugger::SEND_WHEN_DEBUGGING); | 9662 Debugger::OnAfterCompile(old_script, Debugger::SEND_WHEN_DEBUGGING); |
9661 | 9663 |
9662 return *(GetScriptWrapper(old_script)); | 9664 return *(GetScriptWrapper(old_script)); |
9663 } | 9665 } |
9664 | 9666 |
9665 // Replaces code of SharedFunctionInfo with a new one. | 9667 // Replaces code of SharedFunctionInfo with a new one. |
9666 static Object* Runtime_LiveEditReplaceFunctionCode(Arguments args) { | 9668 static Object* Runtime_LiveEditReplaceFunctionCode(Arguments args) { |
9667 ASSERT(args.length() == 2); | 9669 ASSERT(args.length() == 2); |
9668 HandleScope scope; | 9670 HandleScope scope; |
(...skipping 16 matching lines...) Expand all Loading... |
9685 LiveEdit::RelinkFunctionToScript(shared_info_array, script); | 9687 LiveEdit::RelinkFunctionToScript(shared_info_array, script); |
9686 | 9688 |
9687 return Heap::undefined_value(); | 9689 return Heap::undefined_value(); |
9688 } | 9690 } |
9689 | 9691 |
9690 // Updates positions of a shared function info (first parameter) according | 9692 // Updates positions of a shared function info (first parameter) according |
9691 // to script source change. Text change is described in second parameter as | 9693 // to script source change. Text change is described in second parameter as |
9692 // array of groups of 3 numbers: | 9694 // array of groups of 3 numbers: |
9693 // (change_begin, change_end, change_end_new_position). | 9695 // (change_begin, change_end, change_end_new_position). |
9694 // Each group describes a change in text; groups are sorted by change_begin. | 9696 // Each group describes a change in text; groups are sorted by change_begin. |
| 9697 // Returns an array of pairs (new source position, breakpoint_object/array) |
| 9698 // so that JS side could update positions in breakpoint objects. |
9695 static Object* Runtime_LiveEditPatchFunctionPositions(Arguments args) { | 9699 static Object* Runtime_LiveEditPatchFunctionPositions(Arguments args) { |
9696 ASSERT(args.length() == 2); | 9700 ASSERT(args.length() == 2); |
9697 HandleScope scope; | 9701 HandleScope scope; |
9698 CONVERT_ARG_CHECKED(JSArray, shared_array, 0); | 9702 CONVERT_ARG_CHECKED(JSArray, shared_array, 0); |
9699 CONVERT_ARG_CHECKED(JSArray, position_change_array, 1); | 9703 CONVERT_ARG_CHECKED(JSArray, position_change_array, 1); |
9700 | 9704 |
9701 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); | 9705 Handle<Object> result = |
| 9706 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); |
9702 | 9707 |
9703 return Heap::undefined_value(); | 9708 return *result; |
9704 } | 9709 } |
9705 | 9710 |
9706 | 9711 |
9707 // For array of SharedFunctionInfo's (each wrapped in JSValue) | 9712 // For array of SharedFunctionInfo's (each wrapped in JSValue) |
9708 // checks that none of them have activations on stacks (of any thread). | 9713 // checks that none of them have activations on stacks (of any thread). |
9709 // Returns array of the same length with corresponding results of | 9714 // Returns array of the same length with corresponding results of |
9710 // LiveEdit::FunctionPatchabilityStatus type. | 9715 // LiveEdit::FunctionPatchabilityStatus type. |
9711 static Object* Runtime_LiveEditCheckAndDropActivations(Arguments args) { | 9716 static Object* Runtime_LiveEditCheckAndDropActivations(Arguments args) { |
9712 ASSERT(args.length() == 2); | 9717 ASSERT(args.length() == 2); |
9713 HandleScope scope; | 9718 HandleScope scope; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10056 } else { | 10061 } else { |
10057 // Handle last resort GC and make sure to allow future allocations | 10062 // Handle last resort GC and make sure to allow future allocations |
10058 // to grow the heap without causing GCs (if possible). | 10063 // to grow the heap without causing GCs (if possible). |
10059 Counters::gc_last_resort_from_js.Increment(); | 10064 Counters::gc_last_resort_from_js.Increment(); |
10060 Heap::CollectAllGarbage(false); | 10065 Heap::CollectAllGarbage(false); |
10061 } | 10066 } |
10062 } | 10067 } |
10063 | 10068 |
10064 | 10069 |
10065 } } // namespace v8::internal | 10070 } } // namespace v8::internal |
OLD | NEW |