Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: test/cctest/test-serialize.cc

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. 1 // Copyright 2007-2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 v8::HandleScope handle_scope(v8_isolate); 255 v8::HandleScope handle_scope(v8_isolate);
256 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); 256 v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
257 } 257 }
258 // Make sure all builtin scripts are cached. 258 // Make sure all builtin scripts are cached.
259 { 259 {
260 HandleScope scope(isolate); 260 HandleScope scope(isolate);
261 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 261 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
262 isolate->bootstrapper()->SourceLookup<Natives>(i); 262 isolate->bootstrapper()->SourceLookup<Natives>(i);
263 } 263 }
264 } 264 }
265
266 isolate->compilation_cache()->Clear();
mvstanton 2017/02/03 12:16:37 Change to CollectAllAvailableGarbage().
267
265 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, 268 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask,
266 i::GarbageCollectionReason::kTesting); 269 i::GarbageCollectionReason::kTesting);
267 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, 270 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask,
268 i::GarbageCollectionReason::kTesting); 271 i::GarbageCollectionReason::kTesting);
269 272
270 Object* raw_foo; 273 Object* raw_foo;
271 { 274 {
272 v8::HandleScope handle_scope(v8_isolate); 275 v8::HandleScope handle_scope(v8_isolate);
273 v8::Local<v8::String> foo = v8_str("foo"); 276 v8::Local<v8::String> foo = v8_str("foo");
274 CHECK(!foo.IsEmpty()); 277 CHECK(!foo.IsEmpty());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 v8::HandleScope handle_scope(v8_isolate); 366 v8::HandleScope handle_scope(v8_isolate);
364 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); 367 v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
365 } 368 }
366 // Make sure all builtin scripts are cached. 369 // Make sure all builtin scripts are cached.
367 { 370 {
368 HandleScope scope(isolate); 371 HandleScope scope(isolate);
369 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 372 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
370 isolate->bootstrapper()->SourceLookup<Natives>(i); 373 isolate->bootstrapper()->SourceLookup<Natives>(i);
371 } 374 }
372 } 375 }
376
377 isolate->compilation_cache()->Clear();
378
373 // If we don't do this then we end up with a stray root pointing at the 379 // If we don't do this then we end up with a stray root pointing at the
374 // context even after we have disposed of env. 380 // context even after we have disposed of env.
375 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, 381 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask,
376 i::GarbageCollectionReason::kTesting); 382 i::GarbageCollectionReason::kTesting);
377 383
378 { 384 {
379 v8::HandleScope handle_scope(v8_isolate); 385 v8::HandleScope handle_scope(v8_isolate);
380 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); 386 v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
381 } 387 }
382 388
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 CompileScript(isolate, src, src, &cache, 1007 CompileScript(isolate, src, src, &cache,
1002 v8::ScriptCompiler::kProduceCodeCache); 1008 v8::ScriptCompiler::kProduceCodeCache);
1003 1009
1004 DisallowCompilation no_compile_expected(isolate); 1010 DisallowCompilation no_compile_expected(isolate);
1005 Handle<SharedFunctionInfo> copy = CompileScript( 1011 Handle<SharedFunctionInfo> copy = CompileScript(
1006 isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache); 1012 isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache);
1007 1013
1008 CHECK(isolate->compilation_cache() 1014 CHECK(isolate->compilation_cache()
1009 ->LookupScript(src, src, 0, 0, v8::ScriptOriginOptions(), 1015 ->LookupScript(src, src, 0, 0, v8::ScriptOriginOptions(),
1010 isolate->native_context(), SLOPPY) 1016 isolate->native_context(), SLOPPY)
1011 .ToHandleChecked() 1017 .info() == *copy);
1012 .is_identical_to(copy));
1013 1018
1014 delete cache; 1019 delete cache;
1015 } 1020 }
1016 1021
1017 TEST(CodeSerializerInternalizedString) { 1022 TEST(CodeSerializerInternalizedString) {
1018 FLAG_serialize_toplevel = true; 1023 FLAG_serialize_toplevel = true;
1019 LocalContext context; 1024 LocalContext context;
1020 Isolate* isolate = CcTest::i_isolate(); 1025 Isolate* isolate = CcTest::i_isolate();
1021 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. 1026 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache.
1022 1027
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 } 2461 }
2457 delete[] blob.data; 2462 delete[] blob.data;
2458 } 2463 }
2459 2464
2460 TEST(SerializationMemoryStats) { 2465 TEST(SerializationMemoryStats) {
2461 FLAG_profile_deserialization = true; 2466 FLAG_profile_deserialization = true;
2462 FLAG_always_opt = false; 2467 FLAG_always_opt = false;
2463 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 2468 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
2464 delete[] blob.data; 2469 delete[] blob.data;
2465 } 2470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698