1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided
11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 from os.path import join, dirname, abspath
30 root_dir = dirname(File('SConstruct').rfile().abspath)
31 sys.path.append(join(root_dir, 'tools'))
45 atomicops_internals_x86_gcc.cc
85 hydrogen-instructions.cc
87 incremental-marking.cc
90 interpreter-irregexp.cc
110 regexp-macro-assembler-irregexp.cc
111 regexp-macro-assembler.cc
118 scanner-character-streams.cc
141 extensions/gc-extension.cc
142 extensions/externalize-string-extension.cc
144 'arch:arm': Split("""
146 arm/code-stubs-arm.cc
151 arm/deoptimizer-arm.cc
154 arm/full-codegen-arm.cc
157 arm/lithium-codegen-arm.cc
158 arm/lithium-gap-resolver-arm.cc
159 arm/macro-assembler-arm.cc
160 arm/regexp-macro-assembler-arm.cc
161 arm/stub-cache-arm.cc
164 'arch:mips': Split("""
165 mips/assembler-mips.cc
166 mips/builtins-mips.cc
167 mips/code-stubs-mips.cc
169 mips/constants-mips.cc
172 mips/deoptimizer-mips.cc
175 mips/full-codegen-mips.cc
177 mips/lithium-codegen-mips.cc
178 mips/lithium-gap-resolver-mips.cc
180 mips/macro-assembler-mips.cc
181 mips/regexp-macro-assembler-mips.cc
182 mips/stub-cache-mips.cc
184 'arch:ia32': Split("""
185 ia32/assembler-ia32.cc
186 ia32/builtins-ia32.cc
187 ia32/code-stubs-ia32.cc
191 ia32/deoptimizer-ia32.cc
194 ia32/full-codegen-ia32.cc
196 ia32/lithium-codegen-ia32.cc
197 ia32/lithium-gap-resolver-ia32.cc
199 ia32/macro-assembler-ia32.cc
200 ia32/regexp-macro-assembler-ia32.cc
201 ia32/stub-cache-ia32.cc
203 'arch:x64': Split("""
206 x64/code-stubs-x64.cc
210 x64/deoptimizer-x64.cc
213 x64/full-codegen-x64.cc
215 x64/lithium-codegen-x64.cc
216 x64/lithium-gap-resolver-x64.cc
218 x64/macro-assembler-x64.cc
219 x64/regexp-macro-assembler-x64.cc
220 x64/stub-cache-x64.cc
222 'simulator:arm': ['arm/simulator-arm.cc'],
223 'simulator:mips': ['mips/simulator-mips.cc'],
224 'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'],
225 'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'],
226 'os:linux': ['platform-linux.cc', 'platform-posix.cc'],
227 'os:android': ['platform-linux.cc', 'platform-posix.cc'],
228 'os:macos': ['platform-macos.cc', 'platform-posix.cc'],
229 'os:solaris': ['platform-solaris.cc', 'platform-posix.cc'],
230 'os:cygwin': ['platform-cygwin.cc', 'platform-posix.cc'],
231 'os:nullos': ['platform-nullos.cc'],
232 'os:win32': ['platform-win32.cc', 'win32-math.cc'],
235 'objects-debug.cc', 'prettyprinter.cc', 'regexp-macro-assembler-tracer.cc'
240 PREPARSER_SOURCES = {
260 'os:win32': ['win32-math.cc']
273 'd8.cc', 'd8-debug.cc'
300 'd8-windows.cc' # Empty implementation at the moment.
302 'console:readline': [
326 EXPERIMENTAL_LIBRARY_FILES = '''
337 def ConfigureObjectFiles():
338 env = Environment(tools=tools)
339 env.Replace(**context.flags['v8'])
340 context.ApplyEnvOverrides(env)
341 env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
342 env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions')
344 def BuildJS2CEnv(type):
345 js2c_env = { 'TYPE': type, 'COMPRESSION': 'off' }
346 if 'COMPRESS_STARTUP_DATA_BZ2' in env['CPPDEFINES']:
347 js2c_env['COMPRESSION'] = 'bz2'
350 # Build the standard platform-independent source files.
351 source_files = context.GetRelevantSources(SOURCES)
352 d8_js = env.JS2C('d8-js.cc', 'd8.js', **{'TYPE': 'D8', 'COMPRESSION': 'off'})
353 d8_js_obj = context.ConfigureObject(env, d8_js, CPPPATH=['.'])
354 if context.options['library'] == 'shared':
355 d8_files = context.GetRelevantSources(D8_LIGHT_FILES)
358 d8_files = context.GetRelevantSources(D8_FULL_FILES)
359 d8_objs = [d8_js_obj]
360 d8_objs.append(context.ConfigureObject(d8_env, [d8_files]))
362 # Combine the JavaScript library files into a single C++ file and
364 library_files = [s for s in LIBRARY_FILES]
365 library_files.append('macros.py')
366 libraries_src = env.JS2C(
367 ['libraries.cc'], library_files, **BuildJS2CEnv('CORE'))
368 libraries_obj = context.ConfigureObject(env, libraries_src, CPPPATH=['.'])
370 # Combine the experimental JavaScript library files into a C++ file
372 experimental_library_files = [ s for s in EXPERIMENTAL_LIBRARY_FILES ]
373 experimental_library_files.append('macros.py')
374 experimental_libraries_src = env.JS2C(['experimental-libraries.cc'],
375 experimental_library_files,
376 **BuildJS2CEnv('EXPERIMENTAL'))
377 experimental_libraries_obj = context.ConfigureObject(env, experimental_libraries_src, CPPPATH=['.'])
379 source_objs = context.ConfigureObject(env, source_files)
380 non_snapshot_files = [source_objs]
382 preparser_source_files = context.GetRelevantSources(PREPARSER_SOURCES)
383 preparser_objs = context.ConfigureObject(env, preparser_source_files)
385 # Create snapshot if necessary. For cross compilation you should either
386 # do without snapshots and take the performance hit or you should build a
387 # host VM with the simulator=arm and snapshot=on options and then take the
388 # resulting snapshot.cc file from obj/release and put it in the src
389 # directory. Then rebuild the VM with the cross compiler and specify
390 # snapshot=nobuild on the scons command line.
391 empty_snapshot_obj = context.ConfigureObject(env, 'snapshot-empty.cc')
392 mksnapshot_env = env.Copy()
393 mksnapshot_env.Replace(**context.flags['mksnapshot'])
394 mksnapshot_src = 'mksnapshot.cc'
395 mksnapshot = mksnapshot_env.Program('mksnapshot', [mksnapshot_src, libraries_obj, experimental_libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='mksnapshot.exe.pdb')
396 if context.use_snapshot:
397 if context.build_snapshot:
398 snapshot_cc = env.Snapshot('snapshot.cc', mksnapshot, LOGFILE=File('snapshot.log').abspath)
400 snapshot_cc = 'snapshot.cc'
401 snapshot_obj = context.ConfigureObject(env, snapshot_cc, CPPPATH=['.'])
403 snapshot_obj = empty_snapshot_obj
404 library_objs = [non_snapshot_files, libraries_obj, experimental_libraries_obj, snapshot_obj]
405 return (library_objs, d8_objs, [mksnapshot], preparser_objs)
408 (library_objs, d8_objs, mksnapshot, preparser_objs) = ConfigureObjectFiles()
409 Return('library_objs d8_objs mksnapshot preparser_objs')