OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 Handle<Context> native_context = isolate->native_context(); | 1400 Handle<Context> native_context = isolate->native_context(); |
1401 | 1401 |
1402 { | 1402 { |
1403 v8::HandleScope scope(CcTest::isolate()); | 1403 v8::HandleScope scope(CcTest::isolate()); |
1404 CompileRun(raw_source); | 1404 CompileRun(raw_source); |
1405 } | 1405 } |
1406 | 1406 |
1407 // On first compilation, only a hash is inserted in the code cache. We can't | 1407 // On first compilation, only a hash is inserted in the code cache. We can't |
1408 // find that value. | 1408 // find that value. |
1409 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( | 1409 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( |
1410 source, Handle<Object>(), 0, 0, true, native_context); | 1410 source, Handle<Object>(), 0, 0, false, true, native_context); |
1411 CHECK(info.is_null()); | 1411 CHECK(info.is_null()); |
1412 | 1412 |
1413 { | 1413 { |
1414 v8::HandleScope scope(CcTest::isolate()); | 1414 v8::HandleScope scope(CcTest::isolate()); |
1415 CompileRun(raw_source); | 1415 CompileRun(raw_source); |
1416 } | 1416 } |
1417 | 1417 |
1418 // On second compilation, the hash is replaced by a real cache entry mapping | 1418 // On second compilation, the hash is replaced by a real cache entry mapping |
1419 // the source to the shared function info containing the code. | 1419 // the source to the shared function info containing the code. |
1420 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, true, | 1420 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, false, |
1421 native_context); | 1421 true, native_context); |
1422 CHECK(!info.is_null()); | 1422 CHECK(!info.is_null()); |
1423 | 1423 |
1424 heap->CollectAllGarbage(Heap::kNoGCFlags); | 1424 heap->CollectAllGarbage(Heap::kNoGCFlags); |
1425 | 1425 |
1426 // On second compilation, the hash is replaced by a real cache entry mapping | 1426 // On second compilation, the hash is replaced by a real cache entry mapping |
1427 // the source to the shared function info containing the code. | 1427 // the source to the shared function info containing the code. |
1428 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, true, | 1428 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, false, |
1429 native_context); | 1429 true, native_context); |
1430 CHECK(!info.is_null()); | 1430 CHECK(!info.is_null()); |
1431 | 1431 |
1432 while (!info.ToHandleChecked()->code()->IsOld()) { | 1432 while (!info.ToHandleChecked()->code()->IsOld()) { |
1433 info.ToHandleChecked()->code()->MakeOlder(NO_MARKING_PARITY); | 1433 info.ToHandleChecked()->code()->MakeOlder(NO_MARKING_PARITY); |
1434 } | 1434 } |
1435 | 1435 |
1436 heap->CollectAllGarbage(Heap::kNoGCFlags); | 1436 heap->CollectAllGarbage(Heap::kNoGCFlags); |
1437 // Ensure code aging cleared the entry from the cache. | 1437 // Ensure code aging cleared the entry from the cache. |
1438 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, true, | 1438 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, false, |
1439 native_context); | 1439 true, native_context); |
1440 CHECK(info.is_null()); | 1440 CHECK(info.is_null()); |
1441 | 1441 |
1442 { | 1442 { |
1443 v8::HandleScope scope(CcTest::isolate()); | 1443 v8::HandleScope scope(CcTest::isolate()); |
1444 CompileRun(raw_source); | 1444 CompileRun(raw_source); |
1445 } | 1445 } |
1446 | 1446 |
1447 // On first compilation, only a hash is inserted in the code cache. We can't | 1447 // On first compilation, only a hash is inserted in the code cache. We can't |
1448 // find that value. | 1448 // find that value. |
1449 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, true, | 1449 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, false, |
1450 native_context); | 1450 true, native_context); |
1451 CHECK(info.is_null()); | 1451 CHECK(info.is_null()); |
1452 | 1452 |
1453 for (int i = 0; i < CompilationCacheTable::kHashGenerations; i++) { | 1453 for (int i = 0; i < CompilationCacheTable::kHashGenerations; i++) { |
1454 compilation_cache->MarkCompactPrologue(); | 1454 compilation_cache->MarkCompactPrologue(); |
1455 } | 1455 } |
1456 | 1456 |
1457 { | 1457 { |
1458 v8::HandleScope scope(CcTest::isolate()); | 1458 v8::HandleScope scope(CcTest::isolate()); |
1459 CompileRun(raw_source); | 1459 CompileRun(raw_source); |
1460 } | 1460 } |
1461 | 1461 |
1462 // If we aged the cache before caching the script, ensure that we didn't cache | 1462 // If we aged the cache before caching the script, ensure that we didn't cache |
1463 // on next compilation. | 1463 // on next compilation. |
1464 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, true, | 1464 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, false, |
1465 native_context); | 1465 true, native_context); |
1466 CHECK(info.is_null()); | 1466 CHECK(info.is_null()); |
1467 } | 1467 } |
1468 | 1468 |
1469 | 1469 |
1470 // Count the number of native contexts in the weak list of native contexts. | 1470 // Count the number of native contexts in the weak list of native contexts. |
1471 int CountNativeContexts() { | 1471 int CountNativeContexts() { |
1472 int count = 0; | 1472 int count = 0; |
1473 Object* object = CcTest::heap()->native_contexts_list(); | 1473 Object* object = CcTest::heap()->native_contexts_list(); |
1474 while (!object->IsUndefined()) { | 1474 while (!object->IsUndefined()) { |
1475 count++; | 1475 count++; |
(...skipping 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5088 #ifdef DEBUG | 5088 #ifdef DEBUG |
5089 TEST(PathTracer) { | 5089 TEST(PathTracer) { |
5090 CcTest::InitializeVM(); | 5090 CcTest::InitializeVM(); |
5091 v8::HandleScope scope(CcTest::isolate()); | 5091 v8::HandleScope scope(CcTest::isolate()); |
5092 | 5092 |
5093 v8::Local<v8::Value> result = CompileRun("'abc'"); | 5093 v8::Local<v8::Value> result = CompileRun("'abc'"); |
5094 Handle<Object> o = v8::Utils::OpenHandle(*result); | 5094 Handle<Object> o = v8::Utils::OpenHandle(*result); |
5095 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 5095 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
5096 } | 5096 } |
5097 #endif // DEBUG | 5097 #endif // DEBUG |
OLD | NEW |