Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: src/ia32/deoptimizer-ia32.cc

Issue 306473004: Reland 21502 - "Move OS::MemCopy and OS::MemMove out of platform to utils" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_IA32 7 #if V8_TARGET_ARCH_IA32
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
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 OS::MemCopy(new_reloc->GetDataStartAddress() + padding, 70 MemCopy(new_reloc->GetDataStartAddress() + padding,
71 code->relocation_info()->GetDataStartAddress(), 71 code->relocation_info()->GetDataStartAddress(), reloc_length);
72 reloc_length);
73 // Create a relocation writer to write the comments in the padding 72 // Create a relocation writer to write the comments in the padding
74 // space. Use position 0 for everything to ensure short encoding. 73 // space. Use position 0 for everything to ensure short encoding.
75 RelocInfoWriter reloc_info_writer( 74 RelocInfoWriter reloc_info_writer(
76 new_reloc->GetDataStartAddress() + padding, 0); 75 new_reloc->GetDataStartAddress() + padding, 0);
77 intptr_t comment_string 76 intptr_t comment_string
78 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); 77 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString);
79 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); 78 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL);
80 for (int i = 0; i < additional_comments; ++i) { 79 for (int i = 0; i < additional_comments; ++i) {
81 #ifdef DEBUG 80 #ifdef DEBUG
82 byte* pos_before = reloc_info_writer.pos(); 81 byte* pos_before = reloc_info_writer.pos();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ASSERT(prev_call_address == NULL || 154 ASSERT(prev_call_address == NULL ||
156 call_address >= prev_call_address + patch_size()); 155 call_address >= prev_call_address + patch_size());
157 ASSERT(call_address + patch_size() <= code->instruction_end()); 156 ASSERT(call_address + patch_size() <= code->instruction_end());
158 #ifdef DEBUG 157 #ifdef DEBUG
159 prev_call_address = call_address; 158 prev_call_address = call_address;
160 #endif 159 #endif
161 } 160 }
162 161
163 // Move the relocation info to the beginning of the byte array. 162 // Move the relocation info to the beginning of the byte array.
164 int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); 163 int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
165 OS::MemMove( 164 MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
166 code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
167 165
168 // The relocation info is in place, update the size. 166 // The relocation info is in place, update the size.
169 reloc_info->set_length(new_reloc_size); 167 reloc_info->set_length(new_reloc_size);
170 168
171 // Handle the junk part after the new relocation info. We will create 169 // Handle the junk part after the new relocation info. We will create
172 // a non-live object in the extra space at the end of the former reloc info. 170 // a non-live object in the extra space at the end of the former reloc info.
173 Address junk_address = reloc_info->address() + reloc_info->Size(); 171 Address junk_address = reloc_info->address() + reloc_info->Size();
174 ASSERT(junk_address <= reloc_end_address); 172 ASSERT(junk_address <= reloc_end_address);
175 isolate->heap()->CreateFillerObjectAt(junk_address, 173 isolate->heap()->CreateFillerObjectAt(junk_address,
176 reloc_end_address - junk_address); 174 reloc_end_address - junk_address);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 UNREACHABLE(); 426 UNREACHABLE();
429 } 427 }
430 428
431 429
432 #undef __ 430 #undef __
433 431
434 432
435 } } // namespace v8::internal 433 } } // namespace v8::internal
436 434
437 #endif // V8_TARGET_ARCH_IA32 435 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698