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

Side by Side Diff: Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 429453010: Drop V8RecursionScope dependency on ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reorder cleanup methods per haraken Created 6 years, 3 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 TRACE_EVENT1("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Val ue(script->GetUnboundScript()->GetScriptName()))); 162 TRACE_EVENT1("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Val ue(script->GetUnboundScript()->GetScriptName())));
163 163
164 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) 164 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth)
165 return throwStackOverflowExceptionIfNeeded(isolate); 165 return throwStackOverflowExceptionIfNeeded(isolate);
166 166
167 RELEASE_ASSERT(!context->isIteratingOverObservers()); 167 RELEASE_ASSERT(!context->isIteratingOverObservers());
168 168
169 // Run the script and keep track of the current recursion depth. 169 // Run the script and keep track of the current recursion depth.
170 v8::Local<v8::Value> result; 170 v8::Local<v8::Value> result;
171 { 171 {
172 V8RecursionScope recursionScope(isolate, context); 172 V8RecursionScope recursionScope(isolate);
173 result = script->Run(); 173 result = script->Run();
174 } 174 }
175 175
176 if (result.IsEmpty()) 176 if (result.IsEmpty())
177 return v8::Local<v8::Value>(); 177 return v8::Local<v8::Value>();
178 178
179 crashIfV8IsDead(); 179 crashIfV8IsDead();
180 return result; 180 return result;
181 } 181 }
182 182
(...skipping 24 matching lines...) Expand all
207 v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> funct ion, ExecutionContext* context, v8::Handle<v8::Value> receiver, int argc, v8::Ha ndle<v8::Value> args[], v8::Isolate* isolate) 207 v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> funct ion, ExecutionContext* context, v8::Handle<v8::Value> receiver, int argc, v8::Ha ndle<v8::Value> args[], v8::Isolate* isolate)
208 { 208 {
209 TRACE_EVENT0("v8", "v8.callFunction"); 209 TRACE_EVENT0("v8", "v8.callFunction");
210 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 210 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
211 211
212 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) 212 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth)
213 return throwStackOverflowExceptionIfNeeded(isolate); 213 return throwStackOverflowExceptionIfNeeded(isolate);
214 214
215 RELEASE_ASSERT(!context->isIteratingOverObservers()); 215 RELEASE_ASSERT(!context->isIteratingOverObservers());
216 216
217 V8RecursionScope recursionScope(isolate, context); 217 V8RecursionScope recursionScope(isolate);
218 v8::Local<v8::Value> result = function->Call(receiver, argc, args); 218 v8::Local<v8::Value> result = function->Call(receiver, argc, args);
219 crashIfV8IsDead(); 219 crashIfV8IsDead();
220 return result; 220 return result;
221 } 221 }
222 222
223 v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Functio n> function, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> arg s[], v8::Isolate* isolate) 223 v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Functio n> function, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> arg s[], v8::Isolate* isolate)
224 { 224 {
225 TRACE_EVENT0("v8", "v8.callFunction"); 225 TRACE_EVENT0("v8", "v8.callFunction");
226 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 226 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
227 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); 227 V8RecursionScope::MicrotaskSuppression recursionScope(isolate);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 V8RecursionScope::MicrotaskSuppression scope(isolate); 260 V8RecursionScope::MicrotaskSuppression scope(isolate);
261 v8::Local<v8::Object> result = function->NewInstance(argc, argv); 261 v8::Local<v8::Object> result = function->NewInstance(argc, argv);
262 crashIfV8IsDead(); 262 crashIfV8IsDead();
263 return result; 263 return result;
264 } 264 }
265 265
266 v8::Local<v8::Object> V8ScriptRunner::instantiateObjectInDocument(v8::Isolate* i solate, v8::Handle<v8::Function> function, ExecutionContext* context, int argc, v8::Handle<v8::Value> argv[]) 266 v8::Local<v8::Object> V8ScriptRunner::instantiateObjectInDocument(v8::Isolate* i solate, v8::Handle<v8::Function> function, ExecutionContext* context, int argc, v8::Handle<v8::Value> argv[])
267 { 267 {
268 TRACE_EVENT0("v8", "v8.newInstance"); 268 TRACE_EVENT0("v8", "v8.newInstance");
269 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 269 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
270 V8RecursionScope scope(isolate, context); 270 V8RecursionScope scope(isolate);
271 v8::Local<v8::Object> result = function->NewInstance(argc, argv); 271 v8::Local<v8::Object> result = function->NewInstance(argc, argv);
272 crashIfV8IsDead(); 272 crashIfV8IsDead();
273 return result; 273 return result;
274 } 274 }
275 275
276 } // namespace blink 276 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8RecursionScope.cpp ('k') | Source/bindings/core/v8/WorkerScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698