diff options
Diffstat (limited to 'chromium/gin')
-rw-r--r-- | chromium/gin/function_template.h | 11 | ||||
-rw-r--r-- | chromium/gin/gin_features.cc | 17 | ||||
-rw-r--r-- | chromium/gin/modules/file_module_provider.cc | 9 | ||||
-rw-r--r-- | chromium/gin/modules/module_registry.cc | 1 | ||||
-rw-r--r-- | chromium/gin/modules/timer_unittest.cc | 16 | ||||
-rw-r--r-- | chromium/gin/public/gin_features.h | 2 | ||||
-rw-r--r-- | chromium/gin/shell/gin_main.cc | 11 | ||||
-rw-r--r-- | chromium/gin/v8_initializer.cc | 78 | ||||
-rw-r--r-- | chromium/gin/v8_initializer.h | 5 | ||||
-rw-r--r-- | chromium/gin/v8_isolate_memory_dump_provider.cc | 75 | ||||
-rw-r--r-- | chromium/gin/v8_isolate_memory_dump_provider_unittest.cc | 4 | ||||
-rw-r--r-- | chromium/gin/wrappable_unittest.cc | 6 |
12 files changed, 161 insertions, 74 deletions
diff --git a/chromium/gin/function_template.h b/chromium/gin/function_template.h index c0228cb5f83..69ce797c721 100644 --- a/chromium/gin/function_template.h +++ b/chromium/gin/function_template.h @@ -237,11 +237,12 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( typedef internal::CallbackHolder<Sig> HolderT; HolderT* holder = new HolderT(isolate, callback, callback_flags); - return v8::FunctionTemplate::New( - isolate, - &internal::Dispatcher<Sig>::DispatchToCallback, - ConvertToV8<v8::Local<v8::External> >(isolate, - holder->GetHandle(isolate))); + v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New( + isolate, &internal::Dispatcher<Sig>::DispatchToCallback, + ConvertToV8<v8::Local<v8::External>>(isolate, + holder->GetHandle(isolate))); + tmpl->RemovePrototype(); + return tmpl; } // CreateFunctionHandler installs a CallAsFunction handler on the given diff --git a/chromium/gin/gin_features.cc b/chromium/gin/gin_features.cc index 40de09d973a..e9bd0a52478 100644 --- a/chromium/gin/gin_features.cc +++ b/chromium/gin/gin_features.cc @@ -6,14 +6,27 @@ namespace features { -// Enables or disables the experimental V8 Ignition interpreter. +// Enables or disables the V8 Ignition interpreter. const base::Feature kV8Ignition { "V8Ignition", base::FEATURE_DISABLED_BY_DEFAULT }; -// Enables or disables lazy compilation for the V8 Ignition interpreter. +// Enables or disables the V8 Ignition interpreter on low end +// Android devices. +const base::Feature kV8IgnitionLowEnd { + "V8IgnitionLowEnd", base::FEATURE_ENABLED_BY_DEFAULT +}; + +// Enables lazy compilation for the V8 Ignition interpreter. Only +// one of V8IgnitionLazy or V8IgnitionEager should be enabled. const base::Feature kV8IgnitionLazy { "V8IgnitionLazy", base::FEATURE_DISABLED_BY_DEFAULT }; +// Enables eager compilation for the V8 Ignition interpreter. Only +// one of V8IgnitionLazy or V8IgnitionEager should be enabled. +const base::Feature kV8IgnitionEager { + "V8IgnitionEager", base::FEATURE_DISABLED_BY_DEFAULT +}; + } // namespace features diff --git a/chromium/gin/modules/file_module_provider.cc b/chromium/gin/modules/file_module_provider.cc index a25686dfd5e..46939b123be 100644 --- a/chromium/gin/modules/file_module_provider.cc +++ b/chromium/gin/modules/file_module_provider.cc @@ -8,8 +8,10 @@ #include "base/bind.h" #include "base/files/file_util.h" -#include "base/message_loop/message_loop.h" +#include "base/location.h" +#include "base/single_thread_task_runner.h" #include "base/strings/string_split.h" +#include "base/threading/thread_task_runner_handle.h" #include "gin/converter.h" namespace gin { @@ -64,8 +66,9 @@ void FileModuleProvider::AttempToLoadModules( if (attempted_ids_.count(id)) continue; attempted_ids_.insert(id); - base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - AttempToLoadModule, runner->GetWeakPtr(), search_paths_, id)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(AttempToLoadModule, runner->GetWeakPtr(), + search_paths_, id)); } } diff --git a/chromium/gin/modules/module_registry.cc b/chromium/gin/modules/module_registry.cc index 209eb06591d..bf11ec8d7e5 100644 --- a/chromium/gin/modules/module_registry.cc +++ b/chromium/gin/modules/module_registry.cc @@ -94,6 +94,7 @@ Local<FunctionTemplate> GetDefineTemplate(Isolate* isolate) { &g_wrapper_info); if (templ.IsEmpty()) { templ = FunctionTemplate::New(isolate, Define); + templ->RemovePrototype(); data->SetFunctionTemplate(&g_wrapper_info, templ); } return templ; diff --git a/chromium/gin/modules/timer_unittest.cc b/chromium/gin/modules/timer_unittest.cc index 1739e5765df..24d5909e078 100644 --- a/chromium/gin/modules/timer_unittest.cc +++ b/chromium/gin/modules/timer_unittest.cc @@ -7,6 +7,8 @@ #include <memory> #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "base/single_thread_task_runner.h" #include "gin/handle.h" #include "gin/object_template_builder.h" #include "gin/public/isolate_holder.h" @@ -66,9 +68,9 @@ struct TestHelper { } void QuitSoon(base::MessageLoop* message_loop) { - message_loop->PostDelayedTask(FROM_HERE, - base::MessageLoop::QuitWhenIdleClosure(), - base::TimeDelta::FromMilliseconds(0)); + message_loop->task_runner()->PostDelayedTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), + base::TimeDelta::FromMilliseconds(0)); } ShellRunnerDelegate delegate; @@ -93,7 +95,7 @@ TEST_F(TimerUnittest, OneShot) { EXPECT_EQ(0, helper.result->count()); helper.QuitSoon(&message_loop_); - message_loop_.Run(); + base::RunLoop().Run(); EXPECT_EQ(1, helper.result->count()); } @@ -109,7 +111,7 @@ TEST_F(TimerUnittest, OneShotCancel) { EXPECT_EQ(0, helper.result->count()); helper.QuitSoon(&message_loop_); - message_loop_.Run(); + base::RunLoop().Run(); EXPECT_EQ(0, helper.result->count()); } @@ -129,7 +131,7 @@ TEST_F(TimerUnittest, Repeating) { helper.runner->Run(source, "script"); EXPECT_EQ(0, helper.result->count()); - message_loop_.Run(); + base::RunLoop().Run(); EXPECT_EQ(3, helper.result->count()); } @@ -146,7 +148,7 @@ TEST_F(TimerUnittest, TimerCallbackToDestroyedRunner) { // Destroy runner, which should destroy the timer object we created. helper.QuitSoon(&message_loop_); helper.runner.reset(NULL); - message_loop_.Run(); + base::RunLoop().Run(); // Timer should not have run because it was deleted. EXPECT_EQ(0, helper.result->count()); diff --git a/chromium/gin/public/gin_features.h b/chromium/gin/public/gin_features.h index 0e120bd980a..9e26f475cd0 100644 --- a/chromium/gin/public/gin_features.h +++ b/chromium/gin/public/gin_features.h @@ -14,7 +14,9 @@ namespace features { GIN_EXPORT extern const base::Feature kV8Ignition; +GIN_EXPORT extern const base::Feature kV8IgnitionLowEnd; GIN_EXPORT extern const base::Feature kV8IgnitionLazy; +GIN_EXPORT extern const base::Feature kV8IgnitionEager; } // namespace features diff --git a/chromium/gin/shell/gin_main.cc b/chromium/gin/shell/gin_main.cc index 706b86ebc40..e73ce1f6dd0 100644 --- a/chromium/gin/shell/gin_main.cc +++ b/chromium/gin/shell/gin_main.cc @@ -8,9 +8,13 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/i18n/icu_util.h" +#include "base/location.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "base/single_thread_task_runner.h" +#include "base/threading/thread_task_runner_handle.h" #include "gin/array_buffer.h" #include "gin/modules/console.h" #include "gin/modules/module_runner_delegate.h" @@ -93,10 +97,11 @@ int main(int argc, char** argv) { base::CommandLine::ForCurrentProcess()->GetArgs(); for (base::CommandLine::StringVector::const_iterator it = args.begin(); it != args.end(); ++it) { - base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); } - message_loop.RunUntilIdle(); + base::RunLoop().RunUntilIdle(); return 0; } diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc index c4d734dfc6a..c5cf128232d 100644 --- a/chromium/gin/v8_initializer.cc +++ b/chromium/gin/v8_initializer.cc @@ -10,6 +10,7 @@ #include <memory> #include "base/debug/alias.h" +#include "base/debug/crash_logging.h" #include "base/feature_list.h" #include "base/files/file.h" #include "base/files/file_path.h" @@ -19,6 +20,7 @@ #include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/strings/sys_string_conversions.h" +#include "base/sys_info.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" #include "crypto/sha2.h" @@ -44,13 +46,6 @@ base::MemoryMappedFile* g_mapped_snapshot = nullptr; #if defined(V8_USE_EXTERNAL_STARTUP_DATA) -const base::PlatformFile kInvalidPlatformFile = -#if defined(OS_WIN) - INVALID_HANDLE_VALUE; -#else - -1; -#endif - // File handles intentionally never closed. Not using File here because its // Windows implementation guards against two instances owning the same // PlatformFile (which we allow since we know it is never freed). @@ -63,28 +58,25 @@ static base::LazyInstance<OpenedFileMap>::Leaky g_opened_files = OpenedFileMap::mapped_type& GetOpenedFile(const char* file) { OpenedFileMap& opened_files(g_opened_files.Get()); if (opened_files.find(file) == opened_files.end()) { - opened_files[file] = - std::make_pair(kInvalidPlatformFile, base::MemoryMappedFile::Region()); + opened_files[file] = std::make_pair(base::kInvalidPlatformFile, + base::MemoryMappedFile::Region()); } return opened_files[file]; } +const char kNativesFileName[] = "natives_blob.bin"; + #if defined(OS_ANDROID) -const char kNativesFileName64[] = "natives_blob_64.bin"; const char kSnapshotFileName64[] = "snapshot_blob_64.bin"; -const char kNativesFileName32[] = "natives_blob_32.bin"; const char kSnapshotFileName32[] = "snapshot_blob_32.bin"; #if defined(__LP64__) -#define kNativesFileName kNativesFileName64 #define kSnapshotFileName kSnapshotFileName64 #else -#define kNativesFileName kNativesFileName32 #define kSnapshotFileName kSnapshotFileName32 #endif #else // defined(OS_ANDROID) -const char kNativesFileName[] = "natives_blob.bin"; const char kSnapshotFileName[] = "snapshot_blob.bin"; #endif // defined(OS_ANDROID) @@ -193,7 +185,7 @@ base::PlatformFile OpenV8File(const char* file_name, static const OpenedFileMap::mapped_type OpenFileIfNecessary( const char* file_name) { OpenedFileMap::mapped_type& opened = GetOpenedFile(file_name); - if (opened.first == kInvalidPlatformFile) { + if (opened.first == base::kInvalidPlatformFile) { opened.first = OpenV8File(file_name, &opened.second); } return opened; @@ -236,6 +228,18 @@ bool GenerateEntropy(unsigned char* buffer, size_t amount) { return true; } +bool ShouldUseIgnition() { + if (base::FeatureList::IsEnabled(features::kV8Ignition)) return true; +#if defined(OS_ANDROID) + if (base::FeatureList::IsEnabled(features::kV8IgnitionLowEnd) && + base::SysInfo::IsLowEndDevice()) { + return true; + } +#endif + return false; +} + + } // namespace #if defined(V8_USE_EXTERNAL_STARTUP_DATA) @@ -258,7 +262,7 @@ static LoadV8FileResult MapVerify(const OpenedFileMap::mapped_type& file_region, const unsigned char* fingerprint, #endif base::MemoryMappedFile** mmapped_file_out) { - if (file_region.first == kInvalidPlatformFile) + if (file_region.first == base::kInvalidPlatformFile) return V8_LOAD_FAILED_OPEN; if (!MapV8File(file_region.first, file_region.second, mmapped_file_out)) return V8_LOAD_FAILED_MAP; @@ -309,7 +313,7 @@ void V8Initializer::LoadV8SnapshotFromFD(base::PlatformFile snapshot_pf, if (g_mapped_snapshot) return; - if (snapshot_pf == kInvalidPlatformFile) + if (snapshot_pf == base::kInvalidPlatformFile) return; base::MemoryMappedFile::Region snapshot_region = @@ -341,7 +345,7 @@ void V8Initializer::LoadV8NativesFromFD(base::PlatformFile natives_pf, if (g_mapped_natives) return; - CHECK_NE(natives_pf, kInvalidPlatformFile); + CHECK_NE(natives_pf, base::kInvalidPlatformFile); base::MemoryMappedFile::Region natives_region = base::MemoryMappedFile::Region::kWholeFile; @@ -382,17 +386,6 @@ base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( #if defined(OS_ANDROID) // static -base::PlatformFile V8Initializer::GetOpenNativesFileForChildProcesses( - base::MemoryMappedFile::Region* region_out, - bool abi_32_bit) { - const char* natives_file = - abi_32_bit ? kNativesFileName32 : kNativesFileName64; - const OpenedFileMap::mapped_type& opened = OpenFileIfNecessary(natives_file); - *region_out = opened.second; - return opened.first; -} - -// static base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( base::MemoryMappedFile::Region* region_out, bool abi_32_bit) { @@ -404,9 +397,9 @@ base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( } // static -base::FilePath V8Initializer::GetNativesFilePath(bool abi_32_bit) { +base::FilePath V8Initializer::GetNativesFilePath() { base::FilePath path; - GetV8FilePath(abi_32_bit ? kNativesFileName32 : kNativesFileName64, &path); + GetV8FilePath(kNativesFileName, &path); return path; } @@ -437,15 +430,28 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1); } - if (base::FeatureList::IsEnabled(features::kV8Ignition)) { + const char* ignition_enabled_crash_key = "N"; + if (ShouldUseIgnition()) { + ignition_enabled_crash_key = "Y"; std::string flag("--ignition"); v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); - } - if (base::FeatureList::IsEnabled(features::kV8IgnitionLazy)) { - std::string flag("--no-ignition-eager"); - v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); + if (base::FeatureList::IsEnabled(features::kV8IgnitionEager)) { + std::string eager_flag("--ignition-eager"); + v8::V8::SetFlagsFromString( + eager_flag.c_str(), static_cast<int>(eager_flag.size())); + } + + if (base::FeatureList::IsEnabled(features::kV8IgnitionLazy)) { + std::string lazy_flag("--no-ignition-eager"); + v8::V8::SetFlagsFromString( + lazy_flag.c_str(), static_cast<int>(lazy_flag.size())); + } } + static const char kIgnitionEnabledKey[] = "v8-ignition"; + base::debug::SetCrashKeyValue(kIgnitionEnabledKey, + ignition_enabled_crash_key); + #if defined(V8_USE_EXTERNAL_STARTUP_DATA) v8::StartupData natives; diff --git a/chromium/gin/v8_initializer.h b/chromium/gin/v8_initializer.h index 4c034804812..7d16c3eb6d9 100644 --- a/chromium/gin/v8_initializer.h +++ b/chromium/gin/v8_initializer.h @@ -67,14 +67,11 @@ class GIN_EXPORT V8Initializer { base::MemoryMappedFile::Region* region_out); #if defined(OS_ANDROID) - static base::PlatformFile GetOpenNativesFileForChildProcesses( - base::MemoryMappedFile::Region* region_out, - bool abi_32_bit); static base::PlatformFile GetOpenSnapshotFileForChildProcesses( base::MemoryMappedFile::Region* region_out, bool abi_32_bit); - static base::FilePath GetNativesFilePath(bool abi_32_bit); + static base::FilePath GetNativesFilePath(); static base::FilePath GetSnapshotFilePath(bool abi_32_bit); #endif diff --git a/chromium/gin/v8_isolate_memory_dump_provider.cc b/chromium/gin/v8_isolate_memory_dump_provider.cc index 8c3ad6a9c0a..601937b45f0 100644 --- a/chromium/gin/v8_isolate_memory_dump_provider.cc +++ b/chromium/gin/v8_isolate_memory_dump_provider.cc @@ -4,6 +4,7 @@ #include "gin/v8_isolate_memory_dump_provider.h" +#include <inttypes.h> #include <stddef.h> #include "base/strings/stringprintf.h" @@ -44,11 +45,49 @@ bool V8IsolateMemoryDumpProvider::OnMemoryDump( return true; } +namespace { + +// Dump statistics related to code/bytecode when memory-infra.v8.code_stats is +// enabled. +void DumpCodeStatistics( + base::trace_event::MemoryAllocatorDump* heap_spaces_dump, + IsolateHolder* isolate_holder) { + // Collecting code statistics is an expensive operation (~10 ms) when + // compared to other v8 metrics (< 1 ms). So, dump them only when + // memory-infra.v8.code_stats is enabled. + // TODO(primiano): This information should be plumbed through TraceConfig. + // See crbug.com/616441. + bool dump_code_stats = false; + TRACE_EVENT_CATEGORY_GROUP_ENABLED( + TRACE_DISABLED_BY_DEFAULT("memory-infra.v8.code_stats"), + &dump_code_stats); + if (!dump_code_stats) + return; + + v8::HeapCodeStatistics code_statistics; + if (!isolate_holder->isolate()->GetHeapCodeAndMetadataStatistics( + &code_statistics)) { + return; + } + + heap_spaces_dump->AddScalar( + "code_and_metadata_size", + base::trace_event::MemoryAllocatorDump::kUnitsBytes, + code_statistics.code_and_metadata_size()); + heap_spaces_dump->AddScalar( + "bytecode_and_metadata_size", + base::trace_event::MemoryAllocatorDump::kUnitsBytes, + code_statistics.bytecode_and_metadata_size()); +} + +} // namespace anonymous + void V8IsolateMemoryDumpProvider::DumpHeapStatistics( const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* process_memory_dump) { - std::string dump_base_name = - base::StringPrintf("v8/isolate_%p", isolate_holder_->isolate()); + std::string dump_base_name = base::StringPrintf( + "v8/isolate_0x%" PRIXPTR, + reinterpret_cast<uintptr_t>(isolate_holder_->isolate())); // Dump statistics of the heap's spaces. std::string space_name_prefix = dump_base_name + "/heap_spaces"; @@ -73,7 +112,8 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( std::string space_dump_name = space_name_prefix + "/" + space_statistics.space_name(); - auto space_dump = process_memory_dump->CreateAllocatorDump(space_dump_name); + auto* space_dump = + process_memory_dump->CreateAllocatorDump(space_dump_name); space_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, base::trace_event::MemoryAllocatorDump::kUnitsBytes, space_physical_size); @@ -89,7 +129,8 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( // Compute the rest of the memory, not accounted by the spaces above. std::string other_spaces_name = space_name_prefix + "/other_spaces"; - auto other_dump = process_memory_dump->CreateAllocatorDump(other_spaces_name); + auto* other_dump = + process_memory_dump->CreateAllocatorDump(other_spaces_name); other_dump->AddScalar( base::trace_event::MemoryAllocatorDump::kNameSize, @@ -109,7 +150,7 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( // so we add an extra dump to avoid mismatches w.r.t. the total // resident values. if (heap_statistics.does_zap_garbage()) { - auto zap_dump = process_memory_dump->CreateAllocatorDump( + auto* zap_dump = process_memory_dump->CreateAllocatorDump( dump_base_name + "/zapped_for_debug"); zap_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, base::trace_event::MemoryAllocatorDump::kUnitsBytes, @@ -119,7 +160,7 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( // Dump statistics about malloced memory. std::string malloc_name = dump_base_name + "/malloc"; - auto malloc_dump = process_memory_dump->CreateAllocatorDump(malloc_name); + auto* malloc_dump = process_memory_dump->CreateAllocatorDump(malloc_name); malloc_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, base::trace_event::MemoryAllocatorDump::kUnitsBytes, heap_statistics.malloced_memory()); @@ -131,9 +172,16 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( system_allocator_name); } - // If light dump is requested, then object statistics are not dumped - if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::LIGHT) + // Add an empty row for the heap_spaces. This is to keep the shape of the + // dump stable, whether code stats are enabled or not. + auto* heap_spaces_dump = + process_memory_dump->CreateAllocatorDump(space_name_prefix); + + // Dump object statistics only for detailed dumps. + if (args.level_of_detail != + base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { return; + } // Dump statistics of the heap's live objects from last GC. // TODO(primiano): these should not be tracked in the same trace event as they @@ -152,7 +200,7 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( object_name_prefix + "/" + object_statistics.object_type(); if (object_statistics.object_sub_type()[0] != '\0') dump_name += std::string("/") + object_statistics.object_sub_type(); - auto object_dump = process_memory_dump->CreateAllocatorDump(dump_name); + auto* object_dump = process_memory_dump->CreateAllocatorDump(dump_name); object_dump->AddScalar( base::trace_event::MemoryAllocatorDump::kNameObjectCount, @@ -166,9 +214,9 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( if (process_memory_dump->GetAllocatorDump(object_name_prefix + "/CODE_TYPE")) { - auto code_kind_dump = process_memory_dump->CreateAllocatorDump( + auto* code_kind_dump = process_memory_dump->CreateAllocatorDump( object_name_prefix + "/CODE_TYPE/CODE_KIND"); - auto code_age_dump = process_memory_dump->CreateAllocatorDump( + auto* code_age_dump = process_memory_dump->CreateAllocatorDump( object_name_prefix + "/CODE_TYPE/CODE_AGE"); process_memory_dump->AddOwnershipEdge(code_kind_dump->guid(), code_age_dump->guid()); @@ -177,8 +225,11 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( if (did_dump_object_stats) { process_memory_dump->AddOwnershipEdge( process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), - process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); + heap_spaces_dump->guid()); } + + // Dump statistics related to code and bytecode if requested. + DumpCodeStatistics(heap_spaces_dump, isolate_holder_); } } // namespace gin diff --git a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc index a1b730ac884..b04380a6804 100644 --- a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc +++ b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc @@ -23,10 +23,10 @@ TEST_F(V8MemoryDumpProviderTest, DumpStatistics) { v8::V8::SetFlagsFromString(track_objects_flag, static_cast<int>(strlen(track_objects_flag))); - std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( - new base::trace_event::ProcessMemoryDump(nullptr)); base::trace_event::MemoryDumpArgs dump_args = { base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; + std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( + new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); instance_->isolate_memory_dump_provider_for_testing()->OnMemoryDump( dump_args, process_memory_dump.get()); const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& diff --git a/chromium/gin/wrappable_unittest.cc b/chromium/gin/wrappable_unittest.cc index e773d2d2839..905346e64e2 100644 --- a/chromium/gin/wrappable_unittest.cc +++ b/chromium/gin/wrappable_unittest.cc @@ -16,11 +16,17 @@ namespace gin { +// This useless base class ensures that the value of a pointer to a MyObject +// (below) is not the same as the value of that pointer cast to the object's +// WrappableBase base. class BaseClass { public: BaseClass() : value_(23) {} virtual ~BaseClass() {} + // So the compiler doesn't complain that |value_| is unused. + int value() const { return value_; } + private: int value_; |