| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code,
const String& fileName, const TextPosition& scriptStartPosition, ScriptResource
* resource, v8::Isolate* isolate, AccessControlStatus corsStatus) | 45 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code,
const String& fileName, const TextPosition& scriptStartPosition, ScriptResource
* resource, v8::Isolate* isolate, AccessControlStatus corsStatus) |
| 46 { | 46 { |
| 47 // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from | 47 // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from |
| 48 // the ScriptResource. If the format changes, this ID should be changed too. | 48 // the ScriptResource. If the format changes, this ID should be changed too. |
| 49 static const unsigned dataTypeID = 0xECC13BD7; | 49 static const unsigned dataTypeID = 0xECC13BD7; |
| 50 | 50 |
| 51 // Very small scripts are not worth the effort to store cached data. | 51 // Very small scripts are not worth the effort to store cached data. |
| 52 static const int minLengthForCachedData = 1024; | 52 static const int minLengthForCachedData = 1024; |
| 53 | 53 |
| 54 TRACE_EVENT1("v8", "v8.compile", "fileName", TRACE_STR_COPY(fileName.utf8().
data())); | 54 TRACE_EVENT1("v8", "v8.compile", "fileName", fileName.utf8()); |
| 55 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Compile"); | 55 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Compile"); |
| 56 | 56 |
| 57 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at | 57 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at |
| 58 // 1, whereas v8 starts at 0. | 58 // 1, whereas v8 starts at 0. |
| 59 v8::Handle<v8::String> name = v8String(isolate, fileName); | 59 v8::Handle<v8::String> name = v8String(isolate, fileName); |
| 60 v8::Handle<v8::Integer> line = v8::Integer::New(isolate, scriptStartPosition
.m_line.zeroBasedInt()); | 60 v8::Handle<v8::Integer> line = v8::Integer::New(isolate, scriptStartPosition
.m_line.zeroBasedInt()); |
| 61 v8::Handle<v8::Integer> column = v8::Integer::New(isolate, scriptStartPositi
on.m_column.zeroBasedInt()); | 61 v8::Handle<v8::Integer> column = v8::Integer::New(isolate, scriptStartPositi
on.m_column.zeroBasedInt()); |
| 62 v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOri
gin ? v8::True(isolate) : v8::False(isolate); | 62 v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOri
gin ? v8::True(isolate) : v8::False(isolate); |
| 63 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); | 63 v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin); |
| 64 | 64 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 { | 189 { |
| 190 TRACE_EVENT0("v8", "v8.newInstance"); | 190 TRACE_EVENT0("v8", "v8.newInstance"); |
| 191 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution"); | 191 TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution"); |
| 192 V8RecursionScope scope(isolate, context); | 192 V8RecursionScope scope(isolate, context); |
| 193 v8::Local<v8::Object> result = function->NewInstance(argc, argv); | 193 v8::Local<v8::Object> result = function->NewInstance(argc, argv); |
| 194 crashIfV8IsDead(); | 194 crashIfV8IsDead(); |
| 195 return result; | 195 return result; |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace WebCore | 198 } // namespace WebCore |
| OLD | NEW |