| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "codegen.h" | 30 #include "codegen.h" |
| 31 #include "register-allocator.h" | 31 #include "register-allocator.h" |
| 32 | 32 |
| 33 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
| 34 | 34 |
| 35 void RegisterFile::CopyTo(RegisterFile* other) { |
| 36 for (int i = 0; i < kNumRegisters; i++) { |
| 37 other->ref_counts_[i] = ref_counts_[i]; |
| 38 } |
| 39 } |
| 40 |
| 41 |
| 42 #ifdef DEBUG |
| 43 bool RegisterFile::Equals(RegisterFile* other) { |
| 44 for (int i = 0; i < kNumRegisters; i++) { |
| 45 if (ref_counts_[i] != other->ref_counts_[i]) { |
| 46 return false; |
| 47 } |
| 48 } |
| 49 return true; |
| 50 } |
| 51 #endif |
| 52 |
| 53 |
| 35 void RegisterAllocator::Initialize() { | 54 void RegisterAllocator::Initialize() { |
| 36 registers_.Reset(); | 55 registers_.Reset(); |
| 37 registers_.Use(esp); | 56 registers_.Use(esp); |
| 38 registers_.Use(ebp); | 57 registers_.Use(ebp); |
| 39 registers_.Use(esi); | 58 registers_.Use(esi); |
| 40 registers_.Use(edi); | 59 registers_.Use(edi); |
| 41 } | 60 } |
| 42 | 61 |
| 43 | 62 |
| 44 Register RegisterAllocator::AllocateWithoutSpilling() { | 63 Register RegisterAllocator::AllocateWithoutSpilling() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 if (!result.is(no_reg)) { | 82 if (!result.is(no_reg)) { |
| 64 ASSERT(!registers_.is_used(result.code())); | 83 ASSERT(!registers_.is_used(result.code())); |
| 65 registers_.Use(result); | 84 registers_.Use(result); |
| 66 } | 85 } |
| 67 } | 86 } |
| 68 return result; | 87 return result; |
| 69 } | 88 } |
| 70 | 89 |
| 71 | 90 |
| 72 } } // namespace v8::internal | 91 } } // namespace v8::internal |
| OLD | NEW |