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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 TRACE_EVENT0("v8", "v8.compile"); | 68 TRACE_EVENT0("v8", "v8.compile"); |
69 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Compile"); | 69 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Compile"); |
70 v8::Handle<v8::String> name = v8String(fileName, isolate); | 70 v8::Handle<v8::String> name = v8String(fileName, isolate); |
71 v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.z eroBasedInt(), isolate); | 71 v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.z eroBasedInt(), isolate); |
72 v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_colu mn.zeroBasedInt(), isolate); | 72 v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_colu mn.zeroBasedInt(), isolate); |
73 v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOri gin ? v8::True() : v8::False(); | 73 v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOri gin ? v8::True() : v8::False(); |
74 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); | 74 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); |
75 return v8::Script::Compile(code, &origin, scriptData); | 75 return v8::Script::Compile(code, &origin, scriptData); |
76 } | 76 } |
77 | 77 |
78 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ScriptExecutionContext* context) | 78 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ScriptExecutionContext* context, v8::Isolate* isolate) |
marja
2013/09/06 11:57:16
I'm not sure about this... there's also getIsolate
| |
79 { | 79 { |
80 TRACE_EVENT0("v8", "v8.run"); | 80 TRACE_EVENT0("v8", "v8.run"); |
81 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 81 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
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(); | 86 return handleMaxRecursionDepthExceeded(isolate); |
87 | 87 |
88 if (handleOutOfMemory()) | 88 if (handleOutOfMemory()) |
89 return v8::Local<v8::Value>(); | 89 return v8::Local<v8::Value>(); |
90 | 90 |
91 // Run the script and keep track of the current recursion depth. | 91 // Run the script and keep track of the current recursion depth. |
92 v8::Local<v8::Value> result; | 92 v8::Local<v8::Value> result; |
93 { | 93 { |
94 V8RecursionScope recursionScope(context); | 94 V8RecursionScope recursionScope(context); |
95 result = script->Run(); | 95 result = script->Run(); |
96 } | 96 } |
(...skipping 15 matching lines...) Expand all 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[]) | 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) |
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(); | 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::Object> receiver, int argc, v8::Handle<v8::Value> ar gs[], v8::Isolate* isolate) |
137 { | 137 { |
138 TRACE_EVENT0("v8", "v8.callFunction"); | 138 TRACE_EVENT0("v8", "v8.callFunction"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |