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 6209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6220 LocalContext context; | 6220 LocalContext context; |
6221 | 6221 |
6222 heap->CollectAllGarbage(); | 6222 heap->CollectAllGarbage(); |
6223 heap->CollectAllGarbage(); | 6223 heap->CollectAllGarbage(); |
6224 | 6224 |
6225 int sfi_count = 0; | 6225 int sfi_count = 0; |
6226 { | 6226 { |
6227 HeapIterator it(heap); | 6227 HeapIterator it(heap); |
6228 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { | 6228 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { |
6229 if (!obj->IsSharedFunctionInfo()) continue; | 6229 if (!obj->IsSharedFunctionInfo()) continue; |
6230 // Shared function infos without a script (API functions or C++ builtins) | 6230 sfi_count++; |
6231 // are not returned by the iterator because they are not created from a | |
6232 // script. They are not interesting for type feedback vector anyways. | |
6233 | |
6234 // TODO(mvstanton): There are builtins that use type feedback vectors, | |
6235 // consider adding these to the iterator. | |
6236 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | |
6237 if (shared->script()->IsUndefined()) { | |
6238 CHECK(shared->native() || shared->feedback_vector()->is_empty()); | |
6239 } else { | |
6240 sfi_count++; | |
6241 } | |
6242 } | 6231 } |
6243 } | 6232 } |
6244 | 6233 |
6245 { | 6234 { |
6246 SharedFunctionInfo::Iterator iterator(isolate); | 6235 SharedFunctionInfo::Iterator iterator(isolate); |
6247 while (iterator.Next()) sfi_count--; | 6236 while (iterator.Next()) sfi_count--; |
6248 } | 6237 } |
6249 | 6238 |
6250 CHECK_EQ(0, sfi_count); | 6239 CHECK_EQ(0, sfi_count); |
6251 } | 6240 } |
(...skipping 28 matching lines...) Expand all Loading... |
6280 // The CollectGarbage call above starts sweeper threads. | 6269 // The CollectGarbage call above starts sweeper threads. |
6281 // The crash will happen if the following two functions | 6270 // The crash will happen if the following two functions |
6282 // are called before sweeping finishes. | 6271 // are called before sweeping finishes. |
6283 heap->StartIncrementalMarking(); | 6272 heap->StartIncrementalMarking(); |
6284 heap->FinalizeIncrementalMarkingIfComplete("test"); | 6273 heap->FinalizeIncrementalMarkingIfComplete("test"); |
6285 } | 6274 } |
6286 | 6275 |
6287 | 6276 |
6288 } // namespace internal | 6277 } // namespace internal |
6289 } // namespace v8 | 6278 } // namespace v8 |
OLD | NEW |