OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 Loading... |
109 } | 109 } |
110 #else | 110 #else |
111 return FLAG_always_full_compiler; | 111 return FLAG_always_full_compiler; |
112 #endif | 112 #endif |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { | 116 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { |
117 int opt_count = function->shared()->opt_count(); | 117 int opt_count = function->shared()->opt_count(); |
118 function->shared()->set_opt_count(opt_count + 1); | 118 function->shared()->set_opt_count(opt_count + 1); |
119 if (!FLAG_trace_opt) return; | 119 double ms = static_cast<double>(OS::Ticks() - start) / 1000; |
| 120 if (FLAG_trace_opt) { |
| 121 PrintF("[optimizing: "); |
| 122 function->PrintName(); |
| 123 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); |
| 124 PrintF(" - took %0.3f ms]\n", ms); |
| 125 } |
| 126 if (FLAG_trace_opt_stats) { |
| 127 static double compilation_time = 0.0; |
| 128 static int compiled_functions = 0; |
| 129 static int code_size = 0; |
120 | 130 |
121 double ms = static_cast<double>(OS::Ticks() - start) / 1000; | 131 compilation_time += ms; |
122 PrintF("[optimizing: "); | 132 compiled_functions++; |
123 function->PrintName(); | 133 code_size += function->shared()->SourceSize(); |
124 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); | 134 PrintF("Compiled: %d functions with %d byte source size in %fms.\n", |
125 PrintF(" - took %0.3f ms]\n", ms); | 135 compiled_functions, |
| 136 code_size, |
| 137 compilation_time); |
| 138 } |
126 } | 139 } |
127 | 140 |
128 | 141 |
129 static void AbortAndDisable(CompilationInfo* info) { | 142 static void AbortAndDisable(CompilationInfo* info) { |
130 // Disable optimization for the shared function info and mark the | 143 // Disable optimization for the shared function info and mark the |
131 // code as non-optimizable. The marker on the shared function info | 144 // code as non-optimizable. The marker on the shared function info |
132 // is there because we flush non-optimized code thereby loosing the | 145 // is there because we flush non-optimized code thereby loosing the |
133 // non-optimizable information for the code. When the code is | 146 // non-optimizable information for the code. When the code is |
134 // regenerated and set on the shared function info it is marked as | 147 // regenerated and set on the shared function info it is marked as |
135 // non-optimizable if optimization is disabled for the shared | 148 // non-optimizable if optimization is disabled for the shared |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 *code, | 768 *code, |
756 *name)); | 769 *name)); |
757 OPROFILE(CreateNativeCodeRegion(*name, | 770 OPROFILE(CreateNativeCodeRegion(*name, |
758 code->instruction_start(), | 771 code->instruction_start(), |
759 code->instruction_size())); | 772 code->instruction_size())); |
760 } | 773 } |
761 } | 774 } |
762 } | 775 } |
763 | 776 |
764 } } // namespace v8::internal | 777 } } // namespace v8::internal |
OLD | NEW |