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

Side by Side Diff: src/serialize.cc

Issue 17376: Avoiding the assumption that the pc pointer of RelocInfo points to the word c... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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
OLDNEW
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 1, 579 1,
580 "Builtins::builtin_passed_function"); 580 "Builtins::builtin_passed_function");
581 Add(ExternalReference::the_hole_value_location().address(), 581 Add(ExternalReference::the_hole_value_location().address(),
582 UNCLASSIFIED, 582 UNCLASSIFIED,
583 2, 583 2,
584 "Factory::the_hole_value().location()"); 584 "Factory::the_hole_value().location()");
585 Add(ExternalReference::address_of_stack_guard_limit().address(), 585 Add(ExternalReference::address_of_stack_guard_limit().address(),
586 UNCLASSIFIED, 586 UNCLASSIFIED,
587 3, 587 3,
588 "StackGuard::address_of_limit()"); 588 "StackGuard::address_of_limit()");
589 Add(ExternalReference::address_of_regexp_stack_limit().address(),
590 UNCLASSIFIED,
591 4,
592 "StackGuard::address_of_limit()");
Mads Ager (chromium) 2009/01/13 14:26:10 RegexpStackGuard?
olehougaard 2009/01/13 14:35:22 Fixed.
589 Add(ExternalReference::debug_break().address(), 593 Add(ExternalReference::debug_break().address(),
590 UNCLASSIFIED, 594 UNCLASSIFIED,
591 4, 595 5,
592 "Debug::Break()"); 596 "Debug::Break()");
593 Add(ExternalReference::new_space_start().address(), 597 Add(ExternalReference::new_space_start().address(),
594 UNCLASSIFIED, 598 UNCLASSIFIED,
595 5, 599 6,
596 "Heap::NewSpaceStart()"); 600 "Heap::NewSpaceStart()");
597 Add(ExternalReference::heap_always_allocate_scope_depth().address(), 601 Add(ExternalReference::heap_always_allocate_scope_depth().address(),
598 UNCLASSIFIED, 602 UNCLASSIFIED,
599 6, 603 7,
600 "Heap::always_allocate_scope_depth()"); 604 "Heap::always_allocate_scope_depth()");
601 Add(ExternalReference::new_space_allocation_limit_address().address(), 605 Add(ExternalReference::new_space_allocation_limit_address().address(),
602 UNCLASSIFIED, 606 UNCLASSIFIED,
603 7, 607 8,
604 "Heap::NewSpaceAllocationLimitAddress()"); 608 "Heap::NewSpaceAllocationLimitAddress()");
605 Add(ExternalReference::new_space_allocation_top_address().address(), 609 Add(ExternalReference::new_space_allocation_top_address().address(),
606 UNCLASSIFIED, 610 UNCLASSIFIED,
607 8, 611 9,
608 "Heap::NewSpaceAllocationTopAddress()"); 612 "Heap::NewSpaceAllocationTopAddress()");
609 Add(ExternalReference::debug_step_in_fp_address().address(), 613 Add(ExternalReference::debug_step_in_fp_address().address(),
610 UNCLASSIFIED, 614 UNCLASSIFIED,
611 9, 615 10,
612 "Debug::step_in_fp_addr()"); 616 "Debug::step_in_fp_addr()");
613 } 617 }
614 618
615 619
616 ExternalReferenceEncoder::ExternalReferenceEncoder() 620 ExternalReferenceEncoder::ExternalReferenceEncoder()
617 : encodings_(Match) { 621 : encodings_(Match) {
618 ExternalReferenceTable* external_references = 622 ExternalReferenceTable* external_references =
619 ExternalReferenceTable::instance(); 623 ExternalReferenceTable::instance();
620 for (int i = 0; i < external_references->size(); ++i) { 624 for (int i = 0; i < external_references->size(); ++i) {
621 Put(external_references->address(i), i); 625 Put(external_references->address(i), i);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 CHECK(*p == NULL ? code == 0 : code != 0); 801 CHECK(*p == NULL ? code == 0 : code != 0);
798 offsets_.Add(reinterpret_cast<Address>(p) - obj_address_); 802 offsets_.Add(reinterpret_cast<Address>(p) - obj_address_);
799 addresses_.Add(reinterpret_cast<Address>(code)); 803 addresses_.Add(reinterpret_cast<Address>(code));
800 } 804 }
801 } 805 }
802 806
803 virtual void VisitRuntimeEntry(RelocInfo* rinfo) { 807 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {
804 Address target = rinfo->target_address(); 808 Address target = rinfo->target_address();
805 uint32_t encoding = reference_encoder_->Encode(target); 809 uint32_t encoding = reference_encoder_->Encode(target);
806 CHECK(target == NULL ? encoding == 0 : encoding != 0); 810 CHECK(target == NULL ? encoding == 0 : encoding != 0);
807 offsets_.Add(reinterpret_cast<Address>(rinfo->pc()) - obj_address_); 811 offsets_.Add(rinfo->target_address_address() - obj_address_);
808 addresses_.Add(reinterpret_cast<Address>(encoding)); 812 addresses_.Add(reinterpret_cast<Address>(encoding));
809 } 813 }
810 814
811 void Update(Address start_address) { 815 void Update(Address start_address) {
812 for (int i = 0; i < offsets_.length(); i++) { 816 for (int i = 0; i < offsets_.length(); i++) {
813 Address* p = reinterpret_cast<Address*>(start_address + offsets_[i]); 817 Address* p = reinterpret_cast<Address*>(start_address + offsets_[i]);
814 *p = addresses_[i]; 818 *p = addresses_[i];
815 } 819 }
816 } 820 }
817 821
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 1266
1263 void Deserializer::VisitExternalReferences(Address* start, Address* end) { 1267 void Deserializer::VisitExternalReferences(Address* start, Address* end) {
1264 for (Address* p = start; p < end; ++p) { 1268 for (Address* p = start; p < end; ++p) {
1265 uint32_t code = reinterpret_cast<uint32_t>(*p); 1269 uint32_t code = reinterpret_cast<uint32_t>(*p);
1266 *p = reference_decoder_->Decode(code); 1270 *p = reference_decoder_->Decode(code);
1267 } 1271 }
1268 } 1272 }
1269 1273
1270 1274
1271 void Deserializer::VisitRuntimeEntry(RelocInfo* rinfo) { 1275 void Deserializer::VisitRuntimeEntry(RelocInfo* rinfo) {
1272 uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->pc()); 1276 uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->target_address_address());
1273 uint32_t encoding = *pc; 1277 uint32_t encoding = *pc;
1274 Address target = reference_decoder_->Decode(encoding); 1278 Address target = reference_decoder_->Decode(encoding);
1275 rinfo->set_target_address(target); 1279 rinfo->set_target_address(target);
1276 } 1280 }
1277 1281
1278 1282
1279 void Deserializer::GetFlags() { 1283 void Deserializer::GetFlags() {
1280 reader_.ExpectC('F'); 1284 reader_.ExpectC('F');
1281 int argc = reader_.GetInt() + 1; 1285 int argc = reader_.GetInt() + 1;
1282 char** argv = NewArray<char*>(argc); 1286 char** argv = NewArray<char*>(argc);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 ASSERT(index < large_objects_.length()); 1519 ASSERT(index < large_objects_.length());
1516 } 1520 }
1517 return large_objects_[index]; // s.page_offset() is ignored. 1521 return large_objects_[index]; // s.page_offset() is ignored.
1518 } 1522 }
1519 UNREACHABLE(); 1523 UNREACHABLE();
1520 return NULL; 1524 return NULL;
1521 } 1525 }
1522 1526
1523 1527
1524 } } // namespace v8::internal 1528 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698