2008-09-09 20:08:45 +00:00
|
|
|
# Copyright 2008 the V8 project authors. All rights reserved.
|
2008-07-03 15:10:15 +00:00
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above
|
|
|
|
# copyright notice, this list of conditions and the following
|
|
|
|
# disclaimer in the documentation and/or other materials provided
|
|
|
|
# with the distribution.
|
|
|
|
# * Neither the name of Google Inc. nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from os.path import join, dirname, abspath
|
|
|
|
root_dir = dirname(File('SConstruct').rfile().abspath)
|
|
|
|
sys.path.append(join(root_dir, 'tools'))
|
|
|
|
import js2c
|
2008-08-22 13:33:59 +00:00
|
|
|
Import('context')
|
|
|
|
|
|
|
|
|
|
|
|
SOURCES = {
|
2009-10-15 08:22:24 +00:00
|
|
|
'all': Split("""
|
|
|
|
accessors.cc
|
|
|
|
allocation.cc
|
|
|
|
api.cc
|
|
|
|
assembler.cc
|
|
|
|
ast.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
atomicops_internals_x86_gcc.cc
|
2010-11-08 11:49:47 +00:00
|
|
|
bignum.cc
|
2010-11-17 13:20:44 +00:00
|
|
|
bignum-dtoa.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
bootstrapper.cc
|
|
|
|
builtins.cc
|
2010-10-07 13:02:36 +00:00
|
|
|
cached-powers.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
checks.cc
|
2010-03-17 13:15:42 +00:00
|
|
|
circular-queue.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
code-stubs.cc
|
|
|
|
codegen.cc
|
|
|
|
compilation-cache.cc
|
|
|
|
compiler.cc
|
|
|
|
contexts.cc
|
|
|
|
conversions.cc
|
|
|
|
counters.cc
|
2010-03-19 09:46:53 +00:00
|
|
|
cpu-profiler.cc
|
2010-01-29 09:42:13 +00:00
|
|
|
data-flow.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
dateparser.cc
|
|
|
|
debug-agent.cc
|
|
|
|
debug.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
deoptimizer.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
disassembler.cc
|
2010-03-19 12:15:24 +00:00
|
|
|
diy-fp.cc
|
2010-05-05 13:51:27 +00:00
|
|
|
dtoa.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
execution.cc
|
|
|
|
factory.cc
|
|
|
|
flags.cc
|
|
|
|
frame-element.cc
|
|
|
|
frames.cc
|
2010-01-20 16:28:21 +00:00
|
|
|
full-codegen.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
func-name-inferrer.cc
|
|
|
|
global-handles.cc
|
2010-03-18 13:19:59 +00:00
|
|
|
fast-dtoa.cc
|
2010-05-05 13:51:27 +00:00
|
|
|
fixed-dtoa.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
handles.cc
|
|
|
|
hashmap.cc
|
|
|
|
heap-profiler.cc
|
|
|
|
heap.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
hydrogen.cc
|
|
|
|
hydrogen-instructions.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ic.cc
|
|
|
|
interpreter-irregexp.cc
|
|
|
|
jsregexp.cc
|
|
|
|
jump-target.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
lithium-allocator.cc
|
2010-02-17 20:37:08 +00:00
|
|
|
liveedit.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
log-utils.cc
|
|
|
|
log.cc
|
|
|
|
mark-compact.cc
|
|
|
|
messages.cc
|
|
|
|
objects.cc
|
2010-08-11 14:30:14 +00:00
|
|
|
objects-visiting.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
oprofile-agent.cc
|
|
|
|
parser.cc
|
2010-11-23 11:46:36 +00:00
|
|
|
preparser.cc
|
|
|
|
preparse-data.cc
|
2010-03-15 14:11:19 +00:00
|
|
|
profile-generator.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
property.cc
|
|
|
|
regexp-macro-assembler-irregexp.cc
|
|
|
|
regexp-macro-assembler.cc
|
|
|
|
regexp-stack.cc
|
|
|
|
register-allocator.cc
|
|
|
|
rewriter.cc
|
|
|
|
runtime.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
runtime-profiler.cc
|
|
|
|
safepoint-table.cc
|
2010-11-05 13:33:40 +00:00
|
|
|
scanner-base.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
scanner.cc
|
|
|
|
scopeinfo.cc
|
|
|
|
scopes.cc
|
|
|
|
serialize.cc
|
|
|
|
snapshot-common.cc
|
|
|
|
spaces.cc
|
2010-09-29 10:57:23 +00:00
|
|
|
string-search.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
string-stream.cc
|
2010-10-07 08:54:10 +00:00
|
|
|
strtod.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
stub-cache.cc
|
|
|
|
token.cc
|
|
|
|
top.cc
|
2010-03-26 11:34:00 +00:00
|
|
|
type-info.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
unicode.cc
|
|
|
|
utils.cc
|
|
|
|
v8-counters.cc
|
|
|
|
v8.cc
|
|
|
|
v8threads.cc
|
|
|
|
variables.cc
|
|
|
|
version.cc
|
|
|
|
virtual-frame.cc
|
|
|
|
zone.cc
|
2010-11-17 12:28:30 +00:00
|
|
|
extensions/gc-extension.cc
|
|
|
|
extensions/externalize-string-extension.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
"""),
|
|
|
|
'arch:arm': Split("""
|
2010-03-25 13:18:00 +00:00
|
|
|
jump-target-light.cc
|
|
|
|
virtual-frame-light.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
arm/builtins-arm.cc
|
2010-08-25 09:44:44 +00:00
|
|
|
arm/code-stubs-arm.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
arm/codegen-arm.cc
|
|
|
|
arm/constants-arm.cc
|
|
|
|
arm/cpu-arm.cc
|
|
|
|
arm/debug-arm.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
arm/deoptimizer-arm.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
arm/disasm-arm.cc
|
|
|
|
arm/frames-arm.cc
|
2010-01-20 16:28:21 +00:00
|
|
|
arm/full-codegen-arm.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
arm/ic-arm.cc
|
|
|
|
arm/jump-target-arm.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
arm/lithium-arm.cc
|
|
|
|
arm/lithium-codegen-arm.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
arm/macro-assembler-arm.cc
|
|
|
|
arm/regexp-macro-assembler-arm.cc
|
|
|
|
arm/register-allocator-arm.cc
|
|
|
|
arm/stub-cache-arm.cc
|
|
|
|
arm/virtual-frame-arm.cc
|
2009-12-09 12:56:42 +00:00
|
|
|
arm/assembler-arm.cc
|
|
|
|
"""),
|
2010-02-04 20:36:58 +00:00
|
|
|
'arch:mips': Split("""
|
|
|
|
mips/assembler-mips.cc
|
|
|
|
mips/builtins-mips.cc
|
|
|
|
mips/codegen-mips.cc
|
|
|
|
mips/constants-mips.cc
|
|
|
|
mips/cpu-mips.cc
|
|
|
|
mips/debug-mips.cc
|
|
|
|
mips/disasm-mips.cc
|
|
|
|
mips/full-codegen-mips.cc
|
|
|
|
mips/frames-mips.cc
|
|
|
|
mips/ic-mips.cc
|
|
|
|
mips/jump-target-mips.cc
|
|
|
|
mips/macro-assembler-mips.cc
|
|
|
|
mips/register-allocator-mips.cc
|
|
|
|
mips/stub-cache-mips.cc
|
|
|
|
mips/virtual-frame-mips.cc
|
|
|
|
"""),
|
2009-10-15 08:22:24 +00:00
|
|
|
'arch:ia32': Split("""
|
2010-03-25 13:18:00 +00:00
|
|
|
jump-target-heavy.cc
|
|
|
|
virtual-frame-heavy.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ia32/assembler-ia32.cc
|
|
|
|
ia32/builtins-ia32.cc
|
2010-08-25 09:44:44 +00:00
|
|
|
ia32/code-stubs-ia32.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ia32/codegen-ia32.cc
|
|
|
|
ia32/cpu-ia32.cc
|
|
|
|
ia32/debug-ia32.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
ia32/deoptimizer-ia32.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ia32/disasm-ia32.cc
|
|
|
|
ia32/frames-ia32.cc
|
2010-01-20 16:28:21 +00:00
|
|
|
ia32/full-codegen-ia32.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ia32/ic-ia32.cc
|
|
|
|
ia32/jump-target-ia32.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
ia32/lithium-codegen-ia32.cc
|
|
|
|
ia32/lithium-ia32.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
ia32/macro-assembler-ia32.cc
|
|
|
|
ia32/regexp-macro-assembler-ia32.cc
|
|
|
|
ia32/register-allocator-ia32.cc
|
|
|
|
ia32/stub-cache-ia32.cc
|
|
|
|
ia32/virtual-frame-ia32.cc
|
|
|
|
"""),
|
|
|
|
'arch:x64': Split("""
|
2010-03-25 13:18:00 +00:00
|
|
|
jump-target-heavy.cc
|
|
|
|
virtual-frame-heavy.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
x64/assembler-x64.cc
|
|
|
|
x64/builtins-x64.cc
|
2010-08-25 09:44:44 +00:00
|
|
|
x64/code-stubs-x64.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
x64/codegen-x64.cc
|
|
|
|
x64/cpu-x64.cc
|
|
|
|
x64/debug-x64.cc
|
2010-12-07 11:31:57 +00:00
|
|
|
x64/deoptimizer-x64.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
x64/disasm-x64.cc
|
|
|
|
x64/frames-x64.cc
|
2010-01-20 16:28:21 +00:00
|
|
|
x64/full-codegen-x64.cc
|
2009-10-15 08:22:24 +00:00
|
|
|
x64/ic-x64.cc
|
|
|
|
x64/jump-target-x64.cc
|
|
|
|
x64/macro-assembler-x64.cc
|
|
|
|
x64/regexp-macro-assembler-x64.cc
|
|
|
|
x64/register-allocator-x64.cc
|
|
|
|
x64/stub-cache-x64.cc
|
|
|
|
x64/virtual-frame-x64.cc
|
|
|
|
"""),
|
2009-04-23 12:06:38 +00:00
|
|
|
'simulator:arm': ['arm/simulator-arm.cc'],
|
2010-02-04 20:36:58 +00:00
|
|
|
'simulator:mips': ['mips/simulator-mips.cc'],
|
2009-03-24 06:32:00 +00:00
|
|
|
'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'],
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'],
|
2009-03-24 06:32:00 +00:00
|
|
|
'os:linux': ['platform-linux.cc', 'platform-posix.cc'],
|
|
|
|
'os:android': ['platform-linux.cc', 'platform-posix.cc'],
|
|
|
|
'os:macos': ['platform-macos.cc', 'platform-posix.cc'],
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': ['platform-solaris.cc', 'platform-posix.cc'],
|
2008-11-21 10:06:29 +00:00
|
|
|
'os:nullos': ['platform-nullos.cc'],
|
|
|
|
'os:win32': ['platform-win32.cc'],
|
2008-08-22 13:33:59 +00:00
|
|
|
'mode:release': [],
|
2008-11-27 13:54:31 +00:00
|
|
|
'mode:debug': [
|
|
|
|
'objects-debug.cc', 'prettyprinter.cc', 'regexp-macro-assembler-tracer.cc'
|
2010-12-20 10:38:19 +00:00
|
|
|
],
|
|
|
|
'objectprint:on': ['objects-debug.cc']
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
D8_FILES = {
|
|
|
|
'all': [
|
2008-12-18 10:06:49 +00:00
|
|
|
'd8.cc', 'd8-debug.cc'
|
2008-10-21 09:12:27 +00:00
|
|
|
],
|
2009-03-27 13:50:26 +00:00
|
|
|
'os:linux': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
|
|
|
'os:macos': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
|
|
|
'os:android': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
|
|
|
'os:freebsd': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': [
|
|
|
|
'd8-posix.cc'
|
|
|
|
],
|
2009-03-31 11:45:20 +00:00
|
|
|
'os:win32': [
|
2009-03-27 13:50:26 +00:00
|
|
|
'd8-windows.cc'
|
|
|
|
],
|
|
|
|
'os:nullos': [
|
|
|
|
'd8-windows.cc' # Empty implementation at the moment.
|
|
|
|
],
|
2008-10-21 09:12:27 +00:00
|
|
|
'console:readline': [
|
|
|
|
'd8-readline.cc'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
LIBRARY_FILES = '''
|
|
|
|
runtime.js
|
|
|
|
v8natives.js
|
|
|
|
array.js
|
|
|
|
string.js
|
|
|
|
uri.js
|
|
|
|
math.js
|
|
|
|
messages.js
|
|
|
|
apinatives.js
|
2010-03-23 11:40:38 +00:00
|
|
|
date.js
|
|
|
|
regexp.js
|
|
|
|
json.js
|
|
|
|
liveedit-debugger.js
|
|
|
|
mirror-debugger.js
|
|
|
|
debug-debugger.js
|
2008-07-03 15:10:15 +00:00
|
|
|
'''.split()
|
|
|
|
|
|
|
|
|
|
|
|
def Abort(message):
|
|
|
|
print message
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
def ConfigureObjectFiles():
|
2008-07-03 15:10:15 +00:00
|
|
|
env = Environment()
|
2008-08-22 13:33:59 +00:00
|
|
|
env.Replace(**context.flags['v8'])
|
2008-09-05 10:00:50 +00:00
|
|
|
context.ApplyEnvOverrides(env)
|
2008-07-03 15:10:15 +00:00
|
|
|
env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
|
2010-01-18 16:04:25 +00:00
|
|
|
env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions')
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
# Build the standard platform-independent source files.
|
2008-08-22 13:33:59 +00:00
|
|
|
source_files = context.GetRelevantSources(SOURCES)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
d8_files = context.GetRelevantSources(D8_FILES)
|
|
|
|
d8_js = env.JS2C('d8-js.cc', 'd8.js', TYPE='D8')
|
|
|
|
d8_js_obj = context.ConfigureObject(env, d8_js, CPPPATH=['.'])
|
|
|
|
d8_objs = [context.ConfigureObject(env, [d8_files]), d8_js_obj]
|
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
# Combine the JavaScript library files into a single C++ file and
|
2008-07-03 15:10:15 +00:00
|
|
|
# compile it.
|
|
|
|
library_files = [s for s in LIBRARY_FILES]
|
|
|
|
library_files.append('macros.py')
|
2008-10-21 09:12:27 +00:00
|
|
|
libraries_src, libraries_empty_src = env.JS2C(['libraries.cc', 'libraries-empty.cc'], library_files, TYPE='CORE')
|
2008-08-22 13:33:59 +00:00
|
|
|
libraries_obj = context.ConfigureObject(env, libraries_src, CPPPATH=['.'])
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
source_objs = context.ConfigureObject(env, source_files)
|
2010-11-22 14:42:07 +00:00
|
|
|
non_snapshot_files = [source_objs]
|
2008-09-11 10:51:52 +00:00
|
|
|
|
2010-04-13 09:01:30 +00:00
|
|
|
# Create snapshot if necessary. For cross compilation you should either
|
|
|
|
# do without snapshots and take the performance hit or you should build a
|
|
|
|
# host VM with the simulator=arm and snapshot=on options and then take the
|
|
|
|
# resulting snapshot.cc file from obj/release and put it in the src
|
|
|
|
# directory. Then rebuild the VM with the cross compiler and specify
|
|
|
|
# snapshot=nobuild on the scons command line.
|
2008-08-22 13:33:59 +00:00
|
|
|
empty_snapshot_obj = context.ConfigureObject(env, 'snapshot-empty.cc')
|
2009-02-09 16:00:55 +00:00
|
|
|
mksnapshot_env = env.Copy()
|
|
|
|
mksnapshot_env.Replace(**context.flags['mksnapshot'])
|
2009-01-30 09:34:55 +00:00
|
|
|
mksnapshot_src = 'mksnapshot.cc'
|
2009-02-09 16:00:55 +00:00
|
|
|
mksnapshot = mksnapshot_env.Program('mksnapshot', [mksnapshot_src, libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='mksnapshot.exe.pdb')
|
2008-08-22 13:33:59 +00:00
|
|
|
if context.use_snapshot:
|
2009-01-30 09:34:55 +00:00
|
|
|
if context.build_snapshot:
|
|
|
|
snapshot_cc = env.Snapshot('snapshot.cc', mksnapshot, LOGFILE=File('snapshot.log').abspath)
|
|
|
|
else:
|
2010-04-13 09:01:30 +00:00
|
|
|
snapshot_cc = 'snapshot.cc'
|
2008-08-22 13:33:59 +00:00
|
|
|
snapshot_obj = context.ConfigureObject(env, snapshot_cc, CPPPATH=['.'])
|
2008-07-03 15:10:15 +00:00
|
|
|
else:
|
|
|
|
snapshot_obj = empty_snapshot_obj
|
2008-10-21 09:12:27 +00:00
|
|
|
library_objs = [non_snapshot_files, libraries_obj, snapshot_obj]
|
2009-01-30 09:34:55 +00:00
|
|
|
return (library_objs, d8_objs, [mksnapshot])
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
|
2009-01-30 09:34:55 +00:00
|
|
|
(library_objs, d8_objs, mksnapshot) = ConfigureObjectFiles()
|
|
|
|
Return('library_objs d8_objs mksnapshot')
|