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