OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include "v8.h" | 6 #include "v8.h" |
7 | 7 |
8 #include "liveedit.h" | 8 #include "liveedit.h" |
9 | 9 |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 if (new_buffer_size > kMaximalBufferSize) { | 1306 if (new_buffer_size > kMaximalBufferSize) { |
1307 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer"); | 1307 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer"); |
1308 } | 1308 } |
1309 | 1309 |
1310 // Set up new buffer. | 1310 // Set up new buffer. |
1311 byte* new_buffer = NewArray<byte>(new_buffer_size); | 1311 byte* new_buffer = NewArray<byte>(new_buffer_size); |
1312 | 1312 |
1313 // Copy the data. | 1313 // Copy the data. |
1314 int curently_used_size = | 1314 int curently_used_size = |
1315 static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos()); | 1315 static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos()); |
1316 MemMove(new_buffer + new_buffer_size - curently_used_size, | 1316 OS::MemMove(new_buffer + new_buffer_size - curently_used_size, |
1317 reloc_info_writer_.pos(), curently_used_size); | 1317 reloc_info_writer_.pos(), curently_used_size); |
1318 | 1318 |
1319 reloc_info_writer_.Reposition( | 1319 reloc_info_writer_.Reposition( |
1320 new_buffer + new_buffer_size - curently_used_size, | 1320 new_buffer + new_buffer_size - curently_used_size, |
1321 reloc_info_writer_.last_pc()); | 1321 reloc_info_writer_.last_pc()); |
1322 | 1322 |
1323 DeleteArray(buffer_); | 1323 DeleteArray(buffer_); |
1324 buffer_ = new_buffer; | 1324 buffer_ = new_buffer; |
1325 buffer_size_ = new_buffer_size; | 1325 buffer_size_ = new_buffer_size; |
1326 } | 1326 } |
1327 | 1327 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { | 1360 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { |
1361 buffer_writer.Write(it.rinfo()); | 1361 buffer_writer.Write(it.rinfo()); |
1362 } | 1362 } |
1363 } | 1363 } |
1364 } | 1364 } |
1365 | 1365 |
1366 Vector<byte> buffer = buffer_writer.GetResult(); | 1366 Vector<byte> buffer = buffer_writer.GetResult(); |
1367 | 1367 |
1368 if (buffer.length() == code->relocation_size()) { | 1368 if (buffer.length() == code->relocation_size()) { |
1369 // Simply patch relocation area of code. | 1369 // Simply patch relocation area of code. |
1370 MemCopy(code->relocation_start(), buffer.start(), buffer.length()); | 1370 OS::MemCopy(code->relocation_start(), buffer.start(), buffer.length()); |
1371 return code; | 1371 return code; |
1372 } else { | 1372 } else { |
1373 // Relocation info section now has different size. We cannot simply | 1373 // Relocation info section now has different size. We cannot simply |
1374 // rewrite it inside code object. Instead we have to create a new | 1374 // rewrite it inside code object. Instead we have to create a new |
1375 // code object. | 1375 // code object. |
1376 Handle<Code> result(isolate->factory()->CopyCode(code, buffer)); | 1376 Handle<Code> result(isolate->factory()->CopyCode(code, buffer)); |
1377 return result; | 1377 return result; |
1378 } | 1378 } |
1379 } | 1379 } |
1380 | 1380 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 Smi::cast(Memory::Object_at(padding_pointer))->value(); | 1629 Smi::cast(Memory::Object_at(padding_pointer))->value(); |
1630 if (padding_counter * kPointerSize < shortage_bytes) { | 1630 if (padding_counter * kPointerSize < shortage_bytes) { |
1631 return "Not enough space for frame dropper frame " | 1631 return "Not enough space for frame dropper frame " |
1632 "(even with padding frame)"; | 1632 "(even with padding frame)"; |
1633 } | 1633 } |
1634 Memory::Object_at(padding_pointer) = | 1634 Memory::Object_at(padding_pointer) = |
1635 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize); | 1635 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize); |
1636 | 1636 |
1637 StackFrame* pre_pre_frame = frames[top_frame_index - 2]; | 1637 StackFrame* pre_pre_frame = frames[top_frame_index - 2]; |
1638 | 1638 |
1639 MemMove(padding_start + kPointerSize - shortage_bytes, | 1639 OS::MemMove(padding_start + kPointerSize - shortage_bytes, |
1640 padding_start + kPointerSize, | 1640 padding_start + kPointerSize, |
1641 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize); | 1641 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize); |
1642 | 1642 |
1643 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes); | 1643 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes); |
1644 pre_pre_frame->SetCallerFp(pre_top_frame->fp()); | 1644 pre_pre_frame->SetCallerFp(pre_top_frame->fp()); |
1645 unused_stack_top -= shortage_bytes; | 1645 unused_stack_top -= shortage_bytes; |
1646 | 1646 |
1647 STATIC_ASSERT(sizeof(Address) == kPointerSize); | 1647 STATIC_ASSERT(sizeof(Address) == kPointerSize); |
1648 top_frame_pc_address -= shortage_bytes / kPointerSize; | 1648 top_frame_pc_address -= shortage_bytes / kPointerSize; |
1649 } else { | 1649 } else { |
1650 return "Not enough space for frame dropper frame"; | 1650 return "Not enough space for frame dropper frame"; |
1651 } | 1651 } |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | 2019 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { |
2020 isolate_->active_function_info_listener()->FunctionCode(code); | 2020 isolate_->active_function_info_listener()->FunctionCode(code); |
2021 } | 2021 } |
2022 | 2022 |
2023 | 2023 |
2024 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2024 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2025 return isolate->active_function_info_listener() != NULL; | 2025 return isolate->active_function_info_listener() != NULL; |
2026 } | 2026 } |
2027 | 2027 |
2028 } } // namespace v8::internal | 2028 } } // namespace v8::internal |
OLD | NEW |