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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
10 #include "src/ia32/frames-ia32.h" | 10 #include "src/ia32/frames-ia32.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 Handle<ByteArray> new_reloc = | 69 Handle<ByteArray> new_reloc = |
70 factory->NewByteArray(reloc_length + padding, TENURED); | 70 factory->NewByteArray(reloc_length + padding, TENURED); |
71 MemCopy(new_reloc->GetDataStartAddress() + padding, | 71 MemCopy(new_reloc->GetDataStartAddress() + padding, |
72 code->relocation_info()->GetDataStartAddress(), reloc_length); | 72 code->relocation_info()->GetDataStartAddress(), reloc_length); |
73 // Create a relocation writer to write the comments in the padding | 73 // Create a relocation writer to write the comments in the padding |
74 // space. Use position 0 for everything to ensure short encoding. | 74 // space. Use position 0 for everything to ensure short encoding. |
75 RelocInfoWriter reloc_info_writer( | 75 RelocInfoWriter reloc_info_writer( |
76 new_reloc->GetDataStartAddress() + padding, 0); | 76 new_reloc->GetDataStartAddress() + padding, 0); |
77 intptr_t comment_string | 77 intptr_t comment_string |
78 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); | 78 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); |
79 RelocInfo rinfo(isolate, 0, RelocInfo::COMMENT, comment_string, NULL); | 79 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); |
80 for (int i = 0; i < additional_comments; ++i) { | 80 for (int i = 0; i < additional_comments; ++i) { |
81 #ifdef DEBUG | 81 #ifdef DEBUG |
82 byte* pos_before = reloc_info_writer.pos(); | 82 byte* pos_before = reloc_info_writer.pos(); |
83 #endif | 83 #endif |
84 reloc_info_writer.Write(&rinfo); | 84 reloc_info_writer.Write(&rinfo); |
85 DCHECK(RelocInfo::kMinRelocCommentSize == | 85 DCHECK(RelocInfo::kMinRelocCommentSize == |
86 pos_before - reloc_info_writer.pos()); | 86 pos_before - reloc_info_writer.pos()); |
87 } | 87 } |
88 // Replace relocation information on the code object. | 88 // Replace relocation information on the code object. |
89 code->set_relocation_info(*new_reloc); | 89 code->set_relocation_info(*new_reloc); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // For each LLazyBailout instruction insert a call to the corresponding | 136 // For each LLazyBailout instruction insert a call to the corresponding |
137 // deoptimization entry. | 137 // deoptimization entry. |
138 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 138 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
139 if (deopt_data->Pc(i)->value() == -1) continue; | 139 if (deopt_data->Pc(i)->value() == -1) continue; |
140 // Patch lazy deoptimization entry. | 140 // Patch lazy deoptimization entry. |
141 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 141 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
142 CodePatcher patcher(isolate, call_address, patch_size()); | 142 CodePatcher patcher(isolate, call_address, patch_size()); |
143 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 143 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |
144 patcher.masm()->call(deopt_entry, RelocInfo::NONE32); | 144 patcher.masm()->call(deopt_entry, RelocInfo::NONE32); |
145 // We use RUNTIME_ENTRY for deoptimization bailouts. | 145 // We use RUNTIME_ENTRY for deoptimization bailouts. |
146 RelocInfo rinfo(isolate, call_address + 1, // 1 after the call opcode. | 146 RelocInfo rinfo(call_address + 1, // 1 after the call opcode. |
147 RelocInfo::RUNTIME_ENTRY, | 147 RelocInfo::RUNTIME_ENTRY, |
148 reinterpret_cast<intptr_t>(deopt_entry), NULL); | 148 reinterpret_cast<intptr_t>(deopt_entry), NULL); |
149 reloc_info_writer.Write(&rinfo); | 149 reloc_info_writer.Write(&rinfo); |
150 DCHECK_GE(reloc_info_writer.pos(), | 150 DCHECK_GE(reloc_info_writer.pos(), |
151 reloc_info->address() + ByteArray::kHeaderSize); | 151 reloc_info->address() + ByteArray::kHeaderSize); |
152 DCHECK(prev_call_address == NULL || | 152 DCHECK(prev_call_address == NULL || |
153 call_address >= prev_call_address + patch_size()); | 153 call_address >= prev_call_address + patch_size()); |
154 DCHECK(call_address + patch_size() <= code->instruction_end()); | 154 DCHECK(call_address + patch_size() <= code->instruction_end()); |
155 #ifdef DEBUG | 155 #ifdef DEBUG |
156 prev_call_address = call_address; | 156 prev_call_address = call_address; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 #undef __ | 389 #undef __ |
390 | 390 |
391 | 391 |
392 } // namespace internal | 392 } // namespace internal |
393 } // namespace v8 | 393 } // namespace v8 |
394 | 394 |
395 #endif // V8_TARGET_ARCH_IA32 | 395 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |