Improved handling of relocation information to enable more peep-hole optimizations.
Optimized switch statements where all labels are constant small integers.
Optimized String.prototype.indexOf for common cases.
Fixed more build issues (issue 80).
Fixed a couple of profiler issues.
Fixed bug where the body of a function created using the Function constructor was not allowed to end with a single-line comment (issue 85).
Improved handling of object literals by canonicalizing object literal maps. This will allow JSON objects with the same set of properties to share the same map making inline caching work better for JSON objects.
git-svn-id: http://v8.googlecode.com/svn/trunk@373 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/SConstruct b/SConstruct
index b6fc04f..52a1b2b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -30,7 +30,7 @@
import sys
import os
from os.path import join, dirname, abspath
-from types import DictType
+from types import DictType, StringTypes
root_dir = dirname(File('SConstruct').rfile().abspath)
sys.path.append(join(root_dir, 'tools'))
import js2c, utils
@@ -77,7 +77,7 @@
'LINKFLAGS': ['/DEBUG']
},
'mode:release': {
- 'CCFLAGS': ['/Ox', '/MT', '/Ob2', '/Oi', '/Oy'],
+ 'CCFLAGS': ['/Ox', '/MT', '/GF'],
'LINKFLAGS': ['/OPT:REF', '/OPT:ICF']
}
}
@@ -138,7 +138,7 @@
'gcc': {
'all': {
'WARNINGFLAGS': ['-Werror']
- }
+ }
},
'msvc': {
'all': {
@@ -187,6 +187,9 @@
'CCFLAGS': ['-m32'],
'LINKFLAGS': ['-m32']
},
+ 'mode:release': {
+ 'CCFLAGS': ['-O2']
+ },
'mode:debug': {
'CCFLAGS': ['-g', '-O0']
}
@@ -198,11 +201,16 @@
'library:shared': {
'CPPDEFINES': ['USING_V8_SHARED']
},
+ 'prof:on': {
+ 'LINKFLAGS': ['/MAP']
+ },
'mode:release': {
- 'CCFLAGS': ['/MT'],
+ 'CCFLAGS': ['/Ox', '/MT', '/GF'],
+ 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF']
},
'mode:debug': {
- 'CCFLAGS': ['/MTd']
+ 'CCFLAGS': ['/Od', '/MTd'],
+ 'LINKFLAGS': ['/DEBUG']
}
}
}
@@ -275,6 +283,11 @@
'default': 'off',
'help': 'build using snapshots for faster start-up'
},
+ 'prof': {
+ 'values': ['on', 'off'],
+ 'default': 'off',
+ 'help': 'enable profiling of build target'
+ },
'library': {
'values': ['static', 'shared'],
'default': 'static',
@@ -308,7 +321,7 @@
result.Add('mode', 'compilation mode (debug, release)', 'release')
result.Add('sample', 'build sample (shell, process)', '')
result.Add('env', 'override environment settings (NAME1:value1,NAME2:value2)', '')
- for (name, option) in SIMPLE_OPTIONS.items():
+ for (name, option) in SIMPLE_OPTIONS.iteritems():
help = '%s (%s)' % (name, ", ".join(option['values']))
result.Add(name, help, option.get('default'))
return result
@@ -332,7 +345,9 @@
return False
if not IsLegal(env, 'sample', ["shell", "process"]):
return False
- for (name, option) in SIMPLE_OPTIONS.items():
+ if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on':
+ Abort("Profiling on windows only supported for static library.")
+ for (name, option) in SIMPLE_OPTIONS.iteritems():
if (not option.get('default')) and (name not in ARGUMENTS):
message = ("A value for option %s must be specified (%s)." %
(name, ", ".join(option['values'])))
@@ -354,7 +369,7 @@
self.samples = samples
self.use_snapshot = (options['snapshot'] == 'on')
self.flags = None
-
+
def AddRelevantFlags(self, initial, flags):
result = initial.copy()
self.AppendFlags(result, flags.get('all'))
@@ -364,22 +379,24 @@
value = self.options[option]
self.AppendFlags(result, flags[toolchain].get(option + ':' + value))
return result
-
+
def GetRelevantSources(self, source):
result = []
result += source.get('all', [])
- for (name, value) in self.options.items():
+ for (name, value) in self.options.iteritems():
result += source.get(name + ':' + value, [])
return sorted(result)
def AppendFlags(self, options, added):
if not added:
return
- for (key, value) in added.items():
+ for (key, value) in added.iteritems():
if not key in options:
options[key] = value
else:
- options[key] = options[key] + value
+ prefix = options[key]
+ if isinstance(prefix, StringTypes): prefix = prefix.split()
+ options[key] = prefix + value
def ConfigureObject(self, env, input, **kw):
if self.options['library'] == 'static':
@@ -428,7 +445,7 @@
v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS)
jscre_flags = context.AddRelevantFlags(library_flags, JSCRE_EXTRA_FLAGS)
dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS)
- cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
+ cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
sample_flags = context.AddRelevantFlags(os.environ, SAMPLE_FLAGS)
context.flags = {
@@ -438,7 +455,7 @@
'cctest': cctest_flags,
'sample': sample_flags
}
-
+
target_id = mode
suffix = SUFFIXES[target_id]
library_name = 'v8' + suffix