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, ScriptAccessControlCheckStatus 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 == ScriptIsSharedCr ossOrigin ? v8::True() : v8::False(); |
74 printf("V8ScriptRunner::CompileScript: corsStatus == ScriptIsSharedCrossOrig in %s\n", corsStatus == ScriptIsSharedCrossOrigin? "true!" : "false!"); | |
abarth-chromium
2013/08/05 22:31:45
We should probably remove this printf before landi
Mike West
2013/08/06 06:53:07
Ah. Right. *ahem* https://codereview.chromium.org/
| |
75 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); | |
74 return v8::Script::Compile(code, &origin, scriptData); | 76 return v8::Script::Compile(code, &origin, scriptData); |
75 } | 77 } |
76 | 78 |
77 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ScriptExecutionContext* context) | 79 v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc ript, ScriptExecutionContext* context) |
78 { | 80 { |
79 TRACE_EVENT0("v8", "v8.run"); | 81 TRACE_EVENT0("v8", "v8.run"); |
80 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 82 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
81 if (script.IsEmpty()) | 83 if (script.IsEmpty()) |
82 return v8::Local<v8::Value>(); | 84 return v8::Local<v8::Value>(); |
83 | 85 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 { | 188 { |
187 TRACE_EVENT0("v8", "v8.newInstance"); | 189 TRACE_EVENT0("v8", "v8.newInstance"); |
188 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); | 190 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "Execution"); |
189 V8RecursionScope scope(context); | 191 V8RecursionScope scope(context); |
190 v8::Local<v8::Object> result = function->NewInstance(argc, argv); | 192 v8::Local<v8::Object> result = function->NewInstance(argc, argv); |
191 crashIfV8IsDead(); | 193 crashIfV8IsDead(); |
192 return result; | 194 return result; |
193 } | 195 } |
194 | 196 |
195 } // namespace WebCore | 197 } // namespace WebCore |
OLD | NEW |