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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "codegen.h" | 9 #include "codegen.h" |
10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int additional_comments = | 60 int additional_comments = |
61 (min_padding + comment_reloc_size - 1) / comment_reloc_size; | 61 (min_padding + comment_reloc_size - 1) / comment_reloc_size; |
62 // Actual padding size. | 62 // Actual padding size. |
63 int padding = additional_comments * comment_reloc_size; | 63 int padding = additional_comments * comment_reloc_size; |
64 // Allocate new relocation info and copy old relocation to the end | 64 // Allocate new relocation info and copy old relocation to the end |
65 // of the new relocation info array because relocation info is | 65 // of the new relocation info array because relocation info is |
66 // written and read backwards. | 66 // written and read backwards. |
67 Factory* factory = isolate->factory(); | 67 Factory* factory = isolate->factory(); |
68 Handle<ByteArray> new_reloc = | 68 Handle<ByteArray> new_reloc = |
69 factory->NewByteArray(reloc_length + padding, TENURED); | 69 factory->NewByteArray(reloc_length + padding, TENURED); |
70 MemCopy(new_reloc->GetDataStartAddress() + padding, | 70 OS::MemCopy(new_reloc->GetDataStartAddress() + padding, |
71 code->relocation_info()->GetDataStartAddress(), reloc_length); | 71 code->relocation_info()->GetDataStartAddress(), |
| 72 reloc_length); |
72 // Create a relocation writer to write the comments in the padding | 73 // Create a relocation writer to write the comments in the padding |
73 // space. Use position 0 for everything to ensure short encoding. | 74 // space. Use position 0 for everything to ensure short encoding. |
74 RelocInfoWriter reloc_info_writer( | 75 RelocInfoWriter reloc_info_writer( |
75 new_reloc->GetDataStartAddress() + padding, 0); | 76 new_reloc->GetDataStartAddress() + padding, 0); |
76 intptr_t comment_string | 77 intptr_t comment_string |
77 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); | 78 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); |
78 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); | 79 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); |
79 for (int i = 0; i < additional_comments; ++i) { | 80 for (int i = 0; i < additional_comments; ++i) { |
80 #ifdef DEBUG | 81 #ifdef DEBUG |
81 byte* pos_before = reloc_info_writer.pos(); | 82 byte* pos_before = reloc_info_writer.pos(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ASSERT(prev_call_address == NULL || | 155 ASSERT(prev_call_address == NULL || |
155 call_address >= prev_call_address + patch_size()); | 156 call_address >= prev_call_address + patch_size()); |
156 ASSERT(call_address + patch_size() <= code->instruction_end()); | 157 ASSERT(call_address + patch_size() <= code->instruction_end()); |
157 #ifdef DEBUG | 158 #ifdef DEBUG |
158 prev_call_address = call_address; | 159 prev_call_address = call_address; |
159 #endif | 160 #endif |
160 } | 161 } |
161 | 162 |
162 // Move the relocation info to the beginning of the byte array. | 163 // Move the relocation info to the beginning of the byte array. |
163 int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); | 164 int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); |
164 MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size); | 165 OS::MemMove( |
| 166 code->relocation_start(), reloc_info_writer.pos(), new_reloc_size); |
165 | 167 |
166 // The relocation info is in place, update the size. | 168 // The relocation info is in place, update the size. |
167 reloc_info->set_length(new_reloc_size); | 169 reloc_info->set_length(new_reloc_size); |
168 | 170 |
169 // Handle the junk part after the new relocation info. We will create | 171 // Handle the junk part after the new relocation info. We will create |
170 // a non-live object in the extra space at the end of the former reloc info. | 172 // a non-live object in the extra space at the end of the former reloc info. |
171 Address junk_address = reloc_info->address() + reloc_info->Size(); | 173 Address junk_address = reloc_info->address() + reloc_info->Size(); |
172 ASSERT(junk_address <= reloc_end_address); | 174 ASSERT(junk_address <= reloc_end_address); |
173 isolate->heap()->CreateFillerObjectAt(junk_address, | 175 isolate->heap()->CreateFillerObjectAt(junk_address, |
174 reloc_end_address - junk_address); | 176 reloc_end_address - junk_address); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 UNREACHABLE(); | 399 UNREACHABLE(); |
398 } | 400 } |
399 | 401 |
400 | 402 |
401 #undef __ | 403 #undef __ |
402 | 404 |
403 | 405 |
404 } } // namespace v8::internal | 406 } } // namespace v8::internal |
405 | 407 |
406 #endif // V8_TARGET_ARCH_X87 | 408 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |