| OLD | NEW |
| 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 Loading... |
| 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 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, | 265 |
| 266 i::GarbageCollectionReason::kTesting); | 266 heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); |
| 267 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, | 267 heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); |
| 268 i::GarbageCollectionReason::kTesting); | |
| 269 | 268 |
| 270 Object* raw_foo; | 269 Object* raw_foo; |
| 271 { | 270 { |
| 272 v8::HandleScope handle_scope(v8_isolate); | 271 v8::HandleScope handle_scope(v8_isolate); |
| 273 v8::Local<v8::String> foo = v8_str("foo"); | 272 v8::Local<v8::String> foo = v8_str("foo"); |
| 274 CHECK(!foo.IsEmpty()); | 273 CHECK(!foo.IsEmpty()); |
| 275 raw_foo = *(v8::Utils::OpenHandle(*foo)); | 274 raw_foo = *(v8::Utils::OpenHandle(*foo)); |
| 276 } | 275 } |
| 277 | 276 |
| 278 { | 277 { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 v8::HandleScope handle_scope(v8_isolate); | 362 v8::HandleScope handle_scope(v8_isolate); |
| 364 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 363 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
| 365 } | 364 } |
| 366 // Make sure all builtin scripts are cached. | 365 // Make sure all builtin scripts are cached. |
| 367 { | 366 { |
| 368 HandleScope scope(isolate); | 367 HandleScope scope(isolate); |
| 369 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 368 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
| 370 isolate->bootstrapper()->SourceLookup<Natives>(i); | 369 isolate->bootstrapper()->SourceLookup<Natives>(i); |
| 371 } | 370 } |
| 372 } | 371 } |
| 372 |
| 373 // If we don't do this then we end up with a stray root pointing at the | 373 // 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. | 374 // context even after we have disposed of env. |
| 375 heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, | 375 heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); |
| 376 i::GarbageCollectionReason::kTesting); | |
| 377 | 376 |
| 378 { | 377 { |
| 379 v8::HandleScope handle_scope(v8_isolate); | 378 v8::HandleScope handle_scope(v8_isolate); |
| 380 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); | 379 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); |
| 381 } | 380 } |
| 382 | 381 |
| 383 i::Object* raw_context = *v8::Utils::OpenPersistent(env); | 382 i::Object* raw_context = *v8::Utils::OpenPersistent(env); |
| 384 | 383 |
| 385 env.Reset(); | 384 env.Reset(); |
| 386 | 385 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 .ToHandleChecked(); | 997 .ToHandleChecked(); |
| 999 ScriptData* cache = NULL; | 998 ScriptData* cache = NULL; |
| 1000 | 999 |
| 1001 CompileScript(isolate, src, src, &cache, | 1000 CompileScript(isolate, src, src, &cache, |
| 1002 v8::ScriptCompiler::kProduceCodeCache); | 1001 v8::ScriptCompiler::kProduceCodeCache); |
| 1003 | 1002 |
| 1004 DisallowCompilation no_compile_expected(isolate); | 1003 DisallowCompilation no_compile_expected(isolate); |
| 1005 Handle<SharedFunctionInfo> copy = CompileScript( | 1004 Handle<SharedFunctionInfo> copy = CompileScript( |
| 1006 isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache); | 1005 isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache); |
| 1007 | 1006 |
| 1008 CHECK(isolate->compilation_cache() | 1007 InfoVectorPair pair = isolate->compilation_cache()->LookupScript( |
| 1009 ->LookupScript(src, src, 0, 0, v8::ScriptOriginOptions(), | 1008 src, src, 0, 0, v8::ScriptOriginOptions(), isolate->native_context(), |
| 1010 isolate->native_context(), SLOPPY) | 1009 SLOPPY); |
| 1011 .ToHandleChecked() | 1010 |
| 1012 .is_identical_to(copy)); | 1011 CHECK(pair.shared() == *copy); |
| 1013 | 1012 |
| 1014 delete cache; | 1013 delete cache; |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 TEST(CodeSerializerInternalizedString) { | 1016 TEST(CodeSerializerInternalizedString) { |
| 1018 FLAG_serialize_toplevel = true; | 1017 FLAG_serialize_toplevel = true; |
| 1019 LocalContext context; | 1018 LocalContext context; |
| 1020 Isolate* isolate = CcTest::i_isolate(); | 1019 Isolate* isolate = CcTest::i_isolate(); |
| 1021 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. | 1020 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. |
| 1022 | 1021 |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 } | 2455 } |
| 2457 delete[] blob.data; | 2456 delete[] blob.data; |
| 2458 } | 2457 } |
| 2459 | 2458 |
| 2460 TEST(SerializationMemoryStats) { | 2459 TEST(SerializationMemoryStats) { |
| 2461 FLAG_profile_deserialization = true; | 2460 FLAG_profile_deserialization = true; |
| 2462 FLAG_always_opt = false; | 2461 FLAG_always_opt = false; |
| 2463 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2462 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 2464 delete[] blob.data; | 2463 delete[] blob.data; |
| 2465 } | 2464 } |
| OLD | NEW |