Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/serialize.cc

Issue 10795074: Add a new API V8::SetJitCodeEventHandler to push code name and location to users such as profilers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix instruction address calculation on move events. Fix test use of map, fix compilation on Win64. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 int page_of_pointee = offset >> kPageSizeBits; 672 int page_of_pointee = offset >> kPageSizeBits;
673 Address object_address = pages_[space][page_of_pointee] + 673 Address object_address = pages_[space][page_of_pointee] +
674 (offset & Page::kPageAlignmentMask); 674 (offset & Page::kPageAlignmentMask);
675 return HeapObject::FromAddress(object_address); 675 return HeapObject::FromAddress(object_address);
676 } 676 }
677 677
678 678
679 void Deserializer::Deserialize() { 679 void Deserializer::Deserialize() {
680 isolate_ = Isolate::Current(); 680 isolate_ = Isolate::Current();
681 ASSERT(isolate_ != NULL); 681 ASSERT(isolate_ != NULL);
682 // Don't GC while deserializing - just expand the heap. 682 {
683 AlwaysAllocateScope always_allocate; 683 // Don't GC while deserializing - just expand the heap.
684 // Don't use the free lists while deserializing. 684 AlwaysAllocateScope always_allocate;
685 LinearAllocationScope allocate_linearly; 685 // Don't use the free lists while deserializing.
686 // No active threads. 686 LinearAllocationScope allocate_linearly;
687 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); 687 // No active threads.
688 // No active handles. 688 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse());
689 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); 689 // No active handles.
690 ASSERT_EQ(NULL, external_reference_decoder_); 690 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty());
691 external_reference_decoder_ = new ExternalReferenceDecoder(); 691 ASSERT_EQ(NULL, external_reference_decoder_);
692 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); 692 external_reference_decoder_ = new ExternalReferenceDecoder();
693 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); 693 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
694 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
694 695
695 isolate_->heap()->set_native_contexts_list( 696 isolate_->heap()->set_native_contexts_list(
696 isolate_->heap()->undefined_value()); 697 isolate_->heap()->undefined_value());
697 698
698 // Update data pointers to the external strings containing natives sources. 699 // Update data pointers to the external strings containing natives sources.
699 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 700 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
700 Object* source = isolate_->heap()->natives_source_cache()->get(i); 701 Object* source = isolate_->heap()->natives_source_cache()->get(i);
701 if (!source->IsUndefined()) { 702 if (!source->IsUndefined()) {
702 ExternalAsciiString::cast(source)->update_data_cache(); 703 ExternalAsciiString::cast(source)->update_data_cache();
704 }
703 } 705 }
704 } 706 }
707
708 // Issue code events for newly deserialized code objects.
709 LOG_CODE_EVENT(isolate_, LogCodeObjects());
710 LOG_CODE_EVENT(isolate_, LogCompiledFunctions());
705 } 711 }
706 712
707 713
708 void Deserializer::DeserializePartial(Object** root) { 714 void Deserializer::DeserializePartial(Object** root) {
709 isolate_ = Isolate::Current(); 715 isolate_ = Isolate::Current();
710 // Don't GC while deserializing - just expand the heap. 716 // Don't GC while deserializing - just expand the heap.
711 AlwaysAllocateScope always_allocate; 717 AlwaysAllocateScope always_allocate;
712 // Don't use the free lists while deserializing. 718 // Don't use the free lists while deserializing.
713 LinearAllocationScope allocate_linearly; 719 LinearAllocationScope allocate_linearly;
714 if (external_reference_decoder_ == NULL) { 720 if (external_reference_decoder_ == NULL) {
715 external_reference_decoder_ = new ExternalReferenceDecoder(); 721 external_reference_decoder_ = new ExternalReferenceDecoder();
716 } 722 }
723
724 // Keep track of the code space start and end pointers in case new
725 // code objects were unserialized
726 OldSpace* code_space = isolate_->heap()->code_space();
727 Address start_address = code_space->top();
717 VisitPointer(root); 728 VisitPointer(root);
729
730 // There's no code deserialized here. If this assert fires
731 // then that's changed and logging should be added to notify
732 // the profiler et al of the new code.
733 CHECK_EQ(start_address, code_space->top());
718 } 734 }
719 735
720 736
721 Deserializer::~Deserializer() { 737 Deserializer::~Deserializer() {
722 ASSERT(source_->AtEOF()); 738 ASSERT(source_->AtEOF());
723 if (external_reference_decoder_) { 739 if (external_reference_decoder_) {
724 delete external_reference_decoder_; 740 delete external_reference_decoder_;
725 external_reference_decoder_ = NULL; 741 external_reference_decoder_ = NULL;
726 } 742 }
727 } 743 }
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 int Serializer::SpaceAreaSize(int space) { 1722 int Serializer::SpaceAreaSize(int space) {
1707 if (space == CODE_SPACE) { 1723 if (space == CODE_SPACE) {
1708 return isolate_->memory_allocator()->CodePageAreaSize(); 1724 return isolate_->memory_allocator()->CodePageAreaSize();
1709 } else { 1725 } else {
1710 return Page::kPageSize - Page::kObjectStartOffset; 1726 return Page::kPageSize - Page::kObjectStartOffset;
1711 } 1727 }
1712 } 1728 }
1713 1729
1714 1730
1715 } } // namespace v8::internal 1731 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698