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

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

Issue 15975002: Implement V8ScriptRunner::callFunction() Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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/V8ScriptRunner.h ('k') | no next file » | 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8:: String> source, v8::Isolate* isolate, v8::Local<v8::Context> context, const Stri ng& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptDat a) 105 v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8:: String> source, v8::Isolate* isolate, v8::Local<v8::Context> context, const Stri ng& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptDat a)
106 { 106 {
107 TRACE_EVENT0("v8", "v8.run"); 107 TRACE_EVENT0("v8", "v8.run");
108 v8::Local<v8::Value> result; 108 v8::Local<v8::Value> result;
109 if (context.IsEmpty()) 109 if (context.IsEmpty())
110 context = v8::Context::New(isolate); 110 context = v8::Context::New(isolate);
111 if (context.IsEmpty()) 111 if (context.IsEmpty())
112 return result; 112 return result;
113 {
114 v8::Context::Scope scope(context);
115 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fi leName, scriptStartPosition, scriptData, isolate);
116 if (script.IsEmpty())
117 return result;
118 113
119 V8RecursionScope::MicrotaskSuppression recursionScope; 114 v8::Context::Scope scope(context);
120 result = script->Run(); 115 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fileNa me, scriptStartPosition, scriptData, isolate);
121 } 116 if (script.IsEmpty())
117 return result;
118
119 V8RecursionScope::MicrotaskSuppression recursionScope;
120 result = script->Run();
122 return result; 121 return result;
123 } 122 }
124 123
124 v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> funct ion, ScriptExecutionContext* context, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
125 {
126 TRACE_EVENT0("v8", "v8.callFunction");
127 V8GCController::checkMemoryUsage();
128
129 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth)
130 return handleMaxRecursionDepthExceeded();
131
132 V8RecursionScope recursionScope(context);
133 v8::Local<v8::Value> result = function->Call(receiver, argc, args);
134
135 crashIfV8IsDead();
136 return result;
137 }
138
125 v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Functio n> function, v8::Local<v8::Context> context, v8::Handle<v8::Object> receiver, in t argc, v8::Handle<v8::Value> args[], v8::Isolate* isolate) 139 v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Functio n> function, v8::Local<v8::Context> context, v8::Handle<v8::Object> receiver, in t argc, v8::Handle<v8::Value> args[], v8::Isolate* isolate)
126 { 140 {
127 TRACE_EVENT0("v8", "v8.callFunction"); 141 TRACE_EVENT0("v8", "v8.callFunction");
128 v8::Local<v8::Value> result; 142 v8::Local<v8::Value> result;
129 if (context.IsEmpty()) 143 if (context.IsEmpty())
130 context = v8::Context::New(isolate); 144 context = v8::Context::New(isolate);
131 if (context.IsEmpty()) 145 if (context.IsEmpty())
132 return result; 146 return result;
133 147
134 v8::Context::Scope scope(context); 148 v8::Context::Scope scope(context);
135 V8RecursionScope::MicrotaskSuppression recursionScope; 149 V8RecursionScope::MicrotaskSuppression recursionScope;
136 result = function->Call(receiver, argc, args); 150 result = function->Call(receiver, argc, args);
137 crashIfV8IsDead(); 151 crashIfV8IsDead();
138 return result; 152 return result;
139 } 153 }
140 154
141 } // namespace WebCore 155 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698