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

Side by Side Diff: src/execution.h

Issue 102063004: Introduce API to temporarily interrupt long running JavaScript code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 25 matching lines...) Expand all
36 36
37 // Flag used to set the interrupt causes. 37 // Flag used to set the interrupt causes.
38 enum InterruptFlag { 38 enum InterruptFlag {
39 INTERRUPT = 1 << 0, 39 INTERRUPT = 1 << 0,
40 DEBUGBREAK = 1 << 1, 40 DEBUGBREAK = 1 << 1,
41 DEBUGCOMMAND = 1 << 2, 41 DEBUGCOMMAND = 1 << 2,
42 PREEMPT = 1 << 3, 42 PREEMPT = 1 << 3,
43 TERMINATE = 1 << 4, 43 TERMINATE = 1 << 4,
44 GC_REQUEST = 1 << 5, 44 GC_REQUEST = 1 << 5,
45 FULL_DEOPT = 1 << 6, 45 FULL_DEOPT = 1 << 6,
46 INSTALL_CODE = 1 << 7 46 INSTALL_CODE = 1 << 7,
47 API_INTERRUPT = 1 << 8
47 }; 48 };
48 49
49 50
50 class Isolate; 51 class Isolate;
51 52
52 53
53 class Execution : public AllStatic { 54 class Execution : public AllStatic {
54 public: 55 public:
55 // Call a function, the caller supplies a receiver and an array 56 // Call a function, the caller supplies a receiver and an array
56 // of arguments. Arguments are Object* type. After function returns, 57 // of arguments. Arguments are Object* type. After function returns,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void DebugCommand(); 216 void DebugCommand();
216 #endif 217 #endif
217 bool IsGCRequest(); 218 bool IsGCRequest();
218 void RequestGC(); 219 void RequestGC();
219 bool IsInstallCodeRequest(); 220 bool IsInstallCodeRequest();
220 void RequestInstallCode(); 221 void RequestInstallCode();
221 bool IsFullDeopt(); 222 bool IsFullDeopt();
222 void FullDeopt(); 223 void FullDeopt();
223 void Continue(InterruptFlag after_what); 224 void Continue(InterruptFlag after_what);
224 225
226 void RequestInterrupt(InterruptCallback callback, void* data);
227 void ClearInterrupt();
228 bool IsAPIInterrupt();
229 void InvokeInterruptCallback();
230
225 // This provides an asynchronous read of the stack limits for the current 231 // This provides an asynchronous read of the stack limits for the current
226 // thread. There are no locks protecting this, but it is assumed that you 232 // thread. There are no locks protecting this, but it is assumed that you
227 // have the global V8 lock if you are using multiple V8 threads. 233 // have the global V8 lock if you are using multiple V8 threads.
228 uintptr_t climit() { 234 uintptr_t climit() {
229 return thread_local_.climit_; 235 return thread_local_.climit_;
230 } 236 }
231 uintptr_t real_climit() { 237 uintptr_t real_climit() {
232 return thread_local_.real_climit_; 238 return thread_local_.real_climit_;
233 } 239 }
234 uintptr_t jslimit() { 240 uintptr_t jslimit() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // fail. Both the generated code and the runtime system check against the 306 // fail. Both the generated code and the runtime system check against the
301 // one without the real_ prefix. 307 // one without the real_ prefix.
302 uintptr_t real_jslimit_; // Actual JavaScript stack limit set for the VM. 308 uintptr_t real_jslimit_; // Actual JavaScript stack limit set for the VM.
303 uintptr_t jslimit_; 309 uintptr_t jslimit_;
304 uintptr_t real_climit_; // Actual C++ stack limit set for the VM. 310 uintptr_t real_climit_; // Actual C++ stack limit set for the VM.
305 uintptr_t climit_; 311 uintptr_t climit_;
306 312
307 int nesting_; 313 int nesting_;
308 int postpone_interrupts_nesting_; 314 int postpone_interrupts_nesting_;
309 int interrupt_flags_; 315 int interrupt_flags_;
316
317 InterruptCallback interrupt_callback_;
318 void* interrupt_callback_data_;
310 }; 319 };
311 320
312 // TODO(isolates): Technically this could be calculated directly from a 321 // TODO(isolates): Technically this could be calculated directly from a
313 // pointer to StackGuard. 322 // pointer to StackGuard.
314 Isolate* isolate_; 323 Isolate* isolate_;
315 ThreadLocal thread_local_; 324 ThreadLocal thread_local_;
316 325
317 friend class Isolate; 326 friend class Isolate;
318 friend class StackLimitCheck; 327 friend class StackLimitCheck;
319 friend class PostponeInterruptsScope; 328 friend class PostponeInterruptsScope;
320 329
321 DISALLOW_COPY_AND_ASSIGN(StackGuard); 330 DISALLOW_COPY_AND_ASSIGN(StackGuard);
322 }; 331 };
323 332
324 333
325 } } // namespace v8::internal 334 } } // namespace v8::internal
326 335
327 #endif // V8_EXECUTION_H_ 336 #endif // V8_EXECUTION_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/execution.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698