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

Side by Side Diff: src/assembler.cc

Issue 6541053: Add more generic version of reloc info padding to ensure enough space for rel... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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/assembler.h ('k') | src/ia32/lithium-codegen-ia32.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes); 221 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes);
222 // Use unsigned delta-encoding for pc. 222 // Use unsigned delta-encoding for pc.
223 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); 223 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
224 RelocInfo::Mode rmode = rinfo->rmode(); 224 RelocInfo::Mode rmode = rinfo->rmode();
225 225
226 // The two most common modes are given small tags, and usually fit in a byte. 226 // The two most common modes are given small tags, and usually fit in a byte.
227 if (rmode == RelocInfo::EMBEDDED_OBJECT) { 227 if (rmode == RelocInfo::EMBEDDED_OBJECT) {
228 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); 228 WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
229 } else if (rmode == RelocInfo::CODE_TARGET) { 229 } else if (rmode == RelocInfo::CODE_TARGET) {
230 WriteTaggedPC(pc_delta, kCodeTargetTag); 230 WriteTaggedPC(pc_delta, kCodeTargetTag);
231 ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize);
231 } else if (RelocInfo::IsPosition(rmode)) { 232 } else if (RelocInfo::IsPosition(rmode)) {
232 // Use signed delta-encoding for data. 233 // Use signed delta-encoding for data.
233 intptr_t data_delta = rinfo->data() - last_data_; 234 intptr_t data_delta = rinfo->data() - last_data_;
234 int pos_type_tag = rmode == RelocInfo::POSITION ? kNonstatementPositionTag 235 int pos_type_tag = rmode == RelocInfo::POSITION ? kNonstatementPositionTag
235 : kStatementPositionTag; 236 : kStatementPositionTag;
236 // Check if data is small enough to fit in a tagged byte. 237 // Check if data is small enough to fit in a tagged byte.
237 // We cannot use is_intn because data_delta is not an int32_t. 238 // We cannot use is_intn because data_delta is not an int32_t.
238 if (data_delta >= -(1 << (kSmallDataBits-1)) && 239 if (data_delta >= -(1 << (kSmallDataBits-1)) &&
239 data_delta < 1 << (kSmallDataBits-1)) { 240 data_delta < 1 << (kSmallDataBits-1)) {
240 WriteTaggedPC(pc_delta, kPositionTag); 241 WriteTaggedPC(pc_delta, kPositionTag);
241 WriteTaggedData(data_delta, pos_type_tag); 242 WriteTaggedData(data_delta, pos_type_tag);
242 last_data_ = rinfo->data(); 243 last_data_ = rinfo->data();
243 } else { 244 } else {
244 // Otherwise, use costly encoding. 245 // Otherwise, use costly encoding.
245 WriteExtraTaggedPC(pc_delta, kPCJumpTag); 246 WriteExtraTaggedPC(pc_delta, kPCJumpTag);
246 WriteExtraTaggedData(data_delta, pos_type_tag); 247 WriteExtraTaggedData(data_delta, pos_type_tag);
247 last_data_ = rinfo->data(); 248 last_data_ = rinfo->data();
248 } 249 }
249 } else if (RelocInfo::IsComment(rmode)) { 250 } else if (RelocInfo::IsComment(rmode)) {
250 // Comments are normally not generated, so we use the costly encoding. 251 // Comments are normally not generated, so we use the costly encoding.
251 WriteExtraTaggedPC(pc_delta, kPCJumpTag); 252 WriteExtraTaggedPC(pc_delta, kPCJumpTag);
252 WriteExtraTaggedData(rinfo->data() - last_data_, kCommentTag); 253 WriteExtraTaggedData(rinfo->data() - last_data_, kCommentTag);
253 last_data_ = rinfo->data(); 254 last_data_ = rinfo->data();
255 ASSERT(begin_pos - pos_ == RelocInfo::kRelocCommentSize);
254 } else { 256 } else {
255 // For all other modes we simply use the mode as the extra tag. 257 // For all other modes we simply use the mode as the extra tag.
256 // None of these modes need a data component. 258 // None of these modes need a data component.
257 ASSERT(rmode < kPCJumpTag && rmode < kDataJumpTag); 259 ASSERT(rmode < kPCJumpTag && rmode < kDataJumpTag);
258 WriteExtraTaggedPC(pc_delta, rmode); 260 WriteExtraTaggedPC(pc_delta, rmode);
259 } 261 }
260 last_pc_ = rinfo->pc(); 262 last_pc_ = rinfo->pc();
261 #ifdef DEBUG 263 #ifdef DEBUG
262 ASSERT(begin_pos - pos_ <= kMaxSize); 264 ASSERT(begin_pos - pos_ <= kMaxSize);
263 #endif 265 #endif
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 962 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
961 state_.written_position = state_.current_position; 963 state_.written_position = state_.current_position;
962 written = true; 964 written = true;
963 } 965 }
964 966
965 // Return whether something was written. 967 // Return whether something was written.
966 return written; 968 return written;
967 } 969 }
968 970
969 } } // namespace v8::internal 971 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698