| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 void ExternalReferenceEncoder::Put(Address key, int index) { | 496 void ExternalReferenceEncoder::Put(Address key, int index) { |
| 497 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); | 497 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); |
| 498 entry->value = reinterpret_cast<void*>(index); | 498 entry->value = reinterpret_cast<void*>(index); |
| 499 } | 499 } |
| 500 | 500 |
| 501 | 501 |
| 502 ExternalReferenceDecoder::ExternalReferenceDecoder() | 502 ExternalReferenceDecoder::ExternalReferenceDecoder() |
| 503 : encodings_(NewArray<Address*>(kTypeCodeCount)) { | 503 : encodings_(NewArray<Address*>(kTypeCodeCount)) { |
| 504 ExternalReferenceTable* external_references = | 504 ExternalReferenceTable* external_references = |
| 505 ExternalReferenceTable::instance(); | 505 ExternalReferenceTable::instance(); |
| 506 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { | 506 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { |
| 507 int max = external_references->max_id(type) + 1; | 507 int max = external_references->max_id(type) + 1; |
| 508 encodings_[type] = NewArray<Address>(max + 1); | 508 encodings_[type] = NewArray<Address>(max + 1); |
| 509 } | 509 } |
| 510 for (int i = 0; i < external_references->size(); ++i) { | 510 for (int i = 0; i < external_references->size(); ++i) { |
| 511 Put(external_references->code(i), external_references->address(i)); | 511 Put(external_references->code(i), external_references->address(i)); |
| 512 } | 512 } |
| 513 } | 513 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 ASSERT_EQ(NULL, ThreadState::FirstInUse()); | 612 ASSERT_EQ(NULL, ThreadState::FirstInUse()); |
| 613 // No active handles. | 613 // No active handles. |
| 614 ASSERT(HandleScopeImplementer::instance()->blocks()->is_empty()); | 614 ASSERT(HandleScopeImplementer::instance()->blocks()->is_empty()); |
| 615 // Make sure the entire partial snapshot cache is traversed, filling it with | 615 // Make sure the entire partial snapshot cache is traversed, filling it with |
| 616 // valid object pointers. | 616 // valid object pointers. |
| 617 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity; | 617 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity; |
| 618 ASSERT_EQ(NULL, external_reference_decoder_); | 618 ASSERT_EQ(NULL, external_reference_decoder_); |
| 619 external_reference_decoder_ = new ExternalReferenceDecoder(); | 619 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| 620 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG); | 620 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 621 Heap::IterateWeakRoots(this, VISIT_ALL); | 621 Heap::IterateWeakRoots(this, VISIT_ALL); |
| 622 |
| 623 Heap::set_global_contexts_list(Heap::undefined_value()); |
| 622 } | 624 } |
| 623 | 625 |
| 624 | 626 |
| 625 void Deserializer::DeserializePartial(Object** root) { | 627 void Deserializer::DeserializePartial(Object** root) { |
| 626 // Don't GC while deserializing - just expand the heap. | 628 // Don't GC while deserializing - just expand the heap. |
| 627 AlwaysAllocateScope always_allocate; | 629 AlwaysAllocateScope always_allocate; |
| 628 // Don't use the free lists while deserializing. | 630 // Don't use the free lists while deserializing. |
| 629 LinearAllocationScope allocate_linearly; | 631 LinearAllocationScope allocate_linearly; |
| 630 if (external_reference_decoder_ == NULL) { | 632 if (external_reference_decoder_ == NULL) { |
| 631 external_reference_decoder_ = new ExternalReferenceDecoder(); | 633 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1468 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1467 } | 1469 } |
| 1468 } | 1470 } |
| 1469 int allocation_address = fullness_[space]; | 1471 int allocation_address = fullness_[space]; |
| 1470 fullness_[space] = allocation_address + size; | 1472 fullness_[space] = allocation_address + size; |
| 1471 return allocation_address; | 1473 return allocation_address; |
| 1472 } | 1474 } |
| 1473 | 1475 |
| 1474 | 1476 |
| 1475 } } // namespace v8::internal | 1477 } } // namespace v8::internal |
| OLD | NEW |