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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 MemCopy(new_reloc->GetDataStartAddress() + padding, |
71 code->relocation_info()->GetDataStartAddress(), reloc_length); | 71 code->relocation_info()->GetDataStartAddress(), reloc_length); |
72 // Create a relocation writer to write the comments in the padding | 72 // Create a relocation writer to write the comments in the padding |
73 // space. Use position 0 for everything to ensure short encoding. | 73 // space. Use position 0 for everything to ensure short encoding. |
74 RelocInfoWriter reloc_info_writer( | 74 RelocInfoWriter reloc_info_writer( |
75 new_reloc->GetDataStartAddress() + padding, 0); | 75 new_reloc->GetDataStartAddress() + padding, 0); |
76 intptr_t comment_string | 76 intptr_t comment_string |
77 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); | 77 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); |
78 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); | 78 RelocInfo rinfo(isolate, 0, RelocInfo::COMMENT, comment_string, NULL); |
79 for (int i = 0; i < additional_comments; ++i) { | 79 for (int i = 0; i < additional_comments; ++i) { |
80 #ifdef DEBUG | 80 #ifdef DEBUG |
81 byte* pos_before = reloc_info_writer.pos(); | 81 byte* pos_before = reloc_info_writer.pos(); |
82 #endif | 82 #endif |
83 reloc_info_writer.Write(&rinfo); | 83 reloc_info_writer.Write(&rinfo); |
84 DCHECK(RelocInfo::kMinRelocCommentSize == | 84 DCHECK(RelocInfo::kMinRelocCommentSize == |
85 pos_before - reloc_info_writer.pos()); | 85 pos_before - reloc_info_writer.pos()); |
86 } | 86 } |
87 // Replace relocation information on the code object. | 87 // Replace relocation information on the code object. |
88 code->set_relocation_info(*new_reloc); | 88 code->set_relocation_info(*new_reloc); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // For each LLazyBailout instruction insert a call to the corresponding | 135 // For each LLazyBailout instruction insert a call to the corresponding |
136 // deoptimization entry. | 136 // deoptimization entry. |
137 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 137 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
138 if (deopt_data->Pc(i)->value() == -1) continue; | 138 if (deopt_data->Pc(i)->value() == -1) continue; |
139 // Patch lazy deoptimization entry. | 139 // Patch lazy deoptimization entry. |
140 Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 140 Address call_address = code_start_address + deopt_data->Pc(i)->value(); |
141 CodePatcher patcher(isolate, call_address, patch_size()); | 141 CodePatcher patcher(isolate, call_address, patch_size()); |
142 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 142 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |
143 patcher.masm()->call(deopt_entry, RelocInfo::NONE32); | 143 patcher.masm()->call(deopt_entry, RelocInfo::NONE32); |
144 // We use RUNTIME_ENTRY for deoptimization bailouts. | 144 // We use RUNTIME_ENTRY for deoptimization bailouts. |
145 RelocInfo rinfo(call_address + 1, // 1 after the call opcode. | 145 RelocInfo rinfo(isolate, call_address + 1, // 1 after the call opcode. |
146 RelocInfo::RUNTIME_ENTRY, | 146 RelocInfo::RUNTIME_ENTRY, |
147 reinterpret_cast<intptr_t>(deopt_entry), | 147 reinterpret_cast<intptr_t>(deopt_entry), NULL); |
148 NULL); | |
149 reloc_info_writer.Write(&rinfo); | 148 reloc_info_writer.Write(&rinfo); |
150 DCHECK_GE(reloc_info_writer.pos(), | 149 DCHECK_GE(reloc_info_writer.pos(), |
151 reloc_info->address() + ByteArray::kHeaderSize); | 150 reloc_info->address() + ByteArray::kHeaderSize); |
152 DCHECK(prev_call_address == NULL || | 151 DCHECK(prev_call_address == NULL || |
153 call_address >= prev_call_address + patch_size()); | 152 call_address >= prev_call_address + patch_size()); |
154 DCHECK(call_address + patch_size() <= code->instruction_end()); | 153 DCHECK(call_address + patch_size() <= code->instruction_end()); |
155 #ifdef DEBUG | 154 #ifdef DEBUG |
156 prev_call_address = call_address; | 155 prev_call_address = call_address; |
157 #endif | 156 #endif |
158 } | 157 } |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 469 } |
471 | 470 |
472 | 471 |
473 #undef __ | 472 #undef __ |
474 | 473 |
475 | 474 |
476 } // namespace internal | 475 } // namespace internal |
477 } // namespace v8 | 476 } // namespace v8 |
478 | 477 |
479 #endif // V8_TARGET_ARCH_X87 | 478 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |