OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Handle<Code> code(info->shared_info()->code()); | 187 Handle<Code> code(info->shared_info()->code()); |
188 ASSERT(code->kind() == Code::FUNCTION); | 188 ASSERT(code->kind() == Code::FUNCTION); |
189 | 189 |
190 // We should never arrive here if optimization has been disabled on the | 190 // We should never arrive here if optimization has been disabled on the |
191 // shared function info. | 191 // shared function info. |
192 ASSERT(!info->shared_info()->optimization_disabled()); | 192 ASSERT(!info->shared_info()->optimization_disabled()); |
193 | 193 |
194 // Fall back to using the full code generator if it's not possible | 194 // Fall back to using the full code generator if it's not possible |
195 // to use the Hydrogen-based optimizing compiler. We already have | 195 // to use the Hydrogen-based optimizing compiler. We already have |
196 // generated code for this from the shared function object. | 196 // generated code for this from the shared function object. |
197 if (AlwaysFullCompiler() || !FLAG_use_hydrogen) { | 197 if (AlwaysFullCompiler()) { |
198 info->SetCode(code); | 198 info->SetCode(code); |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 // Limit the number of times we re-compile a functions with | 202 // Limit the number of times we re-compile a functions with |
203 // the optimizing compiler. | 203 // the optimizing compiler. |
204 const int kMaxOptCount = | 204 const int kMaxOptCount = |
205 FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; | 205 FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; |
206 if (info->shared_info()->opt_count() > kMaxOptCount) { | 206 if (info->shared_info()->opt_count() > kMaxOptCount) { |
207 info->AbortOptimization(); | 207 info->AbortOptimization(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 Handle<Context> global_context(info->closure()->context()->global_context()); | 284 Handle<Context> global_context(info->closure()->context()->global_context()); |
285 TypeFeedbackOracle oracle(code, global_context, info->isolate()); | 285 TypeFeedbackOracle oracle(code, global_context, info->isolate()); |
286 HGraphBuilder builder(info, &oracle); | 286 HGraphBuilder builder(info, &oracle); |
287 HPhase phase(HPhase::kTotal); | 287 HPhase phase(HPhase::kTotal); |
288 HGraph* graph = builder.CreateGraph(); | 288 HGraph* graph = builder.CreateGraph(); |
289 if (info->isolate()->has_pending_exception()) { | 289 if (info->isolate()->has_pending_exception()) { |
290 info->SetCode(Handle<Code>::null()); | 290 info->SetCode(Handle<Code>::null()); |
291 return false; | 291 return false; |
292 } | 292 } |
293 | 293 |
294 if (graph != NULL && FLAG_build_lithium) { | 294 if (graph != NULL) { |
295 Handle<Code> optimized_code = graph->Compile(info); | 295 Handle<Code> optimized_code = graph->Compile(info); |
296 if (!optimized_code.is_null()) { | 296 if (!optimized_code.is_null()) { |
297 info->SetCode(optimized_code); | 297 info->SetCode(optimized_code); |
298 FinishOptimization(info->closure(), start); | 298 FinishOptimization(info->closure(), start); |
299 return true; | 299 return true; |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 // Keep using the shared code. | 303 // Keep using the shared code. |
304 info->AbortOptimization(); | 304 info->AbortOptimization(); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 789 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
790 Handle<Script>(info->script()), | 790 Handle<Script>(info->script()), |
791 Handle<Code>(info->code()), | 791 Handle<Code>(info->code()), |
792 info)); | 792 info)); |
793 } | 793 } |
794 | 794 |
795 } } // namespace v8::internal | 795 } } // namespace v8::internal |
OLD | NEW |