Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1263 static const int kBufferGap = RelocInfoWriter::kMaxSize; | 1263 static const int kBufferGap = RelocInfoWriter::kMaxSize; |
| 1264 static const int kMaximalBufferSize = 512*MB; | 1264 static const int kMaximalBufferSize = 512*MB; |
| 1265 }; | 1265 }; |
| 1266 | 1266 |
| 1267 // Patch positions in code (changes relocation info section) and possibly | 1267 // Patch positions in code (changes relocation info section) and possibly |
| 1268 // returns new instance of code. | 1268 // returns new instance of code. |
| 1269 static Handle<Code> PatchPositionsInCode( | 1269 static Handle<Code> PatchPositionsInCode( |
| 1270 Handle<Code> code, | 1270 Handle<Code> code, |
| 1271 Handle<JSArray> position_change_array) { | 1271 Handle<JSArray> position_change_array) { |
| 1272 | 1272 |
| 1273 code->MakeYoung(); | |
|
Michael Starzinger
2012/09/21 09:43:19
Why do we make the code young here?
danno
2012/10/25 10:07:23
Done.
| |
| 1274 | |
| 1273 RelocInfoBuffer buffer_writer(code->relocation_size(), | 1275 RelocInfoBuffer buffer_writer(code->relocation_size(), |
| 1274 code->instruction_start()); | 1276 code->instruction_start()); |
| 1275 | 1277 |
| 1276 { | 1278 { |
| 1277 AssertNoAllocation no_allocations_please; | 1279 AssertNoAllocation no_allocations_please; |
| 1278 for (RelocIterator it(*code); !it.done(); it.next()) { | 1280 for (RelocIterator it(*code); !it.done(); it.next()) { |
| 1279 RelocInfo* rinfo = it.rinfo(); | 1281 RelocInfo* rinfo = it.rinfo(); |
| 1280 if (RelocInfo::IsPosition(rinfo->rmode())) { | 1282 if (RelocInfo::IsPosition(rinfo->rmode())) { |
| 1281 int position = static_cast<int>(rinfo->data()); | 1283 int position = static_cast<int>(rinfo->data()); |
| 1282 int new_position = TranslatePosition(position, | 1284 int new_position = TranslatePosition(position, |
| 1283 position_change_array); | 1285 position_change_array); |
| 1284 if (position != new_position) { | 1286 if (position != new_position) { |
| 1285 RelocInfo info_copy(rinfo->pc(), rinfo->rmode(), new_position, NULL); | 1287 RelocInfo info_copy(rinfo->pc(), rinfo->rmode(), new_position, NULL); |
| 1286 buffer_writer.Write(&info_copy); | 1288 buffer_writer.Write(&info_copy); |
| 1287 continue; | 1289 continue; |
| 1288 } | 1290 } |
| 1289 } | 1291 } |
| 1290 buffer_writer.Write(it.rinfo()); | 1292 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { |
| 1293 buffer_writer.Write(it.rinfo()); | |
| 1294 } | |
| 1291 } | 1295 } |
| 1292 } | 1296 } |
| 1293 | 1297 |
| 1294 Vector<byte> buffer = buffer_writer.GetResult(); | 1298 Vector<byte> buffer = buffer_writer.GetResult(); |
| 1295 | 1299 |
| 1296 if (buffer.length() == code->relocation_size()) { | 1300 if (buffer.length() == code->relocation_size()) { |
| 1297 // Simply patch relocation area of code. | 1301 // Simply patch relocation area of code. |
| 1298 memcpy(code->relocation_start(), buffer.start(), buffer.length()); | 1302 memcpy(code->relocation_start(), buffer.start(), buffer.length()); |
| 1299 return code; | 1303 return code; |
| 1300 } else { | 1304 } else { |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1921 | 1925 |
| 1922 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1926 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 1923 return false; | 1927 return false; |
| 1924 } | 1928 } |
| 1925 | 1929 |
| 1926 #endif // ENABLE_DEBUGGER_SUPPORT | 1930 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1927 | 1931 |
| 1928 | 1932 |
| 1929 | 1933 |
| 1930 } } // namespace v8::internal | 1934 } } // namespace v8::internal |
| OLD | NEW |