Improved frame merge code generated by the code generator.
Optimized String.prototype.replace.
Implemented __defineGetter__ and __defineSetter__ for properties with integer keys on non-array objects.
Improved debugger and profiler support.
Fixed a number of portability issues to allow compilation for smaller ARM devices.
Exposed object cloning through the API.
Implemented hidden properties. This is used to expose an identity hash for objects through the API.
Implemented restarting of regular expressions if their input string changes representation during preemption.
Fixed a code generator bug that could cause assignments in loops to be ignored if using continue to break out of the loop (issue 284).
git-svn-id: http://v8.googlecode.com/svn/trunk@1598 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/SConstruct b/SConstruct
index 64e6963..4268841 100644
--- a/SConstruct
+++ b/SConstruct
@@ -35,6 +35,40 @@
sys.path.append(join(root_dir, 'tools'))
import js2c, utils
+# ANDROID_TOP is the top of the Android checkout, fetched from the environment
+# variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB
+# environment variables to the cross-compiling tools.
+ANDROID_TOP = os.environ.get('TOP')
+if ANDROID_TOP is None:
+ ANDROID_TOP=""
+
+ANDROID_FLAGS = ['-march=armv5te',
+ '-mtune=xscale',
+ '-msoft-float',
+ '-fpic',
+ '-mthumb-interwork',
+ '-funwind-tables',
+ '-fstack-protector',
+ '-fno-short-enums',
+ '-fmessage-length=0',
+ '-finline-functions',
+ '-fno-inline-functions-called-once',
+ '-fgcse-after-reload',
+ '-frerun-cse-after-loop',
+ '-frename-registers',
+ '-fomit-frame-pointer',
+ '-fno-strict-aliasing',
+ '-finline-limit=64',
+ '-MD']
+
+ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include',
+ ANDROID_TOP + '/bionic/libc/include',
+ ANDROID_TOP + '/bionic/libstdc++/include',
+ ANDROID_TOP + '/bionic/libc/kernel/common',
+ ANDROID_TOP + '/bionic/libc/kernel/arch-arm',
+ ANDROID_TOP + '/bionic/libm/include',
+ ANDROID_TOP + '/bionic/libm/include/arch/arm',
+ ANDROID_TOP + '/bionic/libthread_db/include']
LIBRARY_FLAGS = {
'all': {
@@ -50,7 +84,11 @@
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG']
},
'mode:release': {
- 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections']
+ 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections',
+ '-ffunction-sections'],
+ 'os:android': {
+ 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
+ }
},
'os:linux': {
'CCFLAGS': ['-ansi'],
@@ -65,6 +103,14 @@
'CCFLAGS': ['-DWIN32'],
'CXXFLAGS': ['-DWIN32'],
},
+ 'os:android': {
+ 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
+ '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
+ 'CCFLAGS': ANDROID_FLAGS,
+ 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type',
+ '-Wstrict-aliasing=2'],
+ 'CPPPATH': ANDROID_INCLUDES,
+ },
'wordsize:64': {
'CCFLAGS': ['-m32'],
'LINKFLAGS': ['-m32']
@@ -114,14 +160,23 @@
'gcc': {
'all': {
'CXXFLAGS': [], #['-fvisibility=hidden'],
- 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W',
+ 'WARNINGFLAGS': ['-Wall', '-Werror', '-W',
'-Wno-unused-parameter']
},
'arch:arm': {
'CPPDEFINES': ['ARM']
},
+ 'arch:android': {
+ 'CPPDEFINES': ['ARM']
+ },
'os:win32': {
- 'WARNINGFLAGS': ['-Wno-long-long']
+ 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
+ },
+ 'os:linux': {
+ 'WARNINGFLAGS': ['-pedantic']
+ },
+ 'os:macos': {
+ 'WARNINGFLAGS': ['-pedantic']
},
'disassembler:on': {
'CPPDEFINES': ['ENABLE_DISASSEMBLER']
@@ -151,7 +206,7 @@
MKSNAPSHOT_EXTRA_FLAGS = {
'gcc': {
'os:linux': {
- 'LIBS': ['pthread'],
+ 'LIBS': ['pthread', 'rt'],
},
'os:macos': {
'LIBS': ['pthread'],
@@ -174,7 +229,7 @@
DTOA_EXTRA_FLAGS = {
'gcc': {
'all': {
- 'WARNINGFLAGS': ['-Werror']
+ 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized']
}
},
'msvc': {
@@ -195,7 +250,7 @@
'LIBPATH': [abspath('.')]
},
'os:linux': {
- 'LIBS': ['pthread'],
+ 'LIBS': ['pthread', 'rt'],
},
'os:macos': {
'LIBS': ['pthread'],
@@ -230,10 +285,11 @@
},
'gcc': {
'all': {
- 'LIBPATH': ['.']
+ 'LIBPATH': ['.'],
+ 'CCFLAGS': ['-fno-rtti', '-fno-exceptions']
},
'os:linux': {
- 'LIBS': ['pthread'],
+ 'LIBS': ['pthread', 'rt'],
},
'os:macos': {
'LIBS': ['pthread'],
@@ -244,6 +300,27 @@
'os:win32': {
'LIBS': ['winmm', 'ws2_32']
},
+ 'os:android': {
+ 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
+ '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
+ 'CCFLAGS': ANDROID_FLAGS,
+ 'CPPPATH': ANDROID_INCLUDES,
+ 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'],
+ 'LINKFLAGS': ['-nostdlib',
+ '-Bdynamic',
+ '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x',
+ '-Wl,-dynamic-linker,/system/bin/linker',
+ '-Wl,--gc-sections',
+ '-Wl,-z,nocopyreloc',
+ '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib',
+ ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o',
+ ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a',
+ ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o'],
+ 'LIBS': ['c', 'stdc++', 'm'],
+ 'mode:release': {
+ 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
+ }
+ },
'wordsize:64': {
'CCFLAGS': ['-m32'],
'LINKFLAGS': ['-m32']
@@ -301,7 +378,7 @@
'LIBS': ['readline']
},
'os:linux': {
- 'LIBS': ['pthread'],
+ 'LIBS': ['pthread', 'rt'],
},
'os:macos': {
'LIBS': ['pthread'],
@@ -355,7 +432,7 @@
'help': 'the toolchain to use'
},
'os': {
- 'values': ['freebsd', 'linux', 'macos', 'win32'],
+ 'values': ['freebsd', 'linux', 'macos', 'win32', 'android'],
'default': OS_GUESS,
'help': 'the os to build for'
},
@@ -510,6 +587,8 @@
options[key] = prefix + value
def ConfigureObject(self, env, input, **kw):
+ if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')):
+ kw['CPPPATH'] += env['CPPPATH']
if self.options['library'] == 'static':
return env.StaticObject(input, **kw)
else:
@@ -574,7 +653,7 @@
library_name = 'v8' + suffix
env['LIBRARY'] = library_name
- # Build the object files by invoking SCons recursively.
+ # Build the object files by invoking SCons recursively.
(object_files, shell_files, mksnapshot) = env.SConscript(
join('src', 'SConscript'),
build_dir=join('obj', target_id),
@@ -596,7 +675,7 @@
pdb_name = library_name + '.dll.pdb'
library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
context.library_targets.append(library)
-
+
d8_env = Environment()
d8_env.Replace(**context.flags['d8'])
shell = d8_env.Program('d8' + suffix, object_files + shell_files)
@@ -616,7 +695,7 @@
sample_program = sample_env.Program(sample_name, sample_object)
sample_env.Depends(sample_program, library)
context.sample_targets.append(sample_program)
-
+
cctest_program = env.SConscript(
join('test', 'cctest', 'SConscript'),
build_dir=join('obj', 'test', target_id),
@@ -624,7 +703,7 @@
duplicate=False
)
context.cctest_targets.append(cctest_program)
-
+
return context