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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 if (shared->code() == *code) { | 870 if (shared->code() == *code) { |
871 // Do not send compilation event for the same code twice. | 871 // Do not send compilation event for the same code twice. |
872 return; | 872 return; |
873 } | 873 } |
874 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); | 874 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); |
875 } | 875 } |
876 | 876 |
877 | 877 |
878 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { | 878 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
879 Handle<Code> code = info->code(); | 879 Handle<Code> code = info->code(); |
880 if (FLAG_cache_optimized_code && | 880 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. |
881 info->osr_ast_id().IsNone() && | 881 |
882 code->kind() == Code::OPTIMIZED_FUNCTION) { | 882 // The native context has a weak list of all optimized code. |
883 info->context()->native_context()->AddOptimizedCode(*code); | |
Michael Starzinger
2013/09/03 21:52:31
This is a bad choking point to add code to the wea
titzer
2013/09/04 11:19:04
I've moved it out to the point that the optimized
| |
884 | |
885 // Cache non-OSR optimized code. | |
886 if (FLAG_cache_optimized_code && info->osr_ast_id().IsNone()) { | |
883 Handle<JSFunction> function = info->closure(); | 887 Handle<JSFunction> function = info->closure(); |
884 Handle<SharedFunctionInfo> shared(function->shared()); | 888 Handle<SharedFunctionInfo> shared(function->shared()); |
885 Handle<FixedArray> literals(function->literals()); | 889 Handle<FixedArray> literals(function->literals()); |
886 Handle<Context> native_context(function->context()->native_context()); | 890 Handle<Context> native_context(function->context()->native_context()); |
887 SharedFunctionInfo::AddToOptimizedCodeMap( | 891 SharedFunctionInfo::AddToOptimizedCodeMap( |
888 shared, native_context, code, literals); | 892 shared, native_context, code, literals); |
889 } | 893 } |
890 } | 894 } |
891 | 895 |
892 | 896 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1265 AllowHandleDereference allow_deref; | 1269 AllowHandleDereference allow_deref; |
1266 bool tracing_on = info()->IsStub() | 1270 bool tracing_on = info()->IsStub() |
1267 ? FLAG_trace_hydrogen_stubs | 1271 ? FLAG_trace_hydrogen_stubs |
1268 : (FLAG_trace_hydrogen && | 1272 : (FLAG_trace_hydrogen && |
1269 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1273 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1270 return (tracing_on && | 1274 return (tracing_on && |
1271 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1275 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1272 } | 1276 } |
1273 | 1277 |
1274 } } // namespace v8::internal | 1278 } } // namespace v8::internal |
OLD | NEW |