OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 static_cast<GapInstruction::InnerPosition>(i); | 167 static_cast<GapInstruction::InnerPosition>(i); |
168 ParallelMove* move = instr->GetParallelMove(inner_pos); | 168 ParallelMove* move = instr->GetParallelMove(inner_pos); |
169 if (move != NULL) resolver()->Resolve(move); | 169 if (move != NULL) resolver()->Resolve(move); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { | 174 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { |
175 CompilationInfo* info = linkage()->info(); | 175 CompilationInfo* info = linkage()->info(); |
176 int deopt_count = code()->GetDeoptimizationEntryCount(); | 176 int deopt_count = code()->GetDeoptimizationEntryCount(); |
177 int patch_count = lazy_deoptimization_entries_.size(); | 177 int patch_count = static_cast<int>(lazy_deoptimization_entries_.size()); |
178 if (patch_count == 0 && deopt_count == 0) return; | 178 if (patch_count == 0 && deopt_count == 0) return; |
179 Handle<DeoptimizationInputData> data = DeoptimizationInputData::New( | 179 Handle<DeoptimizationInputData> data = DeoptimizationInputData::New( |
180 isolate(), deopt_count, patch_count, TENURED); | 180 isolate(), deopt_count, patch_count, TENURED); |
181 | 181 |
182 Handle<ByteArray> translation_array = | 182 Handle<ByteArray> translation_array = |
183 translations_.CreateByteArray(isolate()->factory()); | 183 translations_.CreateByteArray(isolate()->factory()); |
184 | 184 |
185 data->SetTranslationByteArray(*translation_array); | 185 data->SetTranslationByteArray(*translation_array); |
186 data->SetInlinedFunctionCount(Smi::FromInt(0)); | 186 data->SetInlinedFunctionCount(Smi::FromInt(0)); |
187 data->SetOptimizationId(Smi::FromInt(info->optimization_id())); | 187 data->SetOptimizationId(Smi::FromInt(info->optimization_id())); |
188 // TODO(jarin) The following code was copied over from Lithium, not sure | 188 // TODO(jarin) The following code was copied over from Lithium, not sure |
189 // whether the scope or the IsOptimizing condition are really needed. | 189 // whether the scope or the IsOptimizing condition are really needed. |
190 if (info->IsOptimizing()) { | 190 if (info->IsOptimizing()) { |
191 // Reference to shared function info does not change between phases. | 191 // Reference to shared function info does not change between phases. |
192 AllowDeferredHandleDereference allow_handle_dereference; | 192 AllowDeferredHandleDereference allow_handle_dereference; |
193 data->SetSharedFunctionInfo(*info->shared_info()); | 193 data->SetSharedFunctionInfo(*info->shared_info()); |
194 } else { | 194 } else { |
195 data->SetSharedFunctionInfo(Smi::FromInt(0)); | 195 data->SetSharedFunctionInfo(Smi::FromInt(0)); |
196 } | 196 } |
197 | 197 |
198 Handle<FixedArray> literals = isolate()->factory()->NewFixedArray( | 198 Handle<FixedArray> literals = isolate()->factory()->NewFixedArray( |
199 deoptimization_literals_.size(), TENURED); | 199 static_cast<int>(deoptimization_literals_.size()), TENURED); |
200 { | 200 { |
201 AllowDeferredHandleDereference copy_handles; | 201 AllowDeferredHandleDereference copy_handles; |
202 for (unsigned i = 0; i < deoptimization_literals_.size(); i++) { | 202 for (unsigned i = 0; i < deoptimization_literals_.size(); i++) { |
203 literals->set(i, *deoptimization_literals_[i]); | 203 literals->set(i, *deoptimization_literals_[i]); |
204 } | 204 } |
205 data->SetLiteralArray(*literals); | 205 data->SetLiteralArray(*literals); |
206 } | 206 } |
207 | 207 |
208 // No OSR in Turbofan yet... | 208 // No OSR in Turbofan yet... |
209 BailoutId osr_ast_id = BailoutId::None(); | 209 BailoutId osr_ast_id = BailoutId::None(); |
(...skipping 23 matching lines...) Expand all Loading... |
233 } | 233 } |
234 | 234 |
235 | 235 |
236 void CodeGenerator::RecordLazyDeoptimizationEntry(Instruction* instr) { | 236 void CodeGenerator::RecordLazyDeoptimizationEntry(Instruction* instr) { |
237 InstructionOperandConverter i(this, instr); | 237 InstructionOperandConverter i(this, instr); |
238 | 238 |
239 Label after_call; | 239 Label after_call; |
240 masm()->bind(&after_call); | 240 masm()->bind(&after_call); |
241 | 241 |
242 // The continuation and deoptimization are the last two inputs: | 242 // The continuation and deoptimization are the last two inputs: |
243 BasicBlock* cont_block = i.InputBlock(instr->InputCount() - 2); | 243 BasicBlock* cont_block = |
244 BasicBlock* deopt_block = i.InputBlock(instr->InputCount() - 1); | 244 i.InputBlock(static_cast<int>(instr->InputCount()) - 2); |
| 245 BasicBlock* deopt_block = |
| 246 i.InputBlock(static_cast<int>(instr->InputCount()) - 1); |
245 | 247 |
246 Label* cont_label = code_->GetLabel(cont_block); | 248 Label* cont_label = code_->GetLabel(cont_block); |
247 Label* deopt_label = code_->GetLabel(deopt_block); | 249 Label* deopt_label = code_->GetLabel(deopt_block); |
248 | 250 |
249 lazy_deoptimization_entries_.push_back( | 251 lazy_deoptimization_entries_.push_back( |
250 LazyDeoptimizationEntry(after_call.pos(), cont_label, deopt_label)); | 252 LazyDeoptimizationEntry(after_call.pos(), cont_label, deopt_label)); |
251 } | 253 } |
252 | 254 |
253 | 255 |
254 int CodeGenerator::DefineDeoptimizationLiteral(Handle<Object> literal) { | 256 int CodeGenerator::DefineDeoptimizationLiteral(Handle<Object> literal) { |
255 int result = deoptimization_literals_.size(); | 257 int result = static_cast<int>(deoptimization_literals_.size()); |
256 for (unsigned i = 0; i < deoptimization_literals_.size(); ++i) { | 258 for (unsigned i = 0; i < deoptimization_literals_.size(); ++i) { |
257 if (deoptimization_literals_[i].is_identical_to(literal)) return i; | 259 if (deoptimization_literals_[i].is_identical_to(literal)) return i; |
258 } | 260 } |
259 deoptimization_literals_.push_back(literal); | 261 deoptimization_literals_.push_back(literal); |
260 return result; | 262 return result; |
261 } | 263 } |
262 | 264 |
263 | 265 |
264 void CodeGenerator::BuildTranslation(Instruction* instr, | 266 void CodeGenerator::BuildTranslation(Instruction* instr, |
265 int deoptimization_id) { | 267 int deoptimization_id) { |
(...skipping 13 matching lines...) Expand all Loading... |
279 DefineDeoptimizationLiteral(isolate()->factory()->undefined_value()); | 281 DefineDeoptimizationLiteral(isolate()->factory()->undefined_value()); |
280 translation.StoreLiteral(undefined_literal_id); | 282 translation.StoreLiteral(undefined_literal_id); |
281 | 283 |
282 deoptimization_states_[deoptimization_id] = | 284 deoptimization_states_[deoptimization_id] = |
283 new (zone()) DeoptimizationState(translation.index()); | 285 new (zone()) DeoptimizationState(translation.index()); |
284 } | 286 } |
285 | 287 |
286 } // namespace compiler | 288 } // namespace compiler |
287 } // namespace internal | 289 } // namespace internal |
288 } // namespace v8 | 290 } // namespace v8 |
OLD | NEW |