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

Side by Side Diff: src/lithium-allocator.h

Issue 6263005: Change the algorithm and generated code for parallel moves on IA32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Fix compilation on all platforms. Created 9 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 value_ |= PolicyField::encode(policy); 314 value_ |= PolicyField::encode(policy);
315 value_ |= LifetimeField::encode(lifetime); 315 value_ |= LifetimeField::encode(lifetime);
316 value_ |= fixed_index << kFixedIndexShift; 316 value_ |= fixed_index << kFixedIndexShift;
317 ASSERT(this->fixed_index() == fixed_index); 317 ASSERT(this->fixed_index() == fixed_index);
318 } 318 }
319 }; 319 };
320 320
321 321
322 class LMoveOperands BASE_EMBEDDED { 322 class LMoveOperands BASE_EMBEDDED {
323 public: 323 public:
324 LMoveOperands(LOperand* from, LOperand* to) : from_(from), to_(to) { } 324 LMoveOperands(LOperand* source, LOperand* destination)
325 325 : source_(source), destination_(destination) {
326 LOperand* from() const { return from_; }
327 LOperand* to() const { return to_; }
328 bool IsRedundant() const {
329 return IsEliminated() || from_->Equals(to_) || IsIgnored();
330 }
331 bool IsEliminated() const { return from_ == NULL; }
332 bool IsIgnored() const {
333 if (to_ != NULL && to_->IsUnallocated() &&
334 LUnallocated::cast(to_)->HasIgnorePolicy()) {
335 return true;
336 }
337 return false;
338 } 326 }
339 327
340 void Eliminate() { from_ = to_ = NULL; } 328 LOperand* source() const { return source_; }
329 void set_source(LOperand* operand) { source_ = operand; }
330
331 LOperand* destination() const { return destination_; }
332 void set_destination(LOperand* operand) { destination_ = operand; }
333
334 // The gap resolver marks moves as "in-progress" by clearing the
335 // destination (but not the source).
336 bool IsPending() const {
337 return destination_ == NULL && source_ != NULL;
338 }
339
340 // True if this move a move into the given destination operand.
341 bool Blocks(LOperand* operand) const {
342 return !IsEliminated() && source()->Equals(operand);
343 }
344
345 // A move is redundant if it's been eliminated, if its source and
346 // destination are the same, or if its destination is unneeded.
347 bool IsRedundant() const {
348 return IsEliminated() || source_->Equals(destination_) || IsIgnored();
349 }
350
351 bool IsIgnored() const {
352 return destination_ != NULL &&
353 destination_->IsUnallocated() &&
354 LUnallocated::cast(destination_)->HasIgnorePolicy();
355 }
356
357 // We clear both operands to indicate move that's been eliminated.
358 void Eliminate() { source_ = destination_ = NULL; }
359 bool IsEliminated() const { return source_ == NULL; }
fschneider 2011/01/17 09:44:16 maybe ASSERT(destination_ == NULL) here, or retu
Kevin Millikin (Chromium) 2011/01/17 10:13:09 I'll assert (source_ != NULL || destination_ == NU
341 360
342 private: 361 private:
343 LOperand* from_; 362 LOperand* source_;
344 LOperand* to_; 363 LOperand* destination_;
345 }; 364 };
346 365
347 366
348 class LConstantOperand: public LOperand { 367 class LConstantOperand: public LOperand {
349 public: 368 public:
350 static LConstantOperand* Create(int index) { 369 static LConstantOperand* Create(int index) {
351 ASSERT(index >= 0); 370 ASSERT(index >= 0);
352 if (index < kNumCachedOperands) return &cache[index]; 371 if (index < kNumCachedOperands) return &cache[index];
353 return new LConstantOperand(index); 372 return new LConstantOperand(index);
354 } 373 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 1046
1028 bool has_osr_entry_; 1047 bool has_osr_entry_;
1029 1048
1030 DISALLOW_COPY_AND_ASSIGN(LAllocator); 1049 DISALLOW_COPY_AND_ASSIGN(LAllocator);
1031 }; 1050 };
1032 1051
1033 1052
1034 } } // namespace v8::internal 1053 } } // namespace v8::internal
1035 1054
1036 #endif // V8_LITHIUM_ALLOCATOR_H_ 1055 #endif // V8_LITHIUM_ALLOCATOR_H_
OLDNEW
« src/lithium.cc ('K') | « src/lithium.cc ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698