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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 | 184 |
185 static void timerTraceProfilerInMainThread(const char* name, int status) | 185 static void timerTraceProfilerInMainThread(const char* name, int status) |
186 { | 186 { |
187 if (!status) { | 187 if (!status) { |
188 TRACE_EVENT_BEGIN0("v8", name); | 188 TRACE_EVENT_BEGIN0("v8", name); |
189 } else { | 189 } else { |
190 TRACE_EVENT_END0("v8", name); | 190 TRACE_EVENT_END0("v8", name); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 static void initializeV8Common(v8::Isolate* isolate) | |
195 { | |
196 v8::V8::AddGCPrologueCallback(V8GCController::gcPrologue); | |
197 v8::V8::AddGCEpilogueCallback(V8GCController::gcEpilogue); | |
198 | |
199 v8::Debug::SetLiveEditEnabled(isolate, false); | |
200 | |
201 isolate->SetAutorunMicrotasks(false); | |
202 } | |
203 | |
204 void V8Initializer::initializeMainThreadIfNeeded() | 194 void V8Initializer::initializeMainThreadIfNeeded() |
205 { | 195 { |
206 ASSERT(isMainThread()); | 196 ASSERT(isMainThread()); |
207 | 197 |
208 static bool initialized = false; | 198 static bool initialized = false; |
209 if (initialized) | 199 if (initialized) |
210 return; | 200 return; |
211 initialized = true; | 201 initialized = true; |
212 | 202 |
203 static const char v8Flags[] = "--harmony-classes"; | |
eseidel
2014/11/20 18:54:21
We should turn on every last bit of harmony we can
| |
204 v8::V8::SetFlagsFromString(v8Flags, sizeof(v8Flags) - 1); | |
205 | |
213 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, v8ArrayBuffe rAllocator()); | 206 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, v8ArrayBuffe rAllocator()); |
214 | 207 |
215 v8::Isolate* isolate = V8PerIsolateData::initialize(); | 208 v8::Isolate* isolate = V8PerIsolateData::initialize(); |
216 | 209 |
217 initializeV8Common(isolate); | 210 v8::V8::AddGCPrologueCallback(V8GCController::gcPrologue); |
211 v8::V8::AddGCEpilogueCallback(V8GCController::gcEpilogue); | |
212 | |
213 v8::Debug::SetLiveEditEnabled(isolate, false); | |
214 | |
215 isolate->SetAutorunMicrotasks(false); | |
218 | 216 |
219 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); | 217 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); |
220 v8::V8::AddMessageListener(messageHandlerInMainThread); | 218 v8::V8::AddMessageListener(messageHandlerInMainThread); |
221 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread); | 219 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread); |
222 | 220 |
223 isolate->SetEventLogger(timerTraceProfilerInMainThread); | 221 isolate->SetEventLogger(timerTraceProfilerInMainThread); |
224 | 222 |
225 ScriptProfiler::initialize(); | 223 ScriptProfiler::initialize(); |
226 } | 224 } |
227 | 225 |
228 } // namespace blink | 226 } // namespace blink |
OLD | NEW |