Chromium Code Reviews| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 compiled_functions, | 161 compiled_functions, |
| 162 code_size, | 162 code_size, |
| 163 compilation_time); | 163 compilation_time); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 static bool MakeCrankshaftCode(CompilationInfo* info) { | 168 static bool MakeCrankshaftCode(CompilationInfo* info) { |
| 169 // Test if we can optimize this function when asked to. We can only | 169 // Test if we can optimize this function when asked to. We can only |
| 170 // do this after the scopes are computed. | 170 // do this after the scopes are computed. |
| 171 if (!info->AllowOptimize()) info->DisableOptimization(); | 171 if (!info->AllowOptimize()) { |
| 172 info->DisableOptimization(); | |
| 173 } else if (info->IsOptimizable()) { | |
| 174 info->EnableDeoptimizationSupport(); | |
| 175 } | |
| 172 | 176 |
| 173 // In case we are not optimizing simply return the code from | 177 // In case we are not optimizing simply return the code from |
| 174 // the full code generator. | 178 // the full code generator. |
| 175 if (!info->IsOptimizing()) { | 179 if (!info->IsOptimizing()) { |
| 176 return FullCodeGenerator::MakeCode(info); | 180 return FullCodeGenerator::MakeCode(info); |
| 177 } | 181 } |
| 178 | 182 |
| 179 // We should never arrive here if there is not code object on the | 183 // We should never arrive here if there is not code object on the |
| 180 // shared function object. | 184 // shared function object. |
| 181 Handle<Code> code(info->shared_info()->code()); | 185 Handle<Code> code(info->shared_info()->code()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 if (!match) { | 238 if (!match) { |
| 235 info->SetCode(code); | 239 info->SetCode(code); |
| 236 return true; | 240 return true; |
| 237 } | 241 } |
| 238 | 242 |
| 239 // Recompile the unoptimized version of the code if the current version | 243 // Recompile the unoptimized version of the code if the current version |
| 240 // doesn't have deoptimization support. Alternatively, we may decide to | 244 // doesn't have deoptimization support. Alternatively, we may decide to |
| 241 // run the full code generator to get a baseline for the compile-time | 245 // run the full code generator to get a baseline for the compile-time |
| 242 // performance of the hydrogen-based compiler. | 246 // performance of the hydrogen-based compiler. |
| 243 int64_t start = OS::Ticks(); | 247 int64_t start = OS::Ticks(); |
| 244 bool should_recompile = !info->shared_info()->has_deoptimization_support(); | 248 bool should_recompile = !info->shared_info()->has_deoptimization_support(); |
|
Kevin Millikin (Chromium)
2011/11/21 13:47:25
So is all this dead code now? Can we just assert
Rico
2011/11/21 14:00:12
I think that we can get in here if we had a functi
| |
| 245 if (should_recompile || FLAG_hydrogen_stats) { | 249 if (should_recompile || FLAG_hydrogen_stats) { |
| 246 HPhase phase(HPhase::kFullCodeGen); | 250 HPhase phase(HPhase::kFullCodeGen); |
| 247 CompilationInfo unoptimized(info->shared_info()); | 251 CompilationInfo unoptimized(info->shared_info()); |
| 248 // Note that we use the same AST that we will use for generating the | 252 // Note that we use the same AST that we will use for generating the |
| 249 // optimized code. | 253 // optimized code. |
| 250 unoptimized.SetFunction(info->function()); | 254 unoptimized.SetFunction(info->function()); |
| 251 unoptimized.SetScope(info->scope()); | 255 unoptimized.SetScope(info->scope()); |
| 252 if (should_recompile) unoptimized.EnableDeoptimizationSupport(); | 256 if (should_recompile) unoptimized.EnableDeoptimizationSupport(); |
| 253 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized); | 257 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized); |
| 254 if (should_recompile) { | 258 if (should_recompile) { |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 } | 796 } |
| 793 } | 797 } |
| 794 | 798 |
| 795 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 799 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 796 Handle<Script>(info->script()), | 800 Handle<Script>(info->script()), |
| 797 Handle<Code>(info->code()), | 801 Handle<Code>(info->code()), |
| 798 info)); | 802 info)); |
| 799 } | 803 } |
| 800 | 804 |
| 801 } } // namespace v8::internal | 805 } } // namespace v8::internal |
| OLD | NEW |