OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gin/v8_initializer.h" | 5 #include "gin/v8_initializer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/feature_list.h" |
13 #include "base/files/file.h" | 14 #include "base/files/file.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/files/memory_mapped_file.h" | 16 #include "base/files/memory_mapped_file.h" |
16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
19 #include "base/rand_util.h" | 20 #include "base/rand_util.h" |
20 #include "base/strings/sys_string_conversions.h" | 21 #include "base/strings/sys_string_conversions.h" |
21 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "crypto/sha2.h" | 24 #include "crypto/sha2.h" |
| 25 #include "gin/public/gin_features.h" |
24 | 26 |
25 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 27 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
26 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
27 #include "base/android/apk_assets.h" | 29 #include "base/android/apk_assets.h" |
28 #endif | 30 #endif |
29 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
30 #include "base/mac/foundation_util.h" | 32 #include "base/mac/foundation_util.h" |
31 #endif // OS_MACOSX | 33 #endif // OS_MACOSX |
32 #include "base/path_service.h" | 34 #include "base/path_service.h" |
33 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 35 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 416 |
415 if (IsolateHolder::kStrictMode == mode) { | 417 if (IsolateHolder::kStrictMode == mode) { |
416 static const char use_strict[] = "--use_strict"; | 418 static const char use_strict[] = "--use_strict"; |
417 v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); | 419 v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); |
418 } | 420 } |
419 if (IsolateHolder::kStableAndExperimentalV8Extras == v8_extras_mode) { | 421 if (IsolateHolder::kStableAndExperimentalV8Extras == v8_extras_mode) { |
420 static const char flag[] = "--experimental_extras"; | 422 static const char flag[] = "--experimental_extras"; |
421 v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1); | 423 v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1); |
422 } | 424 } |
423 | 425 |
| 426 if (base::FeatureList::IsEnabled(features::kV8Ignition)) { |
| 427 std::string flag("--ignition"); |
| 428 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); |
| 429 } |
| 430 |
424 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 431 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
425 v8::StartupData natives; | 432 v8::StartupData natives; |
426 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data()); | 433 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data()); |
427 natives.raw_size = static_cast<int>(g_mapped_natives->length()); | 434 natives.raw_size = static_cast<int>(g_mapped_natives->length()); |
428 v8::V8::SetNativesDataBlob(&natives); | 435 v8::V8::SetNativesDataBlob(&natives); |
429 | 436 |
430 if (g_mapped_snapshot != NULL) { | 437 if (g_mapped_snapshot != NULL) { |
431 v8::StartupData snapshot; | 438 v8::StartupData snapshot; |
432 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); | 439 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); |
433 snapshot.raw_size = static_cast<int>(g_mapped_snapshot->length()); | 440 snapshot.raw_size = static_cast<int>(g_mapped_snapshot->length()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 480 |
474 // static | 481 // static |
475 base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) { | 482 base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) { |
476 base::FilePath path; | 483 base::FilePath path; |
477 GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path); | 484 GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path); |
478 return path; | 485 return path; |
479 } | 486 } |
480 #endif // defined(OS_ANDROID) | 487 #endif // defined(OS_ANDROID) |
481 | 488 |
482 } // namespace gin | 489 } // namespace gin |
OLD | NEW |