OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // We do not allow copies of copies, so we follow one link to | 86 // We do not allow copies of copies, so we follow one link to |
87 // the actual backing store of a copy before making a copy. | 87 // the actual backing store of a copy before making a copy. |
88 index = target.index(); | 88 index = target.index(); |
89 ASSERT(elements_[index].is_memory() || elements_[index].is_register()); | 89 ASSERT(elements_[index].is_memory() || elements_[index].is_register()); |
90 // Fall through. | 90 // Fall through. |
91 | 91 |
92 case FrameElement::MEMORY: // Fall through. | 92 case FrameElement::MEMORY: // Fall through. |
93 case FrameElement::REGISTER: | 93 case FrameElement::REGISTER: |
94 // All copies are backed by memory or register locations. | 94 // All copies are backed by memory or register locations. |
95 result.type_ = | 95 result.type_ = |
96 FrameElement::TypeField::encode(FrameElement::COPY) | 96 FrameElement::TypeField::encode(FrameElement::COPY) | |
97 | FrameElement::IsCopiedField::encode(false) | 97 FrameElement::SyncField::encode(FrameElement::NOT_SYNCED); |
98 | FrameElement::SyncField::encode(FrameElement::NOT_SYNCED); | |
99 result.data_.index_ = index; | 98 result.data_.index_ = index; |
100 elements_[index].set_copied(); | |
101 break; | 99 break; |
102 | 100 |
103 case FrameElement::INVALID: | 101 case FrameElement::INVALID: |
104 // We should not try to copy invalid elements. | 102 // We should not try to copy invalid elements. |
105 UNREACHABLE(); | 103 UNREACHABLE(); |
106 break; | 104 break; |
107 } | 105 } |
108 return result; | 106 return result; |
109 } | 107 } |
110 | 108 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 bool same_constant = original.is_constant() | 360 bool same_constant = original.is_constant() |
363 && value->is_constant() | 361 && value->is_constant() |
364 && original.handle().is_identical_to(value->handle()); | 362 && original.handle().is_identical_to(value->handle()); |
365 if (same_register || same_constant) { | 363 if (same_register || same_constant) { |
366 value->Unuse(); | 364 value->Unuse(); |
367 return; | 365 return; |
368 } | 366 } |
369 | 367 |
370 // If the original may be a copy, adjust to preserve the copy-on-write | 368 // If the original may be a copy, adjust to preserve the copy-on-write |
371 // semantics of copied elements. | 369 // semantics of copied elements. |
372 if (original.is_copied() && | 370 if (original.is_register() || original.is_memory()) { |
373 (original.is_register() || original.is_memory())) { | |
374 FrameElement ignored = AdjustCopies(frame_index); | 371 FrameElement ignored = AdjustCopies(frame_index); |
375 } | 372 } |
376 | 373 |
377 // If the original is a register reference, deallocate it. | 374 // If the original is a register reference, deallocate it. |
378 if (original.is_register()) { | 375 if (original.is_register()) { |
379 Unuse(original.reg()); | 376 Unuse(original.reg()); |
380 } | 377 } |
381 | 378 |
382 FrameElement new_element; | 379 FrameElement new_element; |
383 if (value->is_register()) { | 380 if (value->is_register()) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 for (int i = 0; i < kNumRegisters; i++) { | 555 for (int i = 0; i < kNumRegisters; i++) { |
559 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { | 556 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { |
560 return false; | 557 return false; |
561 } | 558 } |
562 } | 559 } |
563 | 560 |
564 return true; | 561 return true; |
565 } | 562 } |
566 | 563 |
567 } } // namespace v8::internal | 564 } } // namespace v8::internal |
OLD | NEW |