| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 146 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
| 147 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 147 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
| 148 } | 148 } |
| 149 return -1; | 149 return -1; |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 void LCodeGenBase::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | 153 void LCodeGenBase::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
| 154 ZoneList<Handle<Map> > maps(1, zone()); | 154 ZoneList<Handle<Map> > maps(1, zone()); |
| 155 ZoneList<Handle<JSObject> > objects(1, zone()); | 155 ZoneList<Handle<JSObject> > objects(1, zone()); |
| 156 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 156 ZoneList<Handle<Cell> > cells(1, zone()); |
| 157 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 158 RelocInfo::ModeMask(RelocInfo::CELL); |
| 157 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 159 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 158 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { | 160 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 161 if (mode == RelocInfo::CELL && |
| 162 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_cell())) { |
| 163 Handle<Cell> cell(it.rinfo()->target_cell()); |
| 164 cells.Add(cell, zone()); |
| 165 } else if (mode == RelocInfo::EMBEDDED_OBJECT && |
| 166 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
| 159 if (it.rinfo()->target_object()->IsMap()) { | 167 if (it.rinfo()->target_object()->IsMap()) { |
| 160 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | 168 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
| 161 maps.Add(map, zone()); | 169 maps.Add(map, zone()); |
| 162 } else if (it.rinfo()->target_object()->IsJSObject()) { | 170 } else if (it.rinfo()->target_object()->IsJSObject()) { |
| 163 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | 171 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
| 164 objects.Add(object, zone()); | 172 objects.Add(object, zone()); |
| 173 } else if (it.rinfo()->target_object()->IsCell()) { |
| 174 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object())); |
| 175 cells.Add(cell, zone()); |
| 165 } | 176 } |
| 166 } | 177 } |
| 167 } | 178 } |
| 168 #ifdef VERIFY_HEAP | 179 #ifdef VERIFY_HEAP |
| 169 // This disables verification of weak embedded objects after full GC. | 180 // This disables verification of weak embedded objects after full GC. |
| 170 // AddDependentCode can cause a GC, which would observe the state where | 181 // AddDependentCode can cause a GC, which would observe the state where |
| 171 // this code is not yet in the depended code lists of the embedded maps. | 182 // this code is not yet in the depended code lists of the embedded maps. |
| 172 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; | 183 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; |
| 173 #endif | 184 #endif |
| 174 for (int i = 0; i < maps.length(); i++) { | 185 for (int i = 0; i < maps.length(); i++) { |
| 175 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | 186 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
| 176 } | 187 } |
| 177 for (int i = 0; i < objects.length(); i++) { | 188 for (int i = 0; i < objects.length(); i++) { |
| 178 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | 189 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
| 179 } | 190 } |
| 191 for (int i = 0; i < cells.length(); i++) { |
| 192 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); |
| 193 } |
| 180 } | 194 } |
| 181 | 195 |
| 182 | 196 |
| 183 } } // namespace v8::internal | 197 } } // namespace v8::internal |
| OLD | NEW |