OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 } | 403 } |
404 | 404 |
405 // Limit the number of times we try to optimize functions. | 405 // Limit the number of times we try to optimize functions. |
406 const int kMaxOptCount = | 406 const int kMaxOptCount = |
407 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 407 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
408 if (info()->opt_count() > kMaxOptCount) { | 408 if (info()->opt_count() > kMaxOptCount) { |
409 return AbortOptimization(kOptimizedTooManyTimes); | 409 return AbortOptimization(kOptimizedTooManyTimes); |
410 } | 410 } |
411 | 411 |
412 // Check the whitelist for Crankshaft. | 412 // Check the whitelist for Crankshaft. |
413 if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) { | 413 if (!info()->shared_info()->PassesFilter(FLAG_hydrogen_filter)) { |
414 return AbortOptimization(kHydrogenFilter); | 414 return AbortOptimization(kHydrogenFilter); |
415 } | 415 } |
416 | 416 |
417 // Optimization requires a version of fullcode with deoptimization support. | 417 // Optimization requires a version of fullcode with deoptimization support. |
418 // Recompile the unoptimized version of the code if the current version | 418 // Recompile the unoptimized version of the code if the current version |
419 // doesn't have deoptimization support already. | 419 // doesn't have deoptimization support already. |
420 // Otherwise, if we are gathering compilation time and space statistics | 420 // Otherwise, if we are gathering compilation time and space statistics |
421 // for hydrogen, gather baseline statistics for a fullcode compilation. | 421 // for hydrogen, gather baseline statistics for a fullcode compilation. |
422 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); | 422 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); |
423 if (should_recompile || FLAG_hydrogen_stats) { | 423 if (should_recompile || FLAG_hydrogen_stats) { |
(...skipping 20 matching lines...) Expand all Loading... | |
444 bool is_turbofanable_asm = FLAG_turbo_asm && | 444 bool is_turbofanable_asm = FLAG_turbo_asm && |
445 info()->shared_info()->asm_function() && | 445 info()->shared_info()->asm_function() && |
446 !optimization_disabled; | 446 !optimization_disabled; |
447 | 447 |
448 // 2. Fallback for features unsupported by Crankshaft. | 448 // 2. Fallback for features unsupported by Crankshaft. |
449 bool is_unsupported_by_crankshaft_but_turbofanable = | 449 bool is_unsupported_by_crankshaft_but_turbofanable = |
450 dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 && | 450 dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 && |
451 !optimization_disabled; | 451 !optimization_disabled; |
452 | 452 |
453 // 3. Explicitly enabled by the command-line filter. | 453 // 3. Explicitly enabled by the command-line filter. |
454 bool passes_turbo_filter = info()->closure()->PassesFilter(FLAG_turbo_filter); | 454 bool passes_turbo_filter = |
455 info()->shared_info()->PassesFilter(FLAG_turbo_filter); | |
455 | 456 |
456 // If this is OSR request, OSR must be enabled by Turbofan. | 457 // If this is OSR request, OSR must be enabled by Turbofan. |
457 bool passes_osr_test = FLAG_turbo_osr || !info()->is_osr(); | 458 bool passes_osr_test = FLAG_turbo_osr || !info()->is_osr(); |
458 | 459 |
459 if ((is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable || | 460 if ((is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable || |
460 passes_turbo_filter) && | 461 passes_turbo_filter) && |
461 passes_osr_test) { | 462 passes_osr_test) { |
462 // Use TurboFan for the compilation. | 463 // Use TurboFan for the compilation. |
463 if (FLAG_trace_opt) { | 464 if (FLAG_trace_opt) { |
464 OFStream os(stdout); | 465 OFStream os(stdout); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 return false; | 814 return false; |
814 } | 815 } |
815 | 816 |
816 // Checks whether top level functions should be passed by the filter. | 817 // Checks whether top level functions should be passed by the filter. |
817 if (info->closure().is_null()) { | 818 if (info->closure().is_null()) { |
818 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 819 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
819 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 820 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
820 } | 821 } |
821 | 822 |
822 // Finally respect the filter. | 823 // Finally respect the filter. |
823 return info->closure()->PassesFilter(FLAG_ignition_filter); | 824 return info->closure()->shared()->PassesFilter(FLAG_ignition_filter); |
Michael Starzinger
2016/03/22 09:06:31
Note that CompilationInfo::shared_info() cannot ye
Jakob Kummerow
2016/03/22 09:32:10
Acknowledged.
| |
824 } | 825 } |
825 | 826 |
826 int CodeAndMetadataSize(CompilationInfo* info) { | 827 int CodeAndMetadataSize(CompilationInfo* info) { |
827 int size = 0; | 828 int size = 0; |
828 if (info->has_bytecode_array()) { | 829 if (info->has_bytecode_array()) { |
829 Handle<BytecodeArray> bytecode_array = info->bytecode_array(); | 830 Handle<BytecodeArray> bytecode_array = info->bytecode_array(); |
830 size += bytecode_array->BytecodeArraySize(); | 831 size += bytecode_array->BytecodeArraySize(); |
831 size += bytecode_array->constant_pool()->Size(); | 832 size += bytecode_array->constant_pool()->Size(); |
832 size += bytecode_array->handler_table()->Size(); | 833 size += bytecode_array->handler_table()->Size(); |
833 size += bytecode_array->source_position_table()->Size(); | 834 size += bytecode_array->source_position_table()->Size(); |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1952 MaybeHandle<Code> code; | 1953 MaybeHandle<Code> code; |
1953 if (cached.code != nullptr) code = handle(cached.code); | 1954 if (cached.code != nullptr) code = handle(cached.code); |
1954 Handle<Context> native_context(function->context()->native_context()); | 1955 Handle<Context> native_context(function->context()->native_context()); |
1955 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1956 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1956 literals, BailoutId::None()); | 1957 literals, BailoutId::None()); |
1957 } | 1958 } |
1958 } | 1959 } |
1959 | 1960 |
1960 } // namespace internal | 1961 } // namespace internal |
1961 } // namespace v8 | 1962 } // namespace v8 |
OLD | NEW |