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

Side by Side Diff: src/runtime.cc

Issue 13720: Changed the debugger break handling to support situations where there are no ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 4740 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 RUNTIME_ASSERT(obj->HasIndexedInterceptor()); 4751 RUNTIME_ASSERT(obj->HasIndexedInterceptor());
4752 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); 4752 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
4753 4753
4754 return obj->GetElementWithInterceptor(*obj, index); 4754 return obj->GetElementWithInterceptor(*obj, index);
4755 } 4755 }
4756 4756
4757 4757
4758 static Object* Runtime_CheckExecutionState(Arguments args) { 4758 static Object* Runtime_CheckExecutionState(Arguments args) {
4759 ASSERT(args.length() >= 1); 4759 ASSERT(args.length() >= 1);
4760 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 4760 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
4761 // Check that the break id is valid and that there is a valid frame 4761 // Check that the break id is valid.
4762 // where execution is broken. 4762 if (Top::break_id() == 0 || break_id != Top::break_id()) {
4763 if (break_id != Top::break_id() ||
4764 Top::break_frame_id() == StackFrame::NO_ID) {
4765 return Top::Throw(Heap::illegal_execution_state_symbol()); 4763 return Top::Throw(Heap::illegal_execution_state_symbol());
4766 } 4764 }
4767 4765
4768 return Heap::true_value(); 4766 return Heap::true_value();
4769 } 4767 }
4770 4768
4771 4769
4772 static Object* Runtime_GetFrameCount(Arguments args) { 4770 static Object* Runtime_GetFrameCount(Arguments args) {
4773 HandleScope scope; 4771 HandleScope scope;
4774 ASSERT(args.length() == 1); 4772 ASSERT(args.length() == 1);
4775 4773
4776 // Check arguments. 4774 // Check arguments.
4777 Object* result = Runtime_CheckExecutionState(args); 4775 Object* result = Runtime_CheckExecutionState(args);
4778 if (result->IsFailure()) return result; 4776 if (result->IsFailure()) return result;
4779 4777
4780 // Count all frames which are relevant to debugging stack trace. 4778 // Count all frames which are relevant to debugging stack trace.
4781 int n = 0; 4779 int n = 0;
4782 StackFrame::Id id = Top::break_frame_id(); 4780 StackFrame::Id id = Top::break_frame_id();
4781 if (id == StackFrame::NO_ID) {
4782 // If there is no JavaScript stack frame count is 0.
4783 return Smi::FromInt(0);
4784 }
4783 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) n++; 4785 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) n++;
4784 return Smi::FromInt(n); 4786 return Smi::FromInt(n);
4785 } 4787 }
4786 4788
4787 4789
4788 static const int kFrameDetailsFrameIdIndex = 0; 4790 static const int kFrameDetailsFrameIdIndex = 0;
4789 static const int kFrameDetailsReceiverIndex = 1; 4791 static const int kFrameDetailsReceiverIndex = 1;
4790 static const int kFrameDetailsFunctionIndex = 2; 4792 static const int kFrameDetailsFunctionIndex = 2;
4791 static const int kFrameDetailsArgumentCountIndex = 3; 4793 static const int kFrameDetailsArgumentCountIndex = 3;
4792 static const int kFrameDetailsLocalCountIndex = 4; 4794 static const int kFrameDetailsLocalCountIndex = 4;
(...skipping 21 matching lines...) Expand all
4814 HandleScope scope; 4816 HandleScope scope;
4815 ASSERT(args.length() == 2); 4817 ASSERT(args.length() == 2);
4816 4818
4817 // Check arguments. 4819 // Check arguments.
4818 Object* check = Runtime_CheckExecutionState(args); 4820 Object* check = Runtime_CheckExecutionState(args);
4819 if (check->IsFailure()) return check; 4821 if (check->IsFailure()) return check;
4820 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 4822 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
4821 4823
4822 // Find the relevant frame with the requested index. 4824 // Find the relevant frame with the requested index.
4823 StackFrame::Id id = Top::break_frame_id(); 4825 StackFrame::Id id = Top::break_frame_id();
4826 if (id == StackFrame::NO_ID) {
4827 // If there is no JavaScript stack frame is undefined.
Mads Ager (chromium) 2008/12/11 07:56:54 is -> return?
Søren Thygesen Gjesse 2008/12/11 08:04:49 Done.
4828 return Heap::undefined_value();
4829 }
4824 int count = 0; 4830 int count = 0;
4825 JavaScriptFrameIterator it(id); 4831 JavaScriptFrameIterator it(id);
4826 for (; !it.done(); it.Advance()) { 4832 for (; !it.done(); it.Advance()) {
4827 if (count == index) break; 4833 if (count == index) break;
4828 count++; 4834 count++;
4829 } 4835 }
4830 if (it.done()) return Heap::undefined_value(); 4836 if (it.done()) return Heap::undefined_value();
4831 4837
4832 // Traverse the saved contexts chain to find the active context for the 4838 // Traverse the saved contexts chain to find the active context for the
4833 // selected frame. 4839 // selected frame.
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5908 } else { 5914 } else {
5909 // Handle last resort GC and make sure to allow future allocations 5915 // Handle last resort GC and make sure to allow future allocations
5910 // to grow the heap without causing GCs (if possible). 5916 // to grow the heap without causing GCs (if possible).
5911 Counters::gc_last_resort_from_js.Increment(); 5917 Counters::gc_last_resort_from_js.Increment();
5912 Heap::CollectAllGarbage(); 5918 Heap::CollectAllGarbage();
5913 } 5919 }
5914 } 5920 }
5915 5921
5916 5922
5917 } } // namespace v8::internal 5923 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698