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

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

Issue 181843003: Don't ignore OOM exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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
« no previous file with comments | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/bindings/v8/V8WindowShell.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 /* 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ExecutionContext* context, v8::Isolate* isolate) 78 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ExecutionContext* context, v8::Isolate* isolate)
79 { 79 {
80 TRACE_EVENT0("v8", "v8.run"); 80 TRACE_EVENT0("v8", "v8.run");
81 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution"); 81 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution");
82 if (script.IsEmpty()) 82 if (script.IsEmpty())
83 return v8::Local<v8::Value>(); 83 return v8::Local<v8::Value>();
84 84
85 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) 85 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth)
86 return handleMaxRecursionDepthExceeded(isolate); 86 return handleMaxRecursionDepthExceeded(isolate);
87 87
88 if (handleOutOfMemory())
89 return v8::Local<v8::Value>();
90
91 RELEASE_ASSERT(!context->isIteratingOverObservers()); 88 RELEASE_ASSERT(!context->isIteratingOverObservers());
92 89
93 // Run the script and keep track of the current recursion depth. 90 // Run the script and keep track of the current recursion depth.
94 v8::Local<v8::Value> result; 91 v8::Local<v8::Value> result;
95 { 92 {
96 V8RecursionScope recursionScope(context); 93 V8RecursionScope recursionScope(context);
97 result = script->Run(); 94 result = script->Run();
98 } 95 }
99 96
100 if (handleOutOfMemory())
101 ASSERT(result.IsEmpty());
102
103 if (result.IsEmpty()) 97 if (result.IsEmpty())
104 return v8::Local<v8::Value>(); 98 return v8::Local<v8::Value>();
105 99
106 crashIfV8IsDead(); 100 crashIfV8IsDead();
107 return result; 101 return result;
108 } 102 }
109 103
110 v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8:: String> source, v8::Isolate* isolate, const String& fileName, const TextPosition & scriptStartPosition, v8::ScriptData* scriptData) 104 v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8:: String> source, v8::Isolate* isolate, const String& fileName, const TextPosition & scriptStartPosition, v8::ScriptData* scriptData)
111 { 105 {
112 TRACE_EVENT0("v8", "v8.run"); 106 TRACE_EVENT0("v8", "v8.run");
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 { 189 {
196 TRACE_EVENT0("v8", "v8.newInstance"); 190 TRACE_EVENT0("v8", "v8.newInstance");
197 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution"); 191 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution");
198 V8RecursionScope scope(context); 192 V8RecursionScope scope(context);
199 v8::Local<v8::Object> result = function->NewInstance(argc, argv); 193 v8::Local<v8::Object> result = function->NewInstance(argc, argv);
200 crashIfV8IsDead(); 194 crashIfV8IsDead();
201 return result; 195 return result;
202 } 196 }
203 197
204 } // namespace WebCore 198 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/bindings/v8/V8WindowShell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698