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

Side by Side Diff: src/serialize.cc

Issue 390004: Fix warnings on Win64. (Closed)
Patch Set: Created 11 years, 1 month 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
« src/api.cc ('K') | « src/serialize.h ('k') | src/spaces.h » ('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 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 page_index++; 338 page_index++;
339 } 339 }
340 current_ = RelativeAddress(space, 340 current_ = RelativeAddress(space,
341 page_index, 341 page_index,
342 top_page->Offset(top)); 342 top_page->Offset(top));
343 break; 343 break;
344 } 344 }
345 case NEW_SPACE: 345 case NEW_SPACE:
346 current_ = RelativeAddress(space, 346 current_ = RelativeAddress(space,
347 0, 347 0,
348 Heap::NewSpaceTop() - Heap::NewSpaceStart()); 348 static_cast<int>(Heap::NewSpaceTop()
349 - Heap::NewSpaceStart()));
349 break; 350 break;
350 case LO_SPACE: 351 case LO_SPACE:
351 int page_index = 0; 352 int page_index = 0;
352 for (LargeObjectIterator it(Heap::lo_space()); it.has_next(); it.next()) { 353 for (LargeObjectIterator it(Heap::lo_space()); it.has_next(); it.next()) {
353 page_index++; 354 page_index++;
354 } 355 }
355 current_ = RelativeAddress(space, page_index, 0); 356 current_ = RelativeAddress(space, page_index, 0);
356 break; 357 break;
357 } 358 }
358 } 359 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Debug addresses 570 // Debug addresses
570 Add(Debug_Address(Debug::k_after_break_target_address).address(), 571 Add(Debug_Address(Debug::k_after_break_target_address).address(),
571 DEBUG_ADDRESS, 572 DEBUG_ADDRESS,
572 Debug::k_after_break_target_address << kDebugIdShift, 573 Debug::k_after_break_target_address << kDebugIdShift,
573 "Debug::after_break_target_address()"); 574 "Debug::after_break_target_address()");
574 Add(Debug_Address(Debug::k_debug_break_return_address).address(), 575 Add(Debug_Address(Debug::k_debug_break_return_address).address(),
575 DEBUG_ADDRESS, 576 DEBUG_ADDRESS,
576 Debug::k_debug_break_return_address << kDebugIdShift, 577 Debug::k_debug_break_return_address << kDebugIdShift,
577 "Debug::debug_break_return_address()"); 578 "Debug::debug_break_return_address()");
578 const char* debug_register_format = "Debug::register_address(%i)"; 579 const char* debug_register_format = "Debug::register_address(%i)";
579 size_t dr_format_length = strlen(debug_register_format); 580 int dr_format_length = StrLength(debug_register_format);
580 for (int i = 0; i < kNumJSCallerSaved; ++i) { 581 for (int i = 0; i < kNumJSCallerSaved; ++i) {
581 Vector<char> name = Vector<char>::New(dr_format_length + 1); 582 Vector<char> name = Vector<char>::New(dr_format_length + 1);
582 OS::SNPrintF(name, debug_register_format, i); 583 OS::SNPrintF(name, debug_register_format, i);
583 Add(Debug_Address(Debug::k_register_address, i).address(), 584 Add(Debug_Address(Debug::k_register_address, i).address(),
584 DEBUG_ADDRESS, 585 DEBUG_ADDRESS,
585 Debug::k_register_address << kDebugIdShift | i, 586 Debug::k_register_address << kDebugIdShift | i,
586 name.start()); 587 name.start());
587 } 588 }
588 #endif 589 #endif
589 590
(...skipping 27 matching lines...) Expand all
617 const char* top_address_format = "Top::%s"; 618 const char* top_address_format = "Top::%s";
618 619
619 const char* AddressNames[] = { 620 const char* AddressNames[] = {
620 #define C(name) #name, 621 #define C(name) #name,
621 TOP_ADDRESS_LIST(C) 622 TOP_ADDRESS_LIST(C)
622 TOP_ADDRESS_LIST_PROF(C) 623 TOP_ADDRESS_LIST_PROF(C)
623 NULL 624 NULL
624 #undef C 625 #undef C
625 }; 626 };
626 627
627 size_t top_format_length = strlen(top_address_format) - 2; 628 int top_format_length = StrLength(top_address_format) - 2;
628 for (uint16_t i = 0; i < Top::k_top_address_count; ++i) { 629 for (uint16_t i = 0; i < Top::k_top_address_count; ++i) {
629 const char* address_name = AddressNames[i]; 630 const char* address_name = AddressNames[i];
630 Vector<char> name = 631 Vector<char> name =
631 Vector<char>::New(top_format_length + strlen(address_name) + 1); 632 Vector<char>::New(top_format_length + StrLength(address_name) + 1);
632 const char* chars = name.start(); 633 const char* chars = name.start();
633 OS::SNPrintF(name, top_address_format, address_name); 634 OS::SNPrintF(name, top_address_format, address_name);
634 Add(Top::get_address_from_id((Top::AddressId)i), TOP_ADDRESS, i, chars); 635 Add(Top::get_address_from_id((Top::AddressId)i), TOP_ADDRESS, i, chars);
635 } 636 }
636 637
637 // Extensions 638 // Extensions
638 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1, 639 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1,
639 "GCExtension::GC"); 640 "GCExtension::GC");
640 641
641 // Accessors 642 // Accessors
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 if (pos < len_) { 918 if (pos < len_) {
918 byte* old = str_; 919 byte* old = str_;
919 str_ = NewArray<byte>(max_); 920 str_ = NewArray<byte>(max_);
920 memcpy(str_, old, pos); 921 memcpy(str_, old, pos);
921 memcpy(str_ + pos + bytes, old + pos, len_ - pos); 922 memcpy(str_ + pos + bytes, old + pos, len_ - pos);
922 DeleteArray(old); 923 DeleteArray(old);
923 } 924 }
924 } 925 }
925 926
926 int SnapshotWriter::InsertString(const char* s, int pos) { 927 int SnapshotWriter::InsertString(const char* s, int pos) {
927 int size = strlen(s); 928 int size = StrLength(s);
928 pos = InsertC('[', pos); 929 pos = InsertC('[', pos);
929 pos = InsertInt(size, pos); 930 pos = InsertInt(size, pos);
930 pos = InsertC(']', pos); 931 pos = InsertC(']', pos);
931 return InsertBytes(reinterpret_cast<const byte*>(s), pos, size); 932 return InsertBytes(reinterpret_cast<const byte*>(s), pos, size);
932 } 933 }
933 934
934 935
935 class ReferenceUpdater: public ObjectVisitor { 936 class ReferenceUpdater: public ObjectVisitor {
936 public: 937 public:
937 ReferenceUpdater(HeapObject* obj, Serializer* serializer) 938 ReferenceUpdater(HeapObject* obj, Serializer* serializer)
938 : obj_address_(obj->address()), 939 : obj_address_(obj->address()),
939 serializer_(serializer), 940 serializer_(serializer),
940 reference_encoder_(serializer->reference_encoder_), 941 reference_encoder_(serializer->reference_encoder_),
941 offsets_(8), 942 offsets_(8),
942 addresses_(8), 943 addresses_(8),
943 offsets_32_bit_(0), 944 offsets_32_bit_(0),
944 data_32_bit_(0) { 945 data_32_bit_(0) {
945 } 946 }
946 947
947 virtual void VisitPointers(Object** start, Object** end) { 948 virtual void VisitPointers(Object** start, Object** end) {
948 for (Object** p = start; p < end; ++p) { 949 for (Object** p = start; p < end; ++p) {
949 if ((*p)->IsHeapObject()) { 950 if ((*p)->IsHeapObject()) {
950 offsets_.Add(reinterpret_cast<Address>(p) - obj_address_); 951 offsets_.Add(
952 static_cast<int>(reinterpret_cast<Address>(p) - obj_address_));
951 Address a = serializer_->GetSavedAddress(HeapObject::cast(*p)); 953 Address a = serializer_->GetSavedAddress(HeapObject::cast(*p));
952 addresses_.Add(a); 954 addresses_.Add(a);
953 } 955 }
954 } 956 }
955 } 957 }
956 958
957 virtual void VisitCodeTarget(RelocInfo* rinfo) { 959 virtual void VisitCodeTarget(RelocInfo* rinfo) {
958 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); 960 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
959 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 961 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
960 Address encoded_target = serializer_->GetSavedAddress(target); 962 Address encoded_target = serializer_->GetSavedAddress(target);
961 // All calls and jumps are to code objects that encode into 32 bits. 963 // All calls and jumps are to code objects that encode into 32 bits.
962 offsets_32_bit_.Add(rinfo->target_address_address() - obj_address_); 964 offsets_32_bit_.Add(
965 static_cast<int>(rinfo->target_address_address() - obj_address_));
963 uint32_t small_target = 966 uint32_t small_target =
964 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(encoded_target)); 967 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(encoded_target));
965 ASSERT(reinterpret_cast<uintptr_t>(encoded_target) == small_target); 968 ASSERT(reinterpret_cast<uintptr_t>(encoded_target) == small_target);
966 data_32_bit_.Add(small_target); 969 data_32_bit_.Add(small_target);
967 } 970 }
968 971
969 972
970 virtual void VisitExternalReferences(Address* start, Address* end) { 973 virtual void VisitExternalReferences(Address* start, Address* end) {
971 for (Address* p = start; p < end; ++p) { 974 for (Address* p = start; p < end; ++p) {
972 uint32_t code = reference_encoder_->Encode(*p); 975 uint32_t code = reference_encoder_->Encode(*p);
973 CHECK(*p == NULL ? code == 0 : code != 0); 976 CHECK(*p == NULL ? code == 0 : code != 0);
974 offsets_.Add(reinterpret_cast<Address>(p) - obj_address_); 977 offsets_.Add(
978 static_cast<int>(reinterpret_cast<Address>(p) - obj_address_));
975 addresses_.Add(reinterpret_cast<Address>(code)); 979 addresses_.Add(reinterpret_cast<Address>(code));
976 } 980 }
977 } 981 }
978 982
979 virtual void VisitRuntimeEntry(RelocInfo* rinfo) { 983 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {
980 Address target = rinfo->target_address(); 984 Address target = rinfo->target_address();
981 uint32_t encoding = reference_encoder_->Encode(target); 985 uint32_t encoding = reference_encoder_->Encode(target);
982 CHECK(target == NULL ? encoding == 0 : encoding != 0); 986 CHECK(target == NULL ? encoding == 0 : encoding != 0);
983 offsets_.Add(rinfo->target_address_address() - obj_address_); 987 offsets_.Add(
988 static_cast<int>(rinfo->target_address_address() - obj_address_));
984 addresses_.Add(reinterpret_cast<Address>(encoding)); 989 addresses_.Add(reinterpret_cast<Address>(encoding));
985 } 990 }
986 991
987 void Update(Address start_address) { 992 void Update(Address start_address) {
988 for (int i = 0; i < offsets_.length(); i++) { 993 for (int i = 0; i < offsets_.length(); i++) {
989 memcpy(start_address + offsets_[i], &addresses_[i], sizeof(Address)); 994 memcpy(start_address + offsets_[i], &addresses_[i], sizeof(Address));
990 } 995 }
991 for (int i = 0; i < offsets_32_bit_.length(); i++) { 996 for (int i = 0; i < offsets_32_bit_.length(); i++) {
992 memcpy(start_address + offsets_32_bit_[i], &data_32_bit_[i], 997 memcpy(start_address + offsets_32_bit_[i], &data_32_bit_[i],
993 sizeof(uint32_t)); 998 sizeof(uint32_t));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1048
1044 1049
1045 bool Serializer::serialization_enabled_ = false; 1050 bool Serializer::serialization_enabled_ = false;
1046 1051
1047 1052
1048 #ifdef DEBUG 1053 #ifdef DEBUG
1049 static const int kMaxTagLength = 32; 1054 static const int kMaxTagLength = 32;
1050 1055
1051 void Serializer::Synchronize(const char* tag) { 1056 void Serializer::Synchronize(const char* tag) {
1052 if (FLAG_debug_serialization) { 1057 if (FLAG_debug_serialization) {
1053 int length = strlen(tag); 1058 int length = StrLength(tag);
1054 ASSERT(length <= kMaxTagLength); 1059 ASSERT(length <= kMaxTagLength);
1055 writer_->PutC('S'); 1060 writer_->PutC('S');
1056 writer_->PutInt(length); 1061 writer_->PutInt(length);
1057 writer_->PutBytes(reinterpret_cast<const byte*>(tag), length); 1062 writer_->PutBytes(reinterpret_cast<const byte*>(tag), length);
1058 } 1063 }
1059 } 1064 }
1060 #endif 1065 #endif
1061 1066
1062 1067
1063 void Serializer::InitializeAllocators() { 1068 void Serializer::InitializeAllocators() {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 1413
1409 1414
1410 #ifdef DEBUG 1415 #ifdef DEBUG
1411 void Deserializer::Synchronize(const char* tag) { 1416 void Deserializer::Synchronize(const char* tag) {
1412 if (expect_debug_information_) { 1417 if (expect_debug_information_) {
1413 char buf[kMaxTagLength]; 1418 char buf[kMaxTagLength];
1414 reader_.ExpectC('S'); 1419 reader_.ExpectC('S');
1415 int length = reader_.GetInt(); 1420 int length = reader_.GetInt();
1416 ASSERT(length <= kMaxTagLength); 1421 ASSERT(length <= kMaxTagLength);
1417 reader_.GetBytes(reinterpret_cast<Address>(buf), length); 1422 reader_.GetBytes(reinterpret_cast<Address>(buf), length);
1418 ASSERT_EQ(strlen(tag), length); 1423 ASSERT_EQ(StrLength(tag), length);
1419 ASSERT(strncmp(tag, buf, length) == 0); 1424 ASSERT(strncmp(tag, buf, length) == 0);
1420 } 1425 }
1421 } 1426 }
1422 #endif 1427 #endif
1423 1428
1424 1429
1425 class NoGlobalHandlesChecker : public ObjectVisitor { 1430 class NoGlobalHandlesChecker : public ObjectVisitor {
1426 public: 1431 public:
1427 virtual void VisitPointers(Object** start, Object** end) { 1432 virtual void VisitPointers(Object** start, Object** end) {
1428 ASSERT(false); 1433 ASSERT(false);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 case RAW_DATA_SERIALIZATION: { 1929 case RAW_DATA_SERIALIZATION: {
1925 int size = source_->GetInt(); 1930 int size = source_->GetInt();
1926 byte* raw_data_out = reinterpret_cast<byte*>(current); 1931 byte* raw_data_out = reinterpret_cast<byte*>(current);
1927 source_->CopyRaw(raw_data_out, size); 1932 source_->CopyRaw(raw_data_out, size);
1928 current = reinterpret_cast<Object**>(raw_data_out + size); 1933 current = reinterpret_cast<Object**>(raw_data_out + size);
1929 break; 1934 break;
1930 } 1935 }
1931 case OBJECT_SERIALIZATION + NEW_SPACE: { 1936 case OBJECT_SERIALIZATION + NEW_SPACE: {
1932 ReadObject(NEW_SPACE, Heap::new_space(), current); 1937 ReadObject(NEW_SPACE, Heap::new_space(), current);
1933 if (space != NEW_SPACE) { 1938 if (space != NEW_SPACE) {
1934 Heap::RecordWrite(address, 1939 Heap::RecordWrite(address, static_cast<int>(
1935 reinterpret_cast<Address>(current) - address); 1940 reinterpret_cast<Address>(current) - address));
1936 } 1941 }
1937 current++; 1942 current++;
1938 break; 1943 break;
1939 } 1944 }
1940 case OBJECT_SERIALIZATION + OLD_DATA_SPACE: 1945 case OBJECT_SERIALIZATION + OLD_DATA_SPACE:
1941 ReadObject(OLD_DATA_SPACE, Heap::old_data_space(), current++); 1946 ReadObject(OLD_DATA_SPACE, Heap::old_data_space(), current++);
1942 break; 1947 break;
1943 case OBJECT_SERIALIZATION + OLD_POINTER_SPACE: 1948 case OBJECT_SERIALIZATION + OLD_POINTER_SPACE:
1944 ReadObject(OLD_POINTER_SPACE, Heap::old_pointer_space(), current++); 1949 ReadObject(OLD_POINTER_SPACE, Heap::old_pointer_space(), current++);
1945 break; 1950 break;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 Assembler::set_target_at(location_of_branch_data, 1987 Assembler::set_target_at(location_of_branch_data,
1983 code_object->instruction_start()); 1988 code_object->instruction_start());
1984 location_of_branch_data += Assembler::kCallTargetSize; 1989 location_of_branch_data += Assembler::kCallTargetSize;
1985 current = reinterpret_cast<Object**>(location_of_branch_data); 1990 current = reinterpret_cast<Object**>(location_of_branch_data);
1986 break; 1991 break;
1987 } 1992 }
1988 ONE_CASE_PER_SPACE(BACKREF_SERIALIZATION) { 1993 ONE_CASE_PER_SPACE(BACKREF_SERIALIZATION) {
1989 // Write a backreference to an object we unpacked earlier. 1994 // Write a backreference to an object we unpacked earlier.
1990 int backref_space = (data & kSpaceMask); 1995 int backref_space = (data & kSpaceMask);
1991 if (backref_space == NEW_SPACE && space != NEW_SPACE) { 1996 if (backref_space == NEW_SPACE && space != NEW_SPACE) {
1992 Heap::RecordWrite(address, 1997 Heap::RecordWrite(address, static_cast<int>(
1993 reinterpret_cast<Address>(current) - address); 1998 reinterpret_cast<Address>(current) - address));
1994 } 1999 }
1995 *current++ = GetAddressFromEnd(backref_space); 2000 *current++ = GetAddressFromEnd(backref_space);
1996 break; 2001 break;
1997 } 2002 }
1998 ONE_CASE_PER_SPACE(REFERENCE_SERIALIZATION) { 2003 ONE_CASE_PER_SPACE(REFERENCE_SERIALIZATION) {
1999 // Write a reference to an object we unpacked earlier. 2004 // Write a reference to an object we unpacked earlier.
2000 int reference_space = (data & kSpaceMask); 2005 int reference_space = (data & kSpaceMask);
2001 if (reference_space == NEW_SPACE && space != NEW_SPACE) { 2006 if (reference_space == NEW_SPACE && space != NEW_SPACE) {
2002 Heap::RecordWrite(address, 2007 Heap::RecordWrite(address, static_cast<int>(
2003 reinterpret_cast<Address>(current) - address); 2008 reinterpret_cast<Address>(current) - address));
2004 } 2009 }
2005 *current++ = GetAddressFromStart(reference_space); 2010 *current++ = GetAddressFromStart(reference_space);
2006 break; 2011 break;
2007 } 2012 }
2008 #define COMMON_REFS_CASE(index, reference_space, address) \ 2013 #define COMMON_REFS_CASE(index, reference_space, address) \
2009 case REFERENCE_SERIALIZATION + index: { \ 2014 case REFERENCE_SERIALIZATION + index: { \
2010 ASSERT(SpaceIsPaged(reference_space)); \ 2015 ASSERT(SpaceIsPaged(reference_space)); \
2011 Address object_address = \ 2016 Address object_address = \
2012 pages_[reference_space][0] + (address << kObjectAlignmentBits); \ 2017 pages_[reference_space][0] + (address << kObjectAlignmentBits); \
2013 *current++ = HeapObject::FromAddress(object_address); \ 2018 *current++ = HeapObject::FromAddress(object_address); \
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 UNREACHABLE(); 2080 UNREACHABLE();
2076 } 2081 }
2077 } 2082 }
2078 ASSERT(current == limit); 2083 ASSERT(current == limit);
2079 } 2084 }
2080 2085
2081 2086
2082 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) { 2087 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
2083 const int max_shift = ((kPointerSize * kBitsPerByte) / 7) * 7; 2088 const int max_shift = ((kPointerSize * kBitsPerByte) / 7) * 7;
2084 for (int shift = max_shift; shift > 0; shift -= 7) { 2089 for (int shift = max_shift; shift > 0; shift -= 7) {
2085 if (integer >= 1u << shift) { 2090 if (integer >= static_cast<uintptr_t>(1u) << shift) {
2086 Put(((integer >> shift) & 0x7f) | 0x80, "IntPart"); 2091 Put(((integer >> shift) & 0x7f) | 0x80, "IntPart");
2087 } 2092 }
2088 } 2093 }
2089 PutSection(integer & 0x7f, "IntLastPart"); 2094 PutSection(integer & 0x7f, "IntLastPart");
2090 } 2095 }
2091 2096
2092 #ifdef DEBUG 2097 #ifdef DEBUG
2093 2098
2094 void Deserializer2::Synchronize(const char* tag) { 2099 void Deserializer2::Synchronize(const char* tag) {
2095 int data = source_->Get(); 2100 int data = source_->Get();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 void Serializer2::ObjectSerializer::VisitExternalReferences(Address* start, 2281 void Serializer2::ObjectSerializer::VisitExternalReferences(Address* start,
2277 Address* end) { 2282 Address* end) {
2278 Address references_start = reinterpret_cast<Address>(start); 2283 Address references_start = reinterpret_cast<Address>(start);
2279 OutputRawData(references_start); 2284 OutputRawData(references_start);
2280 2285
2281 for (Address* current = start; current < end; current++) { 2286 for (Address* current = start; current < end; current++) {
2282 sink_->Put(EXTERNAL_REFERENCE_SERIALIZATION, "ExternalReference"); 2287 sink_->Put(EXTERNAL_REFERENCE_SERIALIZATION, "ExternalReference");
2283 int reference_id = serializer_->EncodeExternalReference(*current); 2288 int reference_id = serializer_->EncodeExternalReference(*current);
2284 sink_->PutInt(reference_id, "reference id"); 2289 sink_->PutInt(reference_id, "reference id");
2285 } 2290 }
2286 bytes_processed_so_far_ += (end - start) * kPointerSize; 2291 bytes_processed_so_far_ += static_cast<int>((end - start) * kPointerSize);
2287 } 2292 }
2288 2293
2289 2294
2290 void Serializer2::ObjectSerializer::VisitRuntimeEntry(RelocInfo* rinfo) { 2295 void Serializer2::ObjectSerializer::VisitRuntimeEntry(RelocInfo* rinfo) {
2291 Address target_start = rinfo->target_address_address(); 2296 Address target_start = rinfo->target_address_address();
2292 OutputRawData(target_start); 2297 OutputRawData(target_start);
2293 Address target = rinfo->target_address(); 2298 Address target = rinfo->target_address();
2294 uint32_t encoding = serializer_->EncodeExternalReference(target); 2299 uint32_t encoding = serializer_->EncodeExternalReference(target);
2295 CHECK(target == NULL ? encoding == 0 : encoding != 0); 2300 CHECK(target == NULL ? encoding == 0 : encoding != 0);
2296 sink_->Put(EXTERNAL_BRANCH_TARGET_SERIALIZATION, "ExternalReference"); 2301 sink_->Put(EXTERNAL_BRANCH_TARGET_SERIALIZATION, "ExternalReference");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 } 2336 }
2332 } 2337 }
2333 // One of the strings in the natives cache should match the resource. We 2338 // One of the strings in the natives cache should match the resource. We
2334 // can't serialize any other kinds of external strings. 2339 // can't serialize any other kinds of external strings.
2335 UNREACHABLE(); 2340 UNREACHABLE();
2336 } 2341 }
2337 2342
2338 2343
2339 void Serializer2::ObjectSerializer::OutputRawData(Address up_to) { 2344 void Serializer2::ObjectSerializer::OutputRawData(Address up_to) {
2340 Address object_start = object_->address(); 2345 Address object_start = object_->address();
2341 int up_to_offset = up_to - object_start; 2346 int up_to_offset = static_cast<int>(up_to - object_start);
2342 int skipped = up_to_offset - bytes_processed_so_far_; 2347 int skipped = up_to_offset - bytes_processed_so_far_;
2343 // This assert will fail if the reloc info gives us the target_address_address 2348 // This assert will fail if the reloc info gives us the target_address_address
2344 // locations in a non-ascending order. Luckily that doesn't happen. 2349 // locations in a non-ascending order. Luckily that doesn't happen.
2345 ASSERT(skipped >= 0); 2350 ASSERT(skipped >= 0);
2346 if (skipped != 0) { 2351 if (skipped != 0) {
2347 Address base = object_start + bytes_processed_so_far_; 2352 Address base = object_start + bytes_processed_so_far_;
2348 #define RAW_CASE(index, length) \ 2353 #define RAW_CASE(index, length) \
2349 if (skipped == length) { \ 2354 if (skipped == length) { \
2350 sink_->PutSection(RAW_DATA_SERIALIZATION + index, "RawDataFixed"); \ 2355 sink_->PutSection(RAW_DATA_SERIALIZATION + index, "RawDataFixed"); \
2351 } else /* NOLINT */ 2356 } else /* NOLINT */
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2424 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 2429 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
2425 } 2430 }
2426 } 2431 }
2427 int allocation_address = fullness_[space]; 2432 int allocation_address = fullness_[space];
2428 fullness_[space] = allocation_address + size; 2433 fullness_[space] = allocation_address + size;
2429 return allocation_address; 2434 return allocation_address;
2430 } 2435 }
2431 2436
2432 2437
2433 } } // namespace v8::internal 2438 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/serialize.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698