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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/debug-ia32.cc ('k') | src/ia32/disasm-ia32.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 pos_before - reloc_info_writer.pos()); 109 pos_before - reloc_info_writer.pos());
110 } 110 }
111 // Replace relocation information on the code object. 111 // Replace relocation information on the code object.
112 code->set_relocation_info(*new_reloc); 112 code->set_relocation_info(*new_reloc);
113 } 113 }
114 } 114 }
115 115
116 116
117 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { 117 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) {
118 Address code_start_address = code->instruction_start(); 118 Address code_start_address = code->instruction_start();
119
120 if (FLAG_zap_code_space) {
121 // Fail hard and early if we enter this code object again.
122 byte* pointer = code->FindCodeAgeSequence();
123 if (pointer != NULL) {
124 pointer += kNoCodeAgeSequenceLength;
125 } else {
126 pointer = code->instruction_start();
127 }
128 CodePatcher patcher(pointer, 1);
129 patcher.masm()->int3();
130
131 DeoptimizationInputData* data =
132 DeoptimizationInputData::cast(code->deoptimization_data());
133 int osr_offset = data->OsrPcOffset()->value();
134 if (osr_offset > 0) {
135 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1);
136 osr_patcher.masm()->int3();
137 }
138 }
139
119 // We will overwrite the code's relocation info in-place. Relocation info 140 // We will overwrite the code's relocation info in-place. Relocation info
120 // is written backward. The relocation info is the payload of a byte 141 // is written backward. The relocation info is the payload of a byte
121 // array. Later on we will slide this to the start of the byte array and 142 // array. Later on we will slide this to the start of the byte array and
122 // create a filler object in the remaining space. 143 // create a filler object in the remaining space.
123 ByteArray* reloc_info = code->relocation_info(); 144 ByteArray* reloc_info = code->relocation_info();
124 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); 145 Address reloc_end_address = reloc_info->address() + reloc_info->Size();
125 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); 146 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address);
126 147
127 // For each LLazyBailout instruction insert a call to the corresponding
128 // deoptimization entry.
129
130 // Since the call is a relative encoding, write new 148 // Since the call is a relative encoding, write new
131 // reloc info. We do not need any of the existing reloc info because the 149 // reloc info. We do not need any of the existing reloc info because the
132 // existing code will not be used again (we zap it in debug builds). 150 // existing code will not be used again (we zap it in debug builds).
133 // 151 //
134 // Emit call to lazy deoptimization at all lazy deopt points. 152 // Emit call to lazy deoptimization at all lazy deopt points.
135 DeoptimizationInputData* deopt_data = 153 DeoptimizationInputData* deopt_data =
136 DeoptimizationInputData::cast(code->deoptimization_data()); 154 DeoptimizationInputData::cast(code->deoptimization_data());
155 SharedFunctionInfo* shared =
156 SharedFunctionInfo::cast(deopt_data->SharedFunctionInfo());
157 shared->EvictFromOptimizedCodeMap(code, "deoptimized code");
137 #ifdef DEBUG 158 #ifdef DEBUG
138 Address prev_call_address = NULL; 159 Address prev_call_address = NULL;
139 #endif 160 #endif
161 // For each LLazyBailout instruction insert a call to the corresponding
162 // deoptimization entry.
140 for (int i = 0; i < deopt_data->DeoptCount(); i++) { 163 for (int i = 0; i < deopt_data->DeoptCount(); i++) {
141 if (deopt_data->Pc(i)->value() == -1) continue; 164 if (deopt_data->Pc(i)->value() == -1) continue;
142 // Patch lazy deoptimization entry. 165 // Patch lazy deoptimization entry.
143 Address call_address = code_start_address + deopt_data->Pc(i)->value(); 166 Address call_address = code_start_address + deopt_data->Pc(i)->value();
144 CodePatcher patcher(call_address, patch_size()); 167 CodePatcher patcher(call_address, patch_size());
145 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); 168 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY);
146 patcher.masm()->call(deopt_entry, RelocInfo::NONE32); 169 patcher.masm()->call(deopt_entry, RelocInfo::NONE32);
147 // We use RUNTIME_ENTRY for deoptimization bailouts. 170 // We use RUNTIME_ENTRY for deoptimization bailouts.
148 RelocInfo rinfo(call_address + 1, // 1 after the call opcode. 171 RelocInfo rinfo(call_address + 1, // 1 after the call opcode.
149 RelocInfo::RUNTIME_ENTRY, 172 RelocInfo::RUNTIME_ENTRY,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 SetFrameSlot(offset, value); 462 SetFrameSlot(offset, value);
440 } 463 }
441 464
442 465
443 #undef __ 466 #undef __
444 467
445 468
446 } } // namespace v8::internal 469 } } // namespace v8::internal
447 470
448 #endif // V8_TARGET_ARCH_IA32 471 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/debug-ia32.cc ('k') | src/ia32/disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698