| OLD | NEW |
| 1 #!/bin/bash | |
| 2 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 5 # met: | 4 # met: |
| 6 # | 5 # |
| 7 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 11 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| 12 # with the distribution. | 11 # with the distribution. |
| 13 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
| 14 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
| 15 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
| 16 # | 15 # |
| 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 27 |
| 29 # Runs d8 with the given arguments on the device under 'perf' and | 28 """Top-level presubmit script for V8. |
| 30 # processes the profiler trace and v8 logs using ll_prof.py. | |
| 31 # | |
| 32 # Usage: | |
| 33 # > ./tools/android-ll-prof.sh (debug|release) "args to d8" "args to ll_prof.py" | |
| 34 # | |
| 35 # The script creates deploy directory deploy/data/local/tmp/v8, copies there | |
| 36 # the d8 binary either from out/android_arm.release or out/android_arm.debug, | |
| 37 # and then sync the deploy directory with /data/local/tmp/v8 on the device. | |
| 38 # You can put JS files in the deploy directory before running the script. | |
| 39 # Note: $ANDROID_NDK_ROOT must be set. | |
| 40 | 29 |
| 41 MODE=$1 | 30 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 42 RUN_ARGS=$2 | 31 for more details about the presubmit API built into gcl. |
| 43 LL_PROF_ARGS=$3 | 32 """ |
| 44 | 33 |
| 45 BASE=`cd $(dirname "$0")/..; pwd` | 34 def _V8PresubmitChecks(input_api, output_api): |
| 46 DEPLOY="$BASE/deploy" | 35 """Runs the V8 presubmit checks.""" |
| 36 import sys |
| 37 sys.path.append(input_api.os_path.join( |
| 38 input_api.PresubmitLocalPath(), 'tools')) |
| 39 from presubmit import CppLintProcessor |
| 40 from presubmit import SourceProcessor |
| 47 | 41 |
| 48 set +e | 42 results = [] |
| 49 mkdir -p "$DEPLOY/data/local/tmp/v8" | 43 if not CppLintProcessor().Run(input_api.PresubmitLocalPath()): |
| 44 results.append(output_api.PresubmitError("C++ lint check failed")) |
| 45 if not SourceProcessor().Run(input_api.PresubmitLocalPath()): |
| 46 results.append(output_api.PresubmitError( |
| 47 "Copyright header and trailing whitespaces check failed")) |
| 48 return results |
| 50 | 49 |
| 51 cp "$BASE/out/android_arm.$MODE/d8" "$DEPLOY/data/local/tmp/v8/d8" | |
| 52 | 50 |
| 53 adb -p "$DEPLOY" sync data | 51 def _CommonChecks(input_api, output_api): |
| 52 """Checks common to both upload and commit.""" |
| 53 results = [] |
| 54 results.extend(input_api.canned_checks.CheckOwners( |
| 55 input_api, output_api, source_file_filter=None)) |
| 56 return results |
| 54 | 57 |
| 55 adb shell "cd /data/local/tmp/v8;\ | |
| 56 perf record -R -e cycles -c 10000 -f -i \ | |
| 57 ./d8 --ll_prof --gc-fake-mmap=/data/local/tmp/__v8_gc__ $RUN_ARGS" | |
| 58 | 58 |
| 59 adb pull /data/local/tmp/v8/v8.log . | 59 def CheckChangeOnUpload(input_api, output_api): |
| 60 adb pull /data/local/tmp/v8/v8.log.ll . | 60 results = [] |
| 61 adb pull /data/perf.data . | 61 results.extend(_CommonChecks(input_api, output_api)) |
| 62 return results |
| 62 | 63 |
| 63 ARCH=arm-linux-androideabi-4.6 | |
| 64 TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/$ARCH/prebuilt/linux-x86/bin" | |
| 65 | 64 |
| 66 $BASE/tools/ll_prof.py --host-root="$BASE/deploy" \ | 65 def CheckChangeOnCommit(input_api, output_api): |
| 67 --gc-fake-mmap=/data/local/tmp/__v8_gc__ \ | 66 results = [] |
| 68 --objdump="$TOOLCHAIN/arm-linux-androideabi-objdump" \ | 67 results.extend(_CommonChecks(input_api, output_api)) |
| 69 $LL_PROF_ARGS | 68 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 69 input_api, output_api)) |
| 70 results.extend(_V8PresubmitChecks(input_api, output_api)) |
| 71 return results |
| OLD | NEW |