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 12771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12782 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { | 12782 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { |
12783 ASSERT(args.length() == 2); | 12783 ASSERT(args.length() == 2); |
12784 HandleScope scope(isolate); | 12784 HandleScope scope(isolate); |
12785 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); | 12785 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); |
12786 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); | 12786 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); |
12787 | 12787 |
12788 return *LiveEdit::CompareStrings(s1, s2); | 12788 return *LiveEdit::CompareStrings(s1, s2); |
12789 } | 12789 } |
12790 | 12790 |
12791 | 12791 |
| 12792 // Restarts a call frame and completely drops all frames above. |
| 12793 // Returns true if successful. Otherwise returns undefined or an error message. |
| 12794 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) { |
| 12795 HandleScope scope(isolate); |
| 12796 ASSERT(args.length() == 2); |
| 12797 |
| 12798 // Check arguments. |
| 12799 Object* check; |
| 12800 { MaybeObject* maybe_check = Runtime_CheckExecutionState( |
| 12801 RUNTIME_ARGUMENTS(isolate, args)); |
| 12802 if (!maybe_check->ToObject(&check)) return maybe_check; |
| 12803 } |
| 12804 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
| 12805 Heap* heap = isolate->heap(); |
| 12806 |
| 12807 // Find the relevant frame with the requested index. |
| 12808 StackFrame::Id id = isolate->debug()->break_frame_id(); |
| 12809 if (id == StackFrame::NO_ID) { |
| 12810 // If there are no JavaScript stack frames return undefined. |
| 12811 return heap->undefined_value(); |
| 12812 } |
| 12813 |
| 12814 int count = 0; |
| 12815 JavaScriptFrameIterator it(isolate, id); |
| 12816 for (; !it.done(); it.Advance()) { |
| 12817 if (index < count + it.frame()->GetInlineCount()) break; |
| 12818 count += it.frame()->GetInlineCount(); |
| 12819 } |
| 12820 if (it.done()) return heap->undefined_value(); |
| 12821 |
| 12822 const char* error_message = |
| 12823 LiveEdit::RestartFrame(it.frame(), isolate->zone()); |
| 12824 if (error_message) { |
| 12825 return *(isolate->factory()->LookupAsciiSymbol(error_message)); |
| 12826 } |
| 12827 return heap->true_value(); |
| 12828 } |
| 12829 |
| 12830 |
12792 // A testing entry. Returns statement position which is the closest to | 12831 // A testing entry. Returns statement position which is the closest to |
12793 // source_position. | 12832 // source_position. |
12794 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { | 12833 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { |
12795 ASSERT(args.length() == 2); | 12834 ASSERT(args.length() == 2); |
12796 HandleScope scope(isolate); | 12835 HandleScope scope(isolate); |
12797 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 12836 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
12798 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 12837 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
12799 | 12838 |
12800 Handle<Code> code(function->code(), isolate); | 12839 Handle<Code> code(function->code(), isolate); |
12801 | 12840 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13592 // Handle last resort GC and make sure to allow future allocations | 13631 // Handle last resort GC and make sure to allow future allocations |
13593 // to grow the heap without causing GCs (if possible). | 13632 // to grow the heap without causing GCs (if possible). |
13594 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13633 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13595 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13634 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13596 "Runtime::PerformGC"); | 13635 "Runtime::PerformGC"); |
13597 } | 13636 } |
13598 } | 13637 } |
13599 | 13638 |
13600 | 13639 |
13601 } } // namespace v8::internal | 13640 } } // namespace v8::internal |
OLD | NEW |