Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: src/runtime.cc

Issue 10544151: Support 'restart call frame' debug command (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: grammar Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 successful. Otherwise returns undefined or an error message.
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 =
12826 LiveEdit::RestartFrame(it.frame(), isolate->zone());
12827 if (error_message) {
12828 return *(isolate->factory()->LookupAsciiSymbol(error_message));
12829 }
12830 return heap->true_value();
12831 }
12832
12833
12795 // A testing entry. Returns statement position which is the closest to 12834 // A testing entry. Returns statement position which is the closest to
12796 // source_position. 12835 // source_position.
12797 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { 12836 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) {
12798 ASSERT(args.length() == 2); 12837 ASSERT(args.length() == 2);
12799 HandleScope scope(isolate); 12838 HandleScope scope(isolate);
12800 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 12839 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
12801 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); 12840 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
12802 12841
12803 Handle<Code> code(function->code(), isolate); 12842 Handle<Code> code(function->code(), isolate);
12804 12843
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
13595 // Handle last resort GC and make sure to allow future allocations 13634 // Handle last resort GC and make sure to allow future allocations
13596 // to grow the heap without causing GCs (if possible). 13635 // to grow the heap without causing GCs (if possible).
13597 isolate->counters()->gc_last_resort_from_js()->Increment(); 13636 isolate->counters()->gc_last_resort_from_js()->Increment();
13598 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13637 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13599 "Runtime::PerformGC"); 13638 "Runtime::PerformGC");
13600 } 13639 }
13601 } 13640 }
13602 13641
13603 13642
13604 } } // namespace v8::internal 13643 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698