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

Side by Side Diff: src/runtime.cc

Issue 39124: Handle thread preemption in debugger (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « src/execution.cc ('k') | src/top.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4949 matching lines...) Expand 10 before | Expand all | Expand 10 after
4960 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); 4960 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
4961 4961
4962 return obj->GetElementWithInterceptor(*obj, index); 4962 return obj->GetElementWithInterceptor(*obj, index);
4963 } 4963 }
4964 4964
4965 4965
4966 static Object* Runtime_CheckExecutionState(Arguments args) { 4966 static Object* Runtime_CheckExecutionState(Arguments args) {
4967 ASSERT(args.length() >= 1); 4967 ASSERT(args.length() >= 1);
4968 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 4968 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
4969 // Check that the break id is valid. 4969 // Check that the break id is valid.
4970 if (Top::break_id() == 0 || break_id != Top::break_id()) { 4970 if (Debug::break_id() == 0 || break_id != Debug::break_id()) {
4971 return Top::Throw(Heap::illegal_execution_state_symbol()); 4971 return Top::Throw(Heap::illegal_execution_state_symbol());
4972 } 4972 }
4973 4973
4974 return Heap::true_value(); 4974 return Heap::true_value();
4975 } 4975 }
4976 4976
4977 4977
4978 static Object* Runtime_GetFrameCount(Arguments args) { 4978 static Object* Runtime_GetFrameCount(Arguments args) {
4979 HandleScope scope; 4979 HandleScope scope;
4980 ASSERT(args.length() == 1); 4980 ASSERT(args.length() == 1);
4981 4981
4982 // Check arguments. 4982 // Check arguments.
4983 Object* result = Runtime_CheckExecutionState(args); 4983 Object* result = Runtime_CheckExecutionState(args);
4984 if (result->IsFailure()) return result; 4984 if (result->IsFailure()) return result;
4985 4985
4986 // Count all frames which are relevant to debugging stack trace. 4986 // Count all frames which are relevant to debugging stack trace.
4987 int n = 0; 4987 int n = 0;
4988 StackFrame::Id id = Top::break_frame_id(); 4988 StackFrame::Id id = Debug::break_frame_id();
4989 if (id == StackFrame::NO_ID) { 4989 if (id == StackFrame::NO_ID) {
4990 // If there is no JavaScript stack frame count is 0. 4990 // If there is no JavaScript stack frame count is 0.
4991 return Smi::FromInt(0); 4991 return Smi::FromInt(0);
4992 } 4992 }
4993 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) n++; 4993 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) n++;
4994 return Smi::FromInt(n); 4994 return Smi::FromInt(n);
4995 } 4995 }
4996 4996
4997 4997
4998 static const int kFrameDetailsFrameIdIndex = 0; 4998 static const int kFrameDetailsFrameIdIndex = 0;
(...skipping 24 matching lines...) Expand all
5023 static Object* Runtime_GetFrameDetails(Arguments args) { 5023 static Object* Runtime_GetFrameDetails(Arguments args) {
5024 HandleScope scope; 5024 HandleScope scope;
5025 ASSERT(args.length() == 2); 5025 ASSERT(args.length() == 2);
5026 5026
5027 // Check arguments. 5027 // Check arguments.
5028 Object* check = Runtime_CheckExecutionState(args); 5028 Object* check = Runtime_CheckExecutionState(args);
5029 if (check->IsFailure()) return check; 5029 if (check->IsFailure()) return check;
5030 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 5030 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
5031 5031
5032 // Find the relevant frame with the requested index. 5032 // Find the relevant frame with the requested index.
5033 StackFrame::Id id = Top::break_frame_id(); 5033 StackFrame::Id id = Debug::break_frame_id();
5034 if (id == StackFrame::NO_ID) { 5034 if (id == StackFrame::NO_ID) {
5035 // If there are no JavaScript stack frames return undefined. 5035 // If there are no JavaScript stack frames return undefined.
5036 return Heap::undefined_value(); 5036 return Heap::undefined_value();
5037 } 5037 }
5038 int count = 0; 5038 int count = 0;
5039 JavaScriptFrameIterator it(id); 5039 JavaScriptFrameIterator it(id);
5040 for (; !it.done(); it.Advance()) { 5040 for (; !it.done(); it.Advance()) {
5041 if (count == index) break; 5041 if (count == index) break;
5042 count++; 5042 count++;
5043 } 5043 }
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
6136 } else { 6136 } else {
6137 // Handle last resort GC and make sure to allow future allocations 6137 // Handle last resort GC and make sure to allow future allocations
6138 // to grow the heap without causing GCs (if possible). 6138 // to grow the heap without causing GCs (if possible).
6139 Counters::gc_last_resort_from_js.Increment(); 6139 Counters::gc_last_resort_from_js.Increment();
6140 Heap::CollectAllGarbage(); 6140 Heap::CollectAllGarbage();
6141 } 6141 }
6142 } 6142 }
6143 6143
6144 6144
6145 } } // namespace v8::internal 6145 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/top.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698