OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 HashMap::Entry* entry = | 470 HashMap::Entry* entry = |
471 const_cast<HashMap &>(encodings_).Lookup(key, Hash(key), false); | 471 const_cast<HashMap &>(encodings_).Lookup(key, Hash(key), false); |
472 return entry == NULL | 472 return entry == NULL |
473 ? -1 | 473 ? -1 |
474 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 474 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
475 } | 475 } |
476 | 476 |
477 | 477 |
478 void ExternalReferenceEncoder::Put(Address key, int index) { | 478 void ExternalReferenceEncoder::Put(Address key, int index) { |
479 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); | 479 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); |
480 entry->value = reinterpret_cast<void *>(index); | 480 entry->value = reinterpret_cast<void*>(index); |
481 } | 481 } |
482 | 482 |
483 | 483 |
484 ExternalReferenceDecoder::ExternalReferenceDecoder() | 484 ExternalReferenceDecoder::ExternalReferenceDecoder() |
485 : encodings_(NewArray<Address*>(kTypeCodeCount)) { | 485 : encodings_(NewArray<Address*>(kTypeCodeCount)) { |
486 ExternalReferenceTable* external_references = | 486 ExternalReferenceTable* external_references = |
487 ExternalReferenceTable::instance(); | 487 ExternalReferenceTable::instance(); |
488 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { | 488 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { |
489 int max = external_references->max_id(type) + 1; | 489 int max = external_references->max_id(type) + 1; |
490 encodings_[type] = NewArray<Address>(max + 1); | 490 encodings_[type] = NewArray<Address>(max + 1); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 970 |
971 | 971 |
972 // This ensures that the partial snapshot cache keeps things alive during GC and | 972 // This ensures that the partial snapshot cache keeps things alive during GC and |
973 // tracks their movement. When it is called during serialization of the startup | 973 // tracks their movement. When it is called during serialization of the startup |
974 // snapshot the partial snapshot is empty, so nothing happens. When the partial | 974 // snapshot the partial snapshot is empty, so nothing happens. When the partial |
975 // (context) snapshot is created, this array is populated with the pointers that | 975 // (context) snapshot is created, this array is populated with the pointers that |
976 // the partial snapshot will need. As that happens we emit serialized objects to | 976 // the partial snapshot will need. As that happens we emit serialized objects to |
977 // the startup snapshot that correspond to the elements of this cache array. On | 977 // the startup snapshot that correspond to the elements of this cache array. On |
978 // deserialization we therefore need to visit the cache array. This fills it up | 978 // deserialization we therefore need to visit the cache array. This fills it up |
979 // with pointers to deserialized objects. | 979 // with pointers to deserialized objects. |
980 void SerializerDeserializer::Iterate(ObjectVisitor *visitor) { | 980 void SerializerDeserializer::Iterate(ObjectVisitor* visitor) { |
981 visitor->VisitPointers( | 981 visitor->VisitPointers( |
982 &partial_snapshot_cache_[0], | 982 &partial_snapshot_cache_[0], |
983 &partial_snapshot_cache_[partial_snapshot_cache_length_]); | 983 &partial_snapshot_cache_[partial_snapshot_cache_length_]); |
984 } | 984 } |
985 | 985 |
986 | 986 |
987 // When deserializing we need to set the size of the snapshot cache. This means | 987 // When deserializing we need to set the size of the snapshot cache. This means |
988 // the root iteration code (above) will iterate over array elements, writing the | 988 // the root iteration code (above) will iterate over array elements, writing the |
989 // references to deserialized objects in them. | 989 // references to deserialized objects in them. |
990 void SerializerDeserializer::SetSnapshotCacheSize(int size) { | 990 void SerializerDeserializer::SetSnapshotCacheSize(int size) { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1360 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1361 } | 1361 } |
1362 } | 1362 } |
1363 int allocation_address = fullness_[space]; | 1363 int allocation_address = fullness_[space]; |
1364 fullness_[space] = allocation_address + size; | 1364 fullness_[space] = allocation_address + size; |
1365 return allocation_address; | 1365 return allocation_address; |
1366 } | 1366 } |
1367 | 1367 |
1368 | 1368 |
1369 } } // namespace v8::internal | 1369 } } // namespace v8::internal |
OLD | NEW |