@@ -157,11 +157,23 @@ parser.add_option("--enable-vtune-profiling",
157
157
" JavaScript code executed in nodejs. This feature is only available "
158
158
" for x32, x86, and x64 architectures." )
159
159
160
+ parser.add_option(" --enable-pgo-generate" ,
161
+ action=" store_true" ,
162
+ dest=" enable_pgo_generate" ,
163
+ help=" Enable profiling with pgo of a binary. This feature is only available "
164
+ " on linux with gcc and g++ 5.4.1 or newer." )
165
+
166
+ parser.add_option(" --enable-pgo-use" ,
167
+ action=" store_true" ,
168
+ dest=" enable_pgo_use" ,
169
+ help=" Enable use of the profile generated with --enable-pgo-generate. This "
170
+ " feature is only available on linux with gcc and g++ 5.4.1 or newer." )
171
+
160
172
parser.add_option(" --enable-lto" ,
161
173
action=" store_true" ,
162
174
dest=" enable_lto" ,
163
175
help=" Enable compiling with lto of a binary. This feature is only available "
164
- " on linux with gcc and g++." )
176
+ " on linux with gcc and g++ 5.4.1 or newer ." )
165
177
166
178
parser.add_option(" --link-module" ,
167
179
action=" append" ,
@@ -898,6 +910,16 @@ def configure_mips(o):
898
910
o[' variables' ][' mips_fpu_mode' ] = options.mips_fpu_mode
899
911
900
912
913
+ def gcc_version_ge(version_checked):
914
+ for compiler in [(CC, ' c' ), (CXX, ' c++' )]:
915
+ ok, is_clang, clang_version, compiler_version = \
916
+ try_check_compiler(compiler[0], compiler[1])
917
+ compiler_version_num = tuple(map(int, compiler_version))
918
+ if is_clang or compiler_version_num < version_checked:
919
+ return False
920
+ return True
921
+
922
+
901
923
def configure_node(o):
902
924
if options.dest_os == ' android' :
903
925
o[' variables' ][' OS' ] = ' android'
@@ -942,22 +964,41 @@ def configure_node(o):
942
964
else:
943
965
o[' variables' ][' node_enable_v8_vtunejit' ] = ' false'
944
966
967
+ if flavor ! = ' linux' and (options.enable_pgo_generate or options.enable_pgo_use):
968
+ raise Exception(
969
+ ' The pgo option is supported only on linux.' )
970
+
971
+ if flavor == ' linux' :
972
+ if options.enable_pgo_generate or options.enable_pgo_use:
973
+ version_checked = (5, 4, 1)
974
+ if not gcc_version_ge(version_checked):
975
+ version_checked_str = " ." .join(map(str, version_checked))
976
+ raise Exception(
977
+ ' The options --enable-pgo-generate and --enable-pgo-use '
978
+ ' are supported for gcc and gxx %s or newer only.' % (version_checked_str))
979
+
980
+ if options.enable_pgo_generate and options.enable_pgo_use:
981
+ raise Exception(
982
+ ' Only one of the --enable-pgo-generate or --enable-pgo-use options '
983
+ ' can be specified at a time. You would like to use '
984
+ ' --enable-pgo-generate first, profile node, and then recompile '
985
+ ' with --enable-pgo-use' )
986
+
987
+ o[' variables' ][' enable_pgo_generate' ] = b(options.enable_pgo_generate)
988
+ o[' variables' ][' enable_pgo_use' ] = b(options.enable_pgo_use)
989
+
945
990
if flavor ! = ' linux' and (options.enable_lto):
946
991
raise Exception(
947
992
' The lto option is supported only on linux.' )
948
993
949
994
if flavor == ' linux' :
950
995
if options.enable_lto:
951
996
version_checked = (5, 4, 1)
952
- for compiler in [(CC, ' c' ), (CXX, ' c++' )]:
953
- ok, is_clang, clang_version, compiler_version = \
954
- try_check_compiler(compiler[0], compiler[1])
955
- compiler_version_num = tuple(map(int, compiler_version))
956
- if is_clang or compiler_version_num < version_checked:
957
- version_checked_str = " ." .join(map(str, version_checked))
958
- raise Exception(
959
- ' The option --enable-lto is supported for gcc and gxx %s'
960
- ' or newer only.' % (version_checked_str))
997
+ if not gcc_version_ge(version_checked):
998
+ version_checked_str = " ." .join(map(str, version_checked))
999
+ raise Exception(
1000
+ ' The option --enable-lto is supported for gcc and gxx %s'
1001
+ ' or newer only.' % (version_checked_str))
961
1002
962
1003
o[' variables' ][' enable_lto' ] = b(options.enable_lto)
963
1004
0 commit comments