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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 OwnPtr<v8::ScriptData> scriptData = adoptPtr(v8::ScriptData::PreCompile(code
)); | 57 OwnPtr<v8::ScriptData> scriptData = adoptPtr(v8::ScriptData::PreCompile(code
)); |
58 if (!scriptData) | 58 if (!scriptData) |
59 return nullptr; | 59 return nullptr; |
60 | 60 |
61 cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->
Length()); | 61 cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->
Length()); |
62 | 62 |
63 return scriptData.release(); | 63 return scriptData.release(); |
64 } | 64 } |
65 | 65 |
66 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code,
const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData
* scriptData, v8::Isolate* isolate) | 66 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code,
const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData
* scriptData, v8::Isolate* isolate, AccessControlStatus corsStatus) |
67 { | 67 { |
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::ScriptOrigin origin(name, line, column); | 73 v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOri
gin ? v8::True() : v8::False(); |
| 74 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); |
74 return v8::Script::Compile(code, &origin, scriptData); | 75 return v8::Script::Compile(code, &origin, scriptData); |
75 } | 76 } |
76 | 77 |
77 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) |
78 { | 79 { |
79 TRACE_EVENT0("v8", "v8.run"); | 80 TRACE_EVENT0("v8", "v8.run"); |
80 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 81 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
81 if (script.IsEmpty()) | 82 if (script.IsEmpty()) |
82 return v8::Local<v8::Value>(); | 83 return v8::Local<v8::Value>(); |
83 | 84 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 { | 187 { |
187 TRACE_EVENT0("v8", "v8.newInstance"); | 188 TRACE_EVENT0("v8", "v8.newInstance"); |
188 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 189 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
189 V8RecursionScope scope(context); | 190 V8RecursionScope scope(context); |
190 v8::Local<v8::Object> result = function->NewInstance(argc, argv); | 191 v8::Local<v8::Object> result = function->NewInstance(argc, argv); |
191 crashIfV8IsDead(); | 192 crashIfV8IsDead(); |
192 return result; | 193 return result; |
193 } | 194 } |
194 | 195 |
195 } // namespace WebCore | 196 } // namespace WebCore |
OLD | NEW |