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

Side by Side Diff: src/assert-scope.h

Issue 203223013: Introduce API to trigger exception on JS execution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 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
« include/v8.h ('K') | « src/api.cc ('k') | src/execution.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 HANDLE_ALLOCATION_ASSERT, 42 HANDLE_ALLOCATION_ASSERT,
43 HANDLE_DEREFERENCE_ASSERT, 43 HANDLE_DEREFERENCE_ASSERT,
44 DEFERRED_HANDLE_DEREFERENCE_ASSERT, 44 DEFERRED_HANDLE_DEREFERENCE_ASSERT,
45 CODE_DEPENDENCY_CHANGE_ASSERT, 45 CODE_DEPENDENCY_CHANGE_ASSERT,
46 LAST_PER_THREAD_ASSERT_TYPE 46 LAST_PER_THREAD_ASSERT_TYPE
47 }; 47 };
48 48
49 49
50 enum PerIsolateAssertType { 50 enum PerIsolateAssertType {
51 JAVASCRIPT_EXECUTION_ASSERT, 51 JAVASCRIPT_EXECUTION_ASSERT,
52 JAVASCRIPT_EXECUTION_THROWS,
52 ALLOCATION_FAILURE_ASSERT 53 ALLOCATION_FAILURE_ASSERT
53 }; 54 };
54 55
55 56
56 class PerThreadAssertData { 57 class PerThreadAssertData {
57 public: 58 public:
58 PerThreadAssertData() : nesting_level_(0) { 59 PerThreadAssertData() : nesting_level_(0) {
59 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { 60 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) {
60 assert_states_[i] = true; 61 assert_states_[i] = true;
61 } 62 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Per-isolate assert scopes. 245 // Per-isolate assert scopes.
245 246
246 // Scope to document where we do not expect javascript execution. 247 // Scope to document where we do not expect javascript execution.
247 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false> 248 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false>
248 DisallowJavascriptExecution; 249 DisallowJavascriptExecution;
249 250
250 // Scope to introduce an exception to DisallowJavascriptExecution. 251 // Scope to introduce an exception to DisallowJavascriptExecution.
251 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true> 252 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>
252 AllowJavascriptExecution; 253 AllowJavascriptExecution;
253 254
255 // Scope in which javascript execution leads to exception being thrown.
256 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>
257 ThrowOnJavascriptExecution;
258
259 // Scope to introduce an exception to ThrowOnJavascriptExecution.
260 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>
261 NoThrowOnJavascriptExecution;
262
254 // Scope to document where we do not expect an allocation failure. 263 // Scope to document where we do not expect an allocation failure.
255 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false> 264 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false>
256 DisallowAllocationFailure; 265 DisallowAllocationFailure;
257 266
258 // Scope to introduce an exception to DisallowAllocationFailure. 267 // Scope to introduce an exception to DisallowAllocationFailure.
259 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true> 268 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true>
260 AllowAllocationFailure; 269 AllowAllocationFailure;
261 270
262 } } // namespace v8::internal 271 } } // namespace v8::internal
263 272
264 #endif // V8_ASSERT_SCOPE_H_ 273 #endif // V8_ASSERT_SCOPE_H_
OLDNEW
« include/v8.h ('K') | « src/api.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698