diff options
Diffstat (limited to 'deps/v8/tools')
-rw-r--r-- | deps/v8/tools/android-build.sh | 0 | ||||
-rw-r--r-- | deps/v8/tools/android-ll-prof.sh | 69 | ||||
-rw-r--r-- | deps/v8/tools/android-run.py | 109 | ||||
-rw-r--r-- | deps/v8/tools/android-sync.sh | 105 | ||||
-rwxr-xr-x | deps/v8/tools/grokdump.py | 96 | ||||
-rw-r--r-- | deps/v8/tools/gyp/v8.gyp | 74 | ||||
-rwxr-xr-x | deps/v8/tools/linux-tick-processor | 10 | ||||
-rwxr-xr-x | deps/v8/tools/ll_prof.py | 27 | ||||
-rwxr-xr-x | deps/v8/tools/push-to-trunk.sh | 17 | ||||
-rwxr-xr-x | deps/v8/tools/run-valgrind.py | 56 | ||||
-rwxr-xr-x | deps/v8/tools/test-wrapper-gypbuild.py | 21 | ||||
-rwxr-xr-x | deps/v8/tools/test.py | 10 | ||||
-rw-r--r-- | deps/v8/tools/tickprocessor-driver.js | 4 | ||||
-rw-r--r-- | deps/v8/tools/tickprocessor.js | 18 |
14 files changed, 503 insertions, 113 deletions
diff --git a/deps/v8/tools/android-build.sh b/deps/v8/tools/android-build.sh new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/deps/v8/tools/android-build.sh diff --git a/deps/v8/tools/android-ll-prof.sh b/deps/v8/tools/android-ll-prof.sh new file mode 100644 index 000000000..78790ecb6 --- /dev/null +++ b/deps/v8/tools/android-ll-prof.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# Copyright 2012 the V8 project authors. All rights reserved. +# 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. + +# Runs d8 with the given arguments on the device under 'perf' and +# processes the profiler trace and v8 logs using ll_prof.py. +# +# Usage: +# > ./tools/android-ll-prof.sh (debug|release) "args to d8" "args to ll_prof.py" +# +# The script creates deploy directory deploy/data/local/tmp/v8, copies there +# the d8 binary either from out/android_arm.release or out/android_arm.debug, +# and then sync the deploy directory with /data/local/tmp/v8 on the device. +# You can put JS files in the deploy directory before running the script. +# Note: $ANDROID_NDK_ROOT must be set. + +MODE=$1 +RUN_ARGS=$2 +LL_PROF_ARGS=$3 + +BASE=`cd $(dirname "$0")/..; pwd` +DEPLOY="$BASE/deploy" + +set +e +mkdir -p "$DEPLOY/data/local/tmp/v8" + +cp "$BASE/out/android_arm.$MODE/d8" "$DEPLOY/data/local/tmp/v8/d8" + +adb -p "$DEPLOY" sync data + +adb shell "cd /data/local/tmp/v8;\ + perf record -R -e cycles -c 10000 -f -i \ + ./d8 --ll_prof --gc-fake-mmap=/data/local/tmp/__v8_gc__ $RUN_ARGS" + +adb pull /data/local/tmp/v8/v8.log . +adb pull /data/local/tmp/v8/v8.log.ll . +adb pull /data/perf.data . + +ARCH=arm-linux-androideabi-4.4.3 +TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/$ARCH/prebuilt/linux-x86/bin" + +$BASE/tools/ll_prof.py --host-root="$BASE/deploy" \ + --gc-fake-mmap=/data/local/tmp/__v8_gc__ \ + --objdump="$TOOLCHAIN/arm-linux-androideabi-objdump" \ + $LL_PROF_ARGS diff --git a/deps/v8/tools/android-run.py b/deps/v8/tools/android-run.py new file mode 100644 index 000000000..1693c5b06 --- /dev/null +++ b/deps/v8/tools/android-run.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# +# Copyright 2012 the V8 project authors. All rights reserved. +# 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. + +# This script executes the passed command line on Android device +# using 'adb shell' command. Unfortunately, 'adb shell' always +# returns exit code 0, ignoring the exit code of executed command. +# Since we need to return non-zero exit code if the command failed, +# we augment the passed command line with exit code checking statement +# and output special error string in case of non-zero exit code. +# Then we parse the output of 'adb shell' and look for that error string. + +import os +from os.path import join, dirname, abspath +import subprocess +import sys +import tempfile + +def Check(output, errors): + failed = any([s.startswith('/system/bin/sh:') or s.startswith('ANDROID') + for s in output.split('\n')]) + return 1 if failed else 0 + +def Execute(cmdline): + (fd_out, outname) = tempfile.mkstemp() + (fd_err, errname) = tempfile.mkstemp() + process = subprocess.Popen( + args=cmdline, + shell=True, + stdout=fd_out, + stderr=fd_err, + ) + exit_code = process.wait() + os.close(fd_out) + os.close(fd_err) + output = file(outname).read() + errors = file(errname).read() + os.unlink(outname) + os.unlink(errname) + sys.stdout.write(output) + sys.stderr.write(errors) + return exit_code or Check(output, errors) + +def Escape(arg): + def ShouldEscape(): + for x in arg: + if not x.isalnum() and x != '-' and x != '_': + return True + return False + + return arg if not ShouldEscape() else '"%s"' % (arg.replace('"', '\\"')) + +def WriteToTemporaryFile(data): + (fd, fname) = tempfile.mkstemp() + os.close(fd) + tmp_file = open(fname, "w") + tmp_file.write(data) + tmp_file.close() + return fname + +def Main(): + if (len(sys.argv) == 1): + print("Usage: %s <command-to-run-on-device>" % sys.argv[0]) + return 1 + workspace = abspath(join(dirname(sys.argv[0]), '..')) + android_workspace = os.getenv("ANDROID_V8", "/data/local/v8") + args = [Escape(arg) for arg in sys.argv[1:]] + script = (" ".join(args) + "\n" + "case $? in\n" + " 0) ;;\n" + " *) echo \"ANDROID: Error returned by test\";;\n" + "esac\n") + script = script.replace(workspace, android_workspace) + script_file = WriteToTemporaryFile(script) + android_script_file = android_workspace + "/" + script_file + command = ("adb push '%s' %s;" % (script_file, android_script_file) + + "adb shell 'sh %s';" % android_script_file + + "adb shell 'rm %s'" % android_script_file) + error_code = Execute(command) + os.unlink(script_file) + return error_code + +if __name__ == '__main__': + sys.exit(Main()) diff --git a/deps/v8/tools/android-sync.sh b/deps/v8/tools/android-sync.sh new file mode 100644 index 000000000..5d4ef2eff --- /dev/null +++ b/deps/v8/tools/android-sync.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# Copyright 2012 the V8 project authors. All rights reserved. +# 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. + +# This script pushes android binaries and test data to the device. +# The first argument can be either "android.release" or "android.debug". +# The second argument is a relative path to the output directory with binaries. +# The third argument is the absolute path to the V8 directory on the host. +# The fourth argument is the absolute path to the V8 directory on the device. + +if [ ${#@} -lt 4 ] ; then + echo "$0: Error: need 4 arguments" + exit 1 +fi + +ARCH_MODE=$1 +OUTDIR=$2 +HOST_V8=$3 +ANDROID_V8=$4 + +function LINUX_MD5 { + local HASH=$(md5sum $1) + echo ${HASH%% *} +} + +function DARWIN_MD5 { + local HASH=$(md5 $1) + echo ${HASH} | cut -f2 -d "=" | cut -f2 -d " " +} + +host_os=$(uname -s) +case "${host_os}" in + "Linux") + MD5=LINUX_MD5 + ;; + "Darwin") + MD5=DARWIN_MD5 + ;; + *) + echo "$0: Host platform ${host_os} is not supported" >& 2 + exit 1 +esac + +function sync_file { + local FILE=$1 + local ANDROID_HASH=$(adb shell "md5 \"$ANDROID_V8/$FILE\"") + local HOST_HASH=$($MD5 "$HOST_V8/$FILE") + if [ "${ANDROID_HASH%% *}" != "${HOST_HASH}" ]; then + adb push "$HOST_V8/$FILE" "$ANDROID_V8/$FILE" &> /dev/null + fi + echo -n "." +} + +function sync_dir { + local DIR=$1 + echo -n "sync to $ANDROID_V8/$DIR" + for FILE in $(find "$HOST_V8/$DIR" -not -path "*.svn*" -type f); do + local RELATIVE_FILE=${FILE:${#HOST_V8}} + sync_file "$RELATIVE_FILE" + done + echo "" +} + +echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE" +sync_file "$OUTDIR/$ARCH_MODE/cctest" +sync_file "$OUTDIR/$ARCH_MODE/d8" +sync_file "$OUTDIR/$ARCH_MODE/preparser" +echo "" +echo -n "sync to $ANDROID_V8/tools" +sync_file tools/consarray.js +sync_file tools/codemap.js +sync_file tools/csvparser.js +sync_file tools/profile.js +sync_file tools/splaytree.js +sync_file tools/profile_view.js +sync_file tools/logreader.js +sync_file tools/tickprocessor.js +echo "" +sync_dir test/message +sync_dir test/mjsunit +sync_dir test/preparser diff --git a/deps/v8/tools/grokdump.py b/deps/v8/tools/grokdump.py index a9f0cb9dd..5d9a053af 100755 --- a/deps/v8/tools/grokdump.py +++ b/deps/v8/tools/grokdump.py @@ -1051,12 +1051,30 @@ class ConsString(String): class Oddball(HeapObject): + # Should match declarations in objects.h + KINDS = [ + "False", + "True", + "TheHole", + "Null", + "ArgumentMarker", + "Undefined", + "Other" + ] + def ToStringOffset(self): return self.heap.PointerSize() + def ToNumberOffset(self): + return self.ToStringOffset() + self.heap.PointerSize() + + def KindOffset(self): + return self.ToNumberOffset() + self.heap.PointerSize() + def __init__(self, heap, map, address): HeapObject.__init__(self, heap, map, address) self.to_string = self.ObjectField(self.ToStringOffset()) + self.kind = self.SmiField(self.KindOffset()) def Print(self, p): p.Print(str(self)) @@ -1065,7 +1083,10 @@ class Oddball(HeapObject): if self.to_string: return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars()) else: - return "Oddball(%08x, kind=%s)" % (self.address, "???") + kind = "???" + if 0 <= self.kind < len(Oddball.KINDS): + kind = Oddball.KINDS[self.kind] + return "Oddball(%08x, kind=%s)" % (self.address, kind) class FixedArray(HeapObject): @@ -1086,7 +1107,13 @@ class FixedArray(HeapObject): base_offset = self.ElementsOffset() for i in xrange(self.length): offset = base_offset + 4 * i - p.Print("[%08d] = %s" % (i, self.ObjectField(offset))) + try: + p.Print("[%08d] = %s" % (i, self.ObjectField(offset))) + except TypeError: + p.Dedent() + p.Print("...") + p.Print("}") + return p.Dedent() p.Print("}") @@ -1394,7 +1421,7 @@ class InspectionPadawan(object): if known_map: return known_map found_obj = self.heap.FindObject(tagged_address) - if found_obj: return found_ob + if found_obj: return found_obj address = tagged_address - 1 if self.reader.IsValidAddress(address): map_tagged_address = self.reader.ReadUIntPtr(address) @@ -1451,6 +1478,24 @@ class InspectionShell(cmd.Cmd): self.padawan = InspectionPadawan(reader, heap) self.prompt = "(grok) " + def do_da(self, address): + """ + Print ASCII string starting at specified address. + """ + address = int(address, 16) + string = "" + while self.reader.IsValidAddress(address): + code = self.reader.ReadU8(address) + if code < 128: + string += chr(code) + else: + break + address += 1 + if string == "": + print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address) + else: + print "%s\n" % string + def do_dd(self, address): """ Interpret memory at the given address (if available) as a sequence @@ -1510,23 +1555,23 @@ class InspectionShell(cmd.Cmd): """ self.padawan.PrintKnowledge() - def do_km(self, address): + def do_kd(self, address): """ Teach V8 heap layout information to the inspector. Set the first - map-space page by passing any pointer into that page. + data-space page by passing any pointer into that page. """ address = int(address, 16) page_address = address & ~self.heap.PageAlignmentMask() - self.padawan.known_first_map_page = page_address + self.padawan.known_first_data_page = page_address - def do_kd(self, address): + def do_km(self, address): """ Teach V8 heap layout information to the inspector. Set the first - data-space page by passing any pointer into that page. + map-space page by passing any pointer into that page. """ address = int(address, 16) page_address = address & ~self.heap.PageAlignmentMask() - self.padawan.known_first_data_page = page_address + self.padawan.known_first_map_page = page_address def do_kp(self, address): """ @@ -1537,6 +1582,17 @@ class InspectionShell(cmd.Cmd): page_address = address & ~self.heap.PageAlignmentMask() self.padawan.known_first_pointer_page = page_address + def do_list(self, smth): + """ + List all available memory regions. + """ + def print_region(reader, start, size, location): + print " %s - %s (%d bytes)" % (reader.FormatIntPtr(start), + reader.FormatIntPtr(start + size), + size) + print "Available memory regions:" + self.reader.ForEachMemoryRegion(print_region) + def do_s(self, word): """ Search for a given word in available memory regions. The given word @@ -1560,23 +1616,25 @@ class InspectionShell(cmd.Cmd): """ raise NotImplementedError - def do_list(self, smth): + def do_u(self, args): """ - List all available memory regions. + u 0x<address> 0x<size> + Unassemble memory in the region [address, address + size) """ - def print_region(reader, start, size, location): - print " %s - %s (%d bytes)" % (reader.FormatIntPtr(start), - reader.FormatIntPtr(start + size), - size) - print "Available memory regions:" - self.reader.ForEachMemoryRegion(print_region) - + args = args.split(' ') + start = int(args[0], 16) + size = int(args[1], 16) + lines = self.reader.GetDisasmLines(start, size) + for line in lines: + print FormatDisasmLine(start, self.heap, line) + print EIP_PROXIMITY = 64 CONTEXT_FOR_ARCH = { MD_CPU_ARCHITECTURE_AMD64: - ['rax', 'rbx', 'rcx', 'rdx', 'rdi', 'rsi', 'rbp', 'rsp', 'rip'], + ['rax', 'rbx', 'rcx', 'rdx', 'rdi', 'rsi', 'rbp', 'rsp', 'rip', + 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15'], MD_CPU_ARCHITECTURE_X86: ['eax', 'ebx', 'ecx', 'edx', 'edi', 'esi', 'ebp', 'esp', 'eip'] } diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index f742cc6f3..b646567b5 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -234,10 +234,10 @@ '../../src/ast.h', '../../src/atomicops.h', '../../src/atomicops_internals_x86_gcc.cc', - '../../src/bignum.cc', - '../../src/bignum.h', '../../src/bignum-dtoa.cc', '../../src/bignum-dtoa.h', + '../../src/bignum.cc', + '../../src/bignum.h', '../../src/bootstrapper.cc', '../../src/bootstrapper.h', '../../src/builtins.cc', @@ -268,21 +268,21 @@ '../../src/conversions.h', '../../src/counters.cc', '../../src/counters.h', - '../../src/cpu.h', '../../src/cpu-profiler-inl.h', '../../src/cpu-profiler.cc', '../../src/cpu-profiler.h', + '../../src/cpu.h', '../../src/data-flow.cc', '../../src/data-flow.h', '../../src/date.cc', '../../src/date.h', + '../../src/dateparser-inl.h', '../../src/dateparser.cc', '../../src/dateparser.h', - '../../src/dateparser-inl.h', - '../../src/debug.cc', - '../../src/debug.h', '../../src/debug-agent.cc', '../../src/debug-agent.h', + '../../src/debug.cc', + '../../src/debug.h', '../../src/deoptimizer.cc', '../../src/deoptimizer.h', '../../src/disasm.h', @@ -293,19 +293,25 @@ '../../src/double.h', '../../src/dtoa.cc', '../../src/dtoa.h', - '../../src/elements.cc', - '../../src/elements.h', '../../src/elements-kind.cc', '../../src/elements-kind.h', + '../../src/elements.cc', + '../../src/elements.h', '../../src/execution.cc', '../../src/execution.h', + '../../src/extensions/externalize-string-extension.cc', + '../../src/extensions/externalize-string-extension.h', + '../../src/extensions/gc-extension.cc', + '../../src/extensions/gc-extension.h', + '../../src/extensions/statistics-extension.cc', + '../../src/extensions/statistics-extension.h', '../../src/factory.cc', '../../src/factory.h', '../../src/fast-dtoa.cc', '../../src/fast-dtoa.h', - '../../src/flag-definitions.h', '../../src/fixed-dtoa.cc', '../../src/fixed-dtoa.h', + '../../src/flag-definitions.h', '../../src/flags.cc', '../../src/flags.h', '../../src/frames-inl.h', @@ -323,14 +329,14 @@ '../../src/handles.h', '../../src/hashmap.h', '../../src/heap-inl.h', - '../../src/heap.cc', - '../../src/heap.h', '../../src/heap-profiler.cc', '../../src/heap-profiler.h', - '../../src/hydrogen.cc', - '../../src/hydrogen.h', + '../../src/heap.cc', + '../../src/heap.h', '../../src/hydrogen-instructions.cc', '../../src/hydrogen-instructions.h', + '../../src/hydrogen.cc', + '../../src/hydrogen.h', '../../src/ic-inl.h', '../../src/ic.cc', '../../src/ic.h', @@ -342,19 +348,19 @@ '../../src/interface.h', '../../src/interpreter-irregexp.cc', '../../src/interpreter-irregexp.h', + '../../src/isolate.cc', + '../../src/isolate.h', '../../src/json-parser.h', '../../src/jsregexp.cc', '../../src/jsregexp.h', - '../../src/isolate.cc', - '../../src/isolate.h', '../../src/lazy-instance.h', '../../src/list-inl.h', '../../src/list.h', - '../../src/lithium.cc', - '../../src/lithium.h', + '../../src/lithium-allocator-inl.h', '../../src/lithium-allocator.cc', '../../src/lithium-allocator.h', - '../../src/lithium-allocator-inl.h', + '../../src/lithium.cc', + '../../src/lithium.h', '../../src/liveedit.cc', '../../src/liveedit.h', '../../src/liveobjectlist-inl.h', @@ -372,14 +378,16 @@ '../../src/messages.h', '../../src/natives.h', '../../src/objects-debug.cc', - '../../src/objects-printer.cc', '../../src/objects-inl.h', + '../../src/objects-printer.cc', '../../src/objects-visiting.cc', '../../src/objects-visiting.h', '../../src/objects.cc', '../../src/objects.h', '../../src/once.cc', '../../src/once.h', + '../../src/optimizing-compiler-thread.h', + '../../src/optimizing-compiler-thread.cc', '../../src/parser.cc', '../../src/parser.h', '../../src/platform-posix.h', @@ -394,12 +402,12 @@ '../../src/preparser.h', '../../src/prettyprinter.cc', '../../src/prettyprinter.h', - '../../src/property.cc', - '../../src/property.h', - '../../src/property-details.h', '../../src/profile-generator-inl.h', '../../src/profile-generator.cc', '../../src/profile-generator.h', + '../../src/property-details.h', + '../../src/property.cc', + '../../src/property.h', '../../src/regexp-macro-assembler-irregexp-inl.h', '../../src/regexp-macro-assembler-irregexp.cc', '../../src/regexp-macro-assembler-irregexp.h', @@ -411,16 +419,16 @@ '../../src/regexp-stack.h', '../../src/rewriter.cc', '../../src/rewriter.h', - '../../src/runtime.cc', - '../../src/runtime.h', '../../src/runtime-profiler.cc', '../../src/runtime-profiler.h', + '../../src/runtime.cc', + '../../src/runtime.h', '../../src/safepoint-table.cc', '../../src/safepoint-table.h', - '../../src/scanner.cc', - '../../src/scanner.h', '../../src/scanner-character-streams.cc', '../../src/scanner-character-streams.h', + '../../src/scanner.cc', + '../../src/scanner.h', '../../src/scopeinfo.cc', '../../src/scopeinfo.h', '../../src/scopes.cc', @@ -428,7 +436,7 @@ '../../src/serialize.cc', '../../src/serialize.h', '../../src/small-pointer-list.h', - '../../src/smart-array-pointer.h', + '../../src/smart-pointers.h', '../../src/snapshot-common.cc', '../../src/snapshot.h', '../../src/spaces-inl.h', @@ -447,6 +455,9 @@ '../../src/stub-cache.h', '../../src/token.cc', '../../src/token.h', + '../../src/transitions-inl.h', + '../../src/transitions.cc', + '../../src/transitions.h', '../../src/type-info.cc', '../../src/type-info.h', '../../src/unbound-queue-inl.h', @@ -479,10 +490,6 @@ '../../src/zone-inl.h', '../../src/zone.cc', '../../src/zone.h', - '../../src/extensions/externalize-string-extension.cc', - '../../src/extensions/externalize-string-extension.h', - '../../src/extensions/gc-extension.cc', - '../../src/extensions/gc-extension.h', ], 'conditions': [ ['want_separate_host_toolset==1', { @@ -555,7 +562,7 @@ '../../src/ia32/stub-cache-ia32.cc', ], }], - ['v8_target_arch=="mips"', { + ['v8_target_arch=="mipsel"', { 'sources': [ '../../src/mips/assembler-mips.cc', '../../src/mips/assembler-mips.h', @@ -721,9 +728,6 @@ '../../src/win32-math.h', ], 'msvs_disabled_warnings': [4351, 4355, 4800], - 'direct_dependent_settings': { - 'msvs_disabled_warnings': [4351, 4355, 4800], - }, 'link_settings': { 'libraries': [ '-lwinmm.lib', '-lws2_32.lib' ], }, diff --git a/deps/v8/tools/linux-tick-processor b/deps/v8/tools/linux-tick-processor index 7070ce6fc..93f143f9a 100755 --- a/deps/v8/tools/linux-tick-processor +++ b/deps/v8/tools/linux-tick-processor @@ -12,21 +12,21 @@ done tools_path=`cd $(dirname "$0");pwd` if [ ! "$D8_PATH" ]; then d8_public=`which d8` - if [ -x $d8_public ]; then D8_PATH=$(dirname "$d8_public"); fi + if [ -x "$d8_public" ]; then D8_PATH=$(dirname "$d8_public"); fi fi -[ "$D8_PATH" ] || D8_PATH=$tools_path/.. +[ -n "$D8_PATH" ] || D8_PATH=$tools_path/.. d8_exec=$D8_PATH/d8 -if [ ! -x $d8_exec ]; then +if [ ! -x "$d8_exec" ]; then D8_PATH=`pwd`/out/native d8_exec=$D8_PATH/d8 fi -if [ ! -x $d8_exec ]; then +if [ ! -x "$d8_exec" ]; then d8_exec=`grep -m 1 -o '".*/d8"' $log_file | sed 's/"//g'` fi -if [ ! -x $d8_exec ]; then +if [ ! -x "$d8_exec" ]; then echo "d8 shell not found in $D8_PATH" echo "To build, execute 'make native' from the V8 directory" exit 1 diff --git a/deps/v8/tools/ll_prof.py b/deps/v8/tools/ll_prof.py index 51ba672ac..3afe179d2 100755 --- a/deps/v8/tools/ll_prof.py +++ b/deps/v8/tools/ll_prof.py @@ -68,15 +68,9 @@ Examples: """ -# Must match kGcFakeMmap. -V8_GC_FAKE_MMAP = "/tmp/__v8_gc__" - JS_ORIGIN = "js" JS_SNAPSHOT_ORIGIN = "js-snapshot" -OBJDUMP_BIN = disasm.OBJDUMP_BIN - - class Code(object): """Code object.""" @@ -639,7 +633,7 @@ class TraceReader(object): # Read null-terminated filename. filename = self.trace[offset + self.header_size + ctypes.sizeof(mmap_info): offset + header.size] - mmap_info.filename = filename[:filename.find(chr(0))] + mmap_info.filename = HOST_ROOT + filename[:filename.find(chr(0))] return mmap_info def ReadSample(self, header, offset): @@ -858,6 +852,15 @@ if __name__ == "__main__": default=False, action="store_true", help="no auxiliary messages [default: %default]") + parser.add_option("--gc-fake-mmap", + default="/tmp/__v8_gc__", + help="gc fake mmap file [default: %default]") + parser.add_option("--objdump", + default="/usr/bin/objdump", + help="objdump tool to use [default: %default]") + parser.add_option("--host-root", + default="", + help="Path to the host root [default: %default]") options, args = parser.parse_args() if not options.quiet: @@ -869,6 +872,14 @@ if __name__ == "__main__": print "V8 log: %s, %s.ll (no snapshot)" % (options.log, options.log) print "Perf trace file: %s" % options.trace + V8_GC_FAKE_MMAP = options.gc_fake_mmap + HOST_ROOT = options.host_root + if os.path.exists(options.objdump): + disasm.OBJDUMP_BIN = options.objdump + OBJDUMP_BIN = options.objdump + else: + print "Cannot find %s, falling back to default objdump" % options.objdump + # Stats. events = 0 ticks = 0 @@ -905,7 +916,7 @@ if __name__ == "__main__": if header.type == PERF_RECORD_MMAP: start = time.time() mmap_info = trace_reader.ReadMmap(header, offset) - if mmap_info.filename == V8_GC_FAKE_MMAP: + if mmap_info.filename == HOST_ROOT + V8_GC_FAKE_MMAP: log_reader.ReadUpToGC() else: library_repo.Load(mmap_info, code_map, options) diff --git a/deps/v8/tools/push-to-trunk.sh b/deps/v8/tools/push-to-trunk.sh index ff6dd1d77..a193d5738 100755 --- a/deps/v8/tools/push-to-trunk.sh +++ b/deps/v8/tools/push-to-trunk.sh @@ -304,11 +304,22 @@ fi let CURRENT_STEP+=1 if [ $START_STEP -le $CURRENT_STEP ] ; then echo ">>> Step $CURRENT_STEP: Commit to SVN." - git svn dcommit | tee >(grep -E "^Committed r[0-9]+" \ - | sed -e 's/^Committed r\([0-9]\+\)/\1/' \ - > "$TRUNK_REVISION_FILE") \ + git svn dcommit 2>&1 | tee >(grep -E "^Committed r[0-9]+" \ + | sed -e 's/^Committed r\([0-9]\+\)/\1/' \ + > "$TRUNK_REVISION_FILE") \ || die "'git svn dcommit' failed." TRUNK_REVISION=$(cat "$TRUNK_REVISION_FILE") + # Sometimes grepping for the revision fails. No idea why. If you figure + # out why it is flaky, please do fix it properly. + if [ -z "$TRUNK_REVISION" ] ; then + echo "Sorry, grepping for the SVN revision failed. Please look for it in \ +the last command's output above and provide it manually (just the number, \ +without the leading \"r\")." + while [ -z "$TRUNK_REVISION" ] ; do + echo -n "> " + read TRUNK_REVISION + done + fi persist "TRUNK_REVISION" rm -f "$TRUNK_REVISION_FILE" fi diff --git a/deps/v8/tools/run-valgrind.py b/deps/v8/tools/run-valgrind.py index f8c23da6d..49c1b7031 100755 --- a/deps/v8/tools/run-valgrind.py +++ b/deps/v8/tools/run-valgrind.py @@ -30,36 +30,48 @@ # Simple wrapper for running valgrind and checking the output on # stderr for memory leaks. -import os -import socket import subprocess import sys import re -VALGRIND = os.environ.get('VALGRIND', 'valgrind') - VALGRIND_ARGUMENTS = [ - VALGRIND, - '--log-socket=127.0.0.1:15151', - '--error-exitcode=247', - '--leak-check=no', - '--smc-check=all', + 'valgrind', + '--error-exitcode=1', + '--leak-check=full', + '--smc-check=all' ] -server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -server.bind(('127.0.0.1', 15151)) -server.listen(1) - +# Compute the command line. command = VALGRIND_ARGUMENTS + sys.argv[1:] + +# Run valgrind. process = subprocess.Popen(command, stderr=subprocess.PIPE) +code = process.wait(); +errors = process.stderr.readlines(); + +# If valgrind produced an error, we report that to the user. +if code != 0: + sys.stderr.writelines(errors) + sys.exit(code) + +# Look through the leak details and make sure that we don't +# have any definitely, indirectly, and possibly lost bytes. +LEAK_RE = r"(?:definitely|indirectly|possibly) lost: " +LEAK_LINE_MATCHER = re.compile(LEAK_RE) +LEAK_OKAY_MATCHER = re.compile(r"lost: 0 bytes in 0 blocks") +leaks = [] +for line in errors: + if LEAK_LINE_MATCHER.search(line): + leaks.append(line) + if not LEAK_OKAY_MATCHER.search(line): + sys.stderr.writelines(errors) + sys.exit(1) -errors = '' -conn, addr = server.accept() -while True: - data = conn.recv(8192) - if not data: break - errors += data +# Make sure we found between 2 and 3 leak lines. +if len(leaks) < 2 or len(leaks) > 3: + sys.stderr.writelines(errors) + sys.stderr.write('\n\n#### Malformed valgrind output.\n#### Exiting.\n') + sys.exit(1) -code = process.wait() -if code == 247: sys.stderr.writelines(errors) -sys.exit(code) +# No leaks found. +sys.exit(0) diff --git a/deps/v8/tools/test-wrapper-gypbuild.py b/deps/v8/tools/test-wrapper-gypbuild.py index d99d055e5..4dd6338dc 100755 --- a/deps/v8/tools/test-wrapper-gypbuild.py +++ b/deps/v8/tools/test-wrapper-gypbuild.py @@ -95,11 +95,14 @@ def BuildOptions(): default=1, type="int") result.add_option("--time", help="Print timing information after running", default=False, action="store_true") - result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests", - dest="suppress_dialogs", default=True, action="store_true") - result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests", - dest="suppress_dialogs", action="store_false") - result.add_option("--isolates", help="Whether to test isolates", default=False, action="store_true") + result.add_option("--suppress-dialogs", + help="Suppress Windows dialogs for crashing tests", + dest="suppress_dialogs", default=True, action="store_true") + result.add_option("--no-suppress-dialogs", + help="Display Windows dialogs for crashing tests", + dest="suppress_dialogs", action="store_false") + result.add_option("--isolates", help="Whether to test isolates", + default=False, action="store_true") result.add_option("--store-unexpected-output", help="Store the temporary JS files from tests that fails", dest="store_unexpected_output", default=True, action="store_true") @@ -148,7 +151,8 @@ def ProcessOptions(options): print "Unknown mode %s" % mode return False for arch in options.arch: - if not arch in ['ia32', 'x64', 'arm', 'mips']: + if not arch in ['ia32', 'x64', 'arm', 'mipsel', 'android_arm', + 'android_ia32']: print "Unknown architecture %s" % arch return False if options.buildbot: @@ -217,9 +221,10 @@ def Main(): if not options.no_presubmit: print ">>> running presubmit tests" - returncodes += subprocess.call([workspace + '/tools/presubmit.py']) + returncodes += subprocess.call([sys.executable, + workspace + '/tools/presubmit.py']) - args_for_children = ['python'] + args_for_children = [sys.executable] args_for_children += [workspace + '/tools/test.py'] + PassOnOptions(options) args_for_children += ['--no-build', '--build-system=gyp'] for arg in args: diff --git a/deps/v8/tools/test.py b/deps/v8/tools/test.py index 5131ad761..c361f9373 100755 --- a/deps/v8/tools/test.py +++ b/deps/v8/tools/test.py @@ -140,9 +140,9 @@ def EscapeCommand(command): parts = [] for part in command: if ' ' in part: - # Escape spaces. We may need to escape more characters for this - # to work properly. - parts.append('"%s"' % part) + # Escape spaces and double quotes. We may need to escape more characters + # for this to work properly. + parts.append('"%s"' % part.replace('"', '\\"')) else: parts.append(part) return " ".join(parts) @@ -299,8 +299,6 @@ class MonochromeProgressIndicator(CompactProgressIndicator): 'status_line': "[%(mins)02i:%(secs)02i|%%%(remaining) 4d|+%(passed) 4d|-%(failed) 4d]: %(test)s", 'stdout': '%s', 'stderr': '%s', - 'clear': lambda last_line_length: ("\r" + (" " * last_line_length) + "\r"), - 'max_length': 78 } super(MonochromeProgressIndicator, self).__init__(cases, templates) @@ -1283,7 +1281,7 @@ def ProcessOptions(options): options.scons_flags.append("arch=" + options.arch) # Simulators are slow, therefore allow a longer default timeout. if options.timeout == -1: - if options.arch == 'arm' or options.arch == 'mips': + if options.arch in ['android', 'arm', 'mipsel']: options.timeout = 2 * TIMEOUT_DEFAULT; else: options.timeout = TIMEOUT_DEFAULT; diff --git a/deps/v8/tools/tickprocessor-driver.js b/deps/v8/tools/tickprocessor-driver.js index 9af5ab6c7..313c6d4c9 100644 --- a/deps/v8/tools/tickprocessor-driver.js +++ b/deps/v8/tools/tickprocessor-driver.js @@ -1,4 +1,4 @@ -// Copyright 2009 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -50,7 +50,7 @@ if (params.snapshotLogFileName) { snapshotLogProcessor.processLogFile(params.snapshotLogFileName); } var tickProcessor = new TickProcessor( - new (entriesProviders[params.platform])(params.nm), + new (entriesProviders[params.platform])(params.nm, params.targetRootFS), params.separateIc, params.callGraphSize, params.ignoreUnknown, diff --git a/deps/v8/tools/tickprocessor.js b/deps/v8/tools/tickprocessor.js index 05a336925..4c4886d87 100644 --- a/deps/v8/tools/tickprocessor.js +++ b/deps/v8/tools/tickprocessor.js @@ -1,4 +1,4 @@ -// Copyright 2009 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -608,10 +608,11 @@ CppEntriesProvider.prototype.parseNextLine = function() { }; -function UnixCppEntriesProvider(nmExec) { +function UnixCppEntriesProvider(nmExec, targetRootFS) { this.symbols = []; this.parsePos = 0; this.nmExec = nmExec; + this.targetRootFS = targetRootFS; this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/; }; inherits(UnixCppEntriesProvider, CppEntriesProvider); @@ -619,6 +620,7 @@ inherits(UnixCppEntriesProvider, CppEntriesProvider); UnixCppEntriesProvider.prototype.loadSymbols = function(libName) { this.parsePos = 0; + libName = this.targetRootFS + libName; try { this.symbols = [ os.system(this.nmExec, ['-C', '-n', '-S', libName], -1, -1), @@ -656,8 +658,8 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() { }; -function MacCppEntriesProvider(nmExec) { - UnixCppEntriesProvider.call(this, nmExec); +function MacCppEntriesProvider(nmExec, targetRootFS) { + UnixCppEntriesProvider.call(this, nmExec, targetRootFS); // Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups. this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ()[iItT] (.*)$/; }; @@ -666,6 +668,7 @@ inherits(MacCppEntriesProvider, UnixCppEntriesProvider); MacCppEntriesProvider.prototype.loadSymbols = function(libName) { this.parsePos = 0; + libName = this.targetRootFS + libName; try { this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), '']; } catch (e) { @@ -675,7 +678,8 @@ MacCppEntriesProvider.prototype.loadSymbols = function(libName) { }; -function WindowsCppEntriesProvider() { +function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS) { + this.targetRootFS = targetRootFS; this.symbols = ''; this.parsePos = 0; }; @@ -698,6 +702,7 @@ WindowsCppEntriesProvider.EXE_IMAGE_BASE = 0x00400000; WindowsCppEntriesProvider.prototype.loadSymbols = function(libName) { + libName = this.targetRootFS + libName; var fileNameFields = libName.match(WindowsCppEntriesProvider.FILENAME_RE); if (!fileNameFields) return; var mapFileName = fileNameFields[1] + '.map'; @@ -785,6 +790,8 @@ function ArgumentsProcessor(args) { 'Specify that we are running on Mac OS X platform'], '--nm': ['nm', 'nm', 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], + '--target': ['targetRootFS', '', + 'Specify the target root directory for cross environment'], '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'] }; @@ -804,6 +811,7 @@ ArgumentsProcessor.DEFAULTS = { callGraphSize: 5, ignoreUnknown: false, separateIc: false, + targetRootFS: '', nm: 'nm' }; |