Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: SConstruct

Issue 652114: Add the ability to compile with profiler guided optimizations on Windows... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 'CCFLAGS': ['/O2'], 248 'CCFLAGS': ['/O2'],
249 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 249 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
250 'msvcrt:static': { 250 'msvcrt:static': {
251 'CCFLAGS': ['/MT'] 251 'CCFLAGS': ['/MT']
252 }, 252 },
253 'msvcrt:shared': { 253 'msvcrt:shared': {
254 'CCFLAGS': ['/MD'] 254 'CCFLAGS': ['/MD']
255 }, 255 },
256 'msvcltcg:on': { 256 'msvcltcg:on': {
257 'CCFLAGS': ['/GL'], 257 'CCFLAGS': ['/GL'],
258 'LINKFLAGS': ['/LTCG'],
259 'ARFLAGS': ['/LTCG'], 258 'ARFLAGS': ['/LTCG'],
259 'pgo:off': {
260 'LINKFLAGS': ['/LTCG'],
261 },
262 'pgo:instrument': {
263 'LINKFLAGS': ['/LTCG:PGI']
264 },
265 'pgo:optimize': {
266 'LINKFLAGS': ['/LTCG:PGO']
267 }
260 } 268 }
261 } 269 }
262 } 270 }
263 } 271 }
264 272
265 273
266 V8_EXTRA_FLAGS = { 274 V8_EXTRA_FLAGS = {
267 'gcc': { 275 'gcc': {
268 'all': { 276 'all': {
269 'WARNINGFLAGS': ['-Wall', 277 'WARNINGFLAGS': ['-Wall',
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 'CCFLAGS': ['/O2'], 528 'CCFLAGS': ['/O2'],
521 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 529 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
522 'msvcrt:static': { 530 'msvcrt:static': {
523 'CCFLAGS': ['/MT'] 531 'CCFLAGS': ['/MT']
524 }, 532 },
525 'msvcrt:shared': { 533 'msvcrt:shared': {
526 'CCFLAGS': ['/MD'] 534 'CCFLAGS': ['/MD']
527 }, 535 },
528 'msvcltcg:on': { 536 'msvcltcg:on': {
529 'CCFLAGS': ['/GL'], 537 'CCFLAGS': ['/GL'],
530 'LINKFLAGS': ['/LTCG'], 538 'pgo:off': {
539 'LINKFLAGS': ['/LTCG'],
540 },
541 },
542 'pgo:instrument': {
543 'LINKFLAGS': ['/LTCG:PGI']
544 },
545 'pgo:optimize': {
546 'LINKFLAGS': ['/LTCG:PGO']
531 } 547 }
532 }, 548 },
533 'arch:ia32': { 549 'arch:ia32': {
534 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], 550 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'],
535 'LINKFLAGS': ['/MACHINE:X86'] 551 'LINKFLAGS': ['/MACHINE:X86']
536 }, 552 },
537 'arch:x64': { 553 'arch:x64': {
538 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], 554 'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
539 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752'] 555 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752']
540 }, 556 },
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 }, 720 },
705 'visibility': { 721 'visibility': {
706 'values': ['default', 'hidden'], 722 'values': ['default', 'hidden'],
707 'default': 'hidden', 723 'default': 'hidden',
708 'help': 'shared library symbol visibility' 724 'help': 'shared library symbol visibility'
709 }, 725 },
710 'armvariant': { 726 'armvariant': {
711 'values': ['arm', 'thumb2', 'none'], 727 'values': ['arm', 'thumb2', 'none'],
712 'default': 'none', 728 'default': 'none',
713 'help': 'generate thumb2 instructions instead of arm instructions (default)' 729 'help': 'generate thumb2 instructions instead of arm instructions (default)'
730 },
731 'pgo': {
732 'values': ['off', 'instrument', 'optimize'],
733 'default': 'off',
734 'help': 'select profile guided optimization variant',
714 } 735 }
715 } 736 }
716 737
717 738
718 def GetOptions(): 739 def GetOptions():
719 result = Options() 740 result = Options()
720 result.Add('mode', 'compilation mode (debug, release)', 'release') 741 result.Add('mode', 'compilation mode (debug, release)', 'release')
721 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') 742 result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
722 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '') 743 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '')
723 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') 744 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 if not IsLegal(env, 'regexp', ["native", "interpreted"]): 812 if not IsLegal(env, 'regexp', ["native", "interpreted"]):
792 return False 813 return False
793 if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on' : 814 if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on' :
794 Abort("Profiling on windows only supported for static library.") 815 Abort("Profiling on windows only supported for static library.")
795 if env['prof'] == 'oprofile' and env['os'] != 'linux': 816 if env['prof'] == 'oprofile' and env['os'] != 'linux':
796 Abort("OProfile is only supported on Linux.") 817 Abort("OProfile is only supported on Linux.")
797 if env['os'] == 'win32' and env['soname'] == 'on': 818 if env['os'] == 'win32' and env['soname'] == 'on':
798 Abort("Shared Object soname not applicable for Windows.") 819 Abort("Shared Object soname not applicable for Windows.")
799 if env['soname'] == 'on' and env['library'] == 'static': 820 if env['soname'] == 'on' and env['library'] == 'static':
800 Abort("Shared Object soname not applicable for static library.") 821 Abort("Shared Object soname not applicable for static library.")
822 if env['os'] != 'win32' and env['pgo'] != 'off':
823 Abort("Profile guided optimization only supported on Windows.")
801 for (name, option) in SIMPLE_OPTIONS.iteritems(): 824 for (name, option) in SIMPLE_OPTIONS.iteritems():
802 if (not option.get('default')) and (name not in ARGUMENTS): 825 if (not option.get('default')) and (name not in ARGUMENTS):
803 message = ("A value for option %s must be specified (%s)." % 826 message = ("A value for option %s must be specified (%s)." %
804 (name, ", ".join(option['values']))) 827 (name, ", ".join(option['values'])))
805 Abort(message) 828 Abort(message)
806 if not env[name] in option['values']: 829 if not env[name] in option['values']:
807 message = ("Unknown %s value '%s'. Possible values are (%s)." % 830 message = ("Unknown %s value '%s'. Possible values are (%s)." %
808 (name, env[name], ", ".join(option['values']))) 831 (name, env[name], ", ".join(option['values'])))
809 Abort(message) 832 Abort(message)
810 833
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 899
877 def ApplyEnvOverrides(self, env): 900 def ApplyEnvOverrides(self, env):
878 if not self.env_overrides: 901 if not self.env_overrides:
879 return 902 return
880 if type(env['ENV']) == DictType: 903 if type(env['ENV']) == DictType:
881 env['ENV'].update(**self.env_overrides) 904 env['ENV'].update(**self.env_overrides)
882 else: 905 else:
883 env['ENV'] = self.env_overrides 906 env['ENV'] = self.env_overrides
884 907
885 908
886 def PostprocessOptions(options): 909 def PostprocessOptions(options, os):
887 # Adjust architecture if the simulator option has been set 910 # Adjust architecture if the simulator option has been set
888 if (options['simulator'] != 'none') and (options['arch'] != options['simulator ']): 911 if (options['simulator'] != 'none') and (options['arch'] != options['simulator ']):
889 if 'arch' in ARGUMENTS: 912 if 'arch' in ARGUMENTS:
890 # Print a warning if arch has explicitly been set 913 # Print a warning if arch has explicitly been set
891 print "Warning: forcing architecture to match simulator (%s)" % options['s imulator'] 914 print "Warning: forcing architecture to match simulator (%s)" % options['s imulator']
892 options['arch'] = options['simulator'] 915 options['arch'] = options['simulator']
893 if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): 916 if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'):
894 # Print a warning if profiling is enabled without profiling support 917 # Print a warning if profiling is enabled without profiling support
895 print "Warning: forcing profilingsupport on when prof is on" 918 print "Warning: forcing profilingsupport on when prof is on"
896 options['profilingsupport'] = 'on' 919 options['profilingsupport'] = 'on'
920 if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off':
921 if 'msvcltcg' in ARGUMENTS:
922 print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % opti ons['pgo']
923 options['msvcltcg'] = 'on'
897 if (options['armvariant'] == 'none' and options['arch'] == 'arm'): 924 if (options['armvariant'] == 'none' and options['arch'] == 'arm'):
898 options['armvariant'] = 'arm' 925 options['armvariant'] = 'arm'
899 if (options['armvariant'] != 'none' and options['arch'] != 'arm'): 926 if (options['armvariant'] != 'none' and options['arch'] != 'arm'):
900 options['armvariant'] = 'none' 927 options['armvariant'] = 'none'
901 if options['arch'] == 'mips': 928 if options['arch'] == 'mips':
902 if ('regexp' in ARGUMENTS) and options['regexp'] == 'native': 929 if ('regexp' in ARGUMENTS) and options['regexp'] == 'native':
903 # Print a warning if native regexp is specified for mips 930 # Print a warning if native regexp is specified for mips
904 print "Warning: forcing regexp to interpreted for mips" 931 print "Warning: forcing regexp to interpreted for mips"
905 options['regexp'] = 'interpreted' 932 options['regexp'] = 'interpreted'
906 933
(...skipping 10 matching lines...) Expand all
917 if pos == -1: 944 if pos == -1:
918 continue 945 continue
919 overrides[override[:pos].strip()] = override[pos+1:].strip() 946 overrides[override[:pos].strip()] = override[pos+1:].strip()
920 return overrides 947 return overrides
921 948
922 949
923 def BuildSpecific(env, mode, env_overrides): 950 def BuildSpecific(env, mode, env_overrides):
924 options = {'mode': mode} 951 options = {'mode': mode}
925 for option in SIMPLE_OPTIONS: 952 for option in SIMPLE_OPTIONS:
926 options[option] = env[option] 953 options[option] = env[option]
927 PostprocessOptions(options) 954 PostprocessOptions(options, env['os'])
928 955
929 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] )) 956 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] ))
930 957
931 # Remove variables which can't be imported from the user's external 958 # Remove variables which can't be imported from the user's external
932 # environment into a construction environment. 959 # environment into a construction environment.
933 user_environ = os.environ.copy() 960 user_environ = os.environ.copy()
934 try: 961 try:
935 del user_environ['ENV'] 962 del user_environ['ENV']
936 except KeyError: 963 except KeyError:
937 pass 964 pass
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 # version of scons. Also, there's a bug in some revisions that 1093 # version of scons. Also, there's a bug in some revisions that
1067 # doesn't allow this flag to be set, so we swallow any exceptions. 1094 # doesn't allow this flag to be set, so we swallow any exceptions.
1068 # Lovely. 1095 # Lovely.
1069 try: 1096 try:
1070 SetOption('warn', 'no-deprecated') 1097 SetOption('warn', 'no-deprecated')
1071 except: 1098 except:
1072 pass 1099 pass
1073 1100
1074 1101
1075 Build() 1102 Build()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698