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

Side by Side Diff: src/ia32/register-allocator-ia32.cc

Issue 113837: Change the register allocator so that it no longer tracks references... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ASSERT(CodeGeneratorScope::Current()->allocator()->count(target) == 1); 77 ASSERT(CodeGeneratorScope::Current()->allocator()->count(target) == 1);
78 } 78 }
79 ASSERT(is_register()); 79 ASSERT(is_register());
80 ASSERT(reg().is(target)); 80 ASSERT(reg().is(target));
81 } 81 }
82 82
83 83
84 // ------------------------------------------------------------------------- 84 // -------------------------------------------------------------------------
85 // RegisterAllocator implementation. 85 // RegisterAllocator implementation.
86 86
87 RegisterFile RegisterAllocator::Reserved() {
88 RegisterFile reserved;
89 reserved.Use(esp);
90 reserved.Use(ebp);
91 reserved.Use(esi);
92 return reserved;
93 }
94
95
96 void RegisterAllocator::UnuseReserved(RegisterFile* register_file) {
97 register_file->ref_counts_[esp.code()] = 0;
98 register_file->ref_counts_[ebp.code()] = 0;
99 register_file->ref_counts_[esi.code()] = 0;
100 }
101
102
103 bool RegisterAllocator::IsReserved(int reg_code) {
104 // Test below relies on the order of register codes.
105 return reg_code >= esp.code() && reg_code <= esi.code();
106 }
107
108
109 void RegisterAllocator::Initialize() {
110 Reset();
111 // The following register is live on function entry, saved in the
112 // frame, and available for allocation during execution.
113 Use(edi); // JS function.
114 }
115
116
117 void RegisterAllocator::Reset() {
118 registers_.Reset();
119 // The following registers are live on function entry and reserved
120 // during execution.
121 Use(esp); // Stack pointer.
122 Use(ebp); // Frame pointer (caller's frame pointer on entry).
123 Use(esi); // Context (callee's context on entry).
124 }
125
126
127 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { 87 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() {
128 Result result = AllocateWithoutSpilling(); 88 Result result = AllocateWithoutSpilling();
129 // Check that the register is a byte register. If not, unuse the 89 // Check that the register is a byte register. If not, unuse the
130 // register if valid and return an invalid result. 90 // register if valid and return an invalid result.
131 if (result.is_valid() && !result.reg().is_byte_register()) { 91 if (result.is_valid() && !result.reg().is_byte_register()) {
132 result.Unuse(); 92 result.Unuse();
133 return Result(); 93 return Result();
134 } 94 }
135 return result; 95 return result;
136 } 96 }
137 97
138 98
139 } } // namespace v8::internal 99 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698