OLD | NEW |
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 info->SetCode(code); | 208 info->SetCode(code); |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 // Limit the number of times we re-compile a functions with | 212 // Limit the number of times we re-compile a functions with |
213 // the optimizing compiler. | 213 // the optimizing compiler. |
214 const int kMaxOptCount = | 214 const int kMaxOptCount = |
215 FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; | 215 FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; |
216 if (info->shared_info()->opt_count() > kMaxOptCount) { | 216 if (info->shared_info()->opt_count() > kMaxOptCount) { |
217 info->AbortOptimization(); | 217 info->AbortOptimization(); |
218 Handle<JSFunction> closure = info->closure(); | |
219 info->shared_info()->DisableOptimization(); | 218 info->shared_info()->DisableOptimization(); |
220 // True indicates the compilation pipeline is still going, not | 219 // True indicates the compilation pipeline is still going, not |
221 // necessarily that we optimized the code. | 220 // necessarily that we optimized the code. |
222 return true; | 221 return true; |
223 } | 222 } |
224 | 223 |
225 // Due to an encoding limit on LUnallocated operands in the Lithium | 224 // Due to an encoding limit on LUnallocated operands in the Lithium |
226 // language, we cannot optimize functions with too many formal parameters | 225 // language, we cannot optimize functions with too many formal parameters |
227 // or perform on-stack replacement for function with too many | 226 // or perform on-stack replacement for function with too many |
228 // stack-allocated local variables. | 227 // stack-allocated local variables. |
229 // | 228 // |
230 // The encoding is as a signed value, with parameters and receiver using | 229 // The encoding is as a signed value, with parameters and receiver using |
231 // the negative indices and locals the non-negative ones. | 230 // the negative indices and locals the non-negative ones. |
232 const int parameter_limit = -LUnallocated::kMinFixedIndex; | 231 const int parameter_limit = -LUnallocated::kMinFixedIndex; |
233 const int locals_limit = LUnallocated::kMaxFixedIndex; | 232 const int locals_limit = LUnallocated::kMaxFixedIndex; |
234 Scope* scope = info->scope(); | 233 Scope* scope = info->scope(); |
235 if ((scope->num_parameters() + 1) > parameter_limit || | 234 if ((scope->num_parameters() + 1) > parameter_limit || |
236 (info->osr_ast_id() != AstNode::kNoNumber && | 235 (info->osr_ast_id() != AstNode::kNoNumber && |
237 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit)) { | 236 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit)) { |
238 info->AbortOptimization(); | 237 info->AbortOptimization(); |
239 Handle<JSFunction> closure = info->closure(); | |
240 info->shared_info()->DisableOptimization(); | 238 info->shared_info()->DisableOptimization(); |
241 // True indicates the compilation pipeline is still going, not | 239 // True indicates the compilation pipeline is still going, not |
242 // necessarily that we optimized the code. | 240 // necessarily that we optimized the code. |
243 return true; | 241 return true; |
244 } | 242 } |
245 | 243 |
246 // Take --hydrogen-filter into account. | 244 // Take --hydrogen-filter into account. |
247 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); | 245 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); |
248 Handle<String> name = info->function()->debug_name(); | 246 Handle<String> name = info->function()->debug_name(); |
249 bool match = filter.is_empty() || name->IsEqualTo(filter); | 247 bool match = filter.is_empty() || name->IsEqualTo(filter); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 FinishOptimization(info->closure(), start); | 306 FinishOptimization(info->closure(), start); |
309 return true; | 307 return true; |
310 } | 308 } |
311 } | 309 } |
312 | 310 |
313 // Keep using the shared code. | 311 // Keep using the shared code. |
314 info->AbortOptimization(); | 312 info->AbortOptimization(); |
315 if (!builder.inline_bailout()) { | 313 if (!builder.inline_bailout()) { |
316 // Mark the shared code as unoptimizable unless it was an inlined | 314 // Mark the shared code as unoptimizable unless it was an inlined |
317 // function that bailed out. | 315 // function that bailed out. |
318 Handle<JSFunction> closure = info->closure(); | |
319 info->shared_info()->DisableOptimization(); | 316 info->shared_info()->DisableOptimization(); |
320 } | 317 } |
321 // True indicates the compilation pipeline is still going, not necessarily | 318 // True indicates the compilation pipeline is still going, not necessarily |
322 // that we optimized the code. | 319 // that we optimized the code. |
323 return true; | 320 return true; |
324 } | 321 } |
325 | 322 |
326 | 323 |
327 static bool GenerateCode(CompilationInfo* info) { | 324 static bool GenerateCode(CompilationInfo* info) { |
328 return info->IsCompilingForDebugging() || !V8::UseCrankshaft() ? | 325 return info->IsCompilingForDebugging() || !V8::UseCrankshaft() ? |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 806 } |
810 } | 807 } |
811 | 808 |
812 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 809 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
813 Handle<Script>(info->script()), | 810 Handle<Script>(info->script()), |
814 Handle<Code>(info->code()), | 811 Handle<Code>(info->code()), |
815 info)); | 812 info)); |
816 } | 813 } |
817 | 814 |
818 } } // namespace v8::internal | 815 } } // namespace v8::internal |
OLD | NEW |