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 14104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14115 return count; | 14115 return count; |
14116 } | 14116 } |
14117 | 14117 |
14118 | 14118 |
14119 static void CheckSurvivingGlobalObjectsCount(int expected) { | 14119 static void CheckSurvivingGlobalObjectsCount(int expected) { |
14120 // We need to collect all garbage twice to be sure that everything | 14120 // We need to collect all garbage twice to be sure that everything |
14121 // has been collected. This is because inline caches are cleared in | 14121 // has been collected. This is because inline caches are cleared in |
14122 // the first garbage collection but some of the maps have already | 14122 // the first garbage collection but some of the maps have already |
14123 // been marked at that point. Therefore some of the maps are not | 14123 // been marked at that point. Therefore some of the maps are not |
14124 // collected until the second garbage collection. | 14124 // collected until the second garbage collection. |
14125 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 14125 CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); |
14126 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); | 14126 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
14127 int count = GetGlobalObjectsCount(); | 14127 int count = GetGlobalObjectsCount(); |
14128 #ifdef DEBUG | 14128 #ifdef DEBUG |
14129 if (count != expected) CcTest::heap()->TracePathToGlobal(); | 14129 if (count != expected) CcTest::heap()->TracePathToGlobal(); |
14130 #endif | 14130 #endif |
14131 CHECK_EQ(expected, count); | 14131 CHECK_EQ(expected, count); |
14132 } | 14132 } |
14133 | 14133 |
14134 | 14134 |
14135 TEST(DontLeakGlobalObjects) { | 14135 TEST(DontLeakGlobalObjects) { |
(...skipping 5039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19175 v8::Handle<v8::Message> message = try_catch.Message(); | 19175 v8::Handle<v8::Message> message = try_catch.Message(); |
19176 CHECK(!message.IsEmpty()); | 19176 CHECK(!message.IsEmpty()); |
19177 CHECK_EQ(1, message->GetLineNumber()); | 19177 CHECK_EQ(1, message->GetLineNumber()); |
19178 context->Exit(); | 19178 context->Exit(); |
19179 } | 19179 } |
19180 isolate->ContextDisposedNotification(); | 19180 isolate->ContextDisposedNotification(); |
19181 for (gc_count = 1; gc_count < 10; gc_count++) { | 19181 for (gc_count = 1; gc_count < 10; gc_count++) { |
19182 other_context->Enter(); | 19182 other_context->Enter(); |
19183 CompileRun(source_exception); | 19183 CompileRun(source_exception); |
19184 other_context->Exit(); | 19184 other_context->Exit(); |
19185 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 19185 CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); |
19186 if (GetGlobalObjectsCount() == 1) break; | 19186 if (GetGlobalObjectsCount() == 1) break; |
19187 } | 19187 } |
19188 CHECK_GE(2, gc_count); | 19188 CHECK_GE(2, gc_count); |
19189 CHECK_EQ(1, GetGlobalObjectsCount()); | 19189 CHECK_EQ(1, GetGlobalObjectsCount()); |
19190 | 19190 |
19191 isolate->ContextDisposedNotification(); | 19191 isolate->ContextDisposedNotification(); |
19192 } | 19192 } |
19193 | 19193 |
19194 | 19194 |
19195 THREADED_TEST(ScriptOrigin) { | 19195 THREADED_TEST(ScriptOrigin) { |
(...skipping 4999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24195 char chunk2[] = | 24195 char chunk2[] = |
24196 "XX\xec\x92\x81r = 13;\n" | 24196 "XX\xec\x92\x81r = 13;\n" |
24197 " return foob\xec\x92\x81\xec\x92\x81r;\n" | 24197 " return foob\xec\x92\x81\xec\x92\x81r;\n" |
24198 "}\n"; | 24198 "}\n"; |
24199 chunk1[strlen(chunk1) - 1] = reference[0]; | 24199 chunk1[strlen(chunk1) - 1] = reference[0]; |
24200 chunk2[0] = reference[1]; | 24200 chunk2[0] = reference[1]; |
24201 chunk2[1] = reference[2]; | 24201 chunk2[1] = reference[2]; |
24202 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 24202 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; |
24203 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); | 24203 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); |
24204 } | 24204 } |
OLD | NEW |