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

Side by Side Diff: src/heap.cc

Issue 203070: Stop "cooking" targets of jumps and calls in code objects. Do not convert ju... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « no previous file | src/mark-compact.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 }; 630 };
631 631
632 632
633 static void VerifyNonPointerSpacePointers() { 633 static void VerifyNonPointerSpacePointers() {
634 // Verify that there are no pointers to new space in spaces where we 634 // Verify that there are no pointers to new space in spaces where we
635 // do not expect them. 635 // do not expect them.
636 VerifyNonPointerSpacePointersVisitor v; 636 VerifyNonPointerSpacePointersVisitor v;
637 HeapObjectIterator code_it(Heap::code_space()); 637 HeapObjectIterator code_it(Heap::code_space());
638 while (code_it.has_next()) { 638 while (code_it.has_next()) {
639 HeapObject* object = code_it.next(); 639 HeapObject* object = code_it.next();
640 if (object->IsCode()) { 640 object->Iterate(&v);
641 Code::cast(object)->ConvertICTargetsFromAddressToObject();
642 object->Iterate(&v);
643 Code::cast(object)->ConvertICTargetsFromObjectToAddress();
644 } else {
645 // If we find non-code objects in code space (e.g., free list
646 // nodes) we want to verify them as well.
647 object->Iterate(&v);
648 }
649 } 641 }
650 642
651 HeapObjectIterator data_it(Heap::old_data_space()); 643 HeapObjectIterator data_it(Heap::old_data_space());
652 while (data_it.has_next()) data_it.next()->Iterate(&v); 644 while (data_it.has_next()) data_it.next()->Iterate(&v);
653 } 645 }
654 #endif 646 #endif
655 647
656 648
657 void Heap::Scavenge() { 649 void Heap::Scavenge() {
658 #ifdef DEBUG 650 #ifdef DEBUG
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 1920
1929 if (result->IsFailure()) return result; 1921 if (result->IsFailure()) return result;
1930 1922
1931 // Initialize the object 1923 // Initialize the object
1932 HeapObject::cast(result)->set_map(code_map()); 1924 HeapObject::cast(result)->set_map(code_map());
1933 Code* code = Code::cast(result); 1925 Code* code = Code::cast(result);
1934 code->set_instruction_size(desc.instr_size); 1926 code->set_instruction_size(desc.instr_size);
1935 code->set_relocation_size(desc.reloc_size); 1927 code->set_relocation_size(desc.reloc_size);
1936 code->set_sinfo_size(sinfo_size); 1928 code->set_sinfo_size(sinfo_size);
1937 code->set_flags(flags); 1929 code->set_flags(flags);
1938 code->set_ic_flag(Code::IC_TARGET_IS_ADDRESS);
1939 // Allow self references to created code object by patching the handle to 1930 // Allow self references to created code object by patching the handle to
1940 // point to the newly allocated Code object. 1931 // point to the newly allocated Code object.
1941 if (!self_reference.is_null()) { 1932 if (!self_reference.is_null()) {
1942 *(self_reference.location()) = code; 1933 *(self_reference.location()) = code;
1943 } 1934 }
1944 // Migrate generated code. 1935 // Migrate generated code.
1945 // The generated code can contain Object** values (typically from handles) 1936 // The generated code can contain Object** values (typically from handles)
1946 // that are dereferenced during the copy to point directly to the actual heap 1937 // that are dereferenced during the copy to point directly to the actual heap
1947 // objects. These pointers can include references to the code object itself, 1938 // objects. These pointers can include references to the code object itself,
1948 // through the self_reference parameter. 1939 // through the self_reference parameter.
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 if (!map->IsHeapObject()) return; // visited before 3571 if (!map->IsHeapObject()) return; // visited before
3581 3572
3582 if (found_target) return; // stop if target found 3573 if (found_target) return; // stop if target found
3583 object_stack.Add(obj); 3574 object_stack.Add(obj);
3584 if ((search_for_any_global && obj->IsJSGlobalObject()) || 3575 if ((search_for_any_global && obj->IsJSGlobalObject()) ||
3585 (!search_for_any_global && (obj == search_target))) { 3576 (!search_for_any_global && (obj == search_target))) {
3586 found_target = true; 3577 found_target = true;
3587 return; 3578 return;
3588 } 3579 }
3589 3580
3590 if (obj->IsCode()) {
3591 Code::cast(obj)->ConvertICTargetsFromAddressToObject();
3592 }
3593
3594 // not visited yet 3581 // not visited yet
3595 Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map)); 3582 Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map));
3596 3583
3597 Address map_addr = map_p->address(); 3584 Address map_addr = map_p->address();
3598 3585
3599 obj->set_map(reinterpret_cast<Map*>(map_addr + kMarkTag)); 3586 obj->set_map(reinterpret_cast<Map*>(map_addr + kMarkTag));
3600 3587
3601 MarkObjectRecursively(&map); 3588 MarkObjectRecursively(&map);
3602 3589
3603 obj->IterateBody(map_p->instance_type(), obj->SizeFromMap(map_p), 3590 obj->IterateBody(map_p->instance_type(), obj->SizeFromMap(map_p),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 3626
3640 HeapObject* map_p = HeapObject::FromAddress(map_addr); 3627 HeapObject* map_p = HeapObject::FromAddress(map_addr);
3641 3628
3642 obj->set_map(reinterpret_cast<Map*>(map_p)); 3629 obj->set_map(reinterpret_cast<Map*>(map_p));
3643 3630
3644 UnmarkObjectRecursively(reinterpret_cast<Object**>(&map_p)); 3631 UnmarkObjectRecursively(reinterpret_cast<Object**>(&map_p));
3645 3632
3646 obj->IterateBody(Map::cast(map_p)->instance_type(), 3633 obj->IterateBody(Map::cast(map_p)->instance_type(),
3647 obj->SizeFromMap(Map::cast(map_p)), 3634 obj->SizeFromMap(Map::cast(map_p)),
3648 &unmark_visitor); 3635 &unmark_visitor);
3649
3650 if (obj->IsCode()) {
3651 Code::cast(obj)->ConvertICTargetsFromObjectToAddress();
3652 }
3653 } 3636 }
3654 3637
3655 3638
3656 static void MarkRootObjectRecursively(Object** root) { 3639 static void MarkRootObjectRecursively(Object** root) {
3657 if (search_for_any_global) { 3640 if (search_for_any_global) {
3658 ASSERT(search_target == NULL); 3641 ASSERT(search_target == NULL);
3659 } else { 3642 } else {
3660 ASSERT(search_target->IsHeapObject()); 3643 ASSERT(search_target->IsHeapObject());
3661 } 3644 }
3662 found_target = false; 3645 found_target = false;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3842 for (int i = 0; i < kNumberOfCaches; i++) { 3825 for (int i = 0; i < kNumberOfCaches; i++) {
3843 if (caches_[i] != NULL) { 3826 if (caches_[i] != NULL) {
3844 delete caches_[i]; 3827 delete caches_[i];
3845 caches_[i] = NULL; 3828 caches_[i] = NULL;
3846 } 3829 }
3847 } 3830 }
3848 } 3831 }
3849 3832
3850 3833
3851 } } // namespace v8::internal 3834 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698