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