Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade V8 to 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 24, 2011
1 parent 2680522 commit e33e7d1
Show file tree
Hide file tree
Showing 125 changed files with 6,615 additions and 4,013 deletions.
13 changes: 13 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,16 @@
2011-02-24: Version 3.1.6

Fixed a number of crash bugs.

Added support for Cygwin (issue 64).

Improved Crankshaft for x64 and ARM.

Added Crankshaft support for stores to pixel arrays.

Fixed issue in CPU profiler with Crankshaft.


2011-02-16: Version 3.1.5

Change RegExp parsing to disallow /(*)/.
Expand Down
122 changes: 28 additions & 94 deletions deps/v8/SConstruct
Expand Up @@ -27,7 +27,6 @@

import platform
import re
import subprocess
import sys
import os
from os.path import join, dirname, abspath
Expand Down Expand Up @@ -143,9 +142,6 @@ LIBRARY_FLAGS = {
# Use visibility=default to disable this.
'CXXFLAGS': ['-fvisibility=hidden']
},
'strictaliasing:off': {
'CCFLAGS': ['-fno-strict-aliasing']
},
'mode:debug': {
'CCFLAGS': ['-g', '-O0'],
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
Expand Down Expand Up @@ -306,6 +302,7 @@ V8_EXTRA_FLAGS = {
'gcc': {
'all': {
'WARNINGFLAGS': ['-Wall',
'-Werror',
'-W',
'-Wno-unused-parameter',
'-Wnon-virtual-dtor']
Expand Down Expand Up @@ -655,16 +652,8 @@ def Abort(message):
sys.exit(1)


def GuessOS(env):
return utils.GuessOS()


def GuessArch(env):
return utils.GuessArchitecture()


def GuessToolchain(env):
tools = env['TOOLS']
def GuessToolchain(os):
tools = Environment()['TOOLS']
if 'gcc' in tools:
return 'gcc'
elif 'msvc' in tools:
Expand All @@ -673,9 +662,7 @@ def GuessToolchain(env):
return None


def GuessVisibility(env):
os = env['os']
toolchain = env['toolchain'];
def GuessVisibility(os, toolchain):
if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc':
# MinGW / Cygwin can't do it.
return 'default'
Expand All @@ -685,35 +672,27 @@ def GuessVisibility(env):
return 'hidden'


def GuessStrictAliasing(env):
# There seems to be a problem with gcc 4.5.x
# see http://code.google.com/p/v8/issues/detail?id=884
# it can be worked around by disabling strict aliasing
toolchain = env['toolchain'];
if toolchain == 'gcc':
env = Environment(tools=['gcc'])
version = subprocess.Popen([env['CC'], '-dumpversion'],
stdout=subprocess.PIPE).communicate()[0]
if version.find('4.5.') == 0:
return 'off'
return 'default'
OS_GUESS = utils.GuessOS()
TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
ARCH_GUESS = utils.GuessArchitecture()
VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS)


SIMPLE_OPTIONS = {
'toolchain': {
'values': ['gcc', 'msvc'],
'guess': GuessToolchain,
'help': 'the toolchain to use'
'default': TOOLCHAIN_GUESS,
'help': 'the toolchain to use (%s)' % TOOLCHAIN_GUESS
},
'os': {
'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'solaris', 'cygwin'],
'guess': GuessOS,
'help': 'the os to build for'
'default': OS_GUESS,
'help': 'the os to build for (%s)' % OS_GUESS
},
'arch': {
'values':['arm', 'ia32', 'x64', 'mips'],
'guess': GuessArch,
'help': 'the architecture to build for'
'default': ARCH_GUESS,
'help': 'the architecture to build for (%s)' % ARCH_GUESS
},
'regexp': {
'values': ['native', 'interpreted'],
Expand Down Expand Up @@ -822,15 +801,8 @@ SIMPLE_OPTIONS = {
},
'visibility': {
'values': ['default', 'hidden'],
'guess': GuessVisibility,
'depends': ['os', 'toolchain'],
'help': 'shared library symbol visibility'
},
'strictaliasing': {
'values': ['default', 'off'],
'guess': GuessStrictAliasing,
'depends': ['toolchain'],
'help': 'assume strict aliasing while optimizing'
'default': VISIBILITY_GUESS,
'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS
},
'pgo': {
'values': ['off', 'instrument', 'optimize'],
Expand All @@ -840,55 +812,19 @@ SIMPLE_OPTIONS = {
}


def AddOption(result, name, option):
if 'guess' in option:
# Option has a guess function
guess = option.get('guess')
guess_env = Environment(options=result)
# Check if all options that the guess function depends on are set
if 'depends' in option:
for dependency in option.get('depends'):
if not dependency in guess_env:
return False
default = guess(guess_env)
else:
# Option has a fixed default
default = option.get('default')

help = '%s (%s)' % (option.get('help'), ", ".join(option['values']))
result.Add(name, help, default)
return True


def GetOptions():
result = Options()
result.Add('mode', 'compilation mode (debug, release)', 'release')
result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
result.Add('cache', 'directory to use for scons build cache', '')
result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '')
result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
options = SIMPLE_OPTIONS
while len(options):
postpone = {}
for (name, option) in options.iteritems():
if not AddOption(result, name, option):
postpone[name] = option
options = postpone
for (name, option) in SIMPLE_OPTIONS.iteritems():
help = '%s (%s)' % (name, ", ".join(option['values']))
result.Add(name, help, option.get('default'))
return result


def GetTools(opts):
env = Environment(options=opts)
os = env['os']
toolchain = env['toolchain']
if os == 'win32' and toolchain == 'gcc':
return ['mingw']
elif os == 'win32' and toolchain == 'msvc':
return ['msvc', 'mslink', 'mslib', 'msvs']
else:
return ['default']


def GetVersionComponents():
MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
Expand Down Expand Up @@ -969,7 +905,7 @@ def VerifyOptions(env):
print env['simulator']
Abort("Option unalignedaccesses only supported for the ARM architecture.")
for (name, option) in SIMPLE_OPTIONS.iteritems():
if (not name in env):
if (not option.get('default')) and (name not in ARGUMENTS):
message = ("A value for option %s must be specified (%s)." %
(name, ", ".join(option['values'])))
Abort(message)
Expand Down Expand Up @@ -1097,7 +1033,7 @@ def ParseEnvOverrides(arg, imports):
return overrides


def BuildSpecific(env, mode, env_overrides, tools):
def BuildSpecific(env, mode, env_overrides):
options = {'mode': mode}
for option in SIMPLE_OPTIONS:
options[option] = env[option]
Expand Down Expand Up @@ -1150,7 +1086,7 @@ def BuildSpecific(env, mode, env_overrides, tools):
(object_files, shell_files, mksnapshot) = env.SConscript(
join('src', 'SConscript'),
build_dir=join('obj', target_id),
exports='context tools',
exports='context',
duplicate=False
)

Expand All @@ -1170,21 +1106,21 @@ def BuildSpecific(env, mode, env_overrides, tools):
library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
context.library_targets.append(library)

d8_env = Environment(tools=tools)
d8_env = Environment()
d8_env.Replace(**context.flags['d8'])
context.ApplyEnvOverrides(d8_env)
shell = d8_env.Program('d8' + suffix, object_files + shell_files)
context.d8_targets.append(shell)

for sample in context.samples:
sample_env = Environment(tools=tools)
sample_env = Environment()
sample_env.Replace(**context.flags['sample'])
sample_env.Prepend(LIBS=[library_name])
context.ApplyEnvOverrides(sample_env)
sample_object = sample_env.SConscript(
join('samples', 'SConscript'),
build_dir=join('obj', 'sample', sample, target_id),
exports='sample context tools',
exports='sample context',
duplicate=False
)
sample_name = sample + suffix
Expand All @@ -1197,7 +1133,7 @@ def BuildSpecific(env, mode, env_overrides, tools):
cctest_program = cctest_env.SConscript(
join('test', 'cctest', 'SConscript'),
build_dir=join('obj', 'test', target_id),
exports='context object_files tools',
exports='context object_files',
duplicate=False
)
context.cctest_targets.append(cctest_program)
Expand All @@ -1207,9 +1143,7 @@ def BuildSpecific(env, mode, env_overrides, tools):

def Build():
opts = GetOptions()
tools = GetTools(opts)
env = Environment(options=opts, tools=tools)

env = Environment(options=opts)
Help(opts.GenerateHelpText(env))
VerifyOptions(env)
env_overrides = ParseEnvOverrides(env['env'], env['importenv'])
Expand All @@ -1223,7 +1157,7 @@ def Build():
d8s = []
modes = SplitList(env['mode'])
for mode in modes:
context = BuildSpecific(env.Copy(), mode, env_overrides, tools)
context = BuildSpecific(env.Copy(), mode, env_overrides)
libraries += context.library_targets
mksnapshots += context.mksnapshot_targets
cctests += context.cctest_targets
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/SConscript
Expand Up @@ -31,7 +31,6 @@ root_dir = dirname(File('SConstruct').rfile().abspath)
sys.path.append(join(root_dir, 'tools'))
import js2c
Import('context')
Import('tools')


SOURCES = {
Expand Down Expand Up @@ -154,6 +153,7 @@ SOURCES = {
arm/jump-target-arm.cc
arm/lithium-arm.cc
arm/lithium-codegen-arm.cc
arm/lithium-gap-resolver-arm.cc
arm/macro-assembler-arm.cc
arm/regexp-macro-assembler-arm.cc
arm/register-allocator-arm.cc
Expand Down Expand Up @@ -305,7 +305,7 @@ def Abort(message):


def ConfigureObjectFiles():
env = Environment(tools=tools)
env = Environment()
env.Replace(**context.flags['v8'])
context.ApplyEnvOverrides(env)
env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
Expand Down
16 changes: 15 additions & 1 deletion deps/v8/src/accessors.cc
Expand Up @@ -446,8 +446,15 @@ MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) {
bool found_it = false;
JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
if (!found_it) return Heap::undefined_value();
while (!function->should_have_prototype()) {
found_it = false;
function = FindInPrototypeChain<JSFunction>(object->GetPrototype(),
&found_it);
// There has to be one because we hit the getter.
ASSERT(found_it);
}

if (!function->has_prototype()) {
if (!function->should_have_prototype()) return Heap::undefined_value();
Object* prototype;
{ MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function);
if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
Expand All @@ -467,6 +474,13 @@ MaybeObject* Accessors::FunctionSetPrototype(JSObject* object,
bool found_it = false;
JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
if (!found_it) return Heap::undefined_value();
if (!function->should_have_prototype()) {
// Since we hit this accessor, object will have no prototype property.
return object->SetLocalPropertyIgnoreAttributes(Heap::prototype_symbol(),
value,
NONE);
}

if (function->has_initial_map()) {
// If the function has allocated the initial map
// replace it with a copy containing the new prototype.
Expand Down

0 comments on commit e33e7d1

Please sign in to comment.