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

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

Issue 6321012: Version 3.0.9... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: 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
« no previous file with comments | « src/lithium.cc ('k') | src/lithium-allocator.cc » ('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 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 {
360 ASSERT(source_ != NULL || destination_ == NULL);
361 return source_ == NULL;
362 }
341 363
342 private: 364 private:
343 LOperand* from_; 365 LOperand* source_;
344 LOperand* to_; 366 LOperand* destination_;
345 }; 367 };
346 368
347 369
348 class LConstantOperand: public LOperand { 370 class LConstantOperand: public LOperand {
349 public: 371 public:
350 static LConstantOperand* Create(int index) { 372 static LConstantOperand* Create(int index) {
351 ASSERT(index >= 0); 373 ASSERT(index >= 0);
352 if (index < kNumCachedOperands) return &cache[index]; 374 if (index < kNumCachedOperands) return &cache[index];
353 return new LConstantOperand(index); 375 return new LConstantOperand(index);
354 } 376 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 1049
1028 bool has_osr_entry_; 1050 bool has_osr_entry_;
1029 1051
1030 DISALLOW_COPY_AND_ASSIGN(LAllocator); 1052 DISALLOW_COPY_AND_ASSIGN(LAllocator);
1031 }; 1053 };
1032 1054
1033 1055
1034 } } // namespace v8::internal 1056 } } // namespace v8::internal
1035 1057
1036 #endif // V8_LITHIUM_ALLOCATOR_H_ 1058 #endif // V8_LITHIUM_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/lithium.cc ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698