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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 | 60 |
61 void RegisterAllocator::UnuseReserved(RegisterFile* register_file) { | 61 void RegisterAllocator::UnuseReserved(RegisterFile* register_file) { |
62 register_file->ref_counts_[sp.code()] = 0; | 62 register_file->ref_counts_[sp.code()] = 0; |
63 register_file->ref_counts_[fp.code()] = 0; | 63 register_file->ref_counts_[fp.code()] = 0; |
64 register_file->ref_counts_[cp.code()] = 0; | 64 register_file->ref_counts_[cp.code()] = 0; |
65 register_file->ref_counts_[pc.code()] = 0; | 65 register_file->ref_counts_[pc.code()] = 0; |
66 } | 66 } |
67 | 67 |
68 | 68 |
| 69 bool RegisterAllocator::IsReserved(int reg_code) { |
| 70 return (reg_code == sp.code()) |
| 71 || (reg_code == fp.code()) |
| 72 || (reg_code == cp.code()) |
| 73 || (reg_code == pc.code()); |
| 74 } |
| 75 |
| 76 |
69 void RegisterAllocator::Initialize() { | 77 void RegisterAllocator::Initialize() { |
70 Reset(); | 78 Reset(); |
71 // The following registers are live on function entry, saved in the | 79 // The following registers are live on function entry, saved in the |
72 // frame, and available for allocation during execution. | 80 // frame, and available for allocation during execution. |
73 Use(r1); // JS function. | 81 Use(r1); // JS function. |
74 Use(lr); // Return address. | 82 Use(lr); // Return address. |
75 } | 83 } |
76 | 84 |
77 | 85 |
78 void RegisterAllocator::Reset() { | 86 void RegisterAllocator::Reset() { |
79 registers_.Reset(); | 87 registers_.Reset(); |
80 // The following registers are live on function entry and reserved | 88 // The following registers are live on function entry and reserved |
81 // during execution. | 89 // during execution. |
82 Use(sp); // Stack pointer. | 90 Use(sp); // Stack pointer. |
83 Use(fp); // Frame pointer (caller's frame pointer on entry). | 91 Use(fp); // Frame pointer (caller's frame pointer on entry). |
84 Use(cp); // Context context (callee's context on entry). | 92 Use(cp); // Context context (callee's context on entry). |
85 Use(pc); // Program counter. | 93 Use(pc); // Program counter. |
86 } | 94 } |
87 | 95 |
88 | 96 |
89 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { | 97 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { |
90 UNIMPLEMENTED(); | 98 UNIMPLEMENTED(); |
91 Result invalid(cgen_); | 99 Result invalid(cgen_); |
92 return invalid; | 100 return invalid; |
93 } | 101 } |
94 | 102 |
95 | 103 |
96 } } // namespace v8::internal | 104 } } // namespace v8::internal |
OLD | NEW |