| OLD | NEW |
| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fileNa
me, scriptStartPosition, scriptData, isolate); | 112 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fileNa
me, scriptStartPosition, scriptData, isolate); |
| 113 if (script.IsEmpty()) | 113 if (script.IsEmpty()) |
| 114 return v8::Local<v8::Value>(); | 114 return v8::Local<v8::Value>(); |
| 115 | 115 |
| 116 V8RecursionScope::MicrotaskSuppression recursionScope; | 116 V8RecursionScope::MicrotaskSuppression recursionScope; |
| 117 v8::Local<v8::Value> result = script->Run(); | 117 v8::Local<v8::Value> result = script->Run(); |
| 118 crashIfV8IsDead(); | 118 crashIfV8IsDead(); |
| 119 return result; | 119 return result; |
| 120 } | 120 } |
| 121 | 121 |
| 122 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[], v8::Isolate* isolate) | 122 v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> funct
ion, ScriptExecutionContext* context, v8::Handle<v8::Value> receiver, int argc,
v8::Handle<v8::Value> args[], v8::Isolate* isolate) |
| 123 { | 123 { |
| 124 TRACE_EVENT0("v8", "v8.callFunction"); | 124 TRACE_EVENT0("v8", "v8.callFunction"); |
| 125 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 125 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
| 126 | 126 |
| 127 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) | 127 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) |
| 128 return handleMaxRecursionDepthExceeded(isolate); | 128 return handleMaxRecursionDepthExceeded(isolate); |
| 129 | 129 |
| 130 V8RecursionScope recursionScope(context); | 130 V8RecursionScope recursionScope(context); |
| 131 v8::Local<v8::Value> result = function->Call(receiver, argc, args); | 131 v8::Local<v8::Value> result = function->Call(receiver, argc, args); |
| 132 crashIfV8IsDead(); | 132 crashIfV8IsDead(); |
| 133 return result; | 133 return result; |
| 134 } | 134 } |
| 135 | 135 |
| 136 v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Functio
n> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> ar
gs[], v8::Isolate* isolate) | 136 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) |
| 137 { | 137 { |
| 138 TRACE_EVENT0("v8", "v8.callFunction"); | 138 TRACE_EVENT0("v8", "v8.callFunction"); |
| 139 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 139 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
| 140 V8RecursionScope::MicrotaskSuppression recursionScope; | 140 V8RecursionScope::MicrotaskSuppression recursionScope; |
| 141 v8::Local<v8::Value> result = function->Call(receiver, argc, args); | 141 v8::Local<v8::Value> result = function->Call(receiver, argc, args); |
| 142 crashIfV8IsDead(); | 142 crashIfV8IsDead(); |
| 143 return result; | 143 return result; |
| 144 } | 144 } |
| 145 | 145 |
| 146 v8::Local<v8::Value> V8ScriptRunner::callAsFunction(v8::Handle<v8::Object> objec
t, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) | 146 v8::Local<v8::Value> V8ScriptRunner::callAsFunction(v8::Handle<v8::Object> objec
t, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> args[]) |
| 147 { | 147 { |
| 148 TRACE_EVENT0("v8", "v8.callFunction"); | 148 TRACE_EVENT0("v8", "v8.callFunction"); |
| 149 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 149 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
| 150 V8RecursionScope::MicrotaskSuppression recursionScope; | 150 V8RecursionScope::MicrotaskSuppression recursionScope; |
| 151 v8::Local<v8::Value> result = object->CallAsFunction(receiver, argc, args); | 151 v8::Local<v8::Value> result = object->CallAsFunction(receiver, argc, args); |
| 152 crashIfV8IsDead(); | 152 crashIfV8IsDead(); |
| 153 return result; | 153 return result; |
| 154 } | 154 } |
| 155 | 155 |
| 156 v8::Local<v8::Value> V8ScriptRunner::callAsConstructor(v8::Handle<v8::Object> ob
ject, int argc, v8::Handle<v8::Value> args[]) | 156 v8::Local<v8::Value> V8ScriptRunner::callAsConstructor(v8::Handle<v8::Object> ob
ject, int argc, v8::Handle<v8::Value> args[]) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 187 { | 187 { |
| 188 TRACE_EVENT0("v8", "v8.newInstance"); | 188 TRACE_EVENT0("v8", "v8.newInstance"); |
| 189 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 189 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
| 190 V8RecursionScope scope(context); | 190 V8RecursionScope scope(context); |
| 191 v8::Local<v8::Object> result = function->NewInstance(argc, argv); | 191 v8::Local<v8::Object> result = function->NewInstance(argc, argv); |
| 192 crashIfV8IsDead(); | 192 crashIfV8IsDead(); |
| 193 return result; | 193 return result; |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace WebCore | 196 } // namespace WebCore |
| OLD | NEW |