Bug 15529 - Add missing copyright boilerplate to files in js/src, remove dead files (r=brendan,graydon,jimb)

--HG--
rename : js/src/perfect.js => js/src/tests/js1_1/regress/perfect.js
This commit is contained in:
Luke Wagner 2011-06-21 10:26:22 -07:00
parent 73e4f8616d
commit 3f185cc410
9 changed files with 82 additions and 544 deletions

View File

@ -1,3 +0,0 @@
mozilla/js/src/*
mozilla/js/src/config/*
mozilla/js/src/macbuild/*

View File

@ -1,5 +0,0 @@
#!/bin/bash
X="var d = Date.now();";
for i in t/*.js; do X="$X load(\"$i\");"; done
X="$X print(Date.now() - d);"
echo $X | $1 -j

View File

@ -1,4 +1,40 @@
#!/usr/bin/python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is SpiderMonkey JavaScript engine.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Graydon Hoare <graydon@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#
# The output of this script is a splicemap.
#

View File

@ -1,4 +1,40 @@
#!/bin/sh
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is SpiderMonkey JavaScript engine.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jim Blandy <jimb@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
prefix='@prefix@'
mozilla_version='@MOZILLA_VERSION@'

View File

@ -1,483 +0,0 @@
#!/usr/local/bin/perl
# This script modifies C code to use the hijacked NSPR routines that are
# now baked into the JavaScript engine rather than using the NSPR
# routines that they were based on, i.e. types like PRArenaPool are changed
# to JSArenaPool.
#
# This script was used in 9/98 to facilitate the incorporation of some NSPR
# code into the JS engine so as to minimize dependency on NSPR.
#
# Command-line: jsify.pl [options] [filename]*
#
# Options:
# -r Reverse direction of transformation, i.e. JS ==> NSPR2
# -outdir Directory in which to place output files
# NSPR2 symbols that will be modified to JS symbols, e.g.
# PRArena <==> JSArena
@NSPR_symbols = (
"PRArena",
"PRArenaPool",
"PRArenaStats",
"PR_ARENAMETER",
"PR_ARENA_",
"PR_ARENA_ALIGN",
"PR_ARENA_ALLOCATE",
"PR_ARENA_CONST_ALIGN_MASK",
"PR_ARENA_DEFAULT_ALIGN",
"PR_ARENA_DESTROY",
"PR_ARENA_GROW",
"PR_ARENA_MARK",
"PR_ARENA_RELEASE",
"PR_smprintf",
"PR_smprintf_free",
"PR_snprintf",
"PR_sprintf_append",
"PR_sscanf",
"PR_sxprintf",
"PR_vsmprintf",
"PR_vsnprintf",
"PR_vsprintf_append",
"PR_vsxprintf",
"PRCList",
"PRCListStr",
"PRCLists",
"PRDestroyEventProc",
"PREvent",
"PREventFunProc",
"PREventQueue",
"PRHandleEventProc",
"PR_PostEvent",
"PR_PostSynchronousEvent",
"PR_ProcessPendingEvents",
"PR_CreateEventQueue",
"PR_DequeueEvent",
"PR_DestroyEvent",
"PR_DestroyEventQueue",
"PR_EventAvailable",
"PR_EventLoop",
"PR_GetEvent",
"PR_GetEventOwner",
"PR_GetEventQueueMonitor",
"PR_GetEventQueueSelectFD",
"PR_GetMainEventQueue",
"PR_HandleEvent",
"PR_InitEvent",
"PR_ENTER_EVENT_QUEUE_MONITOR",
"PR_EXIT_EVENT_QUEUE_MONITOR",
"PR_MapEvents",
"PR_RevokeEvents",
"PR_cnvtf",
"PR_dtoa",
"PR_strtod",
"PRFileDesc",
"PR_HASH_BITS",
"PR_GOLDEN_RATIO",
"PRHashAllocOps",
"PRHashComparator",
"PRHashEntry",
"PRHashEnumerator",
"PRHashFunction",
"PRHashNumber",
"PRHashTable",
"PR_HashString",
"PR_HashTableAdd",
"PR_HashTableDestroy",
"PR_HashTableDump",
"PR_HashTableEnumerateEntries",
"PR_HashTableLookup",
"PR_HashTableRawAdd",
"PR_HashTableRawLookup",
"PR_HashTableRawRemove",
"PR_HashTableRemove",
"PRBool",
"PRFloat64",
"PRInt16",
"PRInt32",
"PRInt64",
"PRInt8",
"PRIntn",
"PRUint16",
"PRUint32",
"PRUint64",
"PRUint8",
"PRUintn",
"PRPtrDiff",
"PRPtrdiff",
"PRUptrdiff",
"PRUword",
"PRWord",
"PRPackedBool",
"PRSize",
"PRStatus",
"pruword",
"prword",
"prword_t",
"PR_ALIGN_OF_DOUBLE",
"PR_ALIGN_OF_FLOAT",
"PR_ALIGN_OF_INT",
"PR_ALIGN_OF_INT64",
"PR_ALIGN_OF_LONG",
"PR_ALIGN_OF_POINTER",
"PR_ALIGN_OF_SHORT",
"PR_ALIGN_OF_WORD",
"PR_BITS_PER_BYTE",
"PR_BITS_PER_BYTE_LOG2",
"PR_BITS_PER_DOUBLE",
"PR_BITS_PER_DOUBLE_LOG2",
"PR_BITS_PER_FLOAT",
"PR_BITS_PER_FLOAT_LOG2",
"PR_BITS_PER_INT",
"PR_BITS_PER_INT64",
"PR_BITS_PER_INT64_LOG2",
"PR_BITS_PER_INT_LOG2",
"PR_BITS_PER_LONG",
"PR_BITS_PER_LONG_LOG2",
"PR_BITS_PER_SHORT",
"PR_BITS_PER_SHORT_LOG2",
"PR_BITS_PER_WORD",
"PR_BITS_PER_WORD_LOG2",
"PR_BYTES_PER_BYTE",
"PR_BYTES_PER_DOUBLE",
"PR_BYTES_PER_DWORD",
"PR_BYTES_PER_DWORD_LOG2",
"PR_BYTES_PER_FLOAT",
"PR_BYTES_PER_INT",
"PR_BYTES_PER_INT64",
"PR_BYTES_PER_LONG",
"PR_BYTES_PER_SHORT",
"PR_BYTES_PER_WORD",
"PR_BYTES_PER_WORD_LOG2",
"PRSegment",
"PRSegmentAccess",
"PRStuffFunc",
"PRThread",
"PR_APPEND_LINK",
"PR_ASSERT",
"PR_ATOMIC_DWORD_LOAD",
"PR_ATOMIC_DWORD_STORE",
"PR_Abort",
"PR_ArenaAllocate",
"PR_ArenaCountAllocation",
"PR_ArenaCountGrowth",
"PR_ArenaCountInplaceGrowth",
"PR_ArenaCountRelease",
"PR_ArenaCountRetract",
"PR_ArenaFinish",
"PR_ArenaGrow",
"PR_ArenaRelease",
"PR_CompactArenaPool",
"PR_DumpArenaStats",
"PR_FinishArenaPool",
"PR_FreeArenaPool",
"PR_InitArenaPool",
"PR_Assert",
"PR_AttachThread",
"PR_BEGIN_EXTERN_C",
"PR_BEGIN_MACRO",
"PR_BIT",
"PR_BITMASK",
"PR_BUFFER_OVERFLOW_ERROR",
"PR_CALLBACK",
"PR_CALLBACK_DECL",
"PR_CALLOC",
"PR_CEILING_LOG2",
"PR_CLEAR_ARENA",
"PR_CLEAR_BIT",
"PR_CLEAR_UNUSED",
"PR_CLIST_IS_EMPTY",
"PR_COUNT_ARENA",
"PR_CURRENT_THREAD",
"PR_GetSegmentAccess",
"PR_GetSegmentSize",
"PR_GetSegmentVaddr",
"PR_GrowSegment",
"PR_DestroySegment",
"PR_MapSegment",
"PR_NewSegment",
"PR_Segment",
"PR_Seg",
"PR_SEGMENT_NONE",
"PR_SEGMENT_RDONLY",
"PR_SEGMENT_RDWR",
"PR_Calloc",
"PR_CeilingLog2",
"PR_CompareStrings",
"PR_CompareValues",
"PR_DELETE",
"PR_END_EXTERN_C",
"PR_END_MACRO",
"PR_ENUMERATE_STOP",
"PR_FAILURE",
"PR_FALSE",
"PR_FLOOR_LOG2",
"PR_FREEIF",
"PR_FREE_PATTERN",
"PR_FloorLog2",
"PR_FormatTime",
"PR_Free",
"PR_GetEnv",
"PR_GetError",
"PR_INIT_ARENA_POOL",
"PR_INIT_CLIST",
"PR_INIT_STATIC_CLIST",
"PR_INLINE",
"PR_INSERT_AFTER",
"PR_INSERT_BEFORE",
"PR_INSERT_LINK",
"PR_INT32",
"PR_INTERVAL_NO_TIMEOUT",
"PR_INTERVAL_NO_WAIT",
"PR_Init",
"PR_LIST_HEAD",
"PR_LIST_TAIL",
"PR_LOG",
"PR_LOGGING",
"PR_LOG_ALWAYS",
"PR_LOG_BEGIN",
"PR_LOG_DEBUG",
"PR_LOG_DEFINE",
"PR_LOG_END",
"PR_LOG_ERROR",
"PR_LOG_MAX",
"PR_LOG_MIN",
"PR_LOG_NONE",
"PR_LOG_NOTICE",
"PR_LOG_TEST",
"PR_LOG_WARN",
"PR_LOG_WARNING",
"PR_LogFlush",
"PR_LogPrint",
"PR_MALLOC",
"PR_MAX",
"PR_MD_calloc",
"PR_MD_free",
"PR_MD_malloc",
"PR_MD_realloc",
"PR_MIN",
"PR_Malloc",
"PR_NEW",
"PR_NEWZAP",
"PR_NEXT_LINK",
"PR_NOT_REACHED",
"PR_NewCondVar",
"PR_NewHashTable",
"PR_NewLogModule",
"PR_PREV_LINK",
"PR_PUBLIC_API",
"PR_PUBLIC_DATA",
"PR_RANGE_ERROR",
"PR_REALLOC",
"PR_REMOVE_AND_INIT_LINK",
"PR_REMOVE_LINK",
"PR_ROUNDUP",
"PR_Realloc",
"PR_SET_BIT",
"PR_STATIC_CALLBACK",
"PR_SUCCESS",
"PR_SetError",
"PR_SetLogBuffering",
"PR_SetLogFile",
"PR_TEST_BIT",
"PR_TRUE",
"PR_UINT32",
"PR_UPTRDIFF",
"prarena_h___",
"prbit_h___",
"prclist_h___",
"prdtoa_h___",
"prlog_h___",
"prlong_h___",
"prmacos_h___",
"prmem_h___",
"prprf_h___",
"prtypes_h___",
"prarena",
"prbit",
"prbitmap_t",
"prclist",
"prcpucfg",
"prdtoa",
"prhash",
"plhash",
"prlong",
"prmacos",
"prmem",
"prosdep",
"protypes",
"prprf",
"prtypes"
);
while ($ARGV[0] =~ /^-/) {
if ($ARGV[0] eq "-r") {
shift;
$reverse_conversion = 1;
} elsif ($ARGV[0] eq "-outdir") {
shift;
$outdir = shift;
}
}
# Given an NSPR symbol compute the JS equivalent or
# vice-versa
sub subst {
local ($replacement);
local ($sym) = @_;
$replacement = substr($sym,0,2) eq "pr" ? "js" : "JS";
$replacement .= substr($sym, 2);
return $replacement;
}
# Build the regular expression that will convert between the NSPR
# types and the JS types
if ($reverse_conversion) {
die "Not implemented yet";
} else {
foreach $sym (@NSPR_symbols) {
$regexp .= $sym . "|"
}
# Get rid of the last "!"
chop $regexp;
# Replace PR* with JS* and replace pr* with js*
$regexp = 's/(^|\\W)(' . $regexp . ')/$1 . &subst($2)/eg';
# print $regexp;
}
# Pre-compile a little subroutine to perform the regexp substitution
# between NSPR types and JS types
eval('sub convert_from_NSPR {($line) = @_; $line =~ ' . $regexp . ';}');
sub convert_mallocs {
($line) = @_;
$line =~ s/PR_MALLOC/malloc/g;
$line =~ s/PR_REALLOC/realloc/g;
$line =~ s/PR_FREE/free/g;
return $line;
}
sub convert_includes {
($line) = @_;
if ($line !~ /include/) {
return $line;
}
if ($line =~ /prlog\.h/) {
$line = '#include "jsutil.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /plhash\.h/) {
$line = '#include "jshash.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /plarena\.h/) {
$line = '#include "jsarena.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /prmem\.h/) {
$line = "";
} elsif ($line =~ /jsmsg\.def/) {
$line = '#include "js.msg"' . "\n";
} elsif ($line =~ /shellmsg\.def/) {
$line = '#include "jsshell.msg"' . "\n";
} elsif ($line =~ /jsopcode\.def/) {
$line = '#include "jsopcode.tbl"' . "\n";
}
return $line;
}
sub convert_declarations {
($line) = @_;
$line =~ s/PR_EXTERN/JS_EXTERN_API/g;
$line =~ s/PR_IMPLEMENT_DATA/JS_EXPORT_DATA/g;
$line =~ s/PR_IMPLEMENT/JS_EXPORT_API/g;
$line =~ s/PR_IMPORT/JS_IMPORT/g;
$line =~ s/PR_PUBLIC_API/JS_EXPORT_API/g;
$line =~ s/PR_PUBLIC_DATA/JS_EXPORT_DATA/g;
return $line;
}
sub convert_long_long_macros {
($line) = @_;
$line =~ s/\b(LL_)/JSLL_/g;
return $line;
}
sub convert_asserts {
($line) = @_;
$line =~ s/\bPR_ASSERT/JS_ASSERT/g;
return $line;
}
while ($#ARGV >= 0) {
$infile = shift;
# Change filename, e.g. prtime.h to jsprtime.h, except for legacy
# files that start with 'prmj', like prmjtime.h.
$outfile = $infile;
if ($infile !~ /^prmj/) {
$outfile =~ s/^pr/js/;
$outfile =~ s/^pl/js/;
}
if ($outdir) {
$outfile = $outdir . '/' . $outfile;
}
if ($infile eq $outfile) {
die "Error: refuse to overwrite $outfile, use -outdir option."
}
die "Can't open $infile" if !open(INFILE, "<$infile");
die "Can't open $outfile for writing" if !open(OUTFILE, ">$outfile");
while (<INFILE>) {
$line = $_;
#Get rid of #include "prlog.h"
&convert_includes($line);
# Rename PR_EXTERN, PR_IMPORT, etc.
&convert_declarations($line);
# Convert from PR_MALLOC to malloc, etc.
&convert_mallocs($line);
# Convert from PR_ASSERT to JS_ASSERT
# &convert_asserts($line);
# Convert from, e.g. PRArena to JSPRArena
&convert_from_NSPR($line);
# Change LL_* macros to JSLL_*
&convert_long_long_macros($line);
print OUTFILE $line;
}
}

View File

@ -1,39 +0,0 @@
/ * Double hashing implementation./a\
\ * GENERATED BY js/src/plify_jsdhash.sed -- DO NOT EDIT!!!
/ * Double hashing, a la Knuth 6./a\
\ * GENERATED BY js/src/plify_jsdhash.sed -- DO NOT EDIT!!!
s/jsdhash_h___/pldhash_h___/
s/jsdhash\.bigdump/pldhash.bigdump/
s/jstypes\.h/nscore.h/
s/jsbit\.h/prbit.h/
s/jsdhash\.h/pldhash.h/
s/jsdhash\.c/pldhash.c/
s/jsdhash:/pldhash:/
s/jsutil\.h/nsDebug.h/
s/JS_DHASH/PL_DHASH/g
s/JS_DHash/PL_DHash/g
s/JSDHash/PLDHash/g
s/JSHash/PLHash/g
s/uint8 /PRUint8/g
s/uint16 /PRUint16/g
s/uint32 /PRUint32/g
s/\([^U]\)int8 /\1PRInt8/g
s/\([^U]\)int16 /\1PRInt16/g
s/\([^U]\)int32 /\1PRInt32/g
s/uint8/PRUint8/g
s/uint16/PRUint16/g
s/uint32/PRUint32/g
s/\([^U]\)int8/\1PRInt8/g
s/\([^U]\)int16/\1PRInt16/g
s/\([^U]\)int32/\1PRInt32/g
s/JSBool/PRBool/g
s/extern JS_PUBLIC_API(\([^()]*\))/NS_COM_GLUE \1/
s/JS_PUBLIC_API(\([^()]*\))/\1/
s/JS_NewDHashTable/PL_NewDHashTable/
s/JS_ASSERT(0)/NS_NOTREACHED("0")/
s/\( *\)JS_ASSERT(\(.*\));/\1NS_ASSERTION(\2,\n\1 "\2");/
s/JSDHASH_ONELINE_ASSERT(\(.*\));/NS_ASSERTION(\1, "\1");/
s/JS_UNLIKELY/NS_UNLIKELY/g
s/JS_LIKELY/NS_LIKELY/g
s/JS_/PR_/g
s/fprintf(stderr,/printf_stderr(/

View File

@ -1,2 +1,3 @@
url-prefix ../../jsreftest.html?test=js1_1/regress/
script perfect.js
script function-001.js

View File

@ -1,3 +1,8 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
// Some simple testing of new, eval and some string stuff.
// constructor -- expression array initialization
@ -14,6 +19,7 @@ function ExprArray(n,v)
function perfect(n)
{
print("The perfect numbers up to " + n + " are:");
var results = [];
// We build sumOfDivisors[i] to hold a string expression for
// the sum of the divisors of i, excluding i itself.
@ -27,13 +33,15 @@ function perfect(n)
// already by evaluating.
if (eval(sumOfDivisors[divisor]) == divisor) {
print("" + divisor + " = " + sumOfDivisors[divisor]);
results.push(divisor);
}
}
print("That's all.");
return results;
}
print("\nA number is 'perfect' if it is equal to the sum of its")
print("divisors (excluding itself).\n");
perfect(500);
reportCompare(perfect(500).join(), "6,28,496");

View File

@ -1,13 +0,0 @@
#!/bin/bash
echo -n interp:' '
for i in 1 2 3 4 5; do
INTERP=`Darwin_OPT.OBJ/js -e 'var d = Date.now(); load("'$1'"); print(Date.now() - d);'`
echo -n $INTERP' '
done
echo -ne '\njit: '
for i in 1 2 3 4 5; do
JIT=`Darwin_OPT.OBJ/js -j -e 'var d = Date.now(); load("'$1'"); print(Date.now() - d);'`
echo -n $JIT' '
done
echo -ne '\njit factor: '
(echo scale=2; echo $INTERP / $JIT ) | bc