OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 | 142 |
143 int LCodeGenBase::GetNextEmittedBlock() const { | 143 int LCodeGenBase::GetNextEmittedBlock() const { |
144 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 144 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
145 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 145 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
146 } | 146 } |
147 return -1; | 147 return -1; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 void LCodeGenBase::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | 151 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { |
| 152 ASSERT(code->is_optimized_code()); |
152 ZoneList<Handle<Map> > maps(1, zone()); | 153 ZoneList<Handle<Map> > maps(1, zone()); |
153 ZoneList<Handle<JSObject> > objects(1, zone()); | 154 ZoneList<Handle<JSObject> > objects(1, zone()); |
154 ZoneList<Handle<Cell> > cells(1, zone()); | 155 ZoneList<Handle<Cell> > cells(1, zone()); |
155 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 156 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
156 RelocInfo::ModeMask(RelocInfo::CELL); | 157 RelocInfo::ModeMask(RelocInfo::CELL); |
157 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 158 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
158 RelocInfo::Mode mode = it.rinfo()->rmode(); | 159 RelocInfo::Mode mode = it.rinfo()->rmode(); |
159 if (mode == RelocInfo::CELL && | 160 if (mode == RelocInfo::CELL && |
160 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_cell())) { | 161 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { |
161 Handle<Cell> cell(it.rinfo()->target_cell()); | 162 Handle<Cell> cell(it.rinfo()->target_cell()); |
162 cells.Add(cell, zone()); | 163 cells.Add(cell, zone()); |
163 } else if (mode == RelocInfo::EMBEDDED_OBJECT && | 164 } else if (mode == RelocInfo::EMBEDDED_OBJECT && |
164 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { | 165 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_object())) { |
165 if (it.rinfo()->target_object()->IsMap()) { | 166 if (it.rinfo()->target_object()->IsMap()) { |
166 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | 167 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
167 maps.Add(map, zone()); | 168 maps.Add(map, zone()); |
168 } else if (it.rinfo()->target_object()->IsJSObject()) { | 169 } else if (it.rinfo()->target_object()->IsJSObject()) { |
169 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | 170 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
170 objects.Add(object, zone()); | 171 objects.Add(object, zone()); |
171 } else if (it.rinfo()->target_object()->IsCell()) { | 172 } else if (it.rinfo()->target_object()->IsCell()) { |
172 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object())); | 173 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object())); |
173 cells.Add(cell, zone()); | 174 cells.Add(cell, zone()); |
174 } | 175 } |
(...skipping 11 matching lines...) Expand all Loading... |
186 for (int i = 0; i < objects.length(); i++) { | 187 for (int i = 0; i < objects.length(); i++) { |
187 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | 188 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
188 } | 189 } |
189 for (int i = 0; i < cells.length(); i++) { | 190 for (int i = 0; i < cells.length(); i++) { |
190 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); | 191 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); |
191 } | 192 } |
192 } | 193 } |
193 | 194 |
194 | 195 |
195 } } // namespace v8::internal | 196 } } // namespace v8::internal |
OLD | NEW |