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

Side by Side Diff: src/serialize.cc

Issue 344011: * Fix new snapshot code on ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | 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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 } 1942 }
1943 current++; 1943 current++;
1944 break; 1944 break;
1945 } 1945 }
1946 case CODE_OBJECT_SERIALIZATION: { 1946 case CODE_OBJECT_SERIALIZATION: {
1947 Object* new_code_object = NULL; 1947 Object* new_code_object = NULL;
1948 ReadObject(&new_code_object); 1948 ReadObject(&new_code_object);
1949 Code* code_object = reinterpret_cast<Code*>(new_code_object); 1949 Code* code_object = reinterpret_cast<Code*>(new_code_object);
1950 // Setting a branch/call to another code object from code. 1950 // Setting a branch/call to another code object from code.
1951 Address location_of_branch_data = reinterpret_cast<Address>(current); 1951 Address location_of_branch_data = reinterpret_cast<Address>(current);
1952 Assembler::set_target_address_at(location_of_branch_data, 1952 Assembler::set_target_at(location_of_branch_data,
1953 code_object->instruction_start()); 1953 code_object->instruction_start());
1954 location_of_branch_data += Assembler::kCallTargetSize; 1954 location_of_branch_data += Assembler::kCallTargetSize;
1955 current = reinterpret_cast<Object**>(location_of_branch_data); 1955 current = reinterpret_cast<Object**>(location_of_branch_data);
1956 break; 1956 break;
1957 } 1957 }
1958 case BACKREF_SERIALIZATION: { 1958 case BACKREF_SERIALIZATION: {
1959 // Write a backreference to an object we unpacked earlier. 1959 // Write a backreference to an object we unpacked earlier.
1960 int backref_space = source_->Get(); 1960 int backref_space = source_->Get();
1961 if (backref_space == NEW_SPACE && space != NEW_SPACE) { 1961 if (backref_space == NEW_SPACE && space != NEW_SPACE) {
1962 Heap::RecordWrite(address, 1962 Heap::RecordWrite(address,
1963 reinterpret_cast<Address>(current) - address); 1963 reinterpret_cast<Address>(current) - address);
1964 } 1964 }
1965 *current++ = GetAddress(backref_space); 1965 *current++ = GetAddress(backref_space);
1966 break; 1966 break;
1967 } 1967 }
1968 case CODE_BACKREF_SERIALIZATION: { 1968 case CODE_BACKREF_SERIALIZATION: {
1969 int backref_space = source_->Get(); 1969 int backref_space = source_->Get();
1970 // Can't use Code::cast because heap is not set up yet and assertions 1970 // Can't use Code::cast because heap is not set up yet and assertions
1971 // will fail. 1971 // will fail.
1972 Code* code_object = reinterpret_cast<Code*>(GetAddress(backref_space)); 1972 Code* code_object = reinterpret_cast<Code*>(GetAddress(backref_space));
1973 // Setting a branch/call to previously decoded code object from code. 1973 // Setting a branch/call to previously decoded code object from code.
1974 Address location_of_branch_data = reinterpret_cast<Address>(current); 1974 Address location_of_branch_data = reinterpret_cast<Address>(current);
1975 Assembler::set_target_address_at(location_of_branch_data, 1975 Assembler::set_target_at(location_of_branch_data,
1976 code_object->instruction_start()); 1976 code_object->instruction_start());
1977 location_of_branch_data += Assembler::kCallTargetSize; 1977 location_of_branch_data += Assembler::kCallTargetSize;
1978 current = reinterpret_cast<Object**>(location_of_branch_data); 1978 current = reinterpret_cast<Object**>(location_of_branch_data);
1979 break; 1979 break;
1980 } 1980 }
1981 case EXTERNAL_REFERENCE_SERIALIZATION: { 1981 case EXTERNAL_REFERENCE_SERIALIZATION: {
1982 int reference_id = source_->GetInt(); 1982 int reference_id = source_->GetInt();
1983 Address address = external_reference_decoder_->Decode(reference_id); 1983 Address address = external_reference_decoder_->Decode(reference_id);
1984 *current++ = reinterpret_cast<Object*>(address); 1984 *current++ = reinterpret_cast<Object*>(address);
1985 break; 1985 break;
1986 } 1986 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 2166 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
2167 serializer_->SerializeObject(target, CODE_TARGET_REPRESENTATION); 2167 serializer_->SerializeObject(target, CODE_TARGET_REPRESENTATION);
2168 bytes_processed_so_far_ += Assembler::kCallTargetSize; 2168 bytes_processed_so_far_ += Assembler::kCallTargetSize;
2169 } 2169 }
2170 2170
2171 2171
2172 void Serializer2::ObjectSerializer::OutputRawData(Address up_to) { 2172 void Serializer2::ObjectSerializer::OutputRawData(Address up_to) {
2173 Address object_start = object_->address(); 2173 Address object_start = object_->address();
2174 int up_to_offset = up_to - object_start; 2174 int up_to_offset = up_to - object_start;
2175 int skipped = up_to_offset - bytes_processed_so_far_; 2175 int skipped = up_to_offset - bytes_processed_so_far_;
2176 // This assert will fail if the reloc info gives us the target_address_address
2177 // locations in a non-ascending order. Luckily that doesn't happen.
2176 ASSERT(skipped >= 0); 2178 ASSERT(skipped >= 0);
2177 if (skipped != 0) { 2179 if (skipped != 0) {
2178 sink_->Put(RAW_DATA_SERIALIZATION, "raw data"); 2180 sink_->Put(RAW_DATA_SERIALIZATION, "raw data");
2179 sink_->PutInt(skipped, "length"); 2181 sink_->PutInt(skipped, "length");
2180 for (int i = 0; i < skipped; i++) { 2182 for (int i = 0; i < skipped; i++) {
2181 unsigned int data = object_start[bytes_processed_so_far_ + i]; 2183 unsigned int data = object_start[bytes_processed_so_far_ + i];
2182 sink_->Put(data, "byte"); 2184 sink_->Put(data, "byte");
2183 } 2185 }
2184 } 2186 }
2185 bytes_processed_so_far_ += skipped; 2187 bytes_processed_so_far_ += skipped;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 2242 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
2241 } 2243 }
2242 } 2244 }
2243 int allocation_address = fullness_[space]; 2245 int allocation_address = fullness_[space];
2244 fullness_[space] = allocation_address + size; 2246 fullness_[space] = allocation_address + size;
2245 return allocation_address; 2247 return allocation_address;
2246 } 2248 }
2247 2249
2248 2250
2249 } } // namespace v8::internal 2251 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698