mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1592992 - Part 19: Move jsutil.cpp to util/Utility.cpp. r=jonco
This file provides the implementation of js/Utility.h, so it should be renamed to match the header name. Differential Revision: https://phabricator.services.mozilla.com/D51378 --HG-- rename : js/src/jsutil.cpp => js/src/util/Utility.cpp extra : moz-landing-system : lando
This commit is contained in:
parent
7e0e092dc9
commit
a1298a12f9
@ -53,10 +53,10 @@ import buildconfig
|
||||
# this script could be buggy. (Or the output format of |nm| might change in
|
||||
# the future.)
|
||||
#
|
||||
# So jsutil.cpp deliberately contains a (never-called) function that contains a
|
||||
# single use of all the vanilla allocation/free functions. And this script
|
||||
# fails if it (a) finds uses of those functions in files other than jsutil.cpp,
|
||||
# *or* (b) fails to find them in jsutil.cpp.
|
||||
# So util/Utility.cpp deliberately contains a (never-called) function that
|
||||
# contains a single use of all the vanilla allocation/free functions. And this
|
||||
# script fails if it (a) finds uses of those functions in files other than
|
||||
# util/Utility.cpp, *or* (b) fails to find them in util/Utility.cpp.
|
||||
|
||||
# Tracks overall success of the test.
|
||||
has_failed = False
|
||||
@ -117,12 +117,13 @@ def main():
|
||||
# This regexp matches the relevant lines in the output of |nm|, which look
|
||||
# like the following.
|
||||
#
|
||||
# js/src/libjs_static.a:jsutil.o: U malloc
|
||||
# js/src/libjs_static.a:Utility.o: U malloc
|
||||
#
|
||||
alloc_fns_re = r'([^:/ ]+):\s+U (' + r'|'.join(alloc_fns) + r')'
|
||||
|
||||
# This tracks which allocation/free functions have been seen in jsutil.cpp.
|
||||
jsutil_cpp = set([])
|
||||
# This tracks which allocation/free functions have been seen in
|
||||
# util/Utility.cpp.
|
||||
util_Utility_cpp = set([])
|
||||
|
||||
# Would it be helpful to emit detailed line number information after a failure?
|
||||
emit_line_info = False
|
||||
@ -166,26 +167,26 @@ def main():
|
||||
continue
|
||||
|
||||
fn = m.group(2)
|
||||
if filename == 'jsutil.o':
|
||||
jsutil_cpp.add(fn)
|
||||
if filename == 'Utility.o':
|
||||
util_Utility_cpp.add(fn)
|
||||
else:
|
||||
# An allocation is present in a non-special file. Fail!
|
||||
fail("'" + fn + "' present in " + filename)
|
||||
# Try to give more precise information about the offending code.
|
||||
emit_line_info = True
|
||||
|
||||
# Check that all functions we expect are used in jsutil.cpp. (This will
|
||||
# fail if the function-detection code breaks at any point.)
|
||||
# Check that all functions we expect are used in util/Utility.cpp. (This
|
||||
# will fail if the function-detection code breaks at any point.)
|
||||
for fn in alloc_fns_unescaped:
|
||||
if fn not in jsutil_cpp:
|
||||
fail("'" + fn + "' isn't used as expected in jsutil.cpp")
|
||||
if fn not in util_Utility_cpp:
|
||||
fail("'" + fn + "' isn't used as expected in util/Utility.cpp")
|
||||
else:
|
||||
jsutil_cpp.remove(fn)
|
||||
util_Utility_cpp.remove(fn)
|
||||
|
||||
# This should never happen, but check just in case.
|
||||
if jsutil_cpp:
|
||||
fail('unexpected allocation fns used in jsutil.cpp: ' +
|
||||
', '.join(jsutil_cpp))
|
||||
if util_Utility_cpp:
|
||||
fail('unexpected allocation fns used in util/Utility.cpp: ' +
|
||||
', '.join(util_Utility_cpp))
|
||||
|
||||
# If we found any improper references to allocation functions, try to use
|
||||
# DWARF debug info to get more accurate line number information about the
|
||||
@ -193,7 +194,8 @@ def main():
|
||||
# precise when building with --enable-optimized.
|
||||
if emit_line_info:
|
||||
print('check_vanilla_allocations.py: Source lines with allocation calls:')
|
||||
print('check_vanilla_allocations.py: Accurate in unoptimized builds; jsutil.cpp expected.')
|
||||
print('check_vanilla_allocations.py: Accurate in unoptimized builds; '
|
||||
'util/Utility.cpp expected.')
|
||||
|
||||
# Run |nm|. Options:
|
||||
# -u: show only undefined symbols
|
||||
@ -206,7 +208,7 @@ def main():
|
||||
# This regexp matches the relevant lines in the output of |nm -l|,
|
||||
# which look like the following.
|
||||
#
|
||||
# U malloc jsutil.cpp:117
|
||||
# U malloc util/Utility.cpp:117
|
||||
#
|
||||
alloc_lines_re = r'U ((' + r'|'.join(alloc_fns) + r').*)\s+(\S+:\d+)$'
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace oom {
|
||||
* off-thread script parsing without causing an OOM in the active thread first.
|
||||
*
|
||||
* Getter/Setter functions to encapsulate mozilla::ThreadLocal, implementation
|
||||
* is in jsutil.cpp.
|
||||
* is in util/Utility.cpp.
|
||||
*/
|
||||
# if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
|
||||
|
||||
|
@ -361,17 +361,17 @@ UNIFIED_SOURCES += [
|
||||
# win32 test slowdowns
|
||||
# jsmath.cpp cannot be built in unified mode because it needs to re-#define the
|
||||
# RtlGenRandom declaration's calling convention in <ntsecapi.h> on Windows.
|
||||
# jsutil.cpp cannot be built in unified mode because it is needed for
|
||||
# check-vanilla-allocations.
|
||||
# util/DoubleToString.cpp cannot be built in unified mode because we want to
|
||||
# suppress compiler warnings in third-party dtoa.c.
|
||||
# util/Utility.cpp cannot be built in unified mode because it is needed for
|
||||
# check-vanilla-allocations.
|
||||
# vm/Interpreter.cpp is gigantic and destroys incremental build times for any
|
||||
# files unlucky enough to be unified with it.
|
||||
SOURCES += [
|
||||
'builtin/RegExp.cpp',
|
||||
'jsmath.cpp',
|
||||
'jsutil.cpp',
|
||||
'util/DoubleToString.cpp',
|
||||
'util/Utility.cpp',
|
||||
'vm/Interpreter.cpp',
|
||||
'vm/ProfilingStack.cpp',
|
||||
]
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
/* Various JS utility functions. */
|
||||
|
||||
#include "js/Utility.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
@ -15,7 +17,6 @@
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "js/Utility.h"
|
||||
#include "util/Poison.h"
|
||||
#include "util/Windows.h"
|
||||
#include "vm/HelperThreads.h"
|
Loading…
Reference in New Issue
Block a user