diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index d332e8bb964e..5074dcd958f2 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -670,7 +670,7 @@ ProcessFile(JSContext *cx, } bufp += strlen(bufp); lineno++; - } while (!JS_BufferIsCompilableUnit(cx, obj, buffer, strlen(buffer))); + } while (!JS_BufferIsCompilableUnit(cx, JS_FALSE, obj, buffer, strlen(buffer))); /* Clear any pending exception from previous failed compiles. */ JS_ClearPendingException(cx); diff --git a/js/landbranch.pl b/js/landbranch.pl deleted file mode 100755 index 369b74d43e03..000000000000 --- a/js/landbranch.pl +++ /dev/null @@ -1,227 +0,0 @@ -#! /usr/local/bin/perl5 - -use File::Path; - -# The development branch is where primary development and checkins -# are done on a day-to-day basis. -$development_branch_prefix = "SpiderMonkey140"; - -# Space-separated list of CVS-controlled directories to tag/merge -$merge_dirs = - "mozilla/js/src " ; - -# When line below uncommented, don't recurse into subdirs -#$recurse_flag = '-l'; - -#---------------------------------------------------------------------------- - -# The merge branch is itself a branch off of the development branch -# at a point where the development branch is thought to be stable. -# (A branch is used rather than a static tag because, inevitably, -# the development branch is not quite as stable/buildable as was -# thought.) The contents of the merge branch will be copied to -# the trunk when merging takes place. - - -# The following tags are created automatically by this script: -# -# JS_STABLE_DROP -# -# A static tag on the development branch (or a branch off the -# development branch) that indicates the code that should be merged -# into the trunk. This is a "variable" tag in the sense that it is -# redefined after each merge. -# -# JS_LAST_STABLE_DROP -# -# A static tag that is a copy of what the JS_STABLE_DROP tag was in -# the previous merge cycle. This is a "variable" tag that is -# redefined after each merge. Changes in the branch can be merged -# to the trunk by using: -# -# cvs up -jJS_LAST_STABLE_DROP -jJS_STABLE_DROP -# -# JS_LANDING -# -# A static tag that identifies the code on the trunk after the merge -# from the branch to the trunk takes place. This is a "variable" -# tag that is redefined after each merge. Changes on the trunk -# since the last branch landing can be seen by using: -# -# cvs diff -rJS_LANDING -rHEAD -# -# JS_LANDING_mmddyyyy -# -# This is a tag on the trunk which may be used for archaeological -# purposes. This tag is made from the JS_LANDING tag. - - -$development_branch = $development_branch_prefix . "_BRANCH"; -$development_base = $development_branch_prefix . "_BASE"; - -sub help { -print <<"END"; -$0: A tool for merging stable snapshots of JavaScript from a CVS -development branch onto the trunk - -Landing a snapshot of the development branch consists of -the following steps: - - 1) Tag all/some files on the branch to identify files to be merged. - 2) Merge files from the branch into the trunk using a temporary - working directory. - 3) Resolve any conflicts that arise as a result of the merge. - 4) Commit merged changes to the trunk. - 5) Make changes to resolve (build) difficulties and re-commit. - Repeat as necessary. - 6) Backpropagate changes on the trunk to the development branch. - -This script will assist with steps #2, #4 and #6: - - $0 -merge JS_STABLE_10131998 - $0 -commit - $0 -backpatch - -END -} - -sub log { - local($msg) = @_; - print LOGFILE $msg if $logfile; -} - -# Similar to die built-in -sub die { - local($msg) = @_; - &log($msg); - chomp($msg); - if ($logfile) { - $msg .= "\nSee $logfile for details."; - } - die "$msg\n"; -} - -# Similar to system() built-in -sub system { - local(@args) = @_; - local($cmd) = join(" ", @args); - &log("Executing: $cmd\n"); - - if ($logfile) { - $cmd .= " >> $logfile 2>&1"; - close(LOGFILE); - } - - local($result) = 0xffff & system($cmd); - - if ($logfile) { - open(LOGFILE, ">>$logfile"); - } - - return unless ($result); - $msg = "Died while executing $cmd"; - - if ($result == 0xff00) { - &die("$msg\nWhile executExecution failed due to perl error: $!. "); - } else { - $result >>= 8; - &die("$msg\nExecution failed; exit status: $result. "); - } -} - -chomp($root_dir = `pwd`); - -# Default log file -$logfile = $root_dir . "/log"; - -while ($#ARGV >=0) { - $_ = shift; - - if (/-merge/) { - $do_tag = 1; - $do_checkout = 1; - $do_merge = 1; - $tag = shift; - } elsif (/-commit/ || /-ci/) { - $do_commit = 1; - } elsif (/-backpatch/) { - $do_backpatch = 1; - } elsif (/-log/) { - $logfile = shift; - } elsif (/-tag/) { # Debugging option - $do_tag = 1; - $tag = shift; - } elsif (/-co/) { # Debugging option - $do_checkout = 1; - } else { - print STDERR "Illegal option: $_\n" unless (/-h/); - &help(); - exit(1); - } -} - -die "You must set your CVSROOT environment variable" if !$ENV{"CVSROOT"}; - -if ($logfile) { - open(LOGFILE, ">$logfile") || die "Couldn't open log file \"$logfile\""; - print("Logging to file \"$logfile\".\n"); -} - -$trunk_dir = $root_dir . "/trunk"; - -if ($do_tag) { - if (!$tag) { - &die("Must specify tag on command-line\n"); - } - - print("Tagging tree with tag JS_STABLE_DROP.\n"); - &system("cvs rtag $recurse_flag -F -r $tag JS_STABLE_DROP $merge_dirs"); -} - -if ($do_checkout) { - - # Delete trunk subdir if it already exists - if (-d $trunk_dir) { - &log("Deleting directory $trunk_dir\n"); - rmtree ($trunk_dir, 0, 1); - } - &log("Creating directory $trunk_dir\n"); - mkdir($trunk_dir, 0777) || die "Couldn't create directory $trunk_dir"; - - # Check out on trunk - print("Checking out $merge_dirs.\n"); - chdir $trunk_dir; - &system("cvs co $recurse_flag -A $merge_dirs"); -} - -if ($do_merge) { - chdir $trunk_dir; - print("Merging from JS_STABLE_DROP into trunk\n"); - &system("cvs up -jJS_LAST_STABLE_DROP -jJS_STABLE_DROP"); -} - -if ($do_commit) { - &die("No merged tree found. Wrong directory ?") if (!chdir $trunk_dir); - - ($_,$_,$_,$day,$mon,$year,$_,$_) = localtime(time()); - if ($year < 30) { - $year = "20" . $year; - } else { - $year = "19" . $year; - } - - $mmddyyyy = sprintf("%02d%02d%s", $mon, $day, $year); - - print("Checking in code on trunk"); - &system("cvs ci -m 'Stable drop of JavaScript interpreter code from " . - "$development_branch'"); - - # Tag merged result - &system("cvs tag -F JS_LANDING"); - &system("cvs tag -F JS_LANDING_$mmddyyyy"); - - # Move JS_LAST_STABLE_DROP tag forward - &system("cvs tag -F -rJS_STABLE_DROP JS_LAST_STABLE_DROP"); -} - - diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 2457c861547c..e4417abdc328 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -125,6 +125,7 @@ DIST_INSTALL = 1 VPATH = $(srcdir) CPPSRCS = \ + jsalloc.cpp \ jsanalyze.cpp \ jsapi.cpp \ jsarena.cpp \ @@ -173,6 +174,7 @@ CPPSRCS = \ jsstr.cpp \ jstypedarray.cpp \ jsutil.cpp \ + jsweakmap.cpp \ jswrapper.cpp \ jsxdrapi.cpp \ jsxml.cpp \ @@ -185,6 +187,7 @@ INSTALLED_HEADERS = \ jsautocfg.h \ $(CURDIR)/jsautokw.h \ js.msg \ + jsalloc.h \ jsanalyze.h \ jsapi.h \ jsarray.h \ @@ -254,6 +257,7 @@ INSTALLED_HEADERS = \ jstl.h \ jshashtable.h \ jsversion.h \ + jsweakmap.h \ jswrapper.h \ jsxdrapi.h \ jsxml.h \ @@ -368,6 +372,9 @@ endif ifeq (arm, $(TARGET_CPU)) #CPPSRCS += only_on_arm.cpp endif +ifeq (sparc, $(findstring sparc,$(TARGET_CPU))) +ASFILES += TrampolineSparc.s +endif # # END enclude sources for the method JIT ############################################# @@ -393,7 +400,7 @@ CPPSRCS += checks.cc \ # END enclude sources for V8 dtoa ############################################# -ifeq (,$(filter-out powerpc sparc,$(TARGET_CPU))) +ifeq (,$(filter-out powerpc,$(TARGET_CPU))) VPATH += $(srcdir)/assembler \ $(srcdir)/assembler/wtf \ @@ -615,7 +622,7 @@ endif # (it can't be done with %-expansion, because the files we want to skip aren't # in the vpath). ALL_FILES=$(shell find $(srcdir) \( -name "*.cpp" -o -name "*.h" \) -not -path "*/dist/*") -check-malloc-function-usage: $(filter-out %jsutil.h %jscntxt.h, $(ALL_FILES)) +check-malloc-function-usage: $(filter-out %jsalloc.h %jscntxt.h %jsutil.h, $(ALL_FILES)) # js_malloc and friends are only used by other memory managers, and should # never be used elsewhere directly. @@ -630,10 +637,10 @@ check-malloc-function-usage: $(filter-out %jsutil.h %jscntxt.h, $(ALL_FILES)) # We desire these numbers to go down, not up. See "User guide to memory # management within SpiderMonkey" in jsutil.h. - $(srcdir)/config/check_source_count.py OffTheBooks:: 54 \ + $(srcdir)/config/check_source_count.py OffTheBooks:: 53 \ "in Makefile.in" "{cx,rt}->{new_,new_array,malloc_,calloc_,realloc_}" $^ # This should go to zero, if possible. - $(srcdir)/config/check_source_count.py UnwantedForeground:: 35 \ + $(srcdir)/config/check_source_count.py UnwantedForeground:: 34 \ "in Makefile.in" "{cx,rt}->{free_,delete_,array_delete}" $^ ifneq ($(OS_ARCH),WINNT) # FIXME: this should be made work on Windows too. diff --git a/js/src/Makefile.ref b/js/src/Makefile.ref deleted file mode 100644 index 2ff69cec606a..000000000000 --- a/js/src/Makefile.ref +++ /dev/null @@ -1,468 +0,0 @@ -# -*- Mode: makefile -*- -# vim: ft=make -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Michael Ang -# Kevin Buhr -# -# Alternatively, the contents of this file may be used under the terms of -# either of 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 ***** - -# -# JSRef GNUmake makefile. -# -# Note: dependency rules are missing for some files (some -# .h, all .msg, etc.) Re-make clean if in doubt. -# - - -DEPTH = . - -include config.mk - -#NS_USE_NATIVE = 1 - -ifndef NANOJIT_ARCH -$(warning NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, JIT disabled) -else -ifdef DISABLE_JIT -$(warning disabling JIT per build specification) -else -ENABLE_JIT=1 -endif -endif - -ifdef ENABLE_JIT -DEFINES += -DJS_TRACER -DEFINES += -DFEATURE_NANOJIT -INCLUDES += -Inanojit -endif - -#ifndef BUILD_OPT -#DEFINES += -Ivprof -#endif - -# Look in OBJDIR to find jsautocfg.h, jsautokw.h, and js-config.h -INCLUDES += -I. -I$(OBJDIR) - -ifdef JS_THREADSAFE -DEFINES += -DJS_THREADSAFE -INCLUDES += -I$(DIST)/include/nspr -ifdef USE_MSVC -OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib -else -OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX) -endif -endif - -ifdef JS_HAS_CTYPES -DEFINES += -DJS_HAS_CTYPES -INCLUDES += -I$(DIST)/include/nspr -ifdef USE_MSVC -OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib -else -OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX) -endif -endif - -ifdef JS_NO_THIN_LOCKS -DEFINES += -DJS_USE_ONLY_NSPR_LOCKS -endif - -ifdef JS_GC_ZEAL -DEFINES += -DJS_GC_ZEAL -endif - -# -# XCFLAGS may be set in the environment or on the gmake command line -# -#CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS -CFLAGS += $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) - -LDFLAGS = $(XLDFLAGS) -LDFLAGS += $(OS_LDFLAGS) - -ifdef MOZ_SHARK -DEFINES += -DMOZ_SHARK -CFLAGS += -F/System/Library/PrivateFrameworks -LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD -endif -ifdef MOZ_CALLGRIND -DEFINES += -DMOZ_CALLGRIND -endif -ifdef MOZ_VTUNE -DEFINES += -DMOZ_VTUNE -CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include -OTHER_LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib -endif - -ifndef NO_LIBM -LDFLAGS += -lm -endif - -# Prevent floating point errors caused by VC++ optimizations -ifeq ($(OS_ARCH),WINNT) -_MSC_VER = $(shell $(CXX) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p') -ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) -CFLAGS += -Op -else -CFLAGS += -fp:precise -endif -endif # WINNT - -# -# Server-related changes : -# -ifdef NES40 -DEFINES += -DNES40 -endif - -# -# Line editing support. -# Define JS_READLINE or JS_EDITLINE to enable line editing in the -# js command-line interpreter. -# -ifdef JS_READLINE -# For those platforms with the readline library installed. -DEFINES += -DEDITLINE -PROG_LIBS += -lreadline -ltermcap -else -ifdef JS_EDITLINE -# Use the editline library, built locally. -PREDIRS += editline -DEFINES += -DEDITLINE -PROG_LIBS += $(OBJDIR)/editline/libedit.a -endif -endif - -# For purify -PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \ - $(INCLUDES) $(XCFLAGS) - -# -# JS file lists -# -JS_HFILES = \ - jsarray.h \ - jsatom.h \ - jsbool.h \ - jscntxt.h \ - jsdate.h \ - jsemit.h \ - jsexn.h \ - jsfun.h \ - jsgc.h \ - jsinterp.h \ - jsiter.h \ - jslibmath.h \ - jslock.h \ - jsmath.h \ - jsnum.h \ - jsobj.h \ - json.h \ - jsopcode.h \ - jsparse.h \ - jsarena.h \ - jsclist.h \ - jsdhash.h \ - jsdtoa.h \ - jshash.h \ - jslong.h \ - jstypes.h \ - jsprvtd.h \ - jspubtd.h \ - jsregexp.h \ - jsscan.h \ - jsscope.h \ - jsscript.h \ - jsstr.h \ - jsversion.h \ - jsxdrapi.h \ - jsxml.h \ - $(NULL) - -ifdef ENABLE_JIT -JS_HFILES += \ - jstracer.h \ - nanojit/Assembler.h \ - nanojit/LIR.h \ - nanojit/Native$(NANOJIT_ARCH).h \ - nanojit/avmplus.h \ - nanojit/vm_fops.h \ - nanojit/Fragmento.h \ - nanojit/Native.h \ - nanojit/RegAlloc.h \ - nanojit/nanojit.h \ - $(NULL) -endif - -ifndef BUILD_OPT -#JS_HFILES += \ -# vprof/vprof.h \ -# $(NULL) -endif - -API_HFILES = \ - jsapi.h \ - jsdbgapi.h \ - $(NULL) - -OTHER_HFILES = \ - jsbit.h \ - jscompat.h \ - jscpucfg.h \ - jsotypes.h \ - prmjtime.h \ - resource.h \ - jsopcode.tbl \ - jsproto.tbl \ - js.msg \ - jsshell.msg \ - jskeyword.tbl \ - $(NULL) - -ifndef PREBUILT_CPUCFG -OTHER_HFILES += $(OBJDIR)/jsautocfg.h -endif -OTHER_HFILES += $(OBJDIR)/jsautokw.h $(OBJDIR)/js-config.h - -HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES) - -JS_CPPFILES = \ - jsapi.cpp \ - jsarena.cpp \ - jsarray.cpp \ - jsatom.cpp \ - jsbool.cpp \ - jscntxt.cpp \ - jsdate.cpp \ - jsdbgapi.cpp \ - jsdhash.cpp \ - jsdtoa.cpp \ - jsemit.cpp \ - jsexn.cpp \ - jsfun.cpp \ - jsgc.cpp \ - jshash.cpp \ - jsinterp.cpp \ - jsinvoke.cpp \ - jsiter.cpp \ - jslock.cpp \ - jslog2.cpp \ - jslong.cpp \ - jsmath.cpp \ - jsnum.cpp \ - jsobj.cpp \ - json.cpp \ - jsopcode.cpp \ - jsparse.cpp \ - jsprf.cpp \ - jsregexp.cpp \ - jsscan.cpp \ - jsscope.cpp \ - jsscript.cpp \ - jsstr.cpp \ - jsutil.cpp \ - jsxdrapi.cpp \ - jsxml.cpp \ - prmjtime.cpp \ - $(NULL) - -ifdef ENABLE_JIT -JS_CPPFILES += \ - jsbuiltins.cpp \ - jstracer.cpp \ - nanojit/Assembler.cpp \ - nanojit/Fragmento.cpp \ - nanojit/LIR.cpp \ - nanojit/Native$(NANOJIT_ARCH).cpp \ - nanojit/RegAlloc.cpp \ - nanojit/avmplus.cpp \ - $(NULL) - -endif - -ifndef BUILD_OPT -#JS_CPPFILES += \ -# vprof/vprof.cpp \ -# $(NULL) -endif - -LIB_CPPFILES = $(JS_CPPFILES) -LIB_ASFILES := $(wildcard *_$(OS_ARCH).s) -PROG_CPPFILES = js.cpp - -ifdef USE_MSVC -LIBRARY = $(OBJDIR)/js32.lib -SHARED_LIBRARY = $(OBJDIR)/js32.dll -PROGRAM = $(OBJDIR)/js.exe -else -LIBRARY = $(OBJDIR)/libjs.a -SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX) -PROGRAM = $(OBJDIR)/js -endif - -include rules.mk - -MOZ_DEPTH = ../.. -include jsconfig.mk - -nsinstall-target: - cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR) - -# -# Automatic header generation -# - -AUTO_HEADERS = \ - $(OBJDIR)/jsautokw.h \ - $(OBJDIR)/jsautooplen.h \ - $(NULL) - -$(OBJDIR)/jsautokw.h: jskeyword.tbl - -$(OBJDIR)/jsautooplen.h: jsopcode.tbl - -GARBAGE += $(AUTO_HEADERS) -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen$(HOST_BIN_SUFFIX)) - -ifdef USE_MSVC - -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.obj) - -$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $< - link.exe -out:"$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX)" $(EXE_LINK_FLAGS) $(OBJDIR)/js$*gen.obj - $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@ -else - -GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.d) -$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $(CFLAGS) $(OPTIMIZER) $(LDFLAGS) $< - $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@ - -endif - -# force creation of autoheaders before compiling any source that may use them -$(LIB_OBJS) : $(AUTO_HEADERS) - -# -# An installed header file describing configuration options that affect -# the API. -# - -# Avoid rebuilding unless js-config.h's contents actually change. The -# timestamp on js-config.h.stamp corresponds to the last time we -# checked that js-config.h was up to date. If the stamp changes but -# js-config.h does not, then make concludes that targets depending on -# js-config.h don't need to be rebuilt. The dummy '@true' rule here -# keeps make from concluding that js-config.h never changes. -$(OBJDIR)/js-config.h: $(OBJDIR)/js-config.h.stamp - @true - -js-config-switch=$(if $(value $($1)),-e 's/\#undef $1/\#define $1/') -$(OBJDIR)/js-config.h.stamp: js-config.h.in Makefile.ref - sed < $< > $(@:.stamp=.tmp) \ - $(call js-config-switch,JS_THREADSAFE) \ - $(call js-config-switch,JS_HAS_CTYPES) \ - $(call js-config-switch,JS_GC_ZEAL) \ - -e :dummy - if ! [ -f $(@:.stamp=) ] || ! cmp $(@:.stamp=.tmp) $(@:.stamp=); then \ - mv $(@:.stamp=.tmp) $(@:.stamp=); \ - fi - touch $@ - -GARBAGE += $(OBJDIR)/js-config.h $(OBJDIR)/js-config.h.stamp - -# Force creation of js-config.h before compiling any source that may use it. -$(LIB_OBJS) : $(OBJDIR)/js-config.h - -# -# JS shell executable -# - -ifdef USE_MSVC -$(PROGRAM): $(PROG_OBJS) $(LIBRARY) - link.exe -out:"$@" $(EXE_LINK_FLAGS) $^ -else -$(PROGRAM): $(PROG_OBJS) $(LIBRARY) - $(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \ - $(PROG_LIBS) -endif - -$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY) - purify $(PUREFLAGS) \ - $(CXX) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \ - $(OTHER_LIBS) $(PROG_LIBS) - -ifndef PREBUILT_CPUCFG -$(filter-out jscpucfg.h $(OBJDIR)/jsautocfg.h, $(HFILES)) $(CPPFILES): $(OBJDIR)/jsautocfg.h - -$(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg - rm -f $@ - $(OBJDIR)/jscpucfg > $@ - -$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o - $(CXX) $(OS_LDFLAGS) -o $@ $(OBJDIR)/jscpucfg.o - -GARBAGE += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \ - $(OBJDIR)/jscpucfg.o $(OBJDIR)/jscpucfg.d -endif - -# Automatic make dependencies files -DEPENDENCIES = $(CPPFILES:%.cpp=$(OBJDIR)/%.d) - -# -# Hardwire dependencies for some files -# -ifdef USE_MSVC -OBJ=obj -else -OBJ=o -endif - -$(OBJDIR)/jsinvoke.$(OBJ): jsinterp.h jsinterp.cpp -$(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.cpp - --include $(DEPENDENCIES) - -TARNAME = jsref.tar -TARFILES = files `cat files` - -SUFFIXES: .i -%.i: %.cpp - $(CXX) -C -E $(CFLAGS) $< > $*.i diff --git a/js/src/assembler/assembler/MacroAssembler.h b/js/src/assembler/assembler/MacroAssembler.h index 5f249811cecf..73bda22a8ee2 100644 --- a/js/src/assembler/assembler/MacroAssembler.h +++ b/js/src/assembler/assembler/MacroAssembler.h @@ -54,6 +54,10 @@ namespace JSC { typedef MacroAssemblerX86 MacroAssemblerBase; } #include "MacroAssemblerX86_64.h" namespace JSC { typedef MacroAssemblerX86_64 MacroAssemblerBase; } +#elif WTF_CPU_SPARC +#include "MacroAssemblerSparc.h" +namespace JSC { typedef MacroAssemblerSparc MacroAssemblerBase; } + #else #error "The MacroAssembler is not supported on this platform." #endif diff --git a/js/src/assembler/assembler/MacroAssemblerSparc.h b/js/src/assembler/assembler/MacroAssemblerSparc.h new file mode 100644 index 000000000000..3bdd2d871b1b --- /dev/null +++ b/js/src/assembler/assembler/MacroAssemblerSparc.h @@ -0,0 +1,1491 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=4 sw=4 et tw=99: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * May 28, 2008. + * + * The Initial Developer of the Original Code is + * Leon Sha + * + * Portions created by the Initial Developer are Copyright (C) 2010-2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * 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 ***** */ + +#ifndef MacroAssemblerSparc_h +#define MacroAssemblerSparc_h + +#include + +#if ENABLE_ASSEMBLER && WTF_CPU_SPARC + +#include "SparcAssembler.h" +#include "AbstractMacroAssembler.h" + +namespace JSC { + + class MacroAssemblerSparc : public AbstractMacroAssembler { + public: + enum Condition { + Equal = SparcAssembler::ConditionE, + NotEqual = SparcAssembler::ConditionNE, + Above = SparcAssembler::ConditionGU, + AboveOrEqual = SparcAssembler::ConditionCC, + Below = SparcAssembler::ConditionCS, + BelowOrEqual = SparcAssembler::ConditionLEU, + GreaterThan = SparcAssembler::ConditionG, + GreaterThanOrEqual = SparcAssembler::ConditionGE, + LessThan = SparcAssembler::ConditionL, + LessThanOrEqual = SparcAssembler::ConditionLE, + Overflow = SparcAssembler::ConditionVS, + Signed = SparcAssembler::ConditionNEG, + Zero = SparcAssembler::ConditionE, + NonZero = SparcAssembler::ConditionNE + }; + + enum DoubleCondition { + // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. + DoubleEqual = SparcAssembler::DoubleConditionE, + DoubleNotEqual = SparcAssembler::DoubleConditionNE, + DoubleGreaterThan = SparcAssembler::DoubleConditionG, + DoubleGreaterThanOrEqual = SparcAssembler::DoubleConditionGE, + DoubleLessThan = SparcAssembler::DoubleConditionL, + DoubleLessThanOrEqual = SparcAssembler::DoubleConditionLE, + // If either operand is NaN, these conditions always evaluate to true. + DoubleEqualOrUnordered = SparcAssembler::DoubleConditionUE, + DoubleNotEqualOrUnordered = SparcAssembler::DoubleConditionNE, + DoubleGreaterThanOrUnordered = SparcAssembler::DoubleConditionUG, + DoubleGreaterThanOrEqualOrUnordered = SparcAssembler::DoubleConditionUGE, + DoubleLessThanOrUnordered = SparcAssembler::DoubleConditionUL, + DoubleLessThanOrEqualOrUnordered = SparcAssembler::DoubleConditionULE + }; + + static const RegisterID stackPointerRegister = SparcRegisters::sp; + + static const Scale ScalePtr = TimesFour; + static const unsigned int TotalRegisters = 32; + + void add32(RegisterID src, RegisterID dest) + { + m_assembler.addcc_r(dest, src, dest); + } + + void add32(Imm32 imm, Address address) + { + load32(address, SparcRegisters::g2); + add32(imm, SparcRegisters::g2); + store32(SparcRegisters::g2, address); + } + + void add32(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.addcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.addcc_r(dest, SparcRegisters::g3, dest); + } + } + + void add32(Address src, RegisterID dest) + { + load32(src, SparcRegisters::g2); + m_assembler.addcc_r(dest, SparcRegisters::g2, dest); + } + + void and32(Address src, RegisterID dest) + { + load32(src, SparcRegisters::g2); + m_assembler.andcc_r(dest, SparcRegisters::g2, dest); + } + + void add32(Imm32 imm, RegisterID src, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.addcc_imm(src, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.addcc_r(src, SparcRegisters::g3, dest); + } + } + + void and32(RegisterID src, RegisterID dest) + { + m_assembler.andcc_r(dest, src, dest); + } + + void and32(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.andcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.andcc_r(dest, SparcRegisters::g3, dest); + } + } + + + void lshift32(RegisterID shift_amount, RegisterID dest) + { + m_assembler.sll_r(dest, shift_amount, dest); + } + + void lshift32(Imm32 imm, RegisterID dest) + { + // No need to check if imm.m_value. + // The last 5 bit of imm.m_value will be used anyway. + m_assembler.sll_imm(dest, imm.m_value, dest); + } + + void mul32(RegisterID src, RegisterID dest) + { + m_assembler.smulcc_r(dest, src, dest); + } + + void mul32(Imm32 imm, RegisterID src, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.smulcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.smulcc_r(SparcRegisters::g3, dest, dest); + } + } + + void neg32(RegisterID srcDest) + { + m_assembler.subcc_r(SparcRegisters::g0, srcDest, srcDest); + } + + void not32(RegisterID dest) + { + m_assembler.xnorcc_r(dest, SparcRegisters::g0, dest); + } + + void or32(RegisterID src, RegisterID dest) + { + m_assembler.orcc_r(dest, src, dest); + } + + void or32(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.orcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.or_r(SparcRegisters::g3, dest, dest); + } + } + + + void or32(Address address, RegisterID dest) + { + load32(address, SparcRegisters::g2); + or32(SparcRegisters::g2, dest); + } + + void rshift32(RegisterID shift_amount, RegisterID dest) + { + m_assembler.sra_r(dest, shift_amount, dest); + } + + void rshift32(Imm32 imm, RegisterID dest) + { + // No need to check if imm.m_value. + // The last 5 bit of imm.m_value will be used anyway. + m_assembler.sra_imm(dest, imm.m_value, dest); + } + + void urshift32(RegisterID shift_amount, RegisterID dest) + { + m_assembler.srl_r(dest, shift_amount, dest); + } + + void urshift32(Imm32 imm, RegisterID dest) + { + // No need to check if imm.m_value. + // The last 5 bit of imm.m_value will be used anyway. + m_assembler.srl_imm(dest, imm.m_value, dest); + } + + void sub32(RegisterID src, RegisterID dest) + { + m_assembler.subcc_r(dest, src, dest); + } + + void sub32(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.subcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.subcc_r(dest, SparcRegisters::g3, dest); + } + } + + void sub32(Imm32 imm, Address address) + { + load32(address, SparcRegisters::g2); + sub32(imm, SparcRegisters::g2); + store32(SparcRegisters::g2, address); + } + + void sub32(Address src, RegisterID dest) + { + load32(src, SparcRegisters::g2); + sub32(SparcRegisters::g2, dest); + } + + void xor32(RegisterID src, RegisterID dest) + { + m_assembler.xorcc_r(src, dest, dest); + } + + void xor32(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.xorcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.xorcc_r(dest, SparcRegisters::g3, dest); + } + } + + void xor32(Address src, RegisterID dest) + { + load32(src, SparcRegisters::g2); + xor32(SparcRegisters::g2, dest); + } + + void load8(ImplicitAddress address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldub_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldub_r(address.base, SparcRegisters::g3, dest); + } + } + + void load32(ImplicitAddress address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.lduw_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.lduw_r(address.base, SparcRegisters::g3, dest); + } + } + + void load32(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.lduw_r(address.base, SparcRegisters::g2, dest); + } + + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset+3), SparcRegisters::g2); + m_assembler.ldub_r(address.base, SparcRegisters::g2, dest); + m_assembler.subcc_imm(SparcRegisters::g2, 1, SparcRegisters::g2); + m_assembler.ldub_r(address.base, SparcRegisters::g2, SparcRegisters::g3); + m_assembler.sll_imm(SparcRegisters::g3, 8, SparcRegisters::g3); + m_assembler.or_r(SparcRegisters::g3, dest, dest); + m_assembler.subcc_imm(SparcRegisters::g2, 1, SparcRegisters::g2); + m_assembler.ldub_r(address.base, SparcRegisters::g2, SparcRegisters::g3); + m_assembler.sll_imm(SparcRegisters::g3, 16, SparcRegisters::g3); + m_assembler.or_r(SparcRegisters::g3, dest, dest); + m_assembler.subcc_imm(SparcRegisters::g2, 1, SparcRegisters::g2); + m_assembler.ldub_r(address.base, SparcRegisters::g2, SparcRegisters::g3); + m_assembler.sll_imm(SparcRegisters::g3, 24, SparcRegisters::g3); + m_assembler.or_r(SparcRegisters::g3, dest, dest); + } + + DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(0, SparcRegisters::g3); + m_assembler.lduw_r(address.base, SparcRegisters::g3, dest); + return dataLabel; + } + + DataLabel32 load64WithAddressOffsetPatch(Address address, RegisterID hi, RegisterID lo) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(0, SparcRegisters::g3); + m_assembler.add_imm(SparcRegisters::g3, 4, SparcRegisters::g2); + m_assembler.lduw_r(address.base, SparcRegisters::g3, hi); + m_assembler.lduw_r(address.base, SparcRegisters::g2, lo); + return dataLabel; + } + + Label loadPtrWithPatchToLEA(Address address, RegisterID dest) + { + Label label(this); + load32(address, dest); + return label; + } + + void load16(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.lduh_r(address.base, SparcRegisters::g2, dest); + } + + void load16(ImplicitAddress address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.lduh_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.lduh_r(address.base, SparcRegisters::g3, dest); + } + } + + void store8(RegisterID src, ImplicitAddress address) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.stb_imm(src, address.base, address.offset); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.stb_r(src, address.base, SparcRegisters::g3); + } + } + + void store8(RegisterID src, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.stb_r(src, address.base, SparcRegisters::g2); + } + + void store8(Imm32 imm, ImplicitAddress address) + { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g2); + store8(SparcRegisters::g2, address); + } + + void store8(Imm32 imm, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + move(imm, SparcRegisters::g3); + m_assembler.stb_r(SparcRegisters::g3, SparcRegisters::g2, address.base); + } + + void store16(RegisterID src, ImplicitAddress address) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.sth_imm(src, address.base, address.offset); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.sth_r(src, address.base, SparcRegisters::g3); + } + } + + void store16(RegisterID src, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.sth_r(src, address.base, SparcRegisters::g2); + } + + void store16(Imm32 imm, ImplicitAddress address) + { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g2); + store16(SparcRegisters::g2, address); + } + + void store16(Imm32 imm, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + move(imm, SparcRegisters::g3); + m_assembler.sth_r(SparcRegisters::g3, SparcRegisters::g2, address.base); + } + + void load8ZeroExtend(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.ldub_r(address.base, SparcRegisters::g2, dest); + } + + void load8ZeroExtend(Address address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldub_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldub_r(address.base, SparcRegisters::g3, dest); + } + } + + void load8SignExtend(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.ldsb_r(address.base, SparcRegisters::g2, dest); + } + + void load8SignExtend(Address address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldsb_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldsb_r(address.base, SparcRegisters::g3, dest); + } + } + + void load16SignExtend(BaseIndex address, RegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.ldsh_r(address.base, SparcRegisters::g2, dest); + } + + void load16SignExtend(Address address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldsh_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldsh_r(address.base, SparcRegisters::g3, dest); + } + } + + DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address) + { + DataLabel32 dataLabel(this); + // Since this is for patch, we don't check is offset is imm13. + m_assembler.move_nocheck(0, SparcRegisters::g3); + m_assembler.stw_r(src, address.base, SparcRegisters::g3); + return dataLabel; + } + + + DataLabel32 store64WithAddressOffsetPatch(RegisterID hi, RegisterID lo, Address address) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.add_r(SparcRegisters::g3, address.base, SparcRegisters::g3); + m_assembler.stw_imm(lo, SparcRegisters::g3, 4); + m_assembler.stw_imm(hi, SparcRegisters::g3, 0); + return dataLabel; + } + + DataLabel32 store64WithAddressOffsetPatch(Imm32 hi, RegisterID lo, Address address) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.add_r(SparcRegisters::g3, address.base, SparcRegisters::g3); + m_assembler.stw_imm(lo, SparcRegisters::g3, 4); + move(hi, SparcRegisters::g2); + m_assembler.stw_imm(SparcRegisters::g2, SparcRegisters::g3, 0); + + return dataLabel; + } + + DataLabel32 store64WithAddressOffsetPatch(Imm32 hi, Imm32 lo, Address address) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.add_r(SparcRegisters::g3, address.base, SparcRegisters::g3); + move(lo, SparcRegisters::g2); + m_assembler.stw_imm(SparcRegisters::g2, SparcRegisters::g3, 4); + move(hi, SparcRegisters::g2); + m_assembler.stw_imm(SparcRegisters::g2, SparcRegisters::g3, 0); + + return dataLabel; + } + + + void store32(RegisterID src, ImplicitAddress address) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.stw_imm(src, address.base, address.offset); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.stw_r(src, address.base, SparcRegisters::g3); + } + } + + void store32(RegisterID src, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.stw_r(src, address.base, SparcRegisters::g2); + } + + void store32(Imm32 imm, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + move(imm, SparcRegisters::g3); + m_assembler.stw_r(SparcRegisters::g3, SparcRegisters::g2, address.base); + } + + void store32(Imm32 imm, ImplicitAddress address) + { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g2); + store32(SparcRegisters::g2, address); + } + + void store32(RegisterID src, void* address) + { + m_assembler.move_nocheck((int)address, SparcRegisters::g3); + m_assembler.stw_r(src, SparcRegisters::g0, SparcRegisters::g3); + } + + void store32(Imm32 imm, void* address) + { + move(imm, SparcRegisters::g2); + store32(SparcRegisters::g2, address); + } + + void pop(RegisterID dest) + { + m_assembler.lduw_imm(SparcRegisters::sp, 0x68, dest); + m_assembler.addcc_imm(SparcRegisters::sp, 4, SparcRegisters::sp); + } + + void push(RegisterID src) + { + m_assembler.subcc_imm(SparcRegisters::sp, 4, SparcRegisters::sp); + m_assembler.stw_imm(src, SparcRegisters::sp, 0x68); + } + + void push(Address address) + { + load32(address, SparcRegisters::g2); + push(SparcRegisters::g2); + } + + void push(Imm32 imm) + { + move(imm, SparcRegisters::g2); + push(SparcRegisters::g2); + } + + void move(Imm32 imm, RegisterID dest) + { + if (m_assembler.isimm13(imm.m_value)) + m_assembler.or_imm(SparcRegisters::g0, imm.m_value, dest); + else + m_assembler.move_nocheck(imm.m_value, dest); + } + + void move(RegisterID src, RegisterID dest) + { + m_assembler.or_r(src, SparcRegisters::g0, dest); + } + + void move(ImmPtr imm, RegisterID dest) + { + move(Imm32(imm), dest); + } + + void swap(RegisterID reg1, RegisterID reg2) + { + m_assembler.or_r(reg1, SparcRegisters::g0, SparcRegisters::g3); + m_assembler.or_r(reg2, SparcRegisters::g0, reg1); + m_assembler.or_r(SparcRegisters::g3, SparcRegisters::g0, reg2); + } + + void signExtend32ToPtr(RegisterID src, RegisterID dest) + { + if (src != dest) + move(src, dest); + } + + void zeroExtend32ToPtr(RegisterID src, RegisterID dest) + { + if (src != dest) + move(src, dest); + } + + Jump branch8(Condition cond, Address left, Imm32 right) + { + load8(left, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Jump branch32_force32(Condition cond, RegisterID left, Imm32 right) + { + m_assembler.move_nocheck(right.m_value, SparcRegisters::g3); + m_assembler.subcc_r(left, SparcRegisters::g3, SparcRegisters::g0); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branch32FixedLength(Condition cond, RegisterID left, Imm32 right) + { + m_assembler.move_nocheck(right.m_value, SparcRegisters::g2); + return branch32(cond, left, SparcRegisters::g2); + } + + Jump branch32WithPatch(Condition cond, RegisterID left, Imm32 right, DataLabel32 &dataLabel) + { + // Always use move_nocheck, since the value is to be patched. + dataLabel = DataLabel32(this); + m_assembler.move_nocheck(right.m_value, SparcRegisters::g3); + m_assembler.subcc_r(left, SparcRegisters::g3, SparcRegisters::g0); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branch32(Condition cond, RegisterID left, RegisterID right) + { + m_assembler.subcc_r(left, right, SparcRegisters::g0); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branch32(Condition cond, RegisterID left, Imm32 right) + { + if (m_assembler.isimm13(right.m_value)) + m_assembler.subcc_imm(left, right.m_value, SparcRegisters::g0); + else { + m_assembler.move_nocheck(right.m_value, SparcRegisters::g3); + m_assembler.subcc_r(left, SparcRegisters::g3, SparcRegisters::g0); + } + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branch32(Condition cond, RegisterID left, Address right) + { + load32(right, SparcRegisters::g2); + return branch32(cond, left, SparcRegisters::g2); + } + + Jump branch32(Condition cond, Address left, RegisterID right) + { + load32(left, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Jump branch32(Condition cond, Address left, Imm32 right) + { + load32(left, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Jump branch32(Condition cond, BaseIndex left, Imm32 right) + { + + load32(left, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right) + { + load32WithUnalignedHalfWords(left, SparcRegisters::g4); + return branch32(cond, SparcRegisters::g4, right); + } + + Jump branch16(Condition cond, BaseIndex left, RegisterID right) + { + (void)(cond); + (void)(left); + (void)(right); + ASSERT_NOT_REACHED(); + return jump(); + } + + Jump branch16(Condition cond, BaseIndex left, Imm32 right) + { + load16(left, SparcRegisters::g3); + move(right, SparcRegisters::g2); + m_assembler.subcc_r(SparcRegisters::g3, SparcRegisters::g2, SparcRegisters::g0); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1)) + { + load8(address, SparcRegisters::g2); + return branchTest32(cond, SparcRegisters::g2, mask); + } + + Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask) + { + m_assembler.andcc_r(reg, mask, SparcRegisters::g0); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1)) + { + if (m_assembler.isimm13(mask.m_value)) + m_assembler.andcc_imm(reg, mask.m_value, SparcRegisters::g0); + else { + m_assembler.move_nocheck(mask.m_value, SparcRegisters::g3); + m_assembler.andcc_r(reg, SparcRegisters::g3, SparcRegisters::g0); + } + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1)) + { + load32(address, SparcRegisters::g2); + return branchTest32(cond, SparcRegisters::g2, mask); + } + + Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1)) + { + // FIXME. branchTest32 only used by PolyIC. + // PolyIC is not enabled for sparc now. + ASSERT(0); + return jump(); + } + + Jump jump() + { + return Jump(m_assembler.jmp()); + } + + void jump(RegisterID target) + { + m_assembler.jmpl_r(SparcRegisters::g0, target, SparcRegisters::g0); + m_assembler.nop(); + } + + void jump(Address address) + { + load32(address, SparcRegisters::g2); + m_assembler.jmpl_r(SparcRegisters::g2, SparcRegisters::g0, SparcRegisters::g0); + m_assembler.nop(); + } + + void jump(BaseIndex address) + { + load32(address, SparcRegisters::g2); + m_assembler.jmpl_r(SparcRegisters::g2, SparcRegisters::g0, SparcRegisters::g0); + m_assembler.nop(); + } + + Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + m_assembler.addcc_r(src, dest, dest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchAdd32(Condition cond, Imm32 imm, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + if (m_assembler.isimm13(imm.m_value)) + m_assembler.addcc_imm(dest, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.addcc_r(dest, SparcRegisters::g3, dest); + } + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchAdd32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + load32(src, SparcRegisters::g2); + return branchAdd32(cond, SparcRegisters::g2, dest); + } + + void mull32(RegisterID src1, RegisterID src2, RegisterID dest) + { + m_assembler.smulcc_r(src1, src2, dest); + } + + Jump branchMul32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + m_assembler.smulcc_r(src, dest, dest); + if (cond == Overflow) { + m_assembler.rdy(SparcRegisters::g2); + m_assembler.sra_imm(dest, 31, SparcRegisters::g3); + m_assembler.subcc_r(SparcRegisters::g2, SparcRegisters::g3, SparcRegisters::g2); + cond = NotEqual; + } + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + if (m_assembler.isimm13(imm.m_value)) + m_assembler.smulcc_imm(src, imm.m_value, dest); + else { + m_assembler.move_nocheck(imm.m_value, SparcRegisters::g3); + m_assembler.smulcc_r(src, SparcRegisters::g3, dest); + } + if (cond == Overflow) { + m_assembler.rdy(SparcRegisters::g2); + m_assembler.sra_imm(dest, 31, SparcRegisters::g3); + m_assembler.subcc_r(SparcRegisters::g2, SparcRegisters::g3, SparcRegisters::g2); + cond = NotEqual; + } + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchMul32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + load32(src, SparcRegisters::g2); + return branchMul32(cond, SparcRegisters::g2, dest); + } + + Jump branchSub32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + m_assembler.subcc_r(dest, src, dest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchSub32(Condition cond, Imm32 imm, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + sub32(imm, dest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchSub32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + load32(src, SparcRegisters::g2); + return branchSub32(cond, SparcRegisters::g2, dest); + } + + Jump branchSub32(Condition cond, Imm32 imm, Address dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + sub32(imm, dest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchNeg32(Condition cond, RegisterID srcDest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + neg32(srcDest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); + m_assembler.orcc_r(src, dest, dest); + return Jump(m_assembler.branch(SparcCondition(cond))); + } + + void breakpoint() + { + m_assembler.ta_imm(8); + } + + Call nearCall() + { + return Call(m_assembler.call(), Call::LinkableNear); + } + + Call call(RegisterID target) + { + m_assembler.jmpl_r(target, SparcRegisters::g0, SparcRegisters::o7); + m_assembler.nop(); + JmpSrc jmpSrc; + return Call(jmpSrc, Call::None); + } + + void call(Address address) + { + if (m_assembler.isimm13(address.offset)) { + m_assembler.jmpl_imm(address.base, address.offset, SparcRegisters::o7); + m_assembler.nop(); + } else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.jmpl_r(address.base, SparcRegisters::g3, SparcRegisters::o7); + m_assembler.nop(); + } + } + + void ret() + { + m_assembler.jmpl_imm(SparcRegisters::i7, 8, SparcRegisters::g0); + m_assembler.nop(); + } + + void ret_and_restore() + { + m_assembler.jmpl_imm(SparcRegisters::i7, 8, SparcRegisters::g0); + m_assembler.restore_r(SparcRegisters::g0, SparcRegisters::g0, SparcRegisters::g0); + } + + void save(Imm32 size) + { + if (m_assembler.isimm13(size.m_value)) { + m_assembler.save_imm(SparcRegisters::sp, size.m_value, SparcRegisters::sp); + } else { + m_assembler.move_nocheck(size.m_value, SparcRegisters::g3); + m_assembler.save_r(SparcRegisters::sp, SparcRegisters::g3, SparcRegisters::sp); + } + } + + void set32(Condition cond, Address left, RegisterID right, RegisterID dest) + { + load32(left, SparcRegisters::g2); + set32(cond, SparcRegisters::g2, right, dest); + } + + void set32(Condition cond, RegisterID left, Address right, RegisterID dest) + { + load32(right, SparcRegisters::g2); + set32(cond, left, SparcRegisters::g2, dest); + } + + void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + m_assembler.subcc_r(left, right, SparcRegisters::g0); + m_assembler.or_imm(SparcRegisters::g0, 0, dest); + m_assembler.movcc_imm(1, dest, SparcCondition(cond)); + } + + void set32(Condition cond, RegisterID left, Imm32 right, RegisterID dest) + { + if (m_assembler.isimm13(right.m_value)) + m_assembler.subcc_imm(left, right.m_value, SparcRegisters::g0); + else { + m_assembler.move_nocheck(right.m_value, SparcRegisters::g3); + m_assembler.subcc_r(left, SparcRegisters::g3, SparcRegisters::g0); + } + m_assembler.or_imm(SparcRegisters::g0, 0, dest); + m_assembler.movcc_imm(1, dest, SparcCondition(cond)); + } + + void set32(Condition cond, Address left, Imm32 right, RegisterID dest) + { + load32(left, SparcRegisters::g2); + set32(cond, SparcRegisters::g2, right, dest); + } + + void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + // Sparc does not have byte register. + set32(cond, left, right, dest); + } + + void set8(Condition cond, Address left, RegisterID right, RegisterID dest) + { + // Sparc doesn't have byte registers + load32(left, SparcRegisters::g2); + set32(cond, SparcRegisters::g2, right, dest); + } + + void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest) + { + // Sparc does not have byte register. + set32(cond, left, right, dest); + } + + void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest) + { + load32(address, SparcRegisters::g2); + if (m_assembler.isimm13(mask.m_value)) + m_assembler.andcc_imm(SparcRegisters::g2, mask.m_value, SparcRegisters::g0); + else { + m_assembler.move_nocheck(mask.m_value, SparcRegisters::g3); + m_assembler.andcc_r(SparcRegisters::g3, SparcRegisters::g2, SparcRegisters::g0); + } + m_assembler.or_imm(SparcRegisters::g0, 0, dest); + m_assembler.movcc_imm(1, dest, SparcCondition(cond)); + } + + void setTest8(Condition cond, Address address, Imm32 mask, RegisterID dest) + { + // Sparc does not have byte register. + setTest32(cond, address, mask, dest); + } + + void lea(Address address, RegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.add_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.add_r(address.base, SparcRegisters::g3, dest); + } + } + + void lea(BaseIndex address, RegisterID dest) + { + // lea only used by PolyIC. + // PolyIC is not enabled for sparc now. + ASSERT(0); + } + + void add32(Imm32 imm, AbsoluteAddress address) + { + load32(address.m_ptr, SparcRegisters::g2); + add32(imm, SparcRegisters::g2); + store32(SparcRegisters::g2, address.m_ptr); + } + + void sub32(Imm32 imm, AbsoluteAddress address) + { + load32(address.m_ptr, SparcRegisters::g2); + sub32(imm, SparcRegisters::g2); + store32(SparcRegisters::g2, address.m_ptr); + } + + void load32(void* address, RegisterID dest) + { + m_assembler.move_nocheck((int)address, SparcRegisters::g3); + m_assembler.lduw_r(SparcRegisters::g3, SparcRegisters::g0, dest); + } + + Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right) + { + load32(left.m_ptr, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right) + { + load32(left.m_ptr, SparcRegisters::g2); + return branch32(cond, SparcRegisters::g2, right); + } + + Call call() + { + m_assembler.rdpc(SparcRegisters::g2); + m_assembler.add_imm(SparcRegisters::g2, 32, SparcRegisters::g2); + m_assembler.stw_imm(SparcRegisters::g2, SparcRegisters::fp, -8); + Call cl = Call(m_assembler.call(), Call::Linkable); + m_assembler.lduw_imm(SparcRegisters::fp, -8, SparcRegisters::g2); + m_assembler.jmpl_imm(SparcRegisters::g2, 0, SparcRegisters::g0); + m_assembler.nop(); + return cl; + } + + Call tailRecursiveCall() + { + return Call::fromTailJump(jump()); + } + + Call makeTailRecursiveCall(Jump oldJump) + { + return Call::fromTailJump(oldJump); + } + + DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest) + { + DataLabelPtr dataLabel(this); + Imm32 imm = Imm32(initialValue); + m_assembler.move_nocheck(imm.m_value, dest); + return dataLabel; + } + + DataLabel32 moveWithPatch(Imm32 initialValue, RegisterID dest) + { + DataLabel32 dataLabel(this); + m_assembler.move_nocheck(initialValue.m_value, dest); + return dataLabel; + } + + Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0)) + { + dataLabel = moveWithPatch(initialRightValue, SparcRegisters::g2); + Jump jump = branch32(cond, left, SparcRegisters::g2); + return jump; + } + + Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0)) + { + load32(left, SparcRegisters::g2); + dataLabel = moveWithPatch(initialRightValue, SparcRegisters::g3); + Jump jump = branch32(cond, SparcRegisters::g3, SparcRegisters::g2); + return jump; + } + + DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address) + { + DataLabelPtr dataLabel = moveWithPatch(initialValue, SparcRegisters::g2); + store32(SparcRegisters::g2, address); + return dataLabel; + } + + DataLabelPtr storePtrWithPatch(ImplicitAddress address) + { + return storePtrWithPatch(ImmPtr(0), address); + } + + // Floating point operators + bool supportsFloatingPoint() const + { + return true; + } + + bool supportsFloatingPointTruncate() const + { + return true; + } + + bool supportsFloatingPointSqrt() const + { + return true; + } + + void moveDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fmovd_r(src, dest); + } + + void loadFloat(BaseIndex address, FPRegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.ldf_r(address.base, SparcRegisters::g2, dest); + m_assembler.fstod_r(dest, dest); + } + + void loadFloat(ImplicitAddress address, FPRegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldf_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldf_r(address.base, SparcRegisters::g3, dest); + } + m_assembler.fstod_r(dest, dest); + } + + void loadFloat(const void* address, FPRegisterID dest) + { + m_assembler.move_nocheck((int)address, SparcRegisters::g3); + m_assembler.ldf_r(SparcRegisters::g3, SparcRegisters::g0, dest); + m_assembler.fstod_r(dest, dest); + } + + void loadDouble(BaseIndex address, FPRegisterID dest) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.ldf_r(address.base, SparcRegisters::g2, dest); + m_assembler.add_imm(SparcRegisters::g2, 4, SparcRegisters::g2); + m_assembler.ldf_r(address.base, SparcRegisters::g2, dest + 1); + } + + void loadDouble(ImplicitAddress address, FPRegisterID dest) + { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldf_r(address.base, SparcRegisters::g3, dest); + m_assembler.add_imm(SparcRegisters::g3, 4, SparcRegisters::g3); + m_assembler.ldf_r(address.base, SparcRegisters::g3, dest + 1); + } + + DataLabelPtr loadDouble(const void* address, FPRegisterID dest) + { + DataLabelPtr dataLabel(this); + m_assembler.move_nocheck((int)address, SparcRegisters::g3); + m_assembler.ldf_imm(SparcRegisters::g3, 0, dest); + m_assembler.ldf_imm(SparcRegisters::g3, 4, dest + 1); + return dataLabel; + } + + void storeFloat(FPRegisterID src, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.stf_r(src, address.base, SparcRegisters::g2); + } + + void storeFloat(FPRegisterID src, ImplicitAddress address) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.stf_imm(src, address.base, address.offset); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.stf_r(src, address.base, SparcRegisters::g3); + } + } + + void storeFloat(ImmDouble imm, Address address) + { + union { + float f; + uint32 u32; + } u; + u.f = imm.u.d; + store32(Imm32(u.u32), address); + } + + void storeFloat(ImmDouble imm, BaseIndex address) + { + union { + float f; + uint32 u32; + } u; + u.f = imm.u.d; + store32(Imm32(u.u32), address); + } + + void storeDouble(FPRegisterID src, BaseIndex address) + { + m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2); + add32(Imm32(address.offset), SparcRegisters::g2); + m_assembler.stf_r(src, address.base, SparcRegisters::g2); + m_assembler.add_imm(SparcRegisters::g2, 4, SparcRegisters::g2); + m_assembler.stf_r(src + 1, address.base, SparcRegisters::g2); + } + + void storeDouble(FPRegisterID src, ImplicitAddress address) + { + if (m_assembler.isimm13(address.offset + 4)) { + m_assembler.stf_imm(src, address.base, address.offset); + m_assembler.stf_imm(src + 1, address.base, address.offset + 4); + } else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.stf_r(src, address.base, SparcRegisters::g3); + m_assembler.add_imm(SparcRegisters::g3, 4, SparcRegisters::g3); + m_assembler.stf_r(src + 1, address.base, SparcRegisters::g3); + } + } + + void storeDouble(ImmDouble imm, Address address) + { + store32(Imm32(imm.u.s.msb), address); + store32(Imm32(imm.u.s.lsb), Address(address.base, address.offset + 4)); + } + + void storeDouble(ImmDouble imm, BaseIndex address) + { + store32(Imm32(imm.u.s.msb), address); + store32(Imm32(imm.u.s.lsb), + BaseIndex(address.base, address.index, address.scale, address.offset + 4)); + } + + void addDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.faddd_r(src, dest, dest); + } + + void addDouble(Address src, FPRegisterID dest) + { + loadDouble(src, SparcRegisters::f30); + m_assembler.faddd_r(SparcRegisters::f30, dest, dest); + } + + void divDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fdivd_r(dest, src, dest); + } + + void divDouble(Address src, FPRegisterID dest) + { + loadDouble(src, SparcRegisters::f30); + m_assembler.fdivd_r(dest, SparcRegisters::f30, dest); + } + + void subDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fsubd_r(dest, src, dest); + } + + void subDouble(Address src, FPRegisterID dest) + { + loadDouble(src, SparcRegisters::f30); + m_assembler.fsubd_r(dest, SparcRegisters::f30, dest); + } + + void mulDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fmuld_r(src, dest, dest); + } + + void mulDouble(Address src, FPRegisterID dest) + { + loadDouble(src, SparcRegisters::f30); + m_assembler.fmuld_r(SparcRegisters::f30, dest, dest); + } + + void sqrtDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fsqrtd_r(src, dest); + } + + void negDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fnegd_r(src, dest); + } + + void convertUInt32ToDouble(RegisterID src, FPRegisterID dest) + { + m_assembler.move_nocheck(0x43300000, SparcRegisters::g1); + m_assembler.stw_imm(SparcRegisters::g1, SparcRegisters::sp, 0x60); + m_assembler.stw_imm(src, SparcRegisters::sp, 0x64); + m_assembler.ldf_imm(SparcRegisters::sp, 0x60, SparcRegisters::f30); + m_assembler.ldf_imm(SparcRegisters::sp, 0x64, SparcRegisters::f31); + m_assembler.stw_imm(SparcRegisters::g0, SparcRegisters::sp, 0x64); + m_assembler.ldf_imm(SparcRegisters::sp, 0x60, dest); + m_assembler.ldf_imm(SparcRegisters::sp, 0x64, dest + 1); + m_assembler.fsubd_r(SparcRegisters::f30, dest, dest); + m_assembler.fabss_r(dest, dest); + } + + void convertInt32ToDouble(RegisterID src, FPRegisterID dest) + { + m_assembler.stw_imm(src, SparcRegisters::sp, 0x60); + m_assembler.ldf_imm(SparcRegisters::sp, 0x60, dest); + m_assembler.fitod_r(dest, dest); + } + + void convertInt32ToDouble(Address address, FPRegisterID dest) + { + if (m_assembler.isimm13(address.offset)) + m_assembler.ldf_imm(address.base, address.offset, dest); + else { + m_assembler.move_nocheck(address.offset, SparcRegisters::g3); + m_assembler.ldf_r(address.base, SparcRegisters::g3, dest); + } + m_assembler.fitod_r(dest, dest); + } + + void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) + { + m_assembler.move_nocheck((int)src.m_ptr, SparcRegisters::g3); + m_assembler.ldf_r(SparcRegisters::g3, SparcRegisters::g0, dest); + m_assembler.fitod_r(dest, dest); + } + + void fastLoadDouble(RegisterID lo, RegisterID hi, FPRegisterID fpReg) + { + m_assembler.stw_imm(lo, SparcRegisters::sp, 0x64); + m_assembler.stw_imm(hi, SparcRegisters::sp, 0x60); + m_assembler.ldf_imm(SparcRegisters::sp, 0x60, fpReg); + m_assembler.ldf_imm(SparcRegisters::sp, 0x64, fpReg + 1); + } + + void convertDoubleToFloat(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fdtos_r(src, dest); + } + + void breakDoubleTo32(FPRegisterID srcDest, RegisterID typeReg, RegisterID dataReg) { + // We don't assume stack is aligned to 8. + // Always using stf, ldf instead of stdf, lddf. + m_assembler.stf_imm(srcDest, SparcRegisters::sp, 0x60); + m_assembler.stf_imm(srcDest + 1, SparcRegisters::sp, 0x64); + m_assembler.lduw_imm(SparcRegisters::sp, 0x60, typeReg); + m_assembler.lduw_imm(SparcRegisters::sp, 0x64, dataReg); + } + + Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) + { + m_assembler.fcmpd_r(left, right); + return Jump(m_assembler.fbranch(SparcDoubleCondition(cond))); + } + + // Truncates 'src' to an integer, and places the resulting 'dest'. + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, INT_MIN). + Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest) + { + m_assembler.fdtoi_r(src, SparcRegisters::f30); + m_assembler.stf_imm(SparcRegisters::f30, SparcRegisters::sp, 0x60); + m_assembler.lduw_imm(SparcRegisters::sp, 0x60, dest); + + m_assembler.or_r(SparcRegisters::g0, SparcRegisters::g0, SparcRegisters::g2); + m_assembler.move_nocheck(0x80000000, SparcRegisters::g3); + m_assembler.subcc_r(SparcRegisters::g3, dest, SparcRegisters::g0); + m_assembler.movcc_imm(1, SparcRegisters::g2, SparcCondition(Equal)); + m_assembler.move_nocheck(0x7fffffff, SparcRegisters::g3); + m_assembler.subcc_r(SparcRegisters::g3, dest, SparcRegisters::g0); + m_assembler.movcc_imm(1, SparcRegisters::g2, SparcCondition(Equal)); + + return branch32(Equal, SparcRegisters::g2, Imm32(1)); + } + + // Convert 'src' to an integer, and places the resulting 'dest'. + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, 0). + void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) + { + m_assembler.fdtoi_r(src, SparcRegisters::f30); + m_assembler.stf_imm(SparcRegisters::f30, SparcRegisters::sp, 0x60); + m_assembler.lduw_imm(SparcRegisters::sp, 0x60, dest); + + // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. + m_assembler.fitod_r(SparcRegisters::f30, SparcRegisters::f30); + failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, SparcRegisters::f30)); + + // If the result is zero, it might have been -0.0, and 0.0 equals to -0.0 + failureCases.append(branchTest32(Zero, dest)); + } + + void zeroDouble(FPRegisterID srcDest) + { + m_assembler.fsubd_r(srcDest, srcDest, srcDest); + } + + protected: + SparcAssembler::Condition SparcCondition(Condition cond) + { + return static_cast(cond); + } + + SparcAssembler::DoubleCondition SparcDoubleCondition(DoubleCondition cond) + { + return static_cast(cond); + } + + private: + friend class LinkBuffer; + friend class RepatchBuffer; + + static void linkCall(void* code, Call call, FunctionPtr function) + { + SparcAssembler::linkCall(code, call.m_jmp, function.value()); + } + + static void repatchCall(CodeLocationCall call, CodeLocationLabel destination) + { + SparcAssembler::relinkCall(call.dataLocation(), destination.executableAddress()); + } + + static void repatchCall(CodeLocationCall call, FunctionPtr destination) + { + SparcAssembler::relinkCall(call.dataLocation(), destination.executableAddress()); + } + + }; + +} + + +#endif // ENABLE(ASSEMBLER) && CPU(SPARC) + +#endif // MacroAssemblerSparc_h diff --git a/js/src/assembler/assembler/SparcAssembler.h b/js/src/assembler/assembler/SparcAssembler.h new file mode 100644 index 000000000000..2e68817ba1d3 --- /dev/null +++ b/js/src/assembler/assembler/SparcAssembler.h @@ -0,0 +1,1256 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=4 sw=4 et tw=99: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * May 28, 2008. + * + * The Initial Developer of the Original Code is + * Leon Sha + * + * Portions created by the Initial Developer are Copyright (C) 2010-2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * 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 ***** */ + +#ifndef SparcAssembler_h +#define SparcAssembler_h + +#include + +// Some debug code uses s(n)printf for instruction logging. +#include + +#if ENABLE_ASSEMBLER && WTF_CPU_SPARC + +#include "AssemblerBufferWithConstantPool.h" +#include + +#include "methodjit/Logging.h" +#define IPFX " %s" +#define ISPFX " " +#ifdef JS_METHODJIT_SPEW +# define MAYBE_PAD (isOOLPath ? "> " : "") +# define PRETTY_PRINT_OFFSET(os) (((os)<0)?"-":""), (((os)<0)?-(os):(os)) +# define FIXME_INSN_PRINTING \ + do { \ + js::JaegerSpew(js::JSpew_Insns, \ + ISPFX "FIXME insn printing %s:%d\n", \ + __FILE__, __LINE__); \ + } while (0) +#else +# define MAYBE_PAD "" +# define FIXME_INSN_PRINTING ((void) 0) +# define PRETTY_PRINT_OFFSET(os) "", 0 +#endif + +namespace JSC { + + typedef uint32_t SparcWord; + + namespace SparcRegisters { + typedef enum { + g0 = 0, // g0 is always 0 + g1 = 1, // g1 is a scratch register for v8 + g2 = 2, + g3 = 3, + g4 = 4, + g5 = 5, // Reserved for system + g6 = 6, // Reserved for system + g7 = 7, // Reserved for system + + o0 = 8, + o1 = 9, + o2 = 10, + o3 = 11, + o4 = 12, + o5 = 13, + o6 = 14, // SP + o7 = 15, + + l0 = 16, + l1 = 17, + l2 = 18, + l3 = 19, + l4 = 20, + l5 = 21, + l6 = 22, + l7 = 23, + + i0 = 24, + i1 = 25, + i2 = 26, + i3 = 27, + i4 = 28, + i5 = 29, + i6 = 30, // FP + i7 = 31, + + sp = o6, + fp = i6 + } RegisterID; + + typedef enum { + f0 = 0, + f1 = 1, + f2 = 2, + f3 = 3, + f4 = 4, + f5 = 5, + f6 = 6, + f7 = 7, + f8 = 8, + f9 = 9, + f10 = 10, + f11 = 11, + f12 = 12, + f13 = 13, + f14 = 14, + f15 = 15, + f16 = 16, + f17 = 17, + f18 = 18, + f19 = 19, + f20 = 20, + f21 = 21, + f22 = 22, + f23 = 23, + f24 = 24, + f25 = 25, + f26 = 26, + f27 = 27, + f28 = 28, + f29 = 29, + f30 = 30, + f31 = 31 + } FPRegisterID; + + } // namespace SparcRegisters + + class SparcAssembler { + public: + typedef SparcRegisters::RegisterID RegisterID; + typedef SparcRegisters::FPRegisterID FPRegisterID; + AssemblerBuffer m_buffer; + bool oom() const { return m_buffer.oom(); } + +#ifdef JS_METHODJIT_SPEW + bool isOOLPath; + SparcAssembler() : isOOLPath(false) { } +#else + SparcAssembler() { } +#endif + + // Sparc conditional constants + typedef enum { + ConditionE = 0x1, // Zero + ConditionLE = 0x2, + ConditionL = 0x3, + ConditionLEU = 0x4, + ConditionCS = 0x5, + ConditionNEG = 0x6, + ConditionVS = 0x7, + ConditionA = 0x8, // branch_always + ConditionNE = 0x9, // Non-zero + ConditionG = 0xa, + ConditionGE = 0xb, + ConditionGU = 0xc, + ConditionCC = 0xd, + ConditionVC = 0xf + } Condition; + + + typedef enum { + DoubleConditionNE = 0x1, + DoubleConditionUL = 0x3, + DoubleConditionL = 0x4, + DoubleConditionUG = 0x5, + DoubleConditionG = 0x6, + DoubleConditionE = 0x9, + DoubleConditionUE = 0xa, + DoubleConditionGE = 0xb, + DoubleConditionUGE = 0xc, + DoubleConditionLE = 0xd, + DoubleConditionULE = 0xe + } DoubleCondition; + + typedef enum { + BranchOnCondition, + BranchOnDoubleCondition + } BranchType; + + class JmpSrc { + friend class SparcAssembler; + public: + JmpSrc() + : m_offset(-1) + { + } + + private: + JmpSrc(int offset) + : m_offset(offset) + { + } + + int m_offset; + }; + + class JmpDst { + friend class SparcAssembler; + public: + JmpDst() + : m_offset(-1) + , m_used(false) + { + } + + bool isUsed() const { return m_used; } + void used() { m_used = true; } + bool isValid() const { return m_offset != -1; } + private: + JmpDst(int offset) + : m_offset(offset) + , m_used(false) + { + ASSERT(m_offset == offset); + } + + int m_used : 1; + signed int m_offset : 31; + }; + + // Instruction formating + + void format_2_1(int rd, int op2, int imm22) + { + m_buffer.putInt(rd << 25 | op2 << 22 | (imm22 & 0x3FFFFF)); + } + + void format_2_2(int a, int cond, int op2, int disp22) + { + format_2_1((a & 0x1) << 4 | (cond & 0xF), op2, disp22); + } + + void format_2_3(int a, int cond, int op2, int cc1, int cc0, int p, int disp19) + { + format_2_2(a, cond, op2, (cc1 & 0x1) << 21 | (cc0 & 0x1) << 20 | (p & 0x1) << 19 | (disp19 & 0x7FFFF)); + } + + void format_2_4(int a, int rcond, int op2, int d16hi, int p, int rs1, int d16lo) + { + format_2_2(a, (rcond & 0x7), op2, (d16hi & 0x3) << 20 | (p & 0x1) << 19 | rs1 << 14 | (d16lo & 0x3FFF)); + } + + void format_3(int op1, int rd, int op3, int bits19) + { + m_buffer.putInt(op1 << 30 | rd << 25 | op3 << 19 | (bits19 & 0x7FFFF)); + } + + void format_3_1(int op1, int rd, int op3, int rs1, int bit8, int rs2) + { + format_3(op1, rd, op3, rs1 << 14 | (bit8 & 0xFF) << 5 | rs2); + } + + void format_3_1_imm(int op1, int rd, int op3, int rs1, int simm13) + { + format_3(op1, rd, op3, rs1 << 14 | 1 << 13 | (simm13 & 0x1FFF)); + } + + void format_3_2(int op1, int rd, int op3, int rs1, int rcond, int rs2) + { + format_3(op1, rd, op3, rs1 << 14 | (rcond & 0x3) << 10 | rs2); + } + + void format_3_2_imm(int op1, int rd, int op3, int rs1, int rcond, int simm10) + { + format_3(op1, rd, op3, rs1 << 14 | 1 << 13 | (rcond & 0x3) << 10 | (simm10 & 0x1FFF)); + } + + void format_3_3(int op1, int rd, int op3, int rs1, int cmask, int mmask) + { + format_3(op1, rd, op3, rs1 << 14 | 1 << 13 | (cmask & 0x7) << 5 | (mmask & 0xF)); + } + void format_3_4(int op1, int rd, int op3, int bits19) + { + format_3(op1, rd, op3, bits19); + } + + void format_3_5(int op1, int rd, int op3, int rs1, int x, int rs2) + { + format_3(op1, rd, op3, rs1 << 14 | (x & 0x1) << 12 | rs2); + } + + void format_3_6(int op1, int rd, int op3, int rs1, int shcnt32) + { + format_3(op1, rd, op3, rs1 << 14 | 1 << 13 | (shcnt32 & 0x1F)); + } + + void format_3_7(int op1, int rd, int op3, int rs1, int shcnt64) + { + format_3(op1, rd, op3, rs1 << 14 | 1 << 13 | 1 << 12 | (shcnt64 & 0x3F)); + } + + void format_3_8(int op1, int rd, int op3, int rs1, int bits9, int rs2) + { + format_3(op1, rd, op3, rs1 << 14 | (bits9 & 0x1FF) << 5 | rs2); + } + + void format_3_9(int op1, int cc1, int cc0, int op3, int rs1, int bits9, int rs2) + { + format_3(op1, (cc1 & 0x1) << 1 | (cc0 & 0x1), op3, rs1 << 14 | (bits9 & 0x1FF) << 5 | rs2); + } + + void format_4_1(int rd, int op3, int rs1, int cc1, int cc0, int rs2) + { + format_3(2, rd, op3, rs1 << 14 | (cc1 & 0x1) << 12 | (cc0 & 0x1) << 11 | rs2); + } + + void format_4_1_imm(int rd, int op3, int rs1, int cc1, int cc0, int simm11) + { + format_3(2, rd, op3, rs1 << 14 | (cc1 & 0x1) << 12 | 1 << 13 |(cc0 & 0x1) << 11 | (simm11 & 0x7FF)); + } + + void format_4_2(int rd, int op3, int cc2, int cond, int cc1, int cc0, int rs2) + { + format_3(2, rd, op3, (cc2 & 0x1) << 18 | (cond & 0xF) << 14 | (cc1 & 0x1) << 12 | (cc0 & 0x1) << 11 | rs2); + } + + void format_4_2_imm(int rd, int op3, int cc2, int cond, int cc1, int cc0, int simm11) + { + format_3(2, rd, op3, (cc2 & 0x1) << 18 | (cond & 0xF) << 14 | 1 << 13 | (cc1 & 0x1) << 12 | (cc0 & 0x1) << 11 | (simm11 & 0x7FF)); + } + + void format_4_3(int rd, int op3, int rs1, int cc1, int cc0, int swap_trap) + { + format_3(2, rd, op3, rs1 << 14 | 1 << 13 | (cc1 & 0x1) << 12 | (cc0 & 0x1) << 11 | (swap_trap & 0x7F)); + } + + void format_4_4(int rd, int op3, int rs1, int rcond, int opf_low, int rs2) + { + format_3(2, rd, op3, rs1 << 14 | (rcond & 0x7) << 10 | (opf_low & 0x1F) << 5 | rs2); + } + + void format_4_5(int rd, int op3, int cond, int opf_cc, int opf_low, int rs2) + { + format_3(2, rd, op3, (cond & 0xF) << 14 | (opf_cc & 0x7) << 11 | (opf_low & 0x3F) << 5 | rs2); + } + + void addcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "addcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x10, rs1, 0, rs2); + } + + void addcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "addcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x10, rs1, simm13); + } + + void add_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "add %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0, rs1, 0, rs2); + } + + void add_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "add %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0, rs1, simm13); + } + + void andcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "andcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x11, rs1, 0, rs2); + } + + void andcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "andcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x11, rs1, simm13); + } + + void or_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "or %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x2, rs1, 0, rs2); + } + + void or_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "or %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x2, rs1, simm13); + } + + // sethi %hi(imm22) rd + void sethi(int imm22, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sethi %%hi(0x%x), %s\n", MAYBE_PAD, + imm22, nameGpReg(rd)); + format_2_1(rd, 0x4, (imm22 >> 10)); + } + + void sll_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sll %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_5(2, rd, 0x25, rs1, 0, rs2); + } + + void sll_imm(int rs1, int shcnt32, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sll %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), shcnt32, nameGpReg(rd)); + format_3_6(2, rd, 0x25, rs1, shcnt32); + } + + void sra_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sra %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_5(2, rd, 0x27, rs1, 0, rs2); + } + + void sra_imm(int rs1, int shcnt32, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sra %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), shcnt32, nameGpReg(rd)); + format_3_6(2, rd, 0x27, rs1, shcnt32); + } + + void srl_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "srl %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_5(2, rd, 0x26, rs1, 0, rs2); + } + + void srl_imm(int rs1, int shcnt32, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "srl %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), shcnt32, nameGpReg(rd)); + format_3_6(2, rd, 0x26, rs1, shcnt32); + } + + void subcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "subcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x14, rs1, 0, rs2); + } + + void subcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "subcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x14, rs1, simm13); + } + + void orcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "orcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x12, rs1, 0, rs2); + } + + void orcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "orcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x12, rs1, simm13); + } + + void xorcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "xorcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x13, rs1, 0, rs2); + } + + void xorcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "xorcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x13, rs1, simm13); + } + + void xnorcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "xnorcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x17, rs1, 0, rs2); + } + + void xnorcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "xnorcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x17, rs1, simm13); + } + + void smulcc_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "smulcc %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x1b, rs1, 0, rs2); + } + + void smulcc_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "smulcc %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x1b, rs1, simm13); + } + + void ldsb_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldsb [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0x9, rs1, 0, rs2); + } + + void ldsb_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldsb [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(3, rd, 0x9, rs1, simm13); + } + + void ldub_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldub [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0x1, rs1, 0, rs2); + } + + void ldub_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldub [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(3, rd, 0x1, rs1, simm13); + } + + void lduw_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "lduw [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0x0, rs1, 0, rs2); + } + + void lduwa_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "lduwa [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0x10, rs1, 0x82, rs2); + } + + void lduw_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "lduw [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(3, rd, 0x0, rs1, simm13); + } + + void ldsh_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldsh [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0xa, rs1, 0, rs2); + } + + void ldsh_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ldsh [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(3, rd, 0xa, rs1, simm13); + } + + void lduh_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "lduh [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(3, rd, 0x2, rs1, 0, rs2); + } + + void lduh_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "lduh [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(3, rd, 0x2, rs1, simm13); + } + + void stb_r(int rd, int rs2, int rs1) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "stb %s, [%s + %s]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), nameGpReg(rs2)); + format_3_1(3, rd, 0x5, rs1, 0, rs2); + } + + void stb_imm(int rd, int rs1, int simm13) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "stb %s, [%s + %d]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), simm13); + format_3_1_imm(3, rd, 0x5, rs1, simm13); + } + + void sth_r(int rd, int rs2, int rs1) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sth %s, [%s + %s]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), nameGpReg(rs2)); + format_3_1(3, rd, 0x6, rs1, 0, rs2); + } + + void sth_imm(int rd, int rs1, int simm13) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "sth %s, [%s + %d]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), simm13); + format_3_1_imm(3, rd, 0x6, rs1, simm13); + } + + void stw_r(int rd, int rs2, int rs1) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "stw %s, [%s + %s]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), nameGpReg(rs2)); + format_3_1(3, rd, 0x4, rs1, 0, rs2); + } + + void stw_imm(int rd, int rs1, int simm13) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "stw %s, [%s + %d]\n", MAYBE_PAD, + nameGpReg(rd), nameGpReg(rs1), simm13); + format_3_1_imm(3, rd, 0x4, rs1, simm13); + } + + void ldf_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ld [%s + %s], %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameFpReg(rd)); + format_3_1(3, rd, 0x20, rs1, 0, rs2); + } + + void ldf_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ld [%s + %d], %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameFpReg(rd)); + format_3_1_imm(3, rd, 0x20, rs1, simm13); + } + + void stf_r(int rd, int rs2, int rs1) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "st %s, [%s + %s]\n", MAYBE_PAD, + nameFpReg(rd), nameGpReg(rs1), nameGpReg(rs2)); + format_3_1(3, rd, 0x24, rs1, 0, rs2); + } + + void stf_imm(int rd, int rs1, int simm13) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "st %s, [%s + %d]\n", MAYBE_PAD, + nameFpReg(rd), nameGpReg(rs1), simm13); + format_3_1_imm(3, rd, 0x24, rs1, simm13); + } + + void fmovd_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fmovd %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0x2, rs2); + } + + void fcmpd_r(int rs1, int rs2) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fcmpd %s, %s\n", MAYBE_PAD, + nameFpReg(rs1), nameFpReg(rs2)); + format_3_9(2, 0, 0, 0x35, rs1, 0x52, rs2); + } + + void nop() + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "nop\n", MAYBE_PAD); + format_2_1(0, 0x4, 0); + } + + void branch_con(Condition cond, int target) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "b%s 0x%x\n", MAYBE_PAD, + nameICC(cond), target); + format_2_2(0, cond, 0x2, target); + } + + void fbranch_con(DoubleCondition cond, int target) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fb%s 0x%x\n", MAYBE_PAD, + nameFCC(cond), target); + format_2_2(0, cond, 0x6, target); + } + + void rdy(int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "rdy %s\n", MAYBE_PAD, + nameFpReg(rd)); + format_3_1(2, rd, 0x28, 0, 0, 0); + } + + void rdpc(int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "rdpc %s\n", MAYBE_PAD, + nameGpReg(rd)); + format_3_1(2, rd, 0x28, 5, 0, 0); + } + void jmpl_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "jmpl %s + %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x38, rs1, 0, rs2); + } + + void jmpl_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "jmpl %s + %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x38, rs1, simm13); + } + + void save_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "save %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x3c, rs1, 0, rs2); + } + + void save_imm(int rs1, int simm13, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "save %s, %d, %s\n", MAYBE_PAD, + nameGpReg(rs1), simm13, nameGpReg(rd)); + format_3_1_imm(2, rd, 0x3c, rs1, simm13); + } + + void restore_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "restore %s, %s, %s\n", MAYBE_PAD, + nameGpReg(rs1), nameGpReg(rs2), nameGpReg(rd)); + format_3_1(2, rd, 0x3d, rs1, 0, rs2); + } + + void ta_imm(int swap_trap) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "ta %d\n", MAYBE_PAD, + swap_trap); + format_4_3(0x8, 0xa, 0, 0, 0, swap_trap); + } + + void movcc_imm(int simm11, int rd, Condition cond) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "mov%s %d, %s\n", MAYBE_PAD, + nameICC(cond), simm11, nameGpReg(rd)); + format_4_2_imm(rd, 0x2c, 1, cond, 0, 0, simm11); + } + + void fabss_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fabss %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0x9, rs2); + } + + void faddd_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "faddd %s, %s, %s\n", MAYBE_PAD, + nameFpReg(rs1), nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, rs1, 0x42, rs2); + } + + void fsubd_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fsubd %s, %s, %s\n", MAYBE_PAD, + nameFpReg(rs1), nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, rs1, 0x46, rs2); + } + + void fmuld_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fmuld %s, %s, %s\n", MAYBE_PAD, + nameFpReg(rs1), nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, rs1, 0x4a, rs2); + } + + void fdivd_r(int rs1, int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fdivd %s, %s, %s\n", MAYBE_PAD, + nameFpReg(rs1), nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, rs1, 0x4e, rs2); + } + + void fsqrtd_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fsqartd %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0x2a, rs2); + } + + void fnegd_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fnegd %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0x06, rs2); + } + + void fitod_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fitod %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0xc8, rs2); + } + + void fdtoi_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fdtoi %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0xd2, rs2); + } + + void fdtos_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fdtos %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0xc6, rs2); + } + + void fstod_r(int rs2, int rd) + { + js::JaegerSpew(js::JSpew_Insns, + IPFX "fstod %s, %s\n", MAYBE_PAD, + nameFpReg(rs2), nameFpReg(rd)); + format_3_8(2, rd, 0x34, 0, 0xc9, rs2); + } + + static bool isimm13(int imm) + { + return (imm) <= 0xfff && (imm) >= -0x1000; + } + + static bool isimm22(int imm) + { + return (imm) <= 0x1fffff && (imm) >= -0x200000; + } + + void move_nocheck(int imm_v, RegisterID dest) + { + sethi(imm_v, dest); + or_imm(dest, imm_v & 0x3FF, dest); + } + + JmpSrc call() + { + JmpSrc r = JmpSrc(m_buffer.size()); + js::JaegerSpew(js::JSpew_Insns, + IPFX "call %d\n", MAYBE_PAD, + r.m_offset); + m_buffer.putInt(0x40000000); + nop(); + return r; + } + + JmpSrc jump_common(BranchType branchtype, int cond) + { + if (branchtype == BranchOnCondition) + branch_con(Condition(cond), 0); + else + fbranch_con(DoubleCondition(cond), 0); + + nop(); + branch_con(ConditionA, 7); + nop(); + move_nocheck(0, SparcRegisters::g2); + rdpc(SparcRegisters::g3); + jmpl_r(SparcRegisters::g2, SparcRegisters::g3, SparcRegisters::g0); + nop(); + return JmpSrc(m_buffer.size()); + } + + JmpSrc branch(Condition cond) + { + return jump_common(BranchOnCondition, cond); + } + + JmpSrc fbranch(DoubleCondition cond) + { + return jump_common(BranchOnDoubleCondition, cond); + } + + JmpSrc jmp() + { + return jump_common(BranchOnCondition, ConditionA); + } + + // Assembler admin methods: + + JmpDst label() + { + JmpDst r = JmpDst(m_buffer.size()); + js::JaegerSpew(js::JSpew_Insns, + IPFX "#label ((%d))\n", MAYBE_PAD, r.m_offset); + return r; + } + + // General helpers + + size_t size() const { return m_buffer.size(); } + unsigned char *buffer() const { return m_buffer.buffer(); } + + static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst) + { + return dst.m_offset - src.m_offset; + } + + static int getDifferenceBetweenLabels(JmpDst src, JmpSrc dst) + { + return dst.m_offset - src.m_offset; + } + + static int getDifferenceBetweenLabels(JmpSrc src, JmpDst dst) + { + return dst.m_offset - src.m_offset; + } + + static unsigned getCallReturnOffset(JmpSrc call) + { + return call.m_offset + 20; + } + + static void* getRelocatedAddress(void* code, JmpSrc jump) + { + ASSERT(jump.m_offset != -1); + + return reinterpret_cast(reinterpret_cast(code) + jump.m_offset); + } + + static void* getRelocatedAddress(void* code, JmpDst destination) + { + ASSERT(destination.m_offset != -1); + + return reinterpret_cast(reinterpret_cast(code) + destination.m_offset); + } + + void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool **poolp) + { + return m_buffer.executableAllocAndCopy(allocator, poolp); + } + + void* executableCopy(void* buffer) + { + return memcpy(buffer, m_buffer.buffer(), size()); + } + + static void patchPointerInternal(void* where, int value) + { + // Patch move_nocheck. + uint32_t *branch = (uint32_t*) where; + branch[0] &= 0xFFC00000; + branch[0] |= (value >> 10) & 0x3FFFFF; + branch[1] &= 0xFFFFFC00; + branch[1] |= value & 0x3FF; + ExecutableAllocator::cacheFlush(where, 8); + } + + static void patchbranch(void* where, int value) + { + uint32_t *branch = (uint32_t*) where; + branch[0] &= 0xFFC00000; + branch[0] |= value & 0x3FFFFF; + ExecutableAllocator::cacheFlush(where, 4); + } + + static bool canRelinkJump(void* from, void* to) + { + return true; + } + + static void relinkJump(void* from, void* to) + { + from = (void *)((int)from - 36); + js::JaegerSpew(js::JSpew_Insns, + ISPFX "##link ((%p)) jumps to ((%p))\n", + from, to); + + int value = ((int)to - (int)from) / 4; + if (isimm22(value)) + patchbranch(from, value); + else { + patchbranch(from, 4); + from = (void *)((intptr_t)from + 16); + patchPointerInternal(from, (int)(value * 4 - 24)); + } + } + + void linkJump(JmpSrc from, JmpDst to) + { + ASSERT(from.m_offset != -1); + ASSERT(to.m_offset != -1); + intptr_t code = (intptr_t)(m_buffer.data()); + void *where = (void *)((intptr_t)code + from.m_offset); + void *target = (void *)((intptr_t)code + to.m_offset); + relinkJump(where, target); + } + + static void linkJump(void* code, JmpSrc from, void* to) + { + ASSERT(from.m_offset != -1); + void *where = (void *)((intptr_t)code + from.m_offset); + relinkJump(where, to); + } + + static void relinkCall(void* from, void* to) + { + js::JaegerSpew(js::JSpew_Insns, + ISPFX "##linkCall ((from=%p)) ((to=%p))\n", + from, to); + + int disp = ((int)to - (int)from)/4; + *(uint32_t *)((int)from) &= 0x40000000; + *(uint32_t *)((int)from) |= disp & 0x3fffffff; + ExecutableAllocator::cacheFlush(from, 4); + } + + static void linkCall(void* code, JmpSrc where, void* to) + { + void *from = (void *)((intptr_t)code + where.m_offset); + relinkCall(from, to); + } + + static void linkPointer(void* code, JmpDst where, void* value) + { + js::JaegerSpew(js::JSpew_Insns, + ISPFX "##linkPointer ((%p + %#x)) points to ((%p))\n", + code, where.m_offset, value); + + void *from = (void *)((intptr_t)code + where.m_offset); + patchPointerInternal(from, (int)value); + } + + static void repatchInt32(void* where, int value) + { + js::JaegerSpew(js::JSpew_Insns, + ISPFX "##repatchInt32 ((where=%p)) holds ((value=%d))\n", + where, value); + + patchPointerInternal(where, value); + } + + static void repatchPointer(void* where, void* value) + { + js::JaegerSpew(js::JSpew_Insns, + ISPFX "##repatchPointer ((where = %p)) points to ((%p))\n", + where, value); + + patchPointerInternal(where, (int)value); + } + + static void repatchLoadPtrToLEA(void* where) + { + // sethi is used. The offset is in a register + if (*(uint32_t *)((int)where) & 0x01000000) + where = (void *)((intptr_t)where + 8); + + *(uint32_t *)((int)where) &= 0x3fffffff; + *(uint32_t *)((int)where) |= 0x80000000; + ExecutableAllocator::cacheFlush(where, 4); + } + + static void repatchLEAToLoadPtr(void* where) + { + // sethi is used. The offset is in a register + if (*(uint32_t *)((int)where) & 0x01000000) + where = (void *)((intptr_t)where + 8); + + *(uint32_t *)((int)where) &= 0x3fffffff; + *(uint32_t *)((int)where) |= 0xc0000000; + ExecutableAllocator::cacheFlush(where, 4); + } + + private: + static char const * nameGpReg(int reg) + { + ASSERT(reg <= 31); + ASSERT(reg >= 0); + static char const * names[] = { + "%g0", "%g1", "%g2", "%g3", + "%g4", "%g5", "%g6", "%g7", + "%o0", "%o1", "%o2", "%o3", + "%o4", "%o5", "%sp", "%o7", + "%l0", "%l1", "%l2", "%l3", + "%l4", "%l5", "%l6", "%l7", + "%i0", "%i1", "%i2", "%i3", + "%i4", "%i5", "%fp", "%i7" + }; + return names[reg]; + } + + static char const * nameFpReg(int reg) + { + ASSERT(reg <= 31); + ASSERT(reg >= 0); + static char const * names[] = { + "%f0", "%f1", "%f2", "%f3", + "%f4", "%f5", "%f6", "%f7", + "%f8", "%f9", "%f10", "%f11", + "%f12", "%f13", "%f14", "%f15", + "%f16", "%f17", "%f18", "%f19", + "%f20", "%f21", "%f22", "%f23", + "%f24", "%f25", "%f26", "%f27", + "%f28", "%f29", "%f30", "%f31" + }; + return names[reg]; + } + + static char const * nameICC(Condition cc) + { + ASSERT(cc <= ConditionVC); + ASSERT(cc >= 0); + + uint32_t ccIndex = cc; + static char const * inames[] = { + " ", "e ", + "le ", "l ", + "leu", "cs ", + "neg", "vs ", + "a ", "ne ", + "g ", "ge ", + "gu ", "cc ", + " ", "vc " + }; + return inames[ccIndex]; + } + + static char const * nameFCC(DoubleCondition cc) + { + ASSERT(cc <= DoubleConditionULE); + ASSERT(cc >= 0); + + uint32_t ccIndex = cc; + static char const * fnames[] = { + " ", "ne ", + " ", "ul ", + "l ", "ug ", + "g ", " ", + " ", "e ", + "ue ", "ge ", + "ugu", "le ", + "ule", " " + }; + return fnames[ccIndex]; + } + + + }; + +} // namespace JSC + +#endif // ENABLE(ASSEMBLER) && CPU(SPARC) + +#endif // SparcAssembler_h diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h index 323261e5cbbe..78f0002e7330 100644 --- a/js/src/assembler/jit/ExecutableAllocator.h +++ b/js/src/assembler/jit/ExecutableAllocator.h @@ -35,6 +35,22 @@ #include "jsvector.h" #include "jslock.h" +#if WTF_CPU_SPARC +#ifdef linux // bugzilla 502369 +static void sync_instruction_memory(caddr_t v, u_int len) +{ + caddr_t end = v + len; + caddr_t p = v; + while (p < end) { + asm("flush %0" : : "r" (p)); + p += 32; + } +} +#else +extern "C" void sync_instruction_memory(caddr_t v, u_int len); +#endif +#endif + #if WTF_PLATFORM_IPHONE #include #include @@ -394,6 +410,11 @@ public: { CacheRangeFlush(code, size, CACHE_SYNC_ALL); } +#elif WTF_CPU_SPARC + static void cacheFlush(void* code, size_t size) + { + sync_instruction_memory((caddr_t)code, size); + } #else #error "The cacheFlush support is missing on this platform." #endif diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h index 3dfad2a8ae46..ce3b9491c555 100644 --- a/js/src/assembler/wtf/Platform.h +++ b/js/src/assembler/wtf/Platform.h @@ -159,7 +159,7 @@ /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ #if WTF_CPU_SPARC32 || WTF_CPU_SPARC64 -#define WTF_CPU_SPARC +#define WTF_CPU_SPARC 1 #endif /* CPU(X86) - i386 / x86 32-bit */ @@ -857,6 +857,8 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ /* The JIT is tested & working on x86 Windows */ #elif WTF_CPU_X86 && WTF_PLATFORM_WIN #define ENABLE_JIT 1 +#elif WTF_CPU_SPARC + #define ENABLE_JIT 1 #endif #if WTF_PLATFORM_QT @@ -920,6 +922,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ #if (WTF_CPU_X86 \ || WTF_CPU_X86_64 \ + || WTF_CPU_SPARC \ || WTF_CPU_ARM_TRADITIONAL \ || WTF_CPU_ARM_THUMB2 \ || WTF_CPU_X86) diff --git a/js/src/config.mk b/js/src/config.mk deleted file mode 100644 index 01fb023f9ac1..000000000000 --- a/js/src/config.mk +++ /dev/null @@ -1,186 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of 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 ***** - -ifdef JS_DIST -DIST = $(JS_DIST) -else -DIST = $(DEPTH)/../../dist -endif - -# Set os+release dependent make variables -OS_ARCH := $(subst /,_,$(shell uname -s | sed /\ /s//_/)) - -# Attempt to differentiate between SunOS 5.4 and x86 5.4 -OS_CPUARCH := $(shell uname -m) -ifeq ($(OS_CPUARCH),i86pc) -OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH) -else -ifeq ($(OS_ARCH),AIX) -OS_RELEASE := $(shell uname -v).$(shell uname -r) -else -OS_RELEASE := $(shell uname -r) -endif -endif -ifeq ($(OS_ARCH),IRIX64) -OS_ARCH := IRIX -endif - -# Handle output from win32 unames other than Netscape's version -ifeq (,$(filter-out Windows_95 Windows_98, $(OS_ARCH))) - OS_ARCH := WIN95 -endif -ifeq ($(OS_ARCH),WIN95) - OS_ARCH := WINNT - OS_RELEASE := 4.0 -endif -ifeq ($(OS_ARCH), Windows_NT) - OS_ARCH := WINNT - OS_MINOR_RELEASE := $(shell uname -v) - ifeq ($(OS_MINOR_RELEASE),00) - OS_MINOR_RELEASE = 0 - endif - OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE) -endif -ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH))) - OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH)) - OS_ARCH := WINNT -endif - -# Virtually all Linux versions are identical. -# Any distinctions are handled in linux.h -ifeq ($(OS_ARCH),Linux) -OS_CONFIG := Linux_All -else -ifeq ($(OS_ARCH),dgux) -OS_CONFIG := dgux -else -ifeq ($(OS_ARCH),Darwin) -OS_CONFIG := Darwin -else -ifeq ($(OS_ARCH),Darwin64) -OS_CONFIG := Darwin64 -else -OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE) -endif -endif -endif -endif - -ASFLAGS = -DEFINES = - -ifeq ($(OS_ARCH), WINNT) -INSTALL = nsinstall -CP = cp -else -INSTALL = $(DIST)/bin/nsinstall -CP = cp -endif - -ifdef BUILD_OPT -ifdef USE_MSVC -OPTIMIZER = -O2 -GL -INTERP_OPTIMIZER = -O2 -GL -BUILTINS_OPTIMIZER = -O2 -GL -LDFLAGS += -LTCG -else -OPTIMIZER = -Os -fno-exceptions -fno-rtti -fstrict-aliasing -Wstrict-aliasing=3 -BUILTINS_OPTIMIZER = -O9 -fno-exceptions -fno-rtti -fstrict-aliasing -INTERP_OPTIMIZER = -O3 -fno-exceptions -fno-rtti -fstrict-aliasing -endif -DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(USER) -OBJDIR_TAG = _OPT -else -ifdef USE_MSVC -OPTIMIZER = -Zi -INTERP_OPTIMIZER = -Zi -BUILTINS_OPTIMIZER = $(INTERP_OPTIMIZER) -else -OPTIMIZER = -g3 -fstrict-aliasing -fno-exceptions -fno-rtti -Wstrict-aliasing=3 -INTERP_OPTIMIZER = -g3 -fstrict-aliasing -fno-exceptions -fno-rtti -BUILTINS_OPTIMIZER = $(INTERP_OPTIMIZER) -endif -DEFINES += -DDEBUG -DDEBUG_$(USER) -OBJDIR_TAG = _DBG -endif - -SO_SUFFIX = so - -NS_USE_NATIVE = 1 - -include $(DEPTH)/ref-config/$(OS_CONFIG).mk - -ifndef OBJ_SUFFIX -ifdef USE_MSVC -OBJ_SUFFIX = obj -else -OBJ_SUFFIX = o -endif -endif - -ifndef HOST_BIN_SUFFIX -ifeq ($(OS_ARCH),WINNT) -HOST_BIN_SUFFIX = .exe -else -HOST_BIN_SUFFIX = -endif -endif - -# Name of the binary code directories -ifdef OBJROOT -# prepend $(DEPTH) to the root unless it is an absolute path -OBJDIR = $(if $(filter /%,$(OBJROOT)),$(OBJROOT),$(DEPTH)/$(OBJROOT)) -else -ifeq ($(DEPTH),.) -OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).$(if $(BUILD_IDG),OBJD,OBJ) -else -OBJDIR = $(DEPTH)/$(OS_CONFIG)$(OBJDIR_TAG).$(if $(BUILD_IDG),OBJD,OBJ) -endif -endif - -VPATH = $(OBJDIR) - -LCJAR = js15lc30.jar - -# Library name -LIBDIR := lib -ifeq ($(CPU_ARCH), x86_64) -LIBDIR := lib64 -endif - diff --git a/js/src/configure.in b/js/src/configure.in index 346009182530..79925cba3198 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2872,7 +2872,12 @@ arm*-*) sparc*-*) ENABLE_TRACEJIT=1 NANOJIT_ARCH=Sparc + ENABLE_METHODJIT=1 + ENABLE_MONOIC=1 + ENABLE_POLYIC=1 + ENABLE_POLYIC_TYPED_ARRAY=1 AC_DEFINE(JS_CPU_SPARC) + AC_DEFINE(JS_NUNBOX32) ;; esac diff --git a/js/src/jsalloc.cpp b/js/src/jsalloc.cpp new file mode 100644 index 000000000000..1f1eca9b33e9 --- /dev/null +++ b/js/src/jsalloc.cpp @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=99 ft=cpp: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * July 16, 2009. + * + * The Initial Developer of the Original Code is + * the Mozilla Corporation. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of 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 ***** */ + +#include "jsalloc.h" +#include "jscntxt.h" + +namespace js { + +void * +ContextAllocPolicy::onOutOfMemory(void *p, size_t nbytes) +{ + return cx->runtime->onOutOfMemory(p, nbytes, cx); +} + +void +ContextAllocPolicy::reportAllocOverflow() const +{ + js_ReportAllocationOverflow(cx); +} + +} /* namespace js */ diff --git a/js/src/jsalloc.h b/js/src/jsalloc.h new file mode 100644 index 000000000000..33089d88f2ed --- /dev/null +++ b/js/src/jsalloc.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=99 ft=cpp: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * July 16, 2009. + * + * The Initial Developer of the Original Code is + * the Mozilla Corporation. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of 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 ***** */ + +#ifndef jsalloc_h_ +#define jsalloc_h_ + +#include "jspubtd.h" +#include "jsutil.h" +#include "jsstaticcheck.h" + +namespace js { + +/* + * Allocation policies. These model the concept: + * - public copy constructor, assignment, destructor + * - void *malloc_(size_t) + * Responsible for OOM reporting on NULL return value. + * - void *realloc_(size_t) + * Responsible for OOM reporting on NULL return value. + * - void free_(void *) + * - reportAllocOverflow() + * Called on overflow before the container returns NULL. + */ + +/* Policy for using system memory functions and doing no error reporting. */ +class SystemAllocPolicy +{ + public: + void *malloc_(size_t bytes) { return js_malloc(bytes); } + void *realloc_(void *p, size_t bytes) { return js_realloc(p, bytes); } + void free_(void *p) { js_free(p); } + void reportAllocOverflow() const {} +}; + +/* + * Allocation policy that calls the system memory functions and reports errors + * to the context. Since the JSContext given on construction is stored for + * the lifetime of the container, this policy may only be used for containers + * whose lifetime is a shorter than the given JSContext. + * + * FIXME bug 647103 - rewrite this in terms of temporary allocation functions, + * not the system ones. + */ +class ContextAllocPolicy +{ + JSContext *const cx; + + /* + * Non-inline helper to call JSRuntime::onOutOfMemory with minimal + * code bloat. + */ + JS_FRIEND_API(void *) onOutOfMemory(void *p, size_t nbytes); + + public: + ContextAllocPolicy(JSContext *cx) : cx(cx) {} + + JSContext *context() const { + return cx; + } + + void *malloc_(size_t bytes) { + void *p = js_malloc(bytes); + if (JS_UNLIKELY(!p)) + p = onOutOfMemory(NULL, bytes); + return p; + } + + void *realloc_(void *p, size_t bytes) { + void *p2 = js_realloc(p, bytes); + if (JS_UNLIKELY(!p2)) + p2 = onOutOfMemory(p2, bytes); + return p2; + } + + void free_(void *p) { + js_free(p); + } + + JS_FRIEND_API(void) reportAllocOverflow() const; +}; + +} /* namespace js */ + +#endif /* jsalloc_h_ */ diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index cf00540b080d..86fbccf430a7 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -84,6 +84,7 @@ #include "prmjtime.h" #include "jsstaticcheck.h" #include "jsvector.h" +#include "jsweakmap.h" #include "jswrapper.h" #include "jstypedarray.h" @@ -1176,7 +1177,7 @@ JS_ToggleOptions(JSContext *cx, uint32 options) JS_PUBLIC_API(const char *) JS_GetImplementationVersion(void) { - return "JavaScript-C 1.8.0 pre-release 1 2007-10-03"; + return "JavaScript-C 1.8.5+ 2011-04-16"; } JS_PUBLIC_API(JSCompartmentCallback) @@ -1683,6 +1684,7 @@ static JSStdName standard_class_atoms[] = { #endif {js_InitJSONClass, EAGER_ATOM_AND_CLASP(JSON)}, {js_InitTypedArrayClasses, EAGER_CLASS_ATOM(ArrayBuffer), &js::ArrayBuffer::jsclass}, + {js_InitWeakMapClass, EAGER_CLASS_ATOM(WeakMap), &WeakMap::jsclass}, {NULL, 0, NULL, NULL} }; @@ -2064,7 +2066,10 @@ JS_PUBLIC_API(jsval) JS_ComputeThis(JSContext *cx, jsval *vp) { assertSameCompartment(cx, JSValueArray(vp, 2)); - return BoxThisForVp(cx, Valueify(vp)) ? vp[1] : JSVAL_NULL; + CallReceiver call = CallReceiverFromVp(Valueify(vp)); + if (!BoxNonStrictThis(cx, call)) + return JSVAL_NULL; + return Jsvalify(call.thisv()); } JS_PUBLIC_API(void *) @@ -4058,7 +4063,7 @@ JS_Enumerate(JSContext *cx, JSObject *obj) AutoIdVector props(cx); JSIdArray *ida; if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, &props) || !VectorToIdArray(cx, props, &ida)) - return false; + return NULL; for (size_t n = 0; n < size_t(ida->length); ++n) JS_ASSERT(js_CheckForStringIndex(ida->vector[n]) == ida->vector[n]); return ida; @@ -4840,7 +4845,7 @@ JS_CompileScript(JSContext *cx, JSObject *obj, const char *bytes, size_t length, } JS_PUBLIC_API(JSBool) -JS_BufferIsCompilableUnit(JSContext *cx, JSObject *obj, const char *bytes, size_t length) +JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8, JSObject *obj, const char *bytes, size_t length) { jschar *chars; JSBool result; @@ -4849,7 +4854,10 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *obj, const char *bytes, size_ CHECK_REQUEST(cx); assertSameCompartment(cx, obj); - chars = js_InflateString(cx, bytes, &length); + if (bytes_are_utf8) + chars = js_InflateString(cx, bytes, &length, JS_TRUE); + else + chars = js_InflateString(cx, bytes, &length); if (!chars) return JS_TRUE; @@ -5223,7 +5231,7 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval) CHECK_REQUEST(cx); assertSameCompartment(cx, obj, scriptObj); - JSBool ok = Execute(cx, obj, scriptObj->getScript(), NULL, 0, Valueify(rval)); + JSBool ok = Execute(cx, *obj, scriptObj->getScript(), NULL, 0, Valueify(rval)); LAST_FRAME_CHECKS(cx, ok); return ok; } @@ -5258,7 +5266,7 @@ EvaluateUCScriptForPrincipalsCommon(JSContext *cx, JSObject *obj, script->isUncachedEval = true; JS_ASSERT(script->getVersion() == compileVersion); - bool ok = Execute(cx, obj, script, NULL, 0, Valueify(rval)); + bool ok = Execute(cx, *obj, script, NULL, 0, Valueify(rval)); LAST_FRAME_CHECKS(cx, ok); js_DestroyScript(cx, script); @@ -5407,7 +5415,7 @@ JS_New(JSContext *cx, JSObject *ctor, uintN argc, jsval *argv) if (!cx->stack().pushInvokeArgs(cx, argc, &args)) return NULL; - args.callee().setObject(*ctor); + args.calleev().setObject(*ctor); args.thisv().setNull(); memcpy(args.argv(), argv, argc * sizeof(jsval)); @@ -5756,6 +5764,13 @@ JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_ return js_InflateStringToBuffer(cx, src, srclen, dst, dstlenp); } +JS_PUBLIC_API(JSBool) +JS_DecodeUTF8(JSContext *cx, const char *src, size_t srclen, jschar *dst, + size_t *dstlenp) +{ + return js_InflateUTF8StringToBuffer(cx, src, srclen, dst, dstlenp); +} + JS_PUBLIC_API(char *) JS_EncodeString(JSContext *cx, JSString *str) { @@ -5822,28 +5837,6 @@ JS_TryJSON(JSContext *cx, jsval *vp) return js_TryJSON(cx, Valueify(vp)); } -JS_PUBLIC_API(JSONParser *) -JS_BeginJSONParse(JSContext *cx, jsval *vp) -{ - CHECK_REQUEST(cx); - return js_BeginJSONParse(cx, Valueify(vp)); -} - -JS_PUBLIC_API(JSBool) -JS_ConsumeJSONText(JSContext *cx, JSONParser *jp, const jschar *data, uint32 len) -{ - CHECK_REQUEST(cx); - return js_ConsumeJSONText(cx, jp, data, len); -} - -JS_PUBLIC_API(JSBool) -JS_FinishJSONParse(JSContext *cx, JSONParser *jp, jsval reviver) -{ - CHECK_REQUEST(cx); - assertSameCompartment(cx, reviver); - return js_FinishJSONParse(cx, jp, Valueify(reviver)); -} - JS_PUBLIC_API(JSBool) JS_ParseJSON(JSContext *cx, const jschar *chars, uint32 len, jsval *vp) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index a0bec8adc704..bafec267e293 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1406,6 +1406,7 @@ class Anchor: AnchorPermitted { explicit Anchor(T t) { hold = t; } inline ~Anchor(); T &get() { return hold; } + const T &get() const { return hold; } void set(const T &t) { hold = t; } void clear() { hold = 0; } private: @@ -1949,6 +1950,7 @@ struct JSClass { #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) /* private is (nsISupports *) */ +#define JSCLASS_CONCURRENT_FINALIZER (1<<4) /* finalize is called on background thread */ #define JSCLASS_NEW_RESOLVE_GETS_START (1<<5) /* JSNewResolveOp gets starting object in prototype chain passed in via *objp in/out @@ -2768,8 +2770,8 @@ JS_TypeHandlerThis(JSContext*, JSTypeFunction*, JSTypeCallsite*); * the compiler. */ extern JS_PUBLIC_API(JSBool) -JS_BufferIsCompilableUnit(JSContext *cx, JSObject *obj, - const char *bytes, size_t length); +JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8, + JSObject *obj, const char *bytes, size_t length); extern JS_PUBLIC_API(JSObject *) JS_CompileScript(JSContext *cx, JSObject *obj, @@ -3290,6 +3292,8 @@ JS_SetCStringsAreUTF8(void); * UTF-8, and JS_DecodeBytes decodes from UTF-8, which may create additional * errors if the character sequence is malformed. If UTF-8 support is * disabled, the functions deflate and inflate, respectively. + * + * JS_DecodeUTF8() always behaves the same independently of JS_CStringsAreUTF8(). */ JS_PUBLIC_API(JSBool) JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, @@ -3299,6 +3303,10 @@ JS_PUBLIC_API(JSBool) JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_t *dstlenp); +JS_PUBLIC_API(JSBool) +JS_DecodeUTF8(JSContext *cx, const char *src, size_t srclen, jschar *dst, + size_t *dstlenp); + /* * A variation on JS_EncodeCharacters where a null terminated string is * returned that you are expected to call JS_free on when done. @@ -3393,7 +3401,7 @@ class JSAutoByteString { typedef JSBool (* JSONWriteCallback)(const jschar *buf, uint32 len, void *data); /* - * JSON.stringify as specified by ES3.1 (draft) + * JSON.stringify as specified by ES5. */ JS_PUBLIC_API(JSBool) JS_Stringify(JSContext *cx, jsval *vp, JSObject *replacer, jsval space, @@ -3406,17 +3414,8 @@ JS_PUBLIC_API(JSBool) JS_TryJSON(JSContext *cx, jsval *vp); /* - * JSON.parse as specified by ES3.1 (draft) + * JSON.parse as specified by ES5. */ -JS_PUBLIC_API(JSONParser *) -JS_BeginJSONParse(JSContext *cx, jsval *vp); - -JS_PUBLIC_API(JSBool) -JS_ConsumeJSONText(JSContext *cx, JSONParser *jp, const jschar *data, uint32 len); - -JS_PUBLIC_API(JSBool) -JS_FinishJSONParse(JSContext *cx, JSONParser *jp, jsval reviver); - JS_PUBLIC_API(JSBool) JS_ParseJSON(JSContext *cx, const jschar *chars, uint32 len, jsval *vp); diff --git a/js/src/jsarena.cpp b/js/src/jsarena.cpp index c6543533969b..bfe78e229ed4 100644 --- a/js/src/jsarena.cpp +++ b/js/src/jsarena.cpp @@ -44,6 +44,7 @@ */ #include #include +#include "jsalloc.h" #include "jstypes.h" #include "jsstdint.h" #include "jsbit.h" diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 10e660d51c2b..dff325509bfa 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -1459,7 +1459,7 @@ array_toString(JSContext *cx, uintN argc, Value *vp) if (!cx->stack().pushInvokeArgs(cx, 0, &args)) return false; - args.callee() = join; + args.calleev() = join; args.thisv().setObject(*obj); /* Do the call. */ diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp index 6470e9db15fa..fa834e180a56 100644 --- a/js/src/jsatom.cpp +++ b/js/src/jsatom.cpp @@ -211,7 +211,9 @@ const char *const js_common_atom_names[] = { "has", /* hasAtom */ "hasOwn", /* hasOwnAtom */ "keys", /* keysAtom */ - "iterate" /* iterateAtom */ + "iterate", /* iterateAtom */ + + "WeakMap" /* WeakMapAtom */ }; JS_STATIC_ASSERT(JS_ARRAY_LENGTH(js_common_atom_names) * sizeof(JSAtom *) == diff --git a/js/src/jsatom.h b/js/src/jsatom.h index 6f171c5c4669..72a595fec95a 100644 --- a/js/src/jsatom.h +++ b/js/src/jsatom.h @@ -422,6 +422,8 @@ struct JSAtomState JSAtom *keysAtom; JSAtom *iterateAtom; + JSAtom *WeakMapAtom; + /* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass. */ struct { JSAtom *XMLListAtom; diff --git a/js/src/jsclone.cpp b/js/src/jsclone.cpp index 82fda2266d46..54a62845fd2f 100644 --- a/js/src/jsclone.cpp +++ b/js/src/jsclone.cpp @@ -468,7 +468,7 @@ JSStructuredCloneWriter::startObject(JSObject *obj) JS_ASSERT(obj->isArray() || obj->isObject()); /* Fail if obj is already on the stack. */ - HashSet::AddPtr p = memory.lookupForAdd(obj); + MemorySet::AddPtr p = memory.lookupForAdd(obj); if (p) { JSContext *cx = context(); if (callbacks && callbacks->reportError) diff --git a/js/src/jsclone.h b/js/src/jsclone.h index dbead173c81a..00ab2c1d4f51 100644 --- a/js/src/jsclone.h +++ b/js/src/jsclone.h @@ -179,7 +179,8 @@ struct JSStructuredCloneWriter { // The "memory" list described in the HTML5 internal structured cloning algorithm. // memory has the same elements as objs. - js::HashSet memory; + typedef js::HashSet MemorySet; + MemorySet memory; // The user defined callbacks that will be used for cloning. const JSStructuredCloneCallbacks *callbacks; diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index cc71f2636df6..71172e42f0b1 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -301,8 +301,7 @@ StackSpace::pushSegmentForInvoke(JSContext *cx, uintN argc, InvokeArgsGuard *ag) ag->cx = cx; ag->seg = seg; - ag->argv_ = seg->valueRangeBegin() + 2; - ag->argc_ = argc; + ImplicitCast(*ag) = CallArgsFromVp(argc, seg->valueRangeBegin()); /* Use invokeArgEnd to root [vp, vpend) until the frame is pushed. */ #ifdef DEBUG @@ -1032,6 +1031,9 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode) JS_ASSERT(!rt->gcRunning); JS_UNLOCK_GC(rt); +#ifdef JS_THREADSAFE + rt->gcHelperThread.waitBackgroundSweepEnd(rt); +#endif if (last) { #ifdef JS_THREADSAFE @@ -1112,6 +1114,9 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode) cx->dstOffsetCache.dumpStats(); #endif JS_UNLOCK_GC(rt); +#ifdef JS_THREADSAFE + rt->gcHelperThread.waitBackgroundSweepEnd(rt); +#endif Foreground::delete_(cx); } @@ -1722,7 +1727,7 @@ js_InvokeOperationCallback(JSContext *cx) */ bool delayedOutOfMemory; JS_LOCK_GC(rt); - delayedOutOfMemory = (rt->gcBytes > rt->gcMaxBytes); + delayedOutOfMemory = rt->gcBytes > rt->gcMaxBytes; JS_UNLOCK_GC(rt); if (delayedOutOfMemory) { js_ReportOutOfMemory(cx); diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 737ad727b2e5..7fe9bd258d9c 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -118,27 +118,6 @@ namespace mjit { class JaegerCompartment; } -/* - * Allocation policy that calls JSContext memory functions and reports errors - * to the context. Since the JSContext given on construction is stored for - * the lifetime of the container, this policy may only be used for containers - * whose lifetime is a shorter than the given JSContext. - */ -class ContextAllocPolicy -{ - JSContext *cx; - - public: - ContextAllocPolicy(JSContext *cx) : cx(cx) {} - JSContext *context() const { return cx; } - - /* Inline definitions below. */ - void *malloc_(size_t bytes); - void free_(void *p); - void *realloc_(void *p, size_t bytes); - void reportAllocOverflow() const; -}; - /* * A StackSegment (referred to as just a 'segment') contains a prev-linked set * of stack frames and the slots associated with each frame. A segment and its @@ -411,7 +390,7 @@ class InvokeArgsGuard : public CallArgs */ struct InvokeArgsAlreadyOnTheStack : CallArgs { - InvokeArgsAlreadyOnTheStack(Value *vp, uintN argc) : CallArgs(vp + 2, argc) {} + InvokeArgsAlreadyOnTheStack(Value *vp, uintN argc) : CallArgs(argc, vp + 2) {} }; /* See StackSpace::pushInvokeFrame. */ @@ -1080,8 +1059,8 @@ struct JSRuntime { js::RootedValueMap gcRootsHash; js::GCLocks gcLocksHash; jsrefcount gcKeepAtoms; - size_t gcBytes; - size_t gcTriggerBytes; + uint32 gcBytes; + uint32 gcTriggerBytes; size_t gcLastBytes; size_t gcMaxBytes; size_t gcMaxMallocBytes; @@ -1093,6 +1072,7 @@ struct JSRuntime { int64 gcJitReleaseTime; JSGCMode gcMode; volatile bool gcIsNeeded; + JSObject *gcWeakMapList; /* * Compartment that triggered GC. If more than one Compatment need GC, @@ -1291,9 +1271,6 @@ struct JSRuntime { jsrefcount nonInlineCalls; jsrefcount constructs; - jsrefcount liveObjectProps; - jsrefcount liveObjectPropsPreSweep; - /* * NB: emptyShapes (in JSCompartment) is init'ed iff at least one * of these envars is set: @@ -1379,6 +1356,7 @@ struct JSRuntime { void setGCTriggerFactor(uint32 factor); void setGCLastBytes(size_t lastBytes); + void reduceGCTriggerBytes(uint32 amount); /* * Call the system malloc while checking for GC memory pressure and @@ -1455,7 +1433,6 @@ struct JSRuntime { onTooMuchMalloc(); } - private: /* * The function must be called outside the GC lock. */ @@ -3279,30 +3256,6 @@ js_RegenerateShapeForGC(JSRuntime *rt) namespace js { -inline void * -ContextAllocPolicy::malloc_(size_t bytes) -{ - return cx->malloc_(bytes); -} - -inline void -ContextAllocPolicy::free_(void *p) -{ - cx->free_(p); -} - -inline void * -ContextAllocPolicy::realloc_(void *p, size_t bytes) -{ - return cx->realloc_(p, bytes); -} - -inline void -ContextAllocPolicy::reportAllocOverflow() const -{ - js_ReportAllocationOverflow(cx); -} - template class AutoVectorRooter : protected AutoGCRooter { @@ -3362,7 +3315,8 @@ class AutoVectorRooter : protected AutoGCRooter friend void AutoGCRooter::trace(JSTracer *trc); private: - Vector vector; + typedef Vector VectorImpl; + VectorImpl vector; JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 26f902da7006..a4b483d93bcf 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -262,8 +262,7 @@ StackSpace::pushInvokeArgs(JSContext *cx, uintN argc, InvokeArgsGuard *ag) #endif ag->cx = cx; - ag->argv_ = vp + 2; - ag->argc_ = argc; + ImplicitCast(*ag) = CallArgsFromVp(argc, vp); return true; } diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index b718c17d0200..cda982c9d86c 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -169,7 +169,7 @@ bool JSCompartment::arenaListsAreEmpty() { for (unsigned i = 0; i < FINALIZE_LIMIT; i++) { - if (!arenas[i].isEmpty()) + if (!arenas[i].isEmpty() || arenas[i].hasToBeFinalized) return false; } return true; diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index aa60145757b6..b3a7a5cc81a3 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -377,8 +377,8 @@ struct JS_FRIEND_API(JSCompartment) { js::gc::ArenaList arenas[js::gc::FINALIZE_LIMIT]; js::gc::FreeLists freeLists; - size_t gcBytes; - size_t gcTriggerBytes; + uint32 gcBytes; + uint32 gcTriggerBytes; size_t gcLastBytes; bool hold; @@ -482,12 +482,13 @@ struct JS_FRIEND_API(JSCompartment) { void sweep(JSContext *cx, uint32 releaseInterval); void purge(JSContext *cx); void finishArenaLists(); - void finalizeObjectArenaLists(JSContext *cx); - void finalizeShapeArenaLists(JSContext *cx); - void finalizeStringArenaLists(JSContext *cx); + void finalizeObjectArenaLists(JSContext *cx, JSGCInvocationKind gckind); + void finalizeStringArenaLists(JSContext *cx, JSGCInvocationKind gckind); + void finalizeShapeArenaLists(JSContext *cx, JSGCInvocationKind gckind); bool arenaListsAreEmpty(); void setGCLastBytes(size_t lastBytes); + void reduceGCTriggerBytes(uint32 amount); js::DtoaCache dtoaCache; diff --git a/js/src/jsconfig.mk b/js/src/jsconfig.mk deleted file mode 100644 index 0ee3b7473ee8..000000000000 --- a/js/src/jsconfig.mk +++ /dev/null @@ -1,169 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of 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 ***** - -ifndef OBJDIR - ifdef OBJDIR_NAME - OBJDIR = $(OBJDIR_NAME) - endif -endif - -NSPR_VERSION = v4.0 -NSPR_LIBSUFFIX = 4 - -NSPR_LOCAL = $(MOZ_DEPTH)/dist/$(OBJDIR)/nspr -NSPR_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR) -NSPR_OBJDIR = $(OBJDIR) -ifeq ($(OS_ARCH), SunOS) - NSPR_OBJDIR := $(subst _sparc,,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_ARCH), Linux) - LINUX_REL := $(shell uname -r) - ifneq (,$(findstring 2.0,$(LINUX_REL))) - NSPR_OBJDIR := $(subst _All,2.0_x86_glibc_PTH,$(NSPR_OBJDIR)) - else - NSPR_OBJDIR := $(subst _All,2.2_x86_glibc_PTH,$(NSPR_OBJDIR)) - endif -endif -ifeq ($(OS_ARCH), AIX) - NSPR_OBJDIR := $(subst 4.1,4.2,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_CONFIG), IRIX6.2) - NSPR_OBJDIR := $(subst 6.2,6.2_n32_PTH,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_CONFIG), IRIX6.5) - NSPR_OBJDIR := $(subst 6.5,6.5_n32_PTH,$(NSPR_OBJDIR)) -endif -ifeq ($(OS_ARCH), WINNT) - ifeq ($(OBJDIR), WIN32_D.OBJ) - NSPR_OBJDIR = WINNT4.0_DBG.OBJ - endif - ifeq ($(OBJDIR), WIN32_O.OBJ) - NSPR_OBJDIR = WINNT4.0_OPT.OBJ - endif -endif -NSPR_SHARED = /share/builds/components/nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR) -ifeq ($(OS_ARCH), WINNT) - NSPR_SHARED = nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR) -endif -NSPR_VERSIONFILE = $(NSPR_LOCAL)/Version -NSPR_CURVERSION := $(shell cat $(NSPR_VERSIONFILE) 2>/dev/null) - -get_nspr: - @echo "Grabbing NSPR component..." -ifeq ($(NSPR_VERSION), $(NSPR_CURVERSION)) - @echo "No need, NSPR is up to date in this tree (ver=$(NSPR_VERSION))." -else - mkdir -p $(NSPR_LOCAL) - mkdir -p $(NSPR_DIST) - ifneq ($(OS_ARCH), WINNT) - cp $(NSPR_SHARED)/*.jar $(NSPR_LOCAL) - else - sh $(MOZ_DEPTH)/../reltools/compftp.sh $(NSPR_SHARED) $(NSPR_LOCAL) *.jar - endif - unzip -o $(NSPR_LOCAL)/mdbinary.jar -d $(NSPR_DIST) - mkdir -p $(NSPR_DIST)/include - unzip -o $(NSPR_LOCAL)/mdheader.jar -d $(NSPR_DIST)/include - rm -rf $(NSPR_DIST)/META-INF - rm -rf $(NSPR_DIST)/include/META-INF - echo $(NSPR_VERSION) > $(NSPR_VERSIONFILE) -endif - -SHIP_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR) -SHIP_DIR = $(SHIP_DIST)/SHIP - -SHIP_LIBS = libjs.$(SO_SUFFIX) libjs.a -ifeq ($(OS_ARCH), WINNT) - SHIP_LIBS = js32.dll js32.lib -endif -SHIP_LIBS += $(LCJAR) -SHIP_LIBS := $(addprefix $(SHIP_DIST)/lib/, $(SHIP_LIBS)) - -SHIP_INCS = js*.h prmjtime.h resource.h *.msg *.tbl -SHIP_INCS := $(addprefix $(SHIP_DIST)/include/, $(SHIP_INCS)) - -SHIP_BINS = js -ifeq ($(OS_ARCH), WINNT) - SHIP_BINS := $(addsuffix .exe, $(SHIP_BINS)) -endif -SHIP_BINS := $(addprefix $(SHIP_DIST)/bin/, $(SHIP_BINS)) - -ifdef BUILD_OPT - JSREFJAR = jsref_opt.jar -else -ifdef BUILD_IDG - JSREFJAR = jsref_idg.jar -else - JSREFJAR = jsref_dbg.jar -endif -endif - -ship: - mkdir -p $(SHIP_DIR)/$(LIBDIR) - mkdir -p $(SHIP_DIR)/include - mkdir -p $(SHIP_DIR)/bin - cp $(SHIP_LIBS) $(SHIP_DIR)/$(LIBDIR) - cp $(SHIP_INCS) $(SHIP_DIR)/include - cp $(SHIP_BINS) $(SHIP_DIR)/bin - cd $(SHIP_DIR); \ - zip -r $(JSREFJAR) bin lib include -ifdef BUILD_SHIP - cp $(SHIP_DIR)/$(JSREFJAR) $(BUILD_SHIP) -endif - -CWD = $(shell pwd) -shipSource: $(SHIP_DIR)/jsref_src.lst .FORCE - mkdir -p $(SHIP_DIR) - cd $(MOZ_DEPTH)/.. ; \ - zip $(CWD)/$(SHIP_DIR)/jsref_src.jar -@ < $(CWD)/$(SHIP_DIR)/jsref_src.lst -ifdef BUILD_SHIP - cp $(SHIP_DIR)/jsref_src.jar $(BUILD_SHIP) -endif - -JSREFSRCDIRS := $(shell cat $(DEPTH)/SpiderMonkey.rsp) -$(SHIP_DIR)/jsref_src.lst: .FORCE - mkdir -p $(SHIP_DIR) - rm -f $@ - touch $@ - for d in $(JSREFSRCDIRS); do \ - cd $(MOZ_DEPTH)/..; \ - ls -1 -d $$d | grep -v CVS | grep -v \.OBJ >> $(CWD)/$@; \ - cd $(CWD); \ - done - -.FORCE: diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index baffc4eb2a31..08d8689e63a5 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -2144,7 +2144,7 @@ date_toJSON(JSContext *cx, uintN argc, Value *vp) if (!cx->stack().pushInvokeArgs(cx, 0, &args)) return false; - args.callee() = toISO; + args.calleev() = toISO; args.thisv().setObject(*obj); if (!Invoke(cx, args, 0)) diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 33747ed3ebb6..9f4f2eab80e6 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1399,49 +1399,11 @@ JS_GetScriptedCaller(JSContext *cx, JSStackFrame *fp) return js_GetScriptedCaller(cx, fp); } -JSPrincipals * -js_StackFramePrincipals(JSContext *cx, JSStackFrame *fp) -{ - JSSecurityCallbacks *callbacks; - - if (fp->isFunctionFrame()) { - callbacks = JS_GetSecurityCallbacks(cx); - if (callbacks && callbacks->findObjectPrincipals) { - if (&fp->fun()->compiledFunObj() != &fp->callee()) - return callbacks->findObjectPrincipals(cx, &fp->callee()); - /* FALL THROUGH */ - } - } - if (fp->isScriptFrame()) - return fp->script()->principals; - return NULL; -} - -JSPrincipals * -js_EvalFramePrincipals(JSContext *cx, JSObject *callee, JSStackFrame *caller) -{ - JSPrincipals *principals, *callerPrincipals; - JSSecurityCallbacks *callbacks; - - callbacks = JS_GetSecurityCallbacks(cx); - if (callbacks && callbacks->findObjectPrincipals) - principals = callbacks->findObjectPrincipals(cx, callee); - else - principals = NULL; - if (!caller) - return principals; - callerPrincipals = js_StackFramePrincipals(cx, caller); - return (callerPrincipals && principals && - callerPrincipals->subsume(callerPrincipals, principals)) - ? principals - : callerPrincipals; -} - JS_PUBLIC_API(void *) JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp) { if (fp->annotation() && fp->isScriptFrame()) { - JSPrincipals *principals = js_StackFramePrincipals(cx, fp); + JSPrincipals *principals = fp->principals(cx); if (principals && principals->globalPrivilegesEnabled(cx, principals)) { /* @@ -1466,7 +1428,7 @@ JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp) { JSPrincipals *principals; - principals = js_StackFramePrincipals(cx, fp); + principals = fp->principals(cx); if (!principals) return NULL; return principals->getPrincipalArray(cx, principals); @@ -1530,7 +1492,7 @@ JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv) if (!ac.enter()) return false; - if (!fp->computeThis(cx)) + if (!ComputeThis(cx, fp)) return false; *thisv = Jsvalify(fp->thisValue()); return true; @@ -1668,7 +1630,7 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp, * we use a static level that will cause us not to attempt to optimize * variable references made by this frame. */ - JSScript *script = Compiler::compileScript(cx, scobj, fp, js_StackFramePrincipals(cx, fp), + JSScript *script = Compiler::compileScript(cx, scobj, fp, fp->principals(cx), TCF_COMPILE_N_GO, chars, length, filename, lineno, cx->findVersion(), NULL, UpvarCookie::UPVAR_LEVEL_LIMIT); @@ -1677,7 +1639,7 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp, return false; script->isUncachedEval = true; - bool ok = Execute(cx, scobj, script, fp, JSFRAME_DEBUGGER | JSFRAME_EVAL, Valueify(rval)); + bool ok = Execute(cx, *scobj, script, fp, JSFRAME_DEBUGGER | JSFRAME_EVAL, Valueify(rval)); js_DestroyScript(cx, script); return ok; diff --git a/js/src/jsdbgapi.h b/js/src/jsdbgapi.h index 86240ea10a9e..d82cb574824b 100644 --- a/js/src/jsdbgapi.h +++ b/js/src/jsdbgapi.h @@ -271,16 +271,6 @@ JS_GetFramePC(JSContext *cx, JSStackFrame *fp); extern JS_PUBLIC_API(JSStackFrame *) JS_GetScriptedCaller(JSContext *cx, JSStackFrame *fp); -/* - * Return a weak reference to fp's principals. A null return does not denote - * an error, it means there are no principals. - */ -extern JSPrincipals * -js_StackFramePrincipals(JSContext *cx, JSStackFrame *fp); - -JSPrincipals * -js_EvalFramePrincipals(JSContext *cx, JSObject *callee, JSStackFrame *caller); - extern JS_PUBLIC_API(void *) JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index ff5329fe1d29..b8dfc00f1b7c 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -297,7 +297,7 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message, stackDepth = 0; valueCount = 0; for (fp = js_GetTopStackFrame(cx, FRAME_EXPAND_NONE); fp; fp = fp->prev()) { - if (fp->scopeChain().compartment() != cx->compartment) + if (fp->compartment() != cx->compartment) break; if (fp->isNonEvalFunctionFrame()) { Value v = NullValue(); @@ -340,7 +340,7 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message, values = GetStackTraceValueBuffer(priv); elem = priv->stackElems; for (fp = js_GetTopStackFrame(cx, FRAME_EXPAND_NONE); fp != fpstop; fp = fp->prev()) { - if (fp->scopeChain().compartment() != cx->compartment) + if (fp->compartment() != cx->compartment) break; if (!fp->isFunctionFrame() || fp->isEvalFrame()) { elem->funName = NULL; diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index e9a68b7f009b..4e9fcac1bb85 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1062,7 +1062,7 @@ CreateEvalCallObject(JSContext *cx, JSStackFrame *fp) { JSObject *callobj = NewCallObject(cx, fp->script(), fp->scopeChain(), NULL); if (!callobj) - return false; + return NULL; callobj->setPrivate(fp); fp->setScopeChainWithOwnCallObj(*callobj); @@ -1472,7 +1472,7 @@ JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp) if (thisv.isObject()) { JS_ASSERT(funobj.getFunctionPrivate() == fun); - if (&fun->compiledFunObj() == &funobj && fun->methodAtom()) { + if (fun->compiledFunObj() == funobj && fun->methodAtom()) { JSObject *thisp = &thisv.toObject(); JSObject *first_barriered_thisp = NULL; @@ -1498,10 +1498,10 @@ JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp) * In either case we must allow for the method property * to have been replaced, or its value overwritten. */ - if (shape->isMethod() && &shape->methodObject() == &funobj) { + if (shape->isMethod() && shape->methodObject() == funobj) { if (!thisp->methodReadBarrier(cx, *shape, vp)) return false; - calleeValue().setObject(vp->toObject()); + calleev().setObject(vp->toObject()); return true; } @@ -1514,7 +1514,7 @@ JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp) clone->hasMethodObj(*thisp)) { JS_ASSERT_IF(!clone->getType()->singleton, clone != &funobj); *vp = v; - calleeValue().setObject(*clone); + calleev().setObject(*clone); return true; } } @@ -1543,7 +1543,7 @@ JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp) if (!newfunobj) return false; newfunobj->setMethodObj(*first_barriered_thisp); - calleeValue().setObject(*newfunobj); + calleev().setObject(*newfunobj); vp->setObject(*newfunobj); return true; } @@ -2201,7 +2201,7 @@ js_fun_call(JSContext *cx, uintN argc, Value *vp) return JS_FALSE; /* Push fval, thisv, and the args. */ - args.callee() = fval; + args.calleev() = fval; args.thisv() = thisv; memcpy(args.argv(), argv, argc * sizeof *argv); @@ -2252,7 +2252,7 @@ js_fun_apply(JSContext *cx, uintN argc, Value *vp) return false; /* Push fval, obj, and aobj's elements as args. */ - args.callee() = fval; + args.calleev() = fval; args.thisv() = vp[2]; /* Steps 7-8. */ @@ -2376,7 +2376,7 @@ CallOrConstructBoundFunction(JSContext *cx, uintN argc, Value *vp) memcpy(args.argv() + argslen, vp + 2, argc * sizeof(Value)); /* 15.3.4.5.1, 15.3.4.5.2 step 5. */ - args.callee().setObject(*target); + args.calleev().setObject(*target); if (!constructing) args.thisv() = boundThis; @@ -2513,12 +2513,13 @@ OnBadFormal(JSContext *cx, TokenKind tt) static JSBool Function(JSContext *cx, uintN argc, Value *vp) { + CallArgs call = CallArgsFromVp(argc, vp); + JS::Anchor obj(NewFunction(cx, NULL)); if (!obj.get()) return false; - JSObject &callee = JS_CALLEE(cx, vp).toObject(); - JSObject &calleeParent = *callee.getParent(); + JSObject &calleeParent = *call.callee().getParent(); /* * NB: (new Function) is not lexically closed by its caller, it's just an @@ -2535,32 +2536,6 @@ Function(JSContext *cx, uintN argc, Value *vp) if (!fun) return false; - /* - * Function is static and not called directly by other functions in this - * file, therefore it is callable only as a native function by js_Invoke. - * Find the scripted caller, possibly skipping other native frames such as - * are built for Function.prototype.call or .apply activations that invoke - * Function indirectly from a script. - */ - JSStackFrame *caller = js_GetScriptedCaller(cx, NULL); - uintN lineno; - const char *filename; - JSPrincipals *principals; - if (caller) { - principals = js_EvalFramePrincipals(cx, &callee, caller); - filename = js_ComputeFilename(cx, caller, principals, &lineno); - } else { - filename = NULL; - lineno = 0; - principals = NULL; - } - - /* Belt-and-braces: check that the caller has access to parent. */ - if (!js_CheckPrincipalsAccess(cx, &calleeParent, principals, - CLASS_ATOM(cx, Function))) { - return false; - } - /* * CSP check: whether new Function() is allowed at all. * Report errors via CSP is done in the script security manager. @@ -2574,7 +2549,10 @@ Function(JSContext *cx, uintN argc, Value *vp) Bindings bindings(cx); AutoBindingsRooter root(cx, bindings); - Value *argv = JS_ARGV(cx, vp); + uintN lineno; + const char *filename = CurrentScriptFileAndLine(cx, &lineno); + + Value *argv = call.argv(); uintN n = argc ? argc - 1 : 0; if (n > 0) { /* @@ -2714,10 +2692,12 @@ Function(JSContext *cx, uintN argc, Value *vp) length = 0; } - JS_SET_RVAL(cx, vp, ObjectValue(*obj.get())); - return Compiler::compileFunctionBody(cx, fun, principals, &bindings, - chars, length, filename, lineno, - cx->findVersion()); + JSPrincipals *principals = PrincipalsForCompiledCode(call, cx); + bool ok = Compiler::compileFunctionBody(cx, fun, principals, &bindings, + chars, length, filename, lineno, + cx->findVersion()); + call.rval().setObject(obj); + return ok; } namespace js { @@ -2742,7 +2722,7 @@ LookupInterpretedFunctionPrototype(JSContext *cx, JSObject *funobj) const Shape *shape = funobj->nativeLookup(id); if (!shape) { if (!ResolveInterpretedFunctionPrototype(cx, funobj)) - return false; + return NULL; shape = funobj->nativeLookup(id); } JS_ASSERT(!shape->configurable()); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index cb35364f53c5..35af6b024ff5 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -88,6 +88,7 @@ #include "jsinterpinlines.h" #include "jsobjinlines.h" #include "jshashtable.h" +#include "jsweakmap.h" #include "jsstrinlines.h" #include "jscompartment.h" @@ -232,16 +233,108 @@ Arena::mark(T *thing, JSTracer *trc) return CGCT_VALID; } +template +inline bool +Arena::finalize(JSContext *cx) +{ + JS_ASSERT_IF(header()->hasFreeThings, header()->freeList); + JS_ASSERT(!getMarkingDelay()->link); + JS_ASSERT(getMarkingDelay()->unmarkedChildren == 0); + JS_ASSERT(header()->isUsed); + + FreeCell *nextFree = header()->freeList; + FreeCell *freeList = NULL; + FreeCell **tailp = &freeList; + bool allClear = true; + + T *thingsEnd = &t.things[ThingsPerArena-1]; + T *thing = &t.things[0]; + thingsEnd++; + + if (!nextFree) { + nextFree = thingsEnd->asFreeCell(); + } else { + JS_ASSERT(thing->asFreeCell() <= nextFree); + JS_ASSERT(nextFree < thingsEnd->asFreeCell()); + } + + for (;; thing++) { + if (thing->asFreeCell() == nextFree) { + if (thing == thingsEnd) + break; + nextFree = nextFree->link; + if (!nextFree) { + nextFree = thingsEnd->asFreeCell(); + } else { + JS_ASSERT(thing->asFreeCell() < nextFree); + JS_ASSERT(nextFree < thingsEnd->asFreeCell()); + } + } else if (thing->asFreeCell()->isMarked()) { + allClear = false; + continue; + } else { + thing->finalize(cx); +#ifdef DEBUG + memset(thing, JS_FREE_PATTERN, sizeof(T)); +#endif + } + FreeCell *t = thing->asFreeCell(); + *tailp = t; + tailp = &t->link; + } + +#ifdef DEBUG + /* Check that the free list is consistent. */ + unsigned nfree = 0; + if (freeList) { + JS_ASSERT(tailp != &freeList); + FreeCell *t = freeList; + for (;;) { + ++nfree; + if (&t->link == tailp) + break; + JS_ASSERT(t < t->link); + t = t->link; + } + } +#endif + + if (allClear) { + JS_ASSERT(nfree == ThingsPerArena); + JS_ASSERT((T *)tailp == &t.things[ThingsPerArena-1]); + *tailp = NULL; + header()->freeList = freeList; +#ifdef DEBUG + header()->hasFreeThings = true; +#endif + JS_ASSERT((T *)header()->freeList == &t.things[0]); + } else { + JS_ASSERT(nfree < ThingsPerArena); + *tailp = NULL; + header()->freeList = freeList; +#ifdef DEBUG + header()->hasFreeThings = (nfree == 0) ? false : true; +#endif + } + return allClear; +} + #ifdef DEBUG bool checkArenaListsForThing(JSCompartment *comp, void *thing) { if (comp->arenas[FINALIZE_OBJECT0].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT0_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_OBJECT2].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT2_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_OBJECT4].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT4_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_OBJECT8].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT8_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_OBJECT12].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT12_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_OBJECT16].arenasContainThing(thing) || + comp->arenas[FINALIZE_OBJECT16_BACKGROUND].arenasContainThing(thing) || comp->arenas[FINALIZE_FUNCTION].arenasContainThing(thing) || comp->arenas[FINALIZE_SHAPE].arenasContainThing(thing) || #if JS_HAS_XML_SUPPORT @@ -284,13 +377,18 @@ Chunk::clearMarkBitmap() PodZero(&bitmaps[0], ArenasPerChunk); } -void +bool Chunk::init(JSRuntime *rt) { info.runtime = rt; info.age = 0; info.emptyArenaLists.init(); info.emptyArenaLists.cellFreeList = &arenas[0]; +#ifdef JS_THREADSAFE + info.chunkLock = JS_NEW_LOCK(); + if (!info.chunkLock) + return false; +#endif Arena *arena = &arenas[0]; Arena *last = &arenas[JS_ARRAY_LENGTH(arenas) - 1]; while (arena < last) { @@ -307,6 +405,7 @@ Chunk::init(JSRuntime *rt) last->header()->isUsed = false; #endif info.numFree = ArenasPerChunk; + return true; } bool @@ -332,20 +431,25 @@ Chunk::withinArenasRange(Cell *cell) template Arena * -Chunk::allocateArena(JSCompartment *comp, unsigned thingKind) +Chunk::allocateArena(JSContext *cx, unsigned thingKind) { +#ifdef JS_THREADSAFE + Conditionally lockIf(cx->runtime->gcHelperThread.sweeping, info.chunkLock); +#endif + JSCompartment *comp = cx->compartment; JS_ASSERT(hasAvailableArenas()); Arena *arena = info.emptyArenaLists.getNext(comp, thingKind); JS_ASSERT(arena); JS_ASSERT(arena->header()->isUsed); --info.numFree; - JSRuntime *rt = info.runtime; - rt->gcBytes += sizeof(Arena); - comp->gcBytes += sizeof(Arena); + + JS_ATOMIC_ADD(&rt->gcBytes, sizeof(Arena)); + JS_ATOMIC_ADD(&comp->gcBytes, sizeof(Arena)); + METER(JS_ATOMIC_INCREMENT(&rt->gcStats.nallarenas)); if (comp->gcBytes >= comp->gcTriggerBytes) TriggerCompartmentGC(comp); - METER(rt->gcStats.nallarenas++); + return arena; } @@ -354,15 +458,24 @@ void Chunk::releaseArena(Arena *arena) { JSRuntime *rt = info.runtime; +#ifdef JS_THREADSAFE + Conditionally lockIf(rt->gcHelperThread.sweeping, info.chunkLock); +#endif JSCompartment *comp = arena->header()->compartment; METER(rt->gcStats.afree++); JS_ASSERT(rt->gcStats.nallarenas != 0); - METER(rt->gcStats.nallarenas--); - JS_ASSERT(rt->gcBytes >= sizeof(Arena)); - JS_ASSERT(comp->gcBytes >= sizeof(Arena)); + METER(JS_ATOMIC_DECREMENT(&rt->gcStats.nallarenas)); - rt->gcBytes -= sizeof(Arena); - comp->gcBytes -= sizeof(Arena); + JS_ASSERT(size_t(rt->gcBytes) >= sizeof(Arena)); + JS_ASSERT(size_t(comp->gcBytes) >= sizeof(Arena)); +#ifdef JS_THREADSAFE + if (rt->gcHelperThread.sweeping) { + rt->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * sizeof(Arena)); + comp->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * sizeof(Arena)); + } +#endif + JS_ATOMIC_ADD(&rt->gcBytes, -sizeof(Arena)); + JS_ATOMIC_ADD(&comp->gcBytes, -sizeof(Arena)); info.emptyArenaLists.insert((Arena *)arena); #ifdef DEBUG arena->header()->isUsed = false; @@ -399,6 +512,9 @@ ReleaseGCChunk(JSRuntime *rt, jsuword chunk) JS_ASSERT(p); #ifdef MOZ_GCTIMER JS_ATOMIC_INCREMENT(&destroyChunkCount); +#endif +#ifdef JS_THREADSAFE + JS_DESTROY_LOCK(((Chunk *)chunk)->info.chunkLock); #endif JS_ASSERT(rt->gcStats.nchunks != 0); METER(rt->gcStats.nchunks--); @@ -423,6 +539,9 @@ ReleaseGCChunk(JSRuntime *rt, Chunk *p) JS_ASSERT(p); #ifdef MOZ_GCTIMER JS_ATOMIC_INCREMENT(&destroyChunkCount); +#endif +#ifdef JS_THREADSAFE + JS_DESTROY_LOCK(p->info.chunkLock); #endif JS_ASSERT(rt->gcStats.nchunks != 0); METER(rt->gcStats.nchunks--); @@ -453,7 +572,10 @@ PickChunk(JSRuntime *rt) return NULL; } - chunk->init(rt); + if (!chunk->init(rt)) { + ReleaseGCChunk(rt, chunk); + return NULL; + } return chunk; } @@ -496,7 +618,7 @@ AllocateArena(JSContext *cx, unsigned thingKind) } cx->compartment->chunk = chunk; } - return chunk->allocateArena(cx->compartment, thingKind); + return chunk->allocateArena(cx, thingKind); } JS_FRIEND_API(bool) @@ -652,21 +774,27 @@ MarkIfGCThingWord(JSTracer *trc, jsuword w, uint32 &thingKind) switch (thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: test = MarkCell(cell, trc); break; case FINALIZE_STRING: @@ -874,6 +1002,8 @@ js_FinishGC(JSRuntime *rt) rt->compartments.clear(); rt->atomsCompartment = NULL; + rt->gcWeakMapList = NULL; + for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) ReleaseGCChunk(rt, r.front()); rt->gcChunkSet.clear(); @@ -1052,6 +1182,15 @@ JSRuntime::setGCLastBytes(size_t lastBytes) gcTriggerBytes = (float(gcMaxBytes) < maxtrigger) ? gcMaxBytes : size_t(maxtrigger); } +void +JSRuntime::reduceGCTriggerBytes(uint32 amount) { + JS_ASSERT(amount > 0); + JS_ASSERT((gcTriggerBytes - amount) > 0); + if (gcTriggerBytes - amount < GC_ARENA_ALLOCATION_TRIGGER * GC_HEAP_GROWTH_FACTOR) + return; + gcTriggerBytes -= amount; +} + void JSCompartment::setGCLastBytes(size_t lastBytes) { @@ -1065,6 +1204,15 @@ JSCompartment::setGCLastBytes(size_t lastBytes) gcTriggerBytes = (float(rt->gcMaxBytes) < maxtrigger) ? rt->gcMaxBytes : size_t(maxtrigger); } +void +JSCompartment::reduceGCTriggerBytes(uint32 amount) { + JS_ASSERT(amount > 0); + JS_ASSERT((gcTriggerBytes - amount) > 0); + if (gcTriggerBytes - amount < GC_ARENA_ALLOCATION_TRIGGER * GC_HEAP_GROWTH_FACTOR) + return; + gcTriggerBytes -= amount; +} + void FreeLists::purge() { @@ -1123,6 +1271,11 @@ RunLastDitchGC(JSContext *cx) AutoKeepAtoms keep(rt); js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL); +#ifdef JS_THREADSAFE + if (rt->gcBytes >= rt->gcMaxBytes) + cx->runtime->gcHelperThread.waitBackgroundSweepEnd(cx->runtime); +#endif + return rt->gcBytes < rt->gcMaxBytes; } @@ -1139,6 +1292,10 @@ RefillTypedFreeList(JSContext *cx, unsigned thingKind) return false; bool canGC = !JS_ON_TRACE(cx) && !JS_THREAD_DATA(cx)->waiveGCQuota; +#ifdef JS_THREADSAFE + bool waited = false; +#endif + do { if (canGC && JS_UNLIKELY(NeedLastDitchGC(cx))) { if (!RunLastDitchGC(cx)) @@ -1155,12 +1312,18 @@ RefillTypedFreeList(JSContext *cx, unsigned thingKind) } ArenaList *arenaList = GetFinalizableArenaList(compartment, thingKind); - Arena *a = reinterpret_cast *>(arenaList->getNextWithFreeList()); - if (a) { - JS_ASSERT(a->header()->freeList); - JS_ASSERT(sizeof(T) == a->header()->thingSize); - compartment->freeLists.populate(a, thingKind); - return true; +#ifdef JS_THREADSAFE +try_again: +#endif + Arena *a = NULL; + if (!arenaList->hasToBeFinalized) { + a = reinterpret_cast *>(arenaList->getNextWithFreeList(cx)); + if (a) { + JS_ASSERT(a->header()->freeList); + JS_ASSERT(sizeof(T) == a->header()->thingSize); + compartment->freeLists.populate(a, thingKind); + return true; + } } /* @@ -1174,6 +1337,14 @@ RefillTypedFreeList(JSContext *cx, unsigned thingKind) a->getMarkingDelay()->init(); return true; } +#ifdef JS_THREADSAFE + if (!waited) { + /* The background thread can still free arenas during the finalization phase. */ + cx->runtime->gcHelperThread.waitBackgroundSweepEnd(cx->runtime); + waited = true; + goto try_again; + } +#endif } while (canGC); METER(cx->runtime->gcStats.fail++); @@ -1186,16 +1357,22 @@ RefillFinalizableFreeList(JSContext *cx, unsigned thingKind) { switch (thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: return RefillTypedFreeList(cx, thingKind); case FINALIZE_STRING: return RefillTypedFreeList(cx, thingKind); @@ -1386,21 +1563,27 @@ GCMarker::markDelayedChildren() switch (a->header()->thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_STRING: @@ -1410,7 +1593,7 @@ GCMarker::markDelayedChildren() reinterpret_cast *>(a)->markDelayedChildren(this); break; case FINALIZE_SHORT_STRING: - JS_ASSERT(false); + JS_NOT_REACHED("no delayed marking"); break; case FINALIZE_FUNCTION: reinterpret_cast *>(a)->markDelayedChildren(this); @@ -1504,7 +1687,7 @@ AutoIdArray::trace(JSTracer *trc) void AutoEnumStateRooter::trace(JSTracer *trc) { - js::gc::MarkObject(trc, *obj, "js::AutoEnumStateRooter.obj"); + gc::MarkObject(trc, *obj, "js::AutoEnumStateRooter.obj"); } inline void @@ -1585,24 +1768,24 @@ AutoGCRooter::trace(JSTracer *trc) return; case VALVECTOR: { - Vector &vector = static_cast(this)->vector; + AutoValueVector::VectorImpl &vector = static_cast(this)->vector; MarkValueRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector"); return; } case STRING: - if (JSString *str = static_cast(this)->str) + if (JSString *str = static_cast(this)->str) MarkString(trc, str, "js::AutoStringRooter.str"); return; case IDVECTOR: { - Vector &vector = static_cast(this)->vector; + AutoIdVector::VectorImpl &vector = static_cast(this)->vector; MarkIdRange(trc, vector.length(), vector.begin(), "js::AutoIdVector.vector"); return; } case SHAPEVECTOR: { - Vector &vector = static_cast(this)->vector; + AutoShapeVector::VectorImpl &vector = static_cast(this)->vector; MarkShapeRange(trc, vector.length(), vector.begin(), "js::AutoShapeVector.vector"); return; } @@ -1798,7 +1981,7 @@ js_DestroyScriptsToGC(JSContext *cx, JSCompartment *comp) template static void -FinalizeArenaList(JSCompartment *comp, JSContext *cx, unsigned thingKind) +FinalizeArenaList(JSCompartment *comp, JSContext *cx, JSGCInvocationKind gckind, unsigned thingKind) { JS_STATIC_ASSERT(!(sizeof(T) & Cell::CellMask)); ArenaList *arenaList = GetFinalizableArenaList(comp, thingKind); @@ -1812,94 +1995,14 @@ FinalizeArenaList(JSCompartment *comp, JSContext *cx, unsigned thingKind) uint32 nlivearenas = 0, nkilledarenas = 0, nthings = 0; #endif for (;;) { - ArenaHeader *header = a->header(); - JS_ASSERT_IF(header->hasFreeThings, header->freeList); - JS_ASSERT(header->thingKind == thingKind); - JS_ASSERT(!a->getMarkingDelay()->link); - JS_ASSERT(a->getMarkingDelay()->unmarkedChildren == 0); - JS_ASSERT(a->header()->isUsed); - - FreeCell *nextFree = header->freeList; - FreeCell *freeList = NULL; - FreeCell **tailp = &freeList; - bool allClear = true; - - T *thingsEnd = &a->t.things[a->ThingsPerArena-1]; - T *thing = &a->t.things[0]; - thingsEnd++; - - if (!nextFree) { - nextFree = thingsEnd->asFreeCell(); - } else { - JS_ASSERT(thing->asFreeCell() <= nextFree); - JS_ASSERT(nextFree < thingsEnd->asFreeCell()); - } - - for (;; thing++) { - if (thing->asFreeCell() == nextFree) { - if (thing == thingsEnd) - break; - nextFree = nextFree->link; - if (!nextFree) { - nextFree = thingsEnd->asFreeCell(); - } else { - JS_ASSERT(thing->asFreeCell() < nextFree); - JS_ASSERT(nextFree < thingsEnd->asFreeCell()); - } - } else if (thing->isMarked()) { - allClear = false; - METER(nthings++); - continue; - } else { - thing->finalize(cx); -#ifdef DEBUG - memset(thing, JS_FREE_PATTERN, sizeof(T)); -#endif - } - FreeCell *t = thing->asFreeCell(); - *tailp = t; - tailp = &t->link; - } - -#ifdef DEBUG - /* Check that the free list is consistent. */ - unsigned nfree = 0; - if (freeList) { - JS_ASSERT(tailp != &freeList); - FreeCell *t = freeList; - for (;;) { - ++nfree; - if (&t->link == tailp) - break; - JS_ASSERT(t < t->link); - t = t->link; - } - } -#endif + JS_ASSERT(a->header()->thingKind == thingKind); + bool allClear = a->finalize(cx); if (allClear) { - /* - * Forget just assembled free list head for the arena and - * add the arena itself to the destroy list. - */ - JS_ASSERT(nfree == a->ThingsPerArena); - JS_ASSERT((T *)tailp == &a->t.things[a->ThingsPerArena-1]); - *tailp = NULL; - header->freeList = freeList; -#ifdef DEBUG - header->hasFreeThings = true; -#endif - *ap = (header->next); - JS_ASSERT((T *)header->freeList == &a->t.things[0]); + *ap = a->header()->next; a->chunk()->releaseArena(a); METER(nkilledarenas++); } else { - JS_ASSERT(nfree < a->ThingsPerArena); - *tailp = NULL; - header->freeList = freeList; -#ifdef DEBUG - header->hasFreeThings = (nfree == 0) ? false : true; -#endif - ap = &header->next; + ap = &a->header()->next; METER(nlivearenas++); } if (!(a = (Arena *) *ap)) @@ -1909,33 +2012,173 @@ FinalizeArenaList(JSCompartment *comp, JSContext *cx, unsigned thingKind) METER(UpdateCompartmentStats(comp, thingKind, nlivearenas, nkilledarenas, nthings)); } -void -JSCompartment::finalizeObjectArenaLists(JSContext *cx) +template +static void +FinalizeArenaListLater(JSContext *cx, ArenaList *arenaList, Arena *head) { - FinalizeArenaList(this, cx, FINALIZE_OBJECT0); - FinalizeArenaList(this, cx, FINALIZE_OBJECT2); - FinalizeArenaList(this, cx, FINALIZE_OBJECT4); - FinalizeArenaList(this, cx, FINALIZE_OBJECT8); - FinalizeArenaList(this, cx, FINALIZE_OBJECT12); - FinalizeArenaList(this, cx, FINALIZE_OBJECT16); - FinalizeArenaList(this, cx, FINALIZE_FUNCTION); + JS_STATIC_ASSERT(!(sizeof(T) & Cell::CellMask)); + JS_ASSERT(arenaList->hasToBeFinalized); + Arena **ap = &head; + Arena *a = (Arena *) *ap; + JS_ASSERT(a); +#ifdef DEBUG + int thingKind = head->header()->thingKind; + JSCompartment *comp = head->header()->compartment; +#endif + JS_ASSERT(sizeof(T) == head->header()->thingSize); + +#ifdef JS_GCMETER + uint32 nlivearenas = 0, nkilledarenas = 0, nthings = 0; +#endif + for (;;) { + bool allClear = a->finalize(cx); + /* We don't delete the head because the next allcoated arena has to link to it. */ + if (allClear && (a != (Arena *)head)) { + *ap = a->header()->next; + a->chunk()->releaseArena(a); + METER(nkilledarenas++); + } else { + ap = &a->header()->next; + METER(nlivearenas++); + } + if (!(a = (Arena *) *ap)) + break; + } + arenaList->cursor = (Arena *)head; + arenaList->hasToBeFinalized = false; + METER(UpdateCompartmentStats(comp, thingKind, nlivearenas, nkilledarenas, nthings)); +} + +void +FinalizeArenaList(JSContext *cx, ArenaList *list, Arena *head) +{ + JS_ASSERT(list->head); + JS_ASSERT(head); + js::gc::FinalizeKind kind = js::gc::FinalizeKind(head->header()->thingKind); + + switch (kind) { + case FINALIZE_OBJECT0: + case FINALIZE_OBJECT2: + case FINALIZE_OBJECT4: + case FINALIZE_OBJECT8: + case FINALIZE_OBJECT12: + case FINALIZE_OBJECT16: + case FINALIZE_FUNCTION: + case FINALIZE_SHAPE: + case FINALIZE_EXTERNAL_STRING: + JS_NOT_REACHED("no background finalization"); + break; + case FINALIZE_OBJECT0_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_OBJECT2_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_OBJECT4_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_OBJECT8_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_OBJECT12_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_OBJECT16_BACKGROUND: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_STRING: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + case FINALIZE_SHORT_STRING: + FinalizeArenaListLater(cx, list, (Arena *)head); + break; + #if JS_HAS_XML_SUPPORT + case FINALIZE_XML: + JS_NOT_REACHED("no background finalization"); + break; +#endif + default: + JS_NOT_REACHED("wrong kind"); + } +} + +#ifdef JS_THREADSAFE +template +void BackgroundFinalize(JSCompartment *comp, JSContext *cx, JSGCInvocationKind gckind, unsigned thingKind) +{ + ArenaList *list = GetFinalizableArenaList(comp, thingKind); + if (list->head && list->head->header()->next) { + cx->gcBackgroundFree->finalizeLater(list); + } else { + FinalizeArenaList(comp, cx, gckind, thingKind); + } +} +#endif + +void +JSCompartment::finalizeObjectArenaLists(JSContext *cx, JSGCInvocationKind gckind) +{ + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT0); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT2); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT4); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT8); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT12); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT16); + FinalizeArenaList(this, cx, gckind, FINALIZE_FUNCTION); + +#ifdef JS_THREADSAFE + if (cx->gcBackgroundFree && gckind != GC_LAST_CONTEXT && cx->runtime->state != JSRTS_LANDING) { + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT0_BACKGROUND); + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT2_BACKGROUND); + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT4_BACKGROUND); + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT8_BACKGROUND); + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT12_BACKGROUND); + BackgroundFinalize(this, cx, gckind, FINALIZE_OBJECT16_BACKGROUND); + } else { + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT0_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT2_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT4_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT8_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT12_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT16_BACKGROUND); + } +#else + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT0_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT2_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT4_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT8_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT12_BACKGROUND); + FinalizeArenaList(this, cx, gckind, FINALIZE_OBJECT16_BACKGROUND); +#endif + #if JS_HAS_XML_SUPPORT - FinalizeArenaList(this, cx, FINALIZE_XML); + FinalizeArenaList(this, cx, gckind, FINALIZE_XML); #endif } void -JSCompartment::finalizeStringArenaLists(JSContext *cx) +JSCompartment::finalizeStringArenaLists(JSContext *cx, JSGCInvocationKind gckind) { - FinalizeArenaList(this, cx, FINALIZE_SHORT_STRING); - FinalizeArenaList(this, cx, FINALIZE_STRING); - FinalizeArenaList(this, cx, FINALIZE_EXTERNAL_STRING); +#ifdef JS_THREADSAFE + if (cx->gcBackgroundFree && gckind != GC_LAST_CONTEXT && cx->runtime->state != JSRTS_LANDING) { + BackgroundFinalize(this, cx, gckind, FINALIZE_SHORT_STRING); + BackgroundFinalize(this, cx, gckind, FINALIZE_STRING); + } else { + FinalizeArenaList(this, cx, gckind, FINALIZE_SHORT_STRING); + FinalizeArenaList(this, cx, gckind, FINALIZE_STRING); + } + FinalizeArenaList(this, cx, gckind, FINALIZE_EXTERNAL_STRING); +#else + FinalizeArenaList(this, cx, gckind, FINALIZE_SHORT_STRING); + FinalizeArenaList(this, cx, gckind, FINALIZE_STRING); + FinalizeArenaList(this, cx, gckind, FINALIZE_EXTERNAL_STRING); +#endif } void -JSCompartment::finalizeShapeArenaLists(JSContext *cx) +JSCompartment::finalizeShapeArenaLists(JSContext *cx, JSGCInvocationKind gckind) { - FinalizeArenaList(this, cx, FINALIZE_SHAPE); + FinalizeArenaList(this, cx, gckind, FINALIZE_SHAPE); } #ifdef JS_THREADSAFE @@ -2043,9 +2286,44 @@ GCHelperThread::replenishAndFreeLater(void *ptr) Foreground::free_(ptr); } +void +GCHelperThread::replenishAndFinalizeLater(ArenaList *list) +{ + JS_ASSERT(cx); + JS_ASSERT(finalizeCursor == finalizeCursorEnd); + do { + if (finalizeCursor && !finalizeVector.append(finalizeCursorEnd - FREE_ARRAY_LENGTH)) + break; + finalizeCursor = (void **) OffTheBooks::malloc_(FREE_ARRAY_SIZE); + if (!finalizeCursor) { + finalizeCursorEnd = NULL; + break; + } + finalizeCursorEnd = finalizeCursor + FREE_ARRAY_LENGTH; + *finalizeCursor++ = list; + *finalizeCursor++ = list->head; + return; + } while (false); + FinalizeArenaList(cx, list, list->head); +} + void GCHelperThread::doSweep() { + JS_ASSERT(cx); + if (finalizeCursor) { + void **array = finalizeCursorEnd - FREE_ARRAY_LENGTH; + finalizeElementsAndArray(array, finalizeCursor); + finalizeCursor = finalizeCursorEnd = NULL; + } else { + JS_ASSERT(!finalizeCursorEnd); + } + for (void ***iter = finalizeVector.begin(); iter != finalizeVector.end(); ++iter) { + void **array = *iter; + finalizeElementsAndArray(array, array + FREE_ARRAY_LENGTH); + } + finalizeVector.resize(0); + cx = NULL; if (freeCursor) { void **array = freeCursorEnd - FREE_ARRAY_LENGTH; freeElementsAndArray(array, freeCursor); @@ -2200,7 +2478,21 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM JS_ASSERT(gcmarker.getMarkColor() == BLACK); rt->gcMarkingTracer = &gcmarker; gcmarker.stackLimit = cx->stackLimit; - +#ifdef JS_THREADSAFE + /* + * cx->gcBackgroundFree is set if we need several mark-and-sweep loops to + * finish the GC. + */ + if (!cx->gcBackgroundFree) { + /* Wait until the sweeping from the previois GC finishes. */ + rt->gcHelperThread.waitBackgroundSweepEnd(rt); + cx->gcBackgroundFree = &rt->gcHelperThread; + } else { + rt->gcHelperThread.waitBackgroundSweepEnd(rt); + } + JS_ASSERT(!rt->gcHelperThread.sweeping); + cx->gcBackgroundFree->setContext(cx); +#endif for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) r.front()->clearMarkBitmap(); @@ -2223,8 +2515,10 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM * Mark weak roots. */ while (true) { - if (!js_TraceWatchPoints(&gcmarker)) + if (!js_TraceWatchPoints(&gcmarker) && + !WeakMap::markIteratively(&gcmarker)) { break; + } gcmarker.markDelayedChildren(); } @@ -2233,17 +2527,6 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM if (rt->gcCallback) (void) rt->gcCallback(cx, JSGC_MARK_END); -#ifdef JS_THREADSAFE - /* - * cx->gcBackgroundFree is set if we need several mark-and-sweep loops to - * finish the GC. - */ - if (!cx->gcBackgroundFree) { - /* Wait until the sweeping from the previois GC finishes. */ - rt->gcHelperThread.waitBackgroundSweepEnd(rt); - cx->gcBackgroundFree = &rt->gcHelperThread; - } -#endif #ifdef DEBUG /* Make sure that we didn't mark an object in another compartment */ if (comp) { @@ -2267,16 +2550,15 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM * the GC. */ TIMESTAMP(startSweep); + + /* Finalize unreachable (key,value) pairs in all weak maps. */ + WeakMap::sweep(cx); + js_SweepAtomState(cx); /* Finalize watch points associated with unreachable objects. */ js_SweepWatchPoints(cx); -#ifdef DEBUG - /* Save the pre-sweep count of scope-mapped properties. */ - rt->liveObjectPropsPreSweep = rt->liveObjectProps; -#endif - /* * We finalize objects before other GC things to ensure that object's finalizer * can access them even if they will be freed. Sweep the runtime's property trees @@ -2286,26 +2568,26 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM */ if (comp) { comp->sweep(cx, 0); - comp->finalizeObjectArenaLists(cx); + comp->finalizeObjectArenaLists(cx, gckind); TIMESTAMP(sweepObjectEnd); - comp->finalizeStringArenaLists(cx); + comp->finalizeStringArenaLists(cx, gckind); TIMESTAMP(sweepStringEnd); - comp->finalizeShapeArenaLists(cx); + comp->finalizeShapeArenaLists(cx, gckind); TIMESTAMP(sweepShapeEnd); } else { SweepCrossCompartmentWrappers(cx); for (JSCompartment **c = rt->compartments.begin(); c != rt->compartments.end(); c++) - (*c)->finalizeObjectArenaLists(cx); + (*c)->finalizeObjectArenaLists(cx, gckind); TIMESTAMP(sweepObjectEnd); for (JSCompartment **c = rt->compartments.begin(); c != rt->compartments.end(); c++) - (*c)->finalizeStringArenaLists(cx); + (*c)->finalizeStringArenaLists(cx, gckind); TIMESTAMP(sweepStringEnd); for (JSCompartment **c = rt->compartments.begin(); c != rt->compartments.end(); c++) - (*c)->finalizeShapeArenaLists(cx); + (*c)->finalizeShapeArenaLists(cx, gckind); TIMESTAMP(sweepShapeEnd); @@ -2564,6 +2846,15 @@ GCUntilDone(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM MarkAndSweep(cx, comp, gckind GCTIMER_ARG); +#ifdef JS_THREADSAFE + JS_ASSERT(cx->gcBackgroundFree == &rt->gcHelperThread); + if (rt->gcPoke) { + AutoLockGC lock(rt); + cx->gcBackgroundFree = NULL; + rt->gcHelperThread.startBackgroundSweep(rt); + } +#endif + // GC again if: // - another thread, not in a request, called js_GC // - js_GC was called recursively @@ -2628,6 +2919,9 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) } { +#ifdef JS_THREADSAFE + rt->gcHelperThread.waitBackgroundSweepEnd(rt); +#endif /* Lock out other GC allocator and collector invocations. */ AutoLockGC lock(rt); diff --git a/js/src/jsgc.h b/js/src/jsgc.h index cbaa559ac19d..622b5588445a 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -79,12 +79,18 @@ namespace gc { /* The kind of GC thing with a finalizer. */ enum FinalizeKind { FINALIZE_OBJECT0, + FINALIZE_OBJECT0_BACKGROUND, FINALIZE_OBJECT2, + FINALIZE_OBJECT2_BACKGROUND, FINALIZE_OBJECT4, + FINALIZE_OBJECT4_BACKGROUND, FINALIZE_OBJECT8, + FINALIZE_OBJECT8_BACKGROUND, FINALIZE_OBJECT12, + FINALIZE_OBJECT12_BACKGROUND, FINALIZE_OBJECT16, - FINALIZE_OBJECT_LAST = FINALIZE_OBJECT16, + FINALIZE_OBJECT16_BACKGROUND, + FINALIZE_OBJECT_LAST = FINALIZE_OBJECT16_BACKGROUND, FINALIZE_FUNCTION, FINALIZE_SHAPE, #if JS_HAS_XML_SUPPORT @@ -96,7 +102,7 @@ enum FinalizeKind { FINALIZE_LIMIT }; -const uintN JS_FINALIZE_OBJECT_LIMIT = 6; +const uintN JS_FINALIZE_OBJECT_LIMIT = 12; /* Every arena has a header. */ struct ArenaHeader { @@ -190,8 +196,11 @@ struct Arena { #endif void init(JSCompartment *compartment, unsigned thingKind); + bool finalize(JSContext *cx); }; +void FinalizeArena(Arena *a); + /* * Live objects are marked black. How many other additional colors are available * depends on the size of the GCThing. @@ -350,6 +359,9 @@ struct ChunkInfo { EmptyArenaLists emptyArenaLists; size_t age; size_t numFree; +#ifdef JS_THREADSAFE + PRLock *chunkLock; +#endif }; /* Chunks contain arenas and associated data structures (mark bitmap, delayed marking state). */ @@ -367,14 +379,14 @@ struct Chunk { ChunkInfo info; void clearMarkBitmap(); - void init(JSRuntime *rt); + bool init(JSRuntime *rt); bool unused(); bool hasAvailableArenas(); bool withinArenasRange(Cell *cell); template - Arena *allocateArena(JSCompartment *comp, unsigned thingKind); + Arena *allocateArena(JSContext *cx, unsigned thingKind); template void releaseArena(Arena *a); @@ -534,11 +546,17 @@ GetFinalizableTraceKind(size_t thingKind) static const uint8 map[FINALIZE_LIMIT] = { JSTRACE_OBJECT, /* FINALIZE_OBJECT0 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT0_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT2 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT2_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT4 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT4_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT8 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT8_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT12 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT12_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT16 */ + JSTRACE_OBJECT, /* FINALIZE_OBJECT16_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_FUNCTION */ JSTRACE_SHAPE, /* FINALIZE_SHAPE */ #if JS_HAS_XML_SUPPORT /* FINALIZE_XML */ @@ -571,13 +589,16 @@ checkArenaListsForThing(JSCompartment *comp, jsuword thing); struct ArenaList { Arena *head; /* list start */ Arena *cursor; /* arena with free things */ + volatile bool hasToBeFinalized; inline void init() { head = NULL; cursor = NULL; + hasToBeFinalized = false; } - inline Arena *getNextWithFreeList() { + inline Arena *getNextWithFreeList(JSContext *cx) { + JS_ASSERT(!hasToBeFinalized); Arena *a; while (cursor != NULL) { ArenaHeader *aheader = cursor->header(); @@ -863,6 +884,9 @@ js_WaitForGC(JSRuntime *rt); extern void js_DestroyScriptsToGC(JSContext *cx, JSCompartment *comp); +extern void +FinalizeArenaList(JSContext *cx, js::gc::ArenaList *arenaList, js::gc::Arena *head); + namespace js { #ifdef JS_THREADSAFE @@ -881,19 +905,24 @@ class GCHelperThread { static const size_t FREE_ARRAY_SIZE = size_t(1) << 16; static const size_t FREE_ARRAY_LENGTH = FREE_ARRAY_SIZE / sizeof(void *); + JSContext *cx; PRThread* thread; PRCondVar* wakeup; PRCondVar* sweepingDone; bool shutdown; - bool sweeping; Vector freeVector; void **freeCursor; void **freeCursorEnd; + Vector finalizeVector; + void **finalizeCursor; + void **finalizeCursorEnd; JS_FRIEND_API(void) replenishAndFreeLater(void *ptr); + void replenishAndFinalizeLater(js::gc::ArenaList *list); + static void freeElementsAndArray(void **array, void **end) { JS_ASSERT(array <= end); for (void **p = array; p != end; ++p) @@ -901,6 +930,17 @@ class GCHelperThread { js::Foreground::free_(array); } + void finalizeElementsAndArray(void **array, void **end) { + JS_ASSERT(array <= end); + for (void **p = array; p != end; p += 2) { + js::gc::ArenaList *list = (js::gc::ArenaList *)*p; + js::gc::Arena *head = (js::gc::Arena *)*(p+1); + + FinalizeArenaList(cx, list, head); + } + js::Foreground::free_(array); + } + static void threadMain(void* arg); void threadLoop(JSRuntime *rt); @@ -912,10 +952,13 @@ class GCHelperThread { wakeup(NULL), sweepingDone(NULL), shutdown(false), - sweeping(false), freeCursor(NULL), - freeCursorEnd(NULL) { } + freeCursorEnd(NULL), + finalizeCursor(NULL), + finalizeCursorEnd(NULL), + sweeping(false) { } + volatile bool sweeping; bool init(JSRuntime *rt); void finish(JSRuntime *rt); @@ -932,6 +975,23 @@ class GCHelperThread { else replenishAndFreeLater(ptr); } + + void finalizeLater(js::gc::ArenaList *list) { + JS_ASSERT(!list->hasToBeFinalized); + if (!list->head) + return; + + list->hasToBeFinalized = true; + JS_ASSERT(!sweeping); + if (finalizeCursor + 1 < finalizeCursorEnd) { + *finalizeCursor++ = list; + *finalizeCursor++ = list->head; + } else { + replenishAndFinalizeLater(list); + } + } + + void setContext(JSContext *context) { cx = context; } }; #endif /* JS_THREADSAFE */ diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index 72704b24eb36..f2f36d37e729 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -142,16 +142,22 @@ GetGCKindSlots(FinalizeKind thingKind) /* Using a switch in hopes that thingKind will usually be a compile-time constant. */ switch (thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: return 0; case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: return 2; case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: return 4; case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: return 8; case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: return 12; case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: return 16; default: JS_NOT_REACHED("Bad object finalize kind"); @@ -286,7 +292,8 @@ Mark(JSTracer *trc, T *thing) JS_ASSERT_IF(trc->context->runtime->gcCurrentCompartment, IS_GC_MARKING_TRACER(trc)); JSRuntime *rt = trc->context->runtime; - + JS_ASSERT(thing->arena()->header()->compartment); + JS_ASSERT(thing->arena()->header()->compartment->rt == rt); /* Don't mark things outside a compartment if we are in a per-compartment GC */ if (rt->gcCurrentCompartment && thing->compartment() != rt->gcCurrentCompartment) goto out; diff --git a/js/src/jsgcstats.cpp b/js/src/jsgcstats.cpp index fb6aa7ac45e1..433eac22f301 100644 --- a/js/src/jsgcstats.cpp +++ b/js/src/jsgcstats.cpp @@ -113,11 +113,17 @@ UpdateCompartmentStats(JSCompartment *comp, unsigned thingKind, uint32 nlivearen static const char *const GC_ARENA_NAMES[] = { "object_0", + "object_0_background", "object_2", + "object_2_background", "object_4", + "object_4_background", "object_8", + "object_8_background", "object_12", + "object_12_background", "object_16", + "object_16_background", "function", "shape", #if JS_HAS_XML_SUPPORT @@ -144,16 +150,22 @@ GetAlignedThing(void *thing, int thingKind) Cell *cell = (Cell *)thing; switch (thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: return (void *)GetArena(cell)->getAlignedThing(thing); case FINALIZE_STRING: return (void *)GetArena(cell)->getAlignedThing(thing); @@ -168,7 +180,7 @@ GetAlignedThing(void *thing, int thingKind) return (void *)GetArena(cell)->getAlignedThing(thing); #endif default: - JS_ASSERT(false); + JS_NOT_REACHED("wrong kind"); return NULL; } } @@ -178,21 +190,27 @@ void GetSizeAndThingsPerArena(int thingKind, size_t &thingSize, size_t &thingsPe { switch (thingKind) { case FINALIZE_OBJECT0: + case FINALIZE_OBJECT0_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_OBJECT2: + case FINALIZE_OBJECT2_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_OBJECT4: + case FINALIZE_OBJECT4_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_OBJECT8: + case FINALIZE_OBJECT8_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_OBJECT12: + case FINALIZE_OBJECT12_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_OBJECT16: + case FINALIZE_OBJECT16_BACKGROUND: GetSizeAndThings(thingSize, thingsPerArena); break; case FINALIZE_EXTERNAL_STRING: @@ -211,7 +229,7 @@ void GetSizeAndThingsPerArena(int thingKind, size_t &thingSize, size_t &thingsPe break; #endif default: - JS_ASSERT(false); + JS_NOT_REACHED("wrong kind"); } } @@ -442,7 +460,7 @@ GCTimer::finish(bool lastGC) { TIMEDIFF(sweepObjectEnd, sweepStringEnd), TIMEDIFF(sweepStringEnd, sweepShapeEnd), TIMEDIFF(sweepShapeEnd, sweepDestroyEnd)); - fprintf(gcFile, "%7d, %7d \n", newChunkCount, destroyChunkCount); + fprintf(gcFile, "%7d, %7d\n", newChunkCount, destroyChunkCount); fflush(gcFile); if (lastGC) { diff --git a/js/src/jshashtable.h b/js/src/jshashtable.h index 85bbb6b7e489..9540f1b283d0 100644 --- a/js/src/jshashtable.h +++ b/js/src/jshashtable.h @@ -43,6 +43,7 @@ #ifndef jshashtable_h_ #define jshashtable_h_ +#include "jsalloc.h" #include "jstl.h" /* Gross special case for Gecko, which defines malloc/calloc/free. */ diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index aa050dedc6c8..85fe0064e689 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -505,10 +505,10 @@ JSContext::typeMonitorAssign(JSObject *obj, jsid id, const js::Value &rval) inline bool JSContext::typeMonitorCall(const js::CallArgs &args, bool constructing) { - if (!typeInferenceEnabled() || !args.callee().isObject()) + if (!typeInferenceEnabled()) return true; - JSObject *callee = &args.callee().toObject(); + JSObject *callee = &args.callee(); if (!callee->isFunction() || !callee->getFunctionPrivate()->isInterpreted()) return true; diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index f7b36cb9dcc0..5b4d41a159ca 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -74,10 +74,11 @@ #include "jstracer.h" #include "jslibmath.h" #include "jsvector.h" +#ifdef JS_METHODJIT #include "methodjit/MethodJIT.h" #include "methodjit/MethodJIT-inl.h" #include "methodjit/Logging.h" - +#endif #include "jsatominlines.h" #include "jscntxtinlines.h" #include "jsinferinlines.h" @@ -451,31 +452,6 @@ CallThisObjectHook(JSContext *cx, JSObject *obj, Value *argv) return thisp; } -/* - * ECMA requires "the global object", but in embeddings such as the browser, - * which have multiple top-level objects (windows, frames, etc. in the DOM), - * we prefer fun's parent. An example that causes this code to run: - * - * // in window w1 - * function f() { return this } - * function g() { return f } - * - * // in window w2 - * var h = w1.g() - * alert(h() == w1) - * - * The alert should display "true". - */ -JS_STATIC_INTERPRET bool -ComputeGlobalThis(JSContext *cx, Value *vp) -{ - JSObject *thisp = vp[0].toObject().getGlobal()->thisObject(cx); - if (!thisp) - return false; - vp[1].setObject(*thisp); - return true; -} - namespace js { void @@ -519,24 +495,46 @@ ReportIncompatibleMethod(JSContext *cx, Value *vp, Class *clasp) } } +/* + * ECMA requires "the global object", but in embeddings such as the browser, + * which have multiple top-level objects (windows, frames, etc. in the DOM), + * we prefer fun's parent. An example that causes this code to run: + * + * // in window w1 + * function f() { return this } + * function g() { return f } + * + * // in window w2 + * var h = w1.g() + * alert(h() == w1) + * + * The alert should display "true". + */ bool -BoxThisForVp(JSContext *cx, Value *vp) +BoxNonStrictThis(JSContext *cx, const CallReceiver &call) { /* * Check for SynthesizeFrame poisoning and fast constructors which - * didn't check their vp properly. + * didn't check their callee properly. */ - JS_ASSERT(!vp[1].isMagic()); + Value &thisv = call.thisv(); + JS_ASSERT(!thisv.isMagic()); + #ifdef DEBUG - JSFunction *fun = vp[0].toObject().isFunction() ? vp[0].toObject().getFunctionPrivate() : NULL; + JSFunction *fun = call.callee().isFunction() ? call.callee().getFunctionPrivate() : NULL; JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->inStrictMode()); #endif - if (vp[1].isNullOrUndefined()) - return ComputeGlobalThis(cx, vp); + if (thisv.isNullOrUndefined()) { + JSObject *thisp = call.callee().getGlobal()->thisObject(cx); + if (!thisp) + return false; + call.thisv().setObject(*thisp); + return true; + } - if (!vp[1].isObject()) - return !!js_PrimitiveToObject(cx, &vp[1]); + if (!thisv.isObject()) + return !!js_PrimitiveToObject(cx, &thisv); return true; } @@ -631,7 +629,7 @@ NoSuchMethod(JSContext *cx, uintN argc, Value *vp, uint32 flags) JSObject *obj = &vp[0].toObject(); JS_ASSERT(obj->getClass() == &js_NoSuchMethodClass); - args.callee() = obj->getSlot(JSSLOT_FOUND_FUNCTION); + args.calleev() = obj->getSlot(JSSLOT_FOUND_FUNCTION); args.thisv() = vp[1]; args[0] = obj->getSlot(JSSLOT_SAVED_ID); JSObject *argsobj = NewDenseCopiedArray(cx, argc, vp + 2); @@ -695,12 +693,12 @@ Invoke(JSContext *cx, const CallArgs &argsRef, uint32 flags) CallArgs args = argsRef; JS_ASSERT(args.argc() <= JS_ARGS_LENGTH_MAX); - if (args.callee().isPrimitive()) { - js_ReportIsNotFunction(cx, &args.callee(), flags & JSINVOKE_FUNFLAGS); + if (args.calleev().isPrimitive()) { + js_ReportIsNotFunction(cx, &args.calleev(), flags & JSINVOKE_FUNFLAGS); return false; } - JSObject &callee = args.callee().toObject(); + JSObject &callee = args.callee(); Class *clasp = callee.getClass(); /* Invoke non-functions. */ @@ -711,7 +709,7 @@ Invoke(JSContext *cx, const CallArgs &argsRef, uint32 flags) #endif JS_ASSERT_IF(flags & JSINVOKE_CONSTRUCT, !clasp->construct); if (!clasp->call) { - js_ReportIsNotFunction(cx, &args.callee(), flags); + js_ReportIsNotFunction(cx, &args.calleev(), flags); return false; } if (!cx->markTypeCallerUnexpected(types::TYPE_UNKNOWN)) @@ -789,7 +787,7 @@ InvokeSessionGuard::start(JSContext *cx, const Value &calleev, const Value &this return false; /* Callees may clobber 'this' or 'callee'. */ - savedCallee_ = args_.callee() = calleev; + savedCallee_ = args_.calleev() = calleev; savedThis_ = args_.thisv() = thisv; do { @@ -889,7 +887,7 @@ ExternalInvoke(JSContext *cx, const Value &thisv, const Value &fval, if (!cx->stack().pushInvokeArgs(cx, argc, &args)) return false; - args.callee() = fval; + args.calleev() = fval; args.thisv() = thisv; memcpy(args.argv(), argv, argc * sizeof(Value)); @@ -922,7 +920,7 @@ ExternalInvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *a if (!cx->stack().pushInvokeArgs(cx, argc, &args)) return false; - args.callee() = fval; + args.calleev() = fval; args.thisv().setMagic(JS_THIS_POISON); memcpy(args.argv(), argv, argc * sizeof(Value)); @@ -977,11 +975,12 @@ InitSharpSlots(JSContext *cx, JSStackFrame *fp) #endif bool -Execute(JSContext *cx, JSObject *chain, JSScript *script, +Execute(JSContext *cx, JSObject &chain, JSScript *script, JSStackFrame *prev, uintN flags, Value *result) { - JS_ASSERT(chain); JS_ASSERT_IF(prev, !prev->isDummyFrame()); + JS_ASSERT_IF(prev, prev->compartment() == cx->compartment); + JS_ASSERT(script->compartment == cx->compartment); if (script->isEmpty()) { if (result) @@ -1007,7 +1006,7 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script, /* Initialize frame and locals. */ JSObject *initialVarObj; if (prev) { - JS_ASSERT(chain == &prev->scopeChain()); + JS_ASSERT(chain == prev->scopeChain()); frame.fp()->initEvalFrame(cx, script, prev, flags); /* NB: prev may not be in cx->currentSegment. */ @@ -1016,7 +1015,7 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script, : &prev->varobj(cx->stack().containingSegment(prev)); } else { /* The scope chain could be anything, so innerize just in case. */ - JSObject *innerizedChain = chain; + JSObject *innerizedChain = &chain; OBJ_TO_INNER_OBJECT(cx, innerizedChain); if (!innerizedChain) return false; @@ -1031,14 +1030,14 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script, frame.fp()->initGlobalFrame(script, *innerizedChain, flags); /* If scope chain is an inner window, outerize for 'this'. */ - JSObject *thisp = chain->thisObject(cx); + JSObject *thisp = chain.thisObject(cx); if (!thisp) return false; frame.fp()->globalThis().setObject(*thisp); initialVarObj = cx->hasRunOption(JSOPTION_VAROBJFIX) - ? chain->getGlobal() - : chain; + ? chain.getGlobal() + : &chain; } JS_ASSERT(!initialVarObj->getOps()->defineProperty); @@ -1245,7 +1244,7 @@ StrictlyEqual(JSContext *cx, const Value &lref, const Value &rref, JSBool *equal return true; } if (lval.isObject()) { - *equal = &lval.toObject() == &rval.toObject(); + *equal = lval.toObject() == rval.toObject(); return true; } if (lval.isUndefined()) { @@ -1328,8 +1327,8 @@ InvokeConstructor(JSContext *cx, const CallArgs &argsRef) CallArgs args = argsRef; JSObject *callee; - if (args.callee().isPrimitive() || !(callee = &args.callee().toObject())->getParent()) { - js_ReportIsNotFunction(cx, &args.callee(), JSV2F_CONSTRUCT); + if (args.calleev().isPrimitive() || !(callee = &args.callee())->getParent()) { + js_ReportIsNotFunction(cx, &args.calleev(), JSV2F_CONSTRUCT); return false; } @@ -1391,7 +1390,7 @@ InvokeConstructorWithGivenThis(JSContext *cx, JSObject *thisobj, const Value &fv if (!cx->stack().pushInvokeArgs(cx, argc, &args)) return JS_FALSE; - args.callee() = fval; + args.calleev() = fval; /* Initialize args.thisv on all paths below. */ memcpy(args.argv(), argv, argc * sizeof(Value)); @@ -1415,26 +1414,6 @@ InvokeConstructorWithGivenThis(JSContext *cx, JSObject *thisobj, const Value &fv return ok; } -bool -DirectEval(JSContext *cx, uint32 argc, Value *vp) -{ - JS_ASSERT(vp == cx->regs->sp - argc - 2); - JS_ASSERT(vp[0].isObject()); - JS_ASSERT(vp[0].toObject().isFunction()); - - JSStackFrame *caller = cx->fp(); - JS_ASSERT(caller->isScriptFrame()); - JS_ASSERT(IsBuiltinEvalForScope(&caller->scopeChain(), vp[0])); - AutoFunctionCallProbe callProbe(cx, vp[0].toObject().getFunctionPrivate(), caller->script()); - - JSObject *scopeChain = - GetScopeChainFast(cx, caller, JSOP_EVAL, JSOP_EVAL_LENGTH + JSOP_LINENO_LENGTH); - if (!scopeChain || !EvalKernel(cx, argc, vp, DIRECT_EVAL, caller, scopeChain)) - return false; - cx->regs->sp = vp + 1; - return true; -} - bool ValueToId(JSContext *cx, const Value &v, jsid *idp) { @@ -1592,7 +1571,7 @@ js::GetUpvar(JSContext *cx, uintN closureLevel, UpvarCookie cookie) } else if (slot < fp->numFormalArgs()) { vp = fp->formalArgs(); } else if (slot == UpvarCookie::CALLEE_SLOT) { - vp = &fp->calleeValue(); + vp = &fp->calleev(); slot = 0; } else { slot -= fp->numFormalArgs(); @@ -2173,7 +2152,7 @@ AssertValidPropertyCacheHit(JSContext *cx, JSScript *script, JSFrameRegs& regs, } else if (entry->vword.isShape()) { JS_ASSERT(entry->vword.toShape() == shape); JS_ASSERT_IF(shape->isMethod(), - &shape->methodObject() == &pobj->nativeGetSlot(shape->slot).toObject()); + shape->methodObject() == pobj->nativeGetSlot(shape->slot).toObject()); } else { Value v; JS_ASSERT(entry->vword.isFunObj()); @@ -2182,11 +2161,11 @@ AssertValidPropertyCacheHit(JSContext *cx, JSScript *script, JSFrameRegs& regs, JS_ASSERT(shape->hasDefaultGetterOrIsMethod()); JS_ASSERT(pobj->containsSlot(shape->slot)); v = pobj->nativeGetSlot(shape->slot); - JS_ASSERT(&entry->vword.toFunObj() == &v.toObject()); + JS_ASSERT(entry->vword.toFunObj() == v.toObject()); if (shape->isMethod()) { JS_ASSERT(js_CodeSpec[*regs.pc].format & JOF_CALLOP); - JS_ASSERT(&shape->methodObject() == &v.toObject()); + JS_ASSERT(shape->methodObject() == v.toObject()); } } @@ -2942,7 +2921,7 @@ BEGIN_CASE(JSOP_ENTERWITH) END_CASE(JSOP_ENTERWITH) BEGIN_CASE(JSOP_LEAVEWITH) - JS_ASSERT(®s.sp[-1].toObject() == ®s.fp->scopeChain()); + JS_ASSERT(regs.sp[-1].toObject() == regs.fp->scopeChain()); regs.sp--; js_LeaveWith(cx); END_CASE(JSOP_LEAVEWITH) @@ -4085,19 +4064,26 @@ do_incop: const JSCodeSpec *cs = &js_CodeSpec[op]; JS_ASSERT(cs->ndefs == 1); JS_ASSERT((cs->format & JOF_TMPSLOT_MASK) >= JOF_TMPSLOT2); + + uint32 format = cs->format; + uint32 setPropFlags = (JOF_MODE(format) == JOF_NAME) + ? JSRESOLVE_ASSIGNING + : JSRESOLVE_ASSIGNING | JSRESOLVE_QUALIFIED; + Value &ref = regs.sp[-1]; int32_t tmp; if (JS_LIKELY(ref.isInt32() && CanIncDecWithoutOverflow(tmp = ref.toInt32()))) { - int incr = (cs->format & JOF_INC) ? 1 : -1; - if (cs->format & JOF_POST) + int incr = (format & JOF_INC) ? 1 : -1; + if (format & JOF_POST) ref.getInt32Ref() = tmp + incr; else ref.getInt32Ref() = tmp += incr; - regs.fp->setAssigning(); - JSBool ok = obj->setProperty(cx, id, &ref, script->strictModeCode); - regs.fp->clearAssigning(); - if (!ok) - goto error; + + { + JSAutoResolveFlags rf(cx, setPropFlags); + if (!obj->setProperty(cx, id, &ref, script->strictModeCode)) + goto error; + } /* * We must set regs.sp[-1] to tmp for both post and pre increments @@ -4109,15 +4095,18 @@ do_incop: PUSH_NULL(); if (!js_DoIncDec(cx, cs, ®s.sp[-2], ®s.sp[-1])) goto error; + if (!cx->typeMonitorAssign(obj, id, regs.sp[-1])) goto error; if (!script->typeMonitorOverflow(cx, regs.pc)) goto error; - regs.fp->setAssigning(); - JSBool ok = obj->setProperty(cx, id, ®s.sp[-1], script->strictModeCode); - regs.fp->clearAssigning(); - if (!ok) - goto error; + + { + JSAutoResolveFlags rf(cx, setPropFlags); + if (!obj->setProperty(cx, id, ®s.sp[-1], script->strictModeCode)) + goto error; + } + regs.sp--; } @@ -4194,14 +4183,14 @@ BEGIN_CASE(JSOP_LOCALINC) } BEGIN_CASE(JSOP_THIS) - if (!regs.fp->computeThis(cx)) + if (!ComputeThis(cx, regs.fp)) goto error; PUSH_COPY(regs.fp->thisValue()); END_CASE(JSOP_THIS) BEGIN_CASE(JSOP_UNBRANDTHIS) { - if (!regs.fp->computeThis(cx)) + if (!ComputeThis(cx, regs.fp)) goto error; Value &thisv = regs.fp->thisValue(); if (thisv.isObject()) { @@ -4218,7 +4207,7 @@ END_CASE(JSOP_UNBRANDTHIS) jsint i; BEGIN_CASE(JSOP_GETTHISPROP) - if (!regs.fp->computeThis(cx)) + if (!ComputeThis(cx, regs.fp)) goto error; i = 0; PUSH_COPY(regs.fp->thisValue()); @@ -4810,8 +4799,10 @@ BEGIN_CASE(JSOP_EVAL) if (!IsBuiltinEvalForScope(®s.fp->scopeChain(), *vp)) goto call_using_invoke; - if (!DirectEval(cx, argc, vp)) + if (!DirectEval(cx, CallArgsFromVp(argc, vp))) goto error; + + regs.sp = vp + 1; } END_CASE(JSOP_EVAL) @@ -4843,7 +4834,7 @@ BEGIN_CASE(JSOP_FUNCALL) goto error; } - if (!cx->typeMonitorCall(CallArgs(vp + 2, argc), flags & JSFRAME_CONSTRUCTING)) + if (!cx->typeMonitorCall(CallArgsFromVp(argc, vp), flags & JSFRAME_CONSTRUCTING)) goto error; bool newType = (flags & JSFRAME_CONSTRUCTING) && diff --git a/js/src/jsinterp.h b/js/src/jsinterp.h index f5e4eba9fcca..9fac2948ae4c 100644 --- a/js/src/jsinterp.h +++ b/js/src/jsinterp.h @@ -79,26 +79,25 @@ enum JSInterpMode enum JSFrameFlags { /* Primary frame type */ - JSFRAME_GLOBAL = 0x1, /* frame pushed for a global script */ - JSFRAME_FUNCTION = 0x2, /* frame pushed for a scripted call */ - JSFRAME_DUMMY = 0x4, /* frame pushed for bookkeeping */ + JSFRAME_GLOBAL = 0x1, /* frame pushed for a global script */ + JSFRAME_FUNCTION = 0x2, /* frame pushed for a scripted call */ + JSFRAME_DUMMY = 0x4, /* frame pushed for bookkeeping */ /* Frame subtypes */ - JSFRAME_EVAL = 0x8, /* frame pushed for eval() or debugger eval */ - JSFRAME_DEBUGGER = 0x10, /* frame pushed for debugger eval */ - JSFRAME_GENERATOR = 0x20, /* frame is associated with a generator */ - JSFRAME_FLOATING_GENERATOR = 0x40, /* frame is is in generator obj, not on stack */ - JSFRAME_CONSTRUCTING = 0x80, /* frame is for a constructor invocation */ + JSFRAME_EVAL = 0x8, /* frame pushed for eval() or debugger eval */ + JSFRAME_DEBUGGER = 0x10, /* frame pushed for debugger eval */ + JSFRAME_GENERATOR = 0x20, /* frame is associated with a generator */ + JSFRAME_FLOATING_GENERATOR = 0x40, /* frame is is in generator obj, not on stack */ + JSFRAME_CONSTRUCTING = 0x80, /* frame is for a constructor invocation */ /* Temporary frame states */ - JSFRAME_ASSIGNING = 0x100, /* not-JOF_ASSIGNING op is assigning */ - JSFRAME_YIELDING = 0x200, /* js::Interpret dispatched JSOP_YIELD */ - JSFRAME_FINISHED_IN_INTERPRETER = 0x400, /* set if frame finished in Interpret() */ + JSFRAME_YIELDING = 0x200, /* js::Interpret dispatched JSOP_YIELD */ + JSFRAME_FINISHED_IN_INTERP = 0x400, /* set if frame finished in Interpret() */ /* Concerning function arguments */ - JSFRAME_OVERRIDE_ARGS = 0x1000, /* overridden arguments local variable */ - JSFRAME_OVERFLOW_ARGS = 0x2000, /* numActualArgs > numFormalArgs */ - JSFRAME_UNDERFLOW_ARGS = 0x4000, /* numActualArgs < numFormalArgs */ + JSFRAME_OVERRIDE_ARGS = 0x1000, /* overridden arguments local variable */ + JSFRAME_OVERFLOW_ARGS = 0x2000, /* numActualArgs > numFormalArgs */ + JSFRAME_UNDERFLOW_ARGS = 0x4000, /* numActualArgs < numFormalArgs */ /* Lazy frame initialization */ JSFRAME_HAS_IMACRO_PC = 0x8000, /* frame has imacpc value available */ @@ -493,8 +492,6 @@ struct JSStackFrame return formalArgs()[-1]; } - inline bool computeThis(JSContext *cx); - /* * Callee * @@ -502,7 +499,7 @@ struct JSStackFrame * same caller as its containing function frame. */ - js::Value &calleeValue() const { + js::Value &calleev() const { JS_ASSERT(isFunctionFrame()); if (isEvalFrame()) return ((js::Value *)this)[-2]; @@ -511,18 +508,22 @@ struct JSStackFrame JSObject &callee() const { JS_ASSERT(isFunctionFrame()); - return calleeValue().toObject(); + return calleev().toObject(); } JSObject *maybeCallee() const { return isFunctionFrame() ? &callee() : NULL; } + js::CallReceiver callReceiver() const { + return js::CallReceiverFromArgv(formalArgs()); + } + /* * getValidCalleeObject is a fallible getter to compute the correct callee * function object, which may require deferred cloning due to the JSObject * methodReadBarrier. For a non-function frame, return true with *vp set - * from calleeValue, which may not be an object (it could be undefined). + * from calleev, which may not be an object (it could be undefined). */ bool getValidCalleeObject(JSContext *cx, js::Value *vp); @@ -571,6 +572,20 @@ struct JSStackFrame inline void markActivationObjectsAsPut(); + /* + * Frame compartment + * + * A stack frame's compartment is the frame's containing context's + * compartment when the frame was pushed. + */ + + JSCompartment *compartment() const { + JS_ASSERT_IF(isScriptFrame(), scopeChain().compartment() == script()->compartment); + return scopeChain().compartment(); + } + + inline JSPrincipals *principals(JSContext *cx) const; + /* * Imacropc * @@ -745,18 +760,6 @@ struct JSStackFrame flags_ |= JSFRAME_OVERRIDE_ARGS; } - bool isAssigning() const { - return !!(flags_ & JSFRAME_ASSIGNING); - } - - void setAssigning() { - flags_ |= JSFRAME_ASSIGNING; - } - - void clearAssigning() { - flags_ &= ~JSFRAME_ASSIGNING; - } - bool isYielding() { return !!(flags_ & JSFRAME_YIELDING); } @@ -770,11 +773,11 @@ struct JSStackFrame } void setFinishedInInterpreter() { - flags_ |= JSFRAME_FINISHED_IN_INTERPRETER; + flags_ |= JSFRAME_FINISHED_IN_INTERP; } bool finishedInInterpreter() const { - return !!(flags_ & JSFRAME_FINISHED_IN_INTERPRETER); + return !!(flags_ & JSFRAME_FINISHED_IN_INTERP); } /* @@ -956,33 +959,22 @@ extern bool ScriptDebugEpilogue(JSContext *cx, JSStackFrame *fp, bool ok); /* - * For a call's vp (which necessarily includes callee at vp[0] and the original - * specified |this| at vp[1]), convert null/undefined |this| into the global - * object for the callee and replace other primitives with boxed versions. The - * callee must not be strict mode code. + * For a given |call|, convert null/undefined |this| into the global object for + * the callee and replace other primitives with boxed versions. This assumes + * that call.callee() is not strict mode code. This is the special/slow case of + * ComputeThis. */ extern bool -BoxThisForVp(JSContext *cx, js::Value *vp); +BoxNonStrictThis(JSContext *cx, const CallReceiver &call); /* - * Abstracts the layout of the stack passed to natives from the engine and from - * natives to js::Invoke. + * Ensure that fp->thisValue() is the correct value of |this| for the scripted + * call represented by |fp|. ComputeThis is necessary because fp->thisValue() + * may be set to 'undefined' when 'this' should really be the global object (as + * an optimization to avoid global-this computation). */ -struct CallArgs -{ - Value *argv_; - uintN argc_; - CallArgs() {} - CallArgs(Value *argv, uintN argc) : argv_(argv), argc_(argc) {} - public: - Value *base() const { return argv_ - 2; } - Value &callee() const { return argv_[-2]; } - Value &thisv() const { return argv_[-1]; } - Value &operator[](unsigned i) const { JS_ASSERT(i < argc_); return argv_[i]; } - Value *argv() const { return argv_; } - uintN argc() const { return argc_; } - Value &rval() const { return argv_[-2]; } -}; +inline bool +ComputeThis(JSContext *cx, JSStackFrame *fp); /* * The js::InvokeArgumentsGuard passed to js_Invoke must come from an @@ -1073,30 +1065,12 @@ extern bool ExternalInvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *argv, Value *rval); -/* - * Performs a direct eval for the given arguments, which must correspond to the - * currently-executing stack frame, which must be a script frame. On completion - * the result is returned in *vp and the JS stack pointer is adjusted. - */ -extern JS_REQUIRES_STACK bool -DirectEval(JSContext *cx, uint32 argc, Value *vp); - -/* - * Performs a direct eval for the given arguments, which must correspond to the - * currently-executing stack frame, which must be a script frame. evalfun must - * be the built-in eval function and must correspond to the callee in vp[0]. - * When this function succeeds it returns the result in *vp, adjusts the JS - * stack pointer, and returns true. - */ -extern JS_REQUIRES_STACK bool -DirectEval(JSContext *cx, JSFunction *evalfun, uint32 argc, Value *vp); - /* * Executes a script with the given scope chain in the context of the given * frame. */ extern JS_FORCES_STACK bool -Execute(JSContext *cx, JSObject *chain, JSScript *script, +Execute(JSContext *cx, JSObject &chain, JSScript *script, JSStackFrame *prev, uintN flags, Value *result); /* diff --git a/js/src/jsinterpinlines.h b/js/src/jsinterpinlines.h index a2732f5a6592..12c0f635cb93 100644 --- a/js/src/jsinterpinlines.h +++ b/js/src/jsinterpinlines.h @@ -134,7 +134,7 @@ JSStackFrame::resetInvokeCallFrame() JSFRAME_HAS_HOOK_DATA | JSFRAME_HAS_CALL_OBJ | JSFRAME_HAS_ARGS_OBJ | - JSFRAME_FINISHED_IN_INTERPRETER))); + JSFRAME_FINISHED_IN_INTERP))); /* * Since the stack frame is usually popped after PutActivationObjects, @@ -373,29 +373,6 @@ JSStackFrame::clearMissingArgs() SetValueRangeToUndefined(formalArgs() + numActualArgs(), formalArgsEnd()); } -inline bool -JSStackFrame::computeThis(JSContext *cx) -{ - js::Value &thisv = thisValue(); - if (thisv.isObject()) - return true; - if (isFunctionFrame()) { - if (fun()->inStrictMode()) - return true; - /* - * Eval function frames have their own |this| slot, which is a copy of the function's - * |this| slot. If we lazily wrap a primitive |this| in an eval function frame, the - * eval's frame will get the wrapper, but the function's frame will not. To prevent - * this, we always wrap a function's |this| before pushing an eval frame, and should - * thus never see an unwrapped primitive in a non-strict eval function frame. - */ - JS_ASSERT(!isEvalFrame()); - } - if (!js::BoxThisForVp(cx, &thisv - 1)) - return false; - return true; -} - inline JSObject & JSStackFrame::varobj(js::StackSegment *seg) const { @@ -583,6 +560,9 @@ InvokeSessionGuard::invoke(JSContext *cx) const formals_[-2] = savedCallee_; formals_[-1] = savedThis_; + /* Prevent spurious accessing-callee-after-rval assert. */ + args_.calleeHasBeenReset(); + if (!optimized()) return Invoke(cx, args_, 0); @@ -656,6 +636,27 @@ class PrimitiveBehavior { } // namespace detail +template +bool +GetPrimitiveThis(JSContext *cx, Value *vp, T *v) +{ + typedef detail::PrimitiveBehavior Behavior; + + const Value &thisv = vp[1]; + if (Behavior::isType(thisv)) { + *v = Behavior::extract(thisv); + return true; + } + + if (thisv.isObject() && thisv.toObject().getClass() == Behavior::getClass()) { + *v = Behavior::extract(thisv.toObject().getPrimitiveThis()); + return true; + } + + ReportIncompatibleMethod(cx, vp, Behavior::getClass()); + return false; +} + /* * Compute the implicit |this| parameter for a call expression where the callee * is an unqualified name reference. @@ -733,25 +734,25 @@ ComputeImplicitThis(JSContext *cx, JSObject *obj, const Value &funval, Value *vp return true; } -template -bool -GetPrimitiveThis(JSContext *cx, Value *vp, T *v) +inline bool +ComputeThis(JSContext *cx, JSStackFrame *fp) { - typedef detail::PrimitiveBehavior Behavior; - - const Value &thisv = vp[1]; - if (Behavior::isType(thisv)) { - *v = Behavior::extract(thisv); + Value &thisv = fp->thisValue(); + if (thisv.isObject()) return true; + if (fp->isFunctionFrame()) { + if (fp->fun()->inStrictMode()) + return true; + /* + * Eval function frames have their own |this| slot, which is a copy of the function's + * |this| slot. If we lazily wrap a primitive |this| in an eval function frame, the + * eval's frame will get the wrapper, but the function's frame will not. To prevent + * this, we always wrap a function's |this| before pushing an eval frame, and should + * thus never see an unwrapped primitive in a non-strict eval function frame. + */ + JS_ASSERT(!fp->isEvalFrame()); } - - if (thisv.isObject() && thisv.toObject().getClass() == Behavior::getClass()) { - *v = Behavior::extract(thisv.toObject().getPrimitiveThis()); - return true; - } - - ReportIncompatibleMethod(cx, vp, Behavior::getClass()); - return false; + return BoxNonStrictThis(cx, fp->callReceiver()); } /* diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 195e934e0d86..d80fe9e14bc0 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -90,7 +90,9 @@ static JSObject *iterator_iterator(JSContext *cx, JSObject *obj, JSBool keysonly Class js_IteratorClass = { "Iterator", - JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator), + JSCLASS_HAS_PRIVATE | + JSCLASS_CONCURRENT_FINALIZER | + JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator), PropertyStub, /* addProperty */ PropertyStub, /* delProperty */ PropertyStub, /* getProperty */ @@ -435,7 +437,7 @@ NewIteratorObject(JSContext *cx, uintN flags) */ JSObject *obj = js_NewGCObject(cx, FINALIZE_OBJECT0); if (!obj) - return false; + return NULL; EmptyShape *emptyEnumeratorShape = EmptyShape::getEmptyEnumeratorShape(cx); if (!emptyEnumeratorShape) @@ -564,8 +566,6 @@ EnumeratedIdVectorToIterator(JSContext *cx, JSObject *obj, uintN flags, AutoIdVe return VectorToValueIterator(cx, obj, flags, props, vp); } -typedef Vector ShapeVector; - static inline void UpdateNativeIterator(NativeIterator *ni, JSObject *obj) { diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index c558d7645d77..d6b0d231928c 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -848,6 +848,16 @@ obj_toStringHelper(JSContext *cx, JSObject *obj) return str; } +JSObject * +NonNullObject(JSContext *cx, const Value &v) +{ + if (v.isPrimitive()) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT); + return NULL; + } + return &v.toObject(); +} + } /* ES5 15.2.4.2. Note steps 1 and 2 are errata. */ @@ -931,69 +941,19 @@ js_CheckContentSecurityPolicy(JSContext *cx, JSObject *scopeobj) return !v.isFalse(); } -/* - * Check whether principals subsumes scopeobj's principals, and return true - * if so (or if scopeobj has no principals, for backward compatibility with - * the JS API, which does not require principals), and false otherwise. - */ -JSBool -js_CheckPrincipalsAccess(JSContext *cx, JSObject *scopeobj, - JSPrincipals *principals, JSAtom *caller) +static void +AssertScopeChainValidity(JSContext *cx, JSObject &scopeobj) { - JSSecurityCallbacks *callbacks; - JSPrincipals *scopePrincipals; - - callbacks = JS_GetSecurityCallbacks(cx); - if (callbacks && callbacks->findObjectPrincipals) { - scopePrincipals = callbacks->findObjectPrincipals(cx, scopeobj); - if (!principals || !scopePrincipals || - !principals->subsume(principals, scopePrincipals)) { - JSAutoByteString callerstr; - if (!js_AtomToPrintableString(cx, caller, &callerstr)) - return JS_FALSE; - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, - JSMSG_BAD_INDIRECT_CALL, callerstr.ptr()); - return JS_FALSE; - } - } - return JS_TRUE; -} - -static bool -CheckScopeChainValidity(JSContext *cx, JSObject *scopeobj) -{ - JSObject *inner = scopeobj; +#ifdef DEBUG + JSObject *inner = &scopeobj; OBJ_TO_INNER_OBJECT(cx, inner); - if (!inner) - return false; - JS_ASSERT(inner == scopeobj); + JS_ASSERT(inner && inner == &scopeobj); - /* XXX This is an awful gross hack. */ - while (scopeobj) { - JSObjectOp op = scopeobj->getClass()->ext.innerObject; - if (op && op(cx, scopeobj) != scopeobj) { - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_INDIRECT_CALL, - js_eval_str); - return false; - } - scopeobj = scopeobj->getParent(); + for (JSObject *o = &scopeobj; o; o = o->getParent()) { + if (JSObjectOp op = o->getClass()->ext.innerObject) + JS_ASSERT(op(cx, o) == &scopeobj); } - - return true; -} - -const char * -js_ComputeFilename(JSContext *cx, JSStackFrame *caller, - JSPrincipals *principals, uintN *linenop) -{ - jsbytecode *pc = caller->pc(cx); - if (pc && js_GetOpcode(cx, caller->script(), pc) == JSOP_EVAL) { - JS_ASSERT(js_GetOpcode(cx, caller->script(), pc + JSOP_EVAL_LENGTH) == JSOP_LINENO); - *linenop = GET_UINT16(pc + JSOP_EVAL_LENGTH); - } else { - *linenop = js_FramePCToLineNumber(cx, caller); - } - return caller->script()->filename; +#endif } #ifndef EVAL_CACHE_CHAIN_LIMIT @@ -1019,7 +979,7 @@ EvalCacheHash(JSContext *cx, JSLinearString *str) static JS_ALWAYS_INLINE JSScript * EvalCacheLookup(JSContext *cx, JSLinearString *str, JSStackFrame *caller, uintN staticLevel, - JSPrincipals *principals, JSObject *scopeobj, JSScript **bucket) + JSPrincipals *principals, JSObject &scopeobj, JSScript **bucket) { /* * Cache local eval scripts indexed by source qualified by scope. @@ -1085,7 +1045,7 @@ EvalCacheLookup(JSContext *cx, JSLinearString *str, JSStackFrame *caller, uintN } } if (i < 0 || - objarray->vector[i]->getParent() == scopeobj) { + objarray->vector[i]->getParent() == &scopeobj) { JS_ASSERT(staticLevel == script->staticLevel); EVAL_CACHE_METER(hit); *scriptp = script->u.nextToGC; @@ -1104,80 +1064,109 @@ EvalCacheLookup(JSContext *cx, JSLinearString *str, JSStackFrame *caller, uintN return NULL; } -/* ES5 15.1.2.1. */ -static JSBool -eval(JSContext *cx, uintN argc, Value *vp) +/* + * There are two things we want to do with each script executed in EvalKernel: + * 1. notify jsdbgapi about script creation/destruction + * 2. add the script to the eval cache when EvalKernel is finished + * + * NB: Although the eval cache keeps a script alive wrt to the JS engine, from + * a jsdbgapi user's perspective, we want each eval() to create and destroy a + * script. This hides implementation details and means we don't have to deal + * with calls to JS_GetScriptObject for scripts in the eval cache (currently, + * script->u.object aliases script->u.nextToGC). + */ +class EvalScriptGuard { - /* - * NB: This method handles only indirect eval: direct eval is handled by - * JSOP_EVAL. - */ + JSContext *cx_; + JSLinearString *str_; + JSScript **bucket_; + JSScript *script_; - JSStackFrame *caller = js_GetScriptedCaller(cx, NULL); - - /* FIXME Bug 602994: This really should be perfectly cromulent. */ - if (!caller) { - /* Eval code needs to inherit principals from the caller. */ - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, - JSMSG_BAD_INDIRECT_CALL, js_eval_str); - return false; + public: + EvalScriptGuard(JSContext *cx, JSLinearString *str) + : cx_(cx), + str_(str), + script_(NULL) { + bucket_ = EvalCacheHash(cx, str); } - return EvalKernel(cx, argc, vp, INDIRECT_EVAL, caller, vp[0].toObject().getGlobal()); -} - -namespace js { - -bool -EvalKernel(JSContext *cx, uintN argc, Value *vp, EvalType evalType, JSStackFrame *caller, - JSObject *scopeobj) -{ - /* - * FIXME Bug 602994: Calls with no scripted caller should be permitted and - * should be implemented as indirect calls. - */ - JS_ASSERT(caller); - JS_ASSERT(scopeobj); - - /* - * We once supported a second argument to eval to use as the scope chain - * when evaluating the code string. Warn when such uses are seen so that - * authors will know that support for eval(s, o) has been removed. - */ - JSScript *callerScript = caller->script(); - if (argc > 1 && !callerScript->warnedAboutTwoArgumentEval) { - static const char TWO_ARGUMENT_WARNING[] = - "Support for eval(code, scopeObject) has been removed. " - "Use |with (scopeObject) eval(code);| instead."; - if (!JS_ReportWarning(cx, TWO_ARGUMENT_WARNING)) - return false; - callerScript->warnedAboutTwoArgumentEval = true; + ~EvalScriptGuard() { + if (script_) { + js_CallDestroyScriptHook(cx_, script_); + script_->isCachedEval = true; + script_->u.nextToGC = *bucket_; + *bucket_ = script_; +#ifdef CHECK_SCRIPT_OWNER + script_->owner = NULL; +#endif + } } + void lookupInEvalCache(JSStackFrame *caller, uintN staticLevel, + JSPrincipals *principals, JSObject &scopeobj) { + if (JSScript *found = EvalCacheLookup(cx_, str_, caller, staticLevel, + principals, scopeobj, bucket_)) { + js_CallNewScriptHook(cx_, found, NULL); + script_ = found; + } + } + + void setNewScript(JSScript *script) { + /* NewScriptFromCG has already called js_CallNewScriptHook. */ + JS_ASSERT(!script_ && script); + script_ = script; + } + + bool foundScript() { + return !!script_; + } + + JSScript *script() const { + JS_ASSERT(script_); + return script_; + } +}; + +/* + * Common code implementing direct and indirect eval. + * + * Evaluate call.argv[2], if it is a string, in the context of the given calling + * frame, with the provided scope chain, with the semantics of either a direct + * or indirect eval (see ES5 10.4.2). If this is an indirect eval, scopeobj + * must be a global object. + * + * On success, store the completion value in call.rval and return true. + */ +enum EvalType { DIRECT_EVAL, INDIRECT_EVAL }; + +static bool +EvalKernel(JSContext *cx, const CallArgs &call, EvalType evalType, JSStackFrame *caller, + JSObject &scopeobj) +{ + JS_ASSERT((evalType == INDIRECT_EVAL) == (caller == NULL)); + AssertScopeChainValidity(cx, scopeobj); + /* * CSP check: Is eval() allowed at all? * Report errors via CSP is done in the script security mgr. */ - if (!js_CheckContentSecurityPolicy(cx, scopeobj)) { + if (!js_CheckContentSecurityPolicy(cx, &scopeobj)) { JS_ReportError(cx, "call to eval() blocked by CSP"); return false; } /* ES5 15.1.2.1 step 1. */ - if (argc < 1) { - vp->setUndefined(); + if (call.argc() < 1) { + call.rval().setUndefined(); return true; } - if (!vp[2].isString()) { - *vp = vp[2]; + if (!call[0].isString()) { + call.rval() = call[0]; return true; } - JSString *str = vp[2].toString(); + JSString *str = call[0].toString(); /* ES5 15.1.2.1 steps 2-8. */ - JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, Jsvalify(vp))); - JS_ASSERT(IsAnyBuiltinEval(callee->getFunctionPrivate())); - JSPrincipals *principals = js_EvalFramePrincipals(cx, callee, caller); /* * Per ES5, indirect eval runs in the global scope. (eval is specified this @@ -1194,17 +1183,10 @@ EvalKernel(JSContext *cx, uintN argc, Value *vp, EvalType evalType, JSStackFrame JS_ASSERT(callerPC && js_GetOpcode(cx, caller->script(), callerPC) == JSOP_EVAL); #endif } else { - /* Pretend that we're top level. */ + JS_ASSERT(call.callee().getGlobal() == &scopeobj); staticLevel = 0; - - JS_ASSERT(scopeobj == scopeobj->getGlobal()); - JS_ASSERT(scopeobj->isGlobal()); } - /* Ensure we compile this eval with the right object in the scope chain. */ - if (!CheckScopeChainValidity(cx, scopeobj)) - return false; - JSLinearString *linearStr = str->ensureLinear(cx); if (!linearStr) return false; @@ -1219,21 +1201,26 @@ EvalKernel(JSContext *cx, uintN argc, Value *vp, EvalType evalType, JSStackFrame */ if (length > 2 && chars[0] == '(' && chars[length - 1] == ')') { #if USE_OLD_AND_BUSTED_JSON_PARSER - JSONParser *jp = js_BeginJSONParse(cx, vp, /* suppressErrors = */true); + Value tmp; + JSONParser *jp = js_BeginJSONParse(cx, &tmp, /* suppressErrors = */true); if (jp != NULL) { /* Run JSON-parser on string inside ( and ). */ bool ok = js_ConsumeJSONText(cx, jp, chars + 1, length - 2); ok &= js_FinishJSONParse(cx, jp, NullValue()); - if (ok) + if (ok) { + call.rval() = tmp; return true; - } + } #else JSONSourceParser parser(cx, chars + 1, length - 2, JSONSourceParser::StrictJSON, JSONSourceParser::NoError); - if (!parser.parse(vp)) + Value tmp; + if (!parser.parse(&tmp)) return false; - if (!vp->isUndefined()) + if (!tmp.isUndefined()) { + call.rval() = tmp; return true; + } #endif } @@ -1242,67 +1229,96 @@ EvalKernel(JSContext *cx, uintN argc, Value *vp, EvalType evalType, JSStackFrame * haven't wrapped that yet, do so now, before we make a copy of it for * the eval code to use. */ - if (evalType == DIRECT_EVAL && !caller->computeThis(cx)) + if (evalType == DIRECT_EVAL && !ComputeThis(cx, caller)) return false; - JSScript *script = NULL; - JSScript **bucket = EvalCacheHash(cx, linearStr); - if (evalType == DIRECT_EVAL && caller->isNonEvalFunctionFrame()) { - script = EvalCacheLookup(cx, linearStr, caller, staticLevel, principals, scopeobj, bucket); + EvalScriptGuard esg(cx, linearStr); - /* - * Although the eval cache keeps a script alive from the perspective of - * the JS engine, from a jsdbgapi user's perspective each eval() - * creates and destroys a script. This hides implementation details and - * allows jsdbgapi clients to avoid calling JS_GetScriptObject after a - * script has been returned to the eval cache, which is invalid since - * script->u.object aliases script->u.nextToGC. - */ - if (script) { - js_CallNewScriptHook(cx, script, NULL); - MUST_FLOW_THROUGH("destroy"); + JSPrincipals *principals = PrincipalsForCompiledCode(call, cx); + + if (evalType == DIRECT_EVAL && caller->isNonEvalFunctionFrame()) + esg.lookupInEvalCache(caller, staticLevel, principals, scopeobj); + + if (!esg.foundScript()) { + uintN lineno; + const char *filename = CurrentScriptFileAndLine(cx, &lineno, + evalType == DIRECT_EVAL + ? CALLED_FROM_JSOP_EVAL + : NOT_CALLED_FROM_JSOP_EVAL); + uint32 tcflags = TCF_COMPILE_N_GO | TCF_NEED_MUTABLE_SCRIPT | TCF_COMPILE_FOR_EVAL; + JSScript *compiled = Compiler::compileScript(cx, &scopeobj, caller, principals, tcflags, + chars, length, filename, lineno, + cx->findVersion(), linearStr, staticLevel); + if (!compiled) + return false; + + esg.setNewScript(compiled); + } + + return Execute(cx, scopeobj, esg.script(), caller, JSFRAME_EVAL, &call.rval()); +} + +/* + * We once supported a second argument to eval to use as the scope chain + * when evaluating the code string. Warn when such uses are seen so that + * authors will know that support for eval(s, o) has been removed. + */ +static inline bool +WarnOnTooManyArgs(JSContext *cx, const CallArgs &call) +{ + if (call.argc() > 1) { + if (JSStackFrame *caller = js_GetScriptedCaller(cx, NULL)) { + if (!caller->script()->warnedAboutTwoArgumentEval) { + static const char TWO_ARGUMENT_WARNING[] = + "Support for eval(code, scopeObject) has been removed. " + "Use |with (scopeObject) eval(code);| instead."; + if (!JS_ReportWarning(cx, TWO_ARGUMENT_WARNING)) + return false; + caller->script()->warnedAboutTwoArgumentEval = true; + } + } else { + /* + * In the case of an indirect call without a caller frame, avoid a + * potential warning-flood by doing nothing. + */ } } - /* - * We can't have a callerFrame (down in js::Execute's terms) if we're in - * global code (or if we're an indirect eval). - */ - JSStackFrame *callerFrame = (staticLevel != 0) ? caller : NULL; - if (!script) { - uintN lineno; - const char *filename = js_ComputeFilename(cx, caller, principals, &lineno); + return true; +} - uint32 tcflags = TCF_COMPILE_N_GO | TCF_NEED_MUTABLE_SCRIPT | TCF_COMPILE_FOR_EVAL; - script = Compiler::compileScript(cx, scopeobj, callerFrame, - principals, tcflags, chars, length, - filename, lineno, cx->findVersion(), - linearStr, staticLevel); - if (!script) - return false; - } +/* + * ES5 15.1.2.1. + * + * NB: This method handles only indirect eval. + */ +static JSBool +eval(JSContext *cx, uintN argc, Value *vp) +{ + CallArgs call = CallArgsFromVp(argc, vp); + return WarnOnTooManyArgs(cx, call) && + EvalKernel(cx, call, INDIRECT_EVAL, NULL, *call.callee().getGlobal()); +} - assertSameCompartment(cx, scopeobj, script); +namespace js { - /* - * Belt-and-braces: check that the lesser of eval's principals and the - * caller's principals has access to scopeobj. - */ - JSBool ok = js_CheckPrincipalsAccess(cx, scopeobj, principals, - cx->runtime->atomState.evalAtom) && - Execute(cx, scopeobj, script, callerFrame, JSFRAME_EVAL, vp); +bool +DirectEval(JSContext *cx, const CallArgs &call) +{ + /* Direct eval can assume it was called from an interpreted frame. */ + JSStackFrame *caller = cx->fp(); + JS_ASSERT(caller->isScriptFrame()); + JS_ASSERT(IsBuiltinEvalForScope(&caller->scopeChain(), call.calleev())); + JS_ASSERT(*cx->regs->pc == JSOP_EVAL); - MUST_FLOW_LABEL(destroy); - js_CallDestroyScriptHook(cx, script); + AutoFunctionCallProbe callProbe(cx, call.callee().getFunctionPrivate(), caller->script()); - script->isCachedEval = true; - script->u.nextToGC = *bucket; - *bucket = script; -#ifdef CHECK_SCRIPT_OWNER - script->owner = NULL; -#endif + JSObject *scopeChain = + GetScopeChainFast(cx, caller, JSOP_EVAL, JSOP_EVAL_LENGTH + JSOP_LINENO_LENGTH); - return ok; + return scopeChain && + WarnOnTooManyArgs(cx, call) && + EvalKernel(cx, call, DIRECT_EVAL, caller, *scopeChain); } bool @@ -1319,8 +1335,45 @@ IsAnyBuiltinEval(JSFunction *fun) return fun->maybeNative() == eval; } +JSPrincipals * +PrincipalsForCompiledCode(const CallArgs &call, JSContext *cx) +{ + JS_ASSERT(IsAnyBuiltinEval(call.callee().getFunctionPrivate()) || + IsBuiltinFunctionConstructor(call.callee().getFunctionPrivate())); + + /* + * To compute the principals of the compiled eval/Function code, we simply + * use the callee's principals. To see why the caller's principals are + * ignored, consider first that, in the capability-model we assume, the + * high-privileged eval/Function should never have escaped to the + * low-privileged caller. (For the Mozilla embedding, this is brute-enforced + * by explicit filtering by wrappers.) Thus, the caller's privileges should + * subsume the callee's. + * + * In the converse situation, where the callee has lower privileges than the + * caller, we might initially guess that the caller would want to retain + * their higher privileges in the generated code. However, since the + * compiled code will be run with the callee's scope chain, this would make + * fp->script()->compartment() != fp->compartment(). + */ + + JSPrincipals *calleePrincipals = call.callee().compartment()->principals; + +#ifdef DEBUG + if (calleePrincipals) { + if (JSStackFrame *caller = js_GetScriptedCaller(cx, NULL)) { + if (JSPrincipals *callerPrincipals = caller->principals(cx)) { + JS_ASSERT(callerPrincipals->subsume(callerPrincipals, calleePrincipals)); + } + } + } +#endif + + return calleePrincipals; } +} /* namespace js */ + #if JS_HAS_OBJ_WATCHPOINT static JSBool @@ -1328,20 +1381,13 @@ obj_watch_handler(JSContext *cx, JSObject *obj, jsid id, jsval old, jsval *nvp, void *closure) { JSObject *callable = (JSObject *) closure; - JSSecurityCallbacks *callbacks = JS_GetSecurityCallbacks(cx); - if (callbacks && callbacks->findObjectPrincipals) { - /* Skip over any obj_watch_* frames between us and the real subject. */ + if (JSPrincipals *watcher = callable->principals(cx)) { if (JSStackFrame *caller = js_GetScriptedCaller(cx, NULL)) { - /* - * Only call the watch handler if the watcher is allowed to watch - * the currently executing script. - */ - JSPrincipals *watcher = callbacks->findObjectPrincipals(cx, callable); - JSPrincipals *subject = js_StackFramePrincipals(cx, caller); - - if (watcher && subject && !watcher->subsume(watcher, subject)) { - /* Silently don't call the watch handler. */ - return true; + if (JSPrincipals *subject = caller->principals(cx)) { + if (!watcher->subsume(watcher, subject)) { + /* Silently don't call the watch handler. */ + return JS_TRUE; + } } } } @@ -1590,20 +1636,21 @@ const char js_lookupSetter_str[] = "__lookupSetter__"; JS_FRIEND_API(JSBool) js_obj_defineGetter(JSContext *cx, uintN argc, Value *vp) { - if (!BoxThisForVp(cx, vp)) + CallArgs call = CallArgsFromVp(argc, vp); + if (!BoxNonStrictThis(cx, call)) return false; - JSObject *obj = &vp[1].toObject(); + JSObject *obj = &call.thisv().toObject(); - if (argc <= 1 || !js_IsCallable(vp[3])) { + if (argc <= 1 || !js_IsCallable(call[1])) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_GETTER_OR_SETTER, js_getter_str); return JS_FALSE; } - PropertyOp getter = CastAsPropertyOp(&vp[3].toObject()); + PropertyOp getter = CastAsPropertyOp(&call[1].toObject()); jsid id; - if (!ValueToId(cx, vp[2], &id)) + if (!ValueToId(cx, call[0], &id)) return JS_FALSE; if (!CheckRedeclaration(cx, obj, id, JSPROP_GETTER)) return JS_FALSE; @@ -1621,7 +1668,7 @@ js_obj_defineGetter(JSContext *cx, uintN argc, Value *vp) if (!cx->markTypePropertyConfigured(obj->getType(), id)) return false; - vp->setUndefined(); + call.rval().setUndefined(); return obj->defineProperty(cx, id, UndefinedValue(), getter, StrictPropertyStub, JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED); } @@ -1629,20 +1676,21 @@ js_obj_defineGetter(JSContext *cx, uintN argc, Value *vp) JS_FRIEND_API(JSBool) js_obj_defineSetter(JSContext *cx, uintN argc, Value *vp) { - if (!BoxThisForVp(cx, vp)) + CallArgs call = CallArgsFromVp(argc, vp); + if (!BoxNonStrictThis(cx, call)) return false; - JSObject *obj = &vp[1].toObject(); + JSObject *obj = &call.thisv().toObject(); - if (argc <= 1 || !js_IsCallable(vp[3])) { + if (argc <= 1 || !js_IsCallable(call[1])) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_GETTER_OR_SETTER, js_setter_str); return JS_FALSE; } - StrictPropertyOp setter = CastAsStrictPropertyOp(&vp[3].toObject()); + StrictPropertyOp setter = CastAsStrictPropertyOp(&call[1].toObject()); jsid id; - if (!ValueToId(cx, vp[2], &id)) + if (!ValueToId(cx, call[0], &id)) return JS_FALSE; if (!CheckRedeclaration(cx, obj, id, JSPROP_SETTER)) return JS_FALSE; @@ -1660,7 +1708,7 @@ js_obj_defineSetter(JSContext *cx, uintN argc, Value *vp) if (!cx->markTypePropertyConfigured(obj->getType(), id)) return false; - vp->setUndefined(); + call.rval().setUndefined(); return obj->defineProperty(cx, id, UndefinedValue(), PropertyStub, setter, JSPROP_ENUMERATE | JSPROP_SETTER | JSPROP_SHARED); } @@ -3027,6 +3075,9 @@ NewObjectWithClassProto(JSContext *cx, Class *clasp, JSObject *proto, if (!type) return NULL; + if (CanBeFinalizedInBackground(kind, clasp)) + kind = (gc::FinalizeKind)(kind + 1); + JSObject* obj = js_NewGCObject(cx, kind); if (!obj) return NULL; @@ -3213,7 +3264,7 @@ js_InferFlags(JSContext *cx, uintN defaultFlags) format = cs->format; if (JOF_MODE(format) != JOF_NAME) flags |= JSRESOLVE_QUALIFIED; - if ((format & (JOF_SET | JOF_FOR)) || fp->isAssigning()) { + if (format & (JOF_SET | JOF_FOR)) { flags |= JSRESOLVE_ASSIGNING; } else if (cs->length >= 0) { pc += cs->length; @@ -5521,7 +5572,7 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p return true; if (JS_UNLIKELY(shape->isMethod()) && (getHow & JSGET_NO_METHOD_BARRIER)) { - JS_ASSERT(&shape->methodObject() == &vp->toObject()); + JS_ASSERT(shape->methodObject() == vp->toObject()); return true; } @@ -5990,7 +6041,7 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow, JS_ASSERT_IF(shape && shape->isMethod(), pobj->hasMethodBarrier()); JS_ASSERT_IF(shape && shape->isMethod(), - &pobj->getSlot(shape->slot).toObject() == &shape->methodObject()); + pobj->getSlot(shape->slot).toObject() == shape->methodObject()); if (shape && (defineHow & JSDNP_SET_METHOD)) { /* * JSOP_SETMETHOD is assigning to an existing own property. If it @@ -5999,7 +6050,7 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow, * cache, as the interpreter has no fast path for these unusual * cases. */ - bool identical = shape->isMethod() && &shape->methodObject() == &vp->toObject(); + bool identical = shape->isMethod() && shape->methodObject() == vp->toObject(); if (!identical) { shape = obj->methodShapeChange(cx, *shape); if (!shape) @@ -6209,13 +6260,13 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool str if (fun != funobj) { for (JSStackFrame *fp = cx->maybefp(); fp; fp = fp->prev()) { if (fp->isFunctionFrame() && - &fp->callee() == &fun->compiledFunObj() && + fp->callee() == fun->compiledFunObj() && fp->thisValue().isObject()) { JSObject *tmp = &fp->thisValue().toObject(); do { if (tmp == obj) { - fp->calleeValue().setObject(*funobj); + fp->calleev().setObject(*funobj); break; } } while ((tmp = tmp->getProto()) != NULL); @@ -6812,23 +6863,37 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize) } #endif -void +static const Shape * +LastConfigurableShape(JSObject *obj) +{ + for (Shape::Range r(obj->lastProperty()->all()); !r.empty(); r.popFront()) { + const Shape *shape = &r.front(); + if (shape->configurable()) + return shape; + } + return NULL; +} + +bool js_ClearNative(JSContext *cx, JSObject *obj) { - /* - * Clear obj of all obj's properties. FIXME: we do not clear reserved slots - * lying below JSSLOT_FREE(clasp). JS_ClearScope does that. - */ - if (!obj->nativeEmpty()) { - /* Now that we're done using real properties, clear obj. */ - obj->clear(cx); - - /* Clear slot values since obj->clear reset our shape to empty. */ - uint32 freeslot = JSSLOT_FREE(obj->getClass()); - uint32 n = obj->numSlots(); - for (uint32 i = freeslot; i < n; ++i) - obj->setSlot(i, UndefinedValue()); + /* Remove all configurable properties from obj. */ + while (const Shape *shape = LastConfigurableShape(obj)) { + if (!obj->removeProperty(cx, shape->id)) + return false; } + + /* Set all remaining writable plain data properties to undefined. */ + for (Shape::Range r(obj->lastProperty()->all()); !r.empty(); r.popFront()) { + const Shape *shape = &r.front(); + if (shape->isDataDescriptor() && + shape->writable() && + shape->hasDefaultSetter() && + obj->containsSlot(shape->slot)) { + obj->setSlot(shape->slot, UndefinedValue()); + } + } + return true; } bool @@ -6872,6 +6937,7 @@ JSObject::getGlobal() const JSObject *obj = const_cast(this); while (JSObject *parent = obj->getParent()) obj = parent; + JS_ASSERT(obj->isGlobal()); return obj; } @@ -7264,8 +7330,6 @@ js_DumpStackFrame(JSContext *cx, JSStackFrame *start) fprintf(stderr, " constructing"); if (fp->hasOverriddenArgs()) fprintf(stderr, " overridden_args"); - if (fp->isAssigning()) - fprintf(stderr, " assigning"); if (fp->isDebuggerFrame()) fprintf(stderr, " debugger"); if (fp->isEvalFrame()) diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 5d97b22c768f..d345fce2a9c0 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -826,6 +826,9 @@ struct JSObject : js::gc::Cell { privateData = data; } + /* N.B. Infallible: NULL means 'no principal', not an error. */ + inline JSPrincipals *principals(JSContext *cx); + /* * ES5 meta-object properties and operations. */ @@ -1435,6 +1438,7 @@ struct JSObject : js::gc::Cell { inline bool isXMLId() const; inline bool isNamespace() const; inline bool isQName() const; + inline bool isWeakMap() const; inline bool isProxy() const; inline bool isObjectProxy() const; @@ -1449,6 +1453,17 @@ struct JSObject : js::gc::Cell { /* Check alignment for any fixed slots allocated after the object. */ JS_STATIC_ASSERT(sizeof(JSObject) % sizeof(js::Value) == 0); +/* + * The only sensible way to compare JSObject with == is by identity. We use + * const& instead of * as a syntactic way to assert non-null. This leads to an + * abundance of address-of operators to identity. Hence this overload. + */ +static JS_ALWAYS_INLINE bool +operator==(const JSObject &lhs, const JSObject &rhs) +{ + return &lhs == &rhs; +} + inline js::Value* JSObject::fixedSlots() const { return (js::Value*) (jsuword(this) + sizeof(JSObject)); @@ -2012,7 +2027,7 @@ js_XDRObject(JSXDRState *xdr, JSObject **objp); extern void js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize); -extern void +extern bool js_ClearNative(JSContext *cx, JSObject *obj); extern bool @@ -2021,19 +2036,10 @@ js_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, js::Value *vp); extern bool js_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, const js::Value &v); -extern JSBool -js_CheckPrincipalsAccess(JSContext *cx, JSObject *scopeobj, - JSPrincipals *principals, JSAtom *caller); - /* For CSP -- checks if eval() and friends are allowed to run. */ extern JSBool js_CheckContentSecurityPolicy(JSContext *cx, JSObject *scopeObj); -/* NB: Infallible. */ -extern const char * -js_ComputeFilename(JSContext *cx, JSStackFrame *caller, - JSPrincipals *principals, uintN *linenop); - extern JSBool js_ReportGetterOnlyAssignment(JSContext *cx); @@ -2066,21 +2072,13 @@ SetProto(JSContext *cx, JSObject *obj, JSObject *proto, bool checkForCycles); extern JSString * obj_toStringHelper(JSContext *cx, JSObject *obj); -enum EvalType { INDIRECT_EVAL, DIRECT_EVAL }; - /* - * Common code implementing direct and indirect eval. - * - * Evaluate vp[2], if it is a string, in the context of the given calling - * frame, with the provided scope chain, with the semantics of either a direct - * or indirect eval (see ES5 10.4.2). If this is an indirect eval, scopeobj - * must be a global object. - * - * On success, store the completion value in *vp and return true. + * Performs a direct eval for the given arguments, which must correspond to the + * currently-executing stack frame, which must be a script frame. On completion + * the result is returned in call.rval. */ -extern bool -EvalKernel(JSContext *cx, uintN argc, js::Value *vp, EvalType evalType, JSStackFrame *caller, - JSObject *scopeobj); +extern JS_REQUIRES_STACK bool +DirectEval(JSContext *cx, const CallArgs &call); /* * True iff |v| is the built-in eval function for the global object that @@ -2093,6 +2091,13 @@ IsBuiltinEvalForScope(JSObject *scopeChain, const js::Value &v); extern bool IsAnyBuiltinEval(JSFunction *fun); +/* 'call' should be for the eval/Function native invocation. */ +extern JSPrincipals * +PrincipalsForCompiledCode(const CallArgs &call, JSContext *cx); + +extern JSObject * +NonNullObject(JSContext *cx, const Value &v); + } #endif /* jsobj_h___ */ diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 6bccca2ae069..52dddc531319 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -53,6 +53,7 @@ #include "jsproxy.h" #include "jsscope.h" #include "jsstaticcheck.h" +#include "jstypedarray.h" #include "jsxml.h" /* Headers included for inline implementations used by this header. */ @@ -232,7 +233,7 @@ JSObject::methodReadBarrier(JSContext *cx, const js::Shape &shape, js::Value *vp JS_ASSERT(hasMethodBarrier()); JS_ASSERT(nativeContains(shape)); JS_ASSERT(shape.isMethod()); - JS_ASSERT(&shape.methodObject() == &vp->toObject()); + JS_ASSERT(shape.methodObject() == vp->toObject()); JS_ASSERT(shape.writable()); JS_ASSERT(shape.slot != SHAPE_INVALID_SLOT); JS_ASSERT(shape.hasDefaultSetter() || shape.setterOp() == js_watch_set); @@ -743,7 +744,7 @@ JSObject::hasMethodObj(const JSObject& obj) const { return JSSLOT_FUN_METHOD_OBJ < numSlots() && getFixedSlot(JSSLOT_FUN_METHOD_OBJ).isObject() && - &getFixedSlot(JSSLOT_FUN_METHOD_OBJ).toObject() == &obj; + getFixedSlot(JSSLOT_FUN_METHOD_OBJ).toObject() == obj; } inline void @@ -978,10 +979,6 @@ JSObject::init(JSContext *cx, js::Class *aclasp, js::types::TypeObject *type, inline void JSObject::finish(JSContext *cx) { -#ifdef DEBUG - if (isNative()) - JS_LOCK_RUNTIME_VOID(cx->runtime, cx->runtime->liveObjectProps -= propertyCount()); -#endif if (hasSlotsArray()) cx->free_(slots); } @@ -1024,6 +1021,35 @@ JSObject::isCallable() return isFunction() || getClass()->call; } +inline JSPrincipals * +JSObject::principals(JSContext *cx) +{ + JSPrincipals *compPrincipals = compartment()->principals; +#ifdef DEBUG + if (!compPrincipals) + return NULL; + + /* + * Assert that the compartment's principals are either the same or + * equivalent to those we would find through security hooks. + */ + JSSecurityCallbacks *cb = JS_GetSecurityCallbacks(cx); + if (JSObjectPrincipalsFinder finder = cb ? cb->findObjectPrincipals : NULL) { + JSPrincipals *hookPrincipals = finder(cx, this); + JS_ASSERT(hookPrincipals == compPrincipals || + (hookPrincipals->subsume(hookPrincipals, compPrincipals) && + compPrincipals->subsume(compPrincipals, hookPrincipals))); + } +#endif + return compPrincipals; +} + +inline JSPrincipals * +JSStackFrame::principals(JSContext *cx) const +{ + return scopeChain().principals(cx); +} + static inline bool js_IsCallable(const js::Value &v) { @@ -1129,6 +1155,22 @@ InitScopeForObject(JSContext* cx, JSObject* obj, js::Class *clasp, js::types::Ty return false; } +static inline bool +CanBeFinalizedInBackground(gc::FinalizeKind kind, Class *clasp) +{ + JS_ASSERT(kind <= gc::FINALIZE_OBJECT_LAST); + /* If the class has no finalizer or a finalizer that is safe to call on + * a different thread, we change the finalize kind. For example, + * FINALIZE_OBJECT0 calls the finalizer on the main thread, + * FINALIZE_OBJECT0_BACKGROUND calls the finalizer on the gcHelperThread. + * kind % 2 prevents from recursivly incrementing the finalize kind because + * we can call NewObject with a background finalize kind. + */ + if (kind % 2 == 0 && (!clasp->finalize || clasp->flags & JSCLASS_CONCURRENT_FINALIZER)) + return true; + return false; +} + /* * Helper optimized for creating a native instance of the given class (not the * class's prototype object). Use this in preference to NewObject, but use @@ -1141,6 +1183,7 @@ NewNativeClassInstance(JSContext *cx, Class *clasp, JSObject *proto, { JS_ASSERT(proto); JS_ASSERT(parent); + JS_ASSERT(kind <= gc::FINALIZE_OBJECT_LAST); types::TypeObject *type = proto->getNewType(cx); if (!type) @@ -1150,6 +1193,10 @@ NewNativeClassInstance(JSContext *cx, Class *clasp, JSObject *proto, * Allocate an object from the GC heap and initialize all its fields before * doing any operation that can potentially trigger GC. */ + + if (CanBeFinalizedInBackground(kind, clasp)) + kind = (gc::FinalizeKind)(kind + 1); + JSObject* obj = js_NewGCObject(cx, kind); if (obj) { @@ -1309,6 +1356,10 @@ NewObject(JSContext *cx, js::Class *clasp, JSObject *proto, JSObject *parent, * * The should be specialized by the template. */ + + if (!isFunction && CanBeFinalizedInBackground(kind, clasp)) + kind = (gc::FinalizeKind)(kind + 1); + JSObject* obj = isFunction ? js_NewGCFunction(cx) : js_NewGCObject(cx, kind); if (!obj) goto out; diff --git a/js/src/json.cpp b/js/src/json.cpp index 972752c3a347..7a06ede9b8de 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -343,7 +343,7 @@ PreprocessValue(JSContext *cx, JSObject *holder, jsid key, Value *vp, StringifyC if (!cx->stack().pushInvokeArgs(cx, 1, &args)) return false; - args.callee() = toJSON; + args.calleev() = toJSON; args.thisv() = *vp; args[0] = StringValue(keyStr); @@ -366,7 +366,7 @@ PreprocessValue(JSContext *cx, JSObject *holder, jsid key, Value *vp, StringifyC if (!cx->stack().pushInvokeArgs(cx, 2, &args)) return false; - args.callee() = ObjectValue(*scx->replacer); + args.calleev() = ObjectValue(*scx->replacer); args.thisv() = ObjectValue(*holder); args[0] = StringValue(keyStr); args[1] = *vp; diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index 52948d6a6ff0..49c6d7214e65 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -3402,7 +3402,7 @@ Parser::functionDef(JSAtom *funAtom, FunctionType type, uintN lambda) if (!outertc->inFunction() && bodyLevel && funAtom && !lambda && outertc->compiling()) { JS_ASSERT(pn->pn_cookie.isFree()); if (!DefineGlobal(pn, outertc->asCodeGenerator(), funAtom)) - return false; + return NULL; } pn->pn_blockid = outertc->blockid(); @@ -4261,146 +4261,6 @@ BindDestructuringLHS(JSContext *cx, JSParseNode *pn, JSTreeContext *tc) return JS_TRUE; } -typedef struct FindPropValData { - uint32 numvars; /* # of destructuring vars in left side */ - uint32 maxstep; /* max # of steps searching right side */ - JSDHashTable table; /* hash table for O(1) right side search */ -} FindPropValData; - -typedef struct FindPropValEntry { - JSDHashEntryHdr hdr; - JSParseNode *pnkey; - JSParseNode *pnval; -} FindPropValEntry; - -#define ASSERT_VALID_PROPERTY_KEY(pnkey) \ - JS_ASSERT(((pnkey)->pn_arity == PN_NULLARY && \ - ((pnkey)->pn_type == TOK_NUMBER || \ - (pnkey)->pn_type == TOK_STRING || \ - (pnkey)->pn_type == TOK_NAME)) || \ - ((pnkey)->pn_arity == PN_NAME && (pnkey)->pn_type == TOK_NAME)) - -static JSDHashNumber -HashFindPropValKey(JSDHashTable *table, const void *key) -{ - const JSParseNode *pnkey = (const JSParseNode *)key; - - ASSERT_VALID_PROPERTY_KEY(pnkey); - return (pnkey->pn_type == TOK_NUMBER) - ? (JSDHashNumber) JS_HASH_DOUBLE(pnkey->pn_dval) - : ATOM_HASH(pnkey->pn_atom); -} - -static JSBool -MatchFindPropValEntry(JSDHashTable *table, - const JSDHashEntryHdr *entry, - const void *key) -{ - const FindPropValEntry *fpve = (const FindPropValEntry *)entry; - const JSParseNode *pnkey = (const JSParseNode *)key; - - ASSERT_VALID_PROPERTY_KEY(pnkey); - return pnkey->pn_type == fpve->pnkey->pn_type && - ((pnkey->pn_type == TOK_NUMBER) - ? pnkey->pn_dval == fpve->pnkey->pn_dval - : pnkey->pn_atom == fpve->pnkey->pn_atom); -} - -static const JSDHashTableOps FindPropValOps = { - JS_DHashAllocTable, - JS_DHashFreeTable, - HashFindPropValKey, - MatchFindPropValEntry, - JS_DHashMoveEntryStub, - JS_DHashClearEntryStub, - JS_DHashFinalizeStub, - NULL -}; - -#define STEP_HASH_THRESHOLD 10 -#define BIG_DESTRUCTURING 5 -#define BIG_OBJECT_INIT 20 - -static JSParseNode * -FindPropertyValue(JSParseNode *pn, JSParseNode *pnid, FindPropValData *data) -{ - FindPropValEntry *entry; - JSParseNode *pnhit, *pnhead, *pnprop, *pnkey; - uint32 step; - - /* If we have a hash table, use it as the sole source of truth. */ - if (data->table.ops) { - entry = (FindPropValEntry *) - JS_DHashTableOperate(&data->table, pnid, JS_DHASH_LOOKUP); - return JS_DHASH_ENTRY_IS_BUSY(&entry->hdr) ? entry->pnval : NULL; - } - - /* If pn is not an object initialiser node, we can't do anything here. */ - if (pn->pn_type != TOK_RC) - return NULL; - - /* - * We must search all the way through pn's list, to handle the case of an - * id duplicated for two or more property initialisers. - */ - pnhit = NULL; - step = 0; - ASSERT_VALID_PROPERTY_KEY(pnid); - pnhead = pn->pn_head; - if (pnid->pn_type == TOK_NUMBER) { - for (pnprop = pnhead; pnprop; pnprop = pnprop->pn_next) { - JS_ASSERT(pnprop->pn_type == TOK_COLON); - if (pnprop->pn_op == JSOP_NOP) { - pnkey = pnprop->pn_left; - ASSERT_VALID_PROPERTY_KEY(pnkey); - if (pnkey->pn_type == TOK_NUMBER && - pnkey->pn_dval == pnid->pn_dval) { - pnhit = pnprop; - } - ++step; - } - } - } else { - for (pnprop = pnhead; pnprop; pnprop = pnprop->pn_next) { - JS_ASSERT(pnprop->pn_type == TOK_COLON); - if (pnprop->pn_op == JSOP_NOP) { - pnkey = pnprop->pn_left; - ASSERT_VALID_PROPERTY_KEY(pnkey); - if (pnkey->pn_type == pnid->pn_type && - pnkey->pn_atom == pnid->pn_atom) { - pnhit = pnprop; - } - ++step; - } - } - } - if (!pnhit) - return NULL; - - /* Hit via full search -- see whether it's time to create the hash table. */ - JS_ASSERT(!data->table.ops); - if (step > data->maxstep) { - data->maxstep = step; - if (step >= STEP_HASH_THRESHOLD && - data->numvars >= BIG_DESTRUCTURING && - pn->pn_count >= BIG_OBJECT_INIT && - JS_DHashTableInit(&data->table, &FindPropValOps, pn, - sizeof(FindPropValEntry), - JS_DHASH_DEFAULT_CAPACITY(pn->pn_count))) - { - for (pn = pnhead; pn; pn = pn->pn_next) { - JS_ASSERT(pnprop->pn_type == TOK_COLON); - ASSERT_VALID_PROPERTY_KEY(pn->pn_left); - entry = (FindPropValEntry *) - JS_DHashTableOperate(&data->table, pn->pn_left, - JS_DHASH_ADD); - entry->pnval = pn->pn_right; - } - } - } - return pnhit->pn_right; -} - /* * Destructuring patterns can appear in two kinds of contexts: * @@ -4424,7 +4284,7 @@ FindPropertyValue(JSParseNode *pn, JSParseNode *pnid, FindPropValData *data) * into the appropriate use chains; creates placeholder definitions; * and so on. CheckDestructuring is called with |data| NULL (since we * won't be binding any new names), and we specialize lvalues as - * appropriate. If right is NULL, we just check for well-formed lvalues. + * appropriate. * * In declaration-like contexts, the normal variable reference * processing would just be an obstruction, because we're going to @@ -4441,87 +4301,59 @@ FindPropertyValue(JSParseNode *pn, JSParseNode *pnid, FindPropValData *data) * either of these functions, you might have to change the other to * match. */ -static JSBool -CheckDestructuring(JSContext *cx, BindData *data, - JSParseNode *left, JSParseNode *right, - JSTreeContext *tc) +static bool +CheckDestructuring(JSContext *cx, BindData *data, JSParseNode *left, JSTreeContext *tc) { - JSBool ok; - FindPropValData fpvd; - JSParseNode *lhs, *rhs, *pn, *pn2; + bool ok; if (left->pn_type == TOK_ARRAYCOMP) { ReportCompileErrorNumber(cx, TS(tc->parser), left, JSREPORT_ERROR, JSMSG_ARRAY_COMP_LEFTSIDE); - return JS_FALSE; + return false; } -#if JS_HAS_DESTRUCTURING_SHORTHAND - if (right && right->pn_arity == PN_LIST && (right->pn_xflags & PNX_DESTRUCT)) { - ReportCompileErrorNumber(cx, TS(tc->parser), right, JSREPORT_ERROR, - JSMSG_BAD_OBJECT_INIT); - return JS_FALSE; - } -#endif - - fpvd.table.ops = NULL; - lhs = left->pn_head; if (left->pn_type == TOK_RB) { - rhs = (right && right->pn_type == left->pn_type) - ? right->pn_head - : NULL; - - while (lhs) { - pn = lhs, pn2 = rhs; - + for (JSParseNode *pn = left->pn_head; pn; pn = pn->pn_next) { /* Nullary comma is an elision; binary comma is an expression.*/ if (pn->pn_type != TOK_COMMA || pn->pn_arity != PN_NULLARY) { if (pn->pn_type == TOK_RB || pn->pn_type == TOK_RC) { - ok = CheckDestructuring(cx, data, pn, pn2, tc); + ok = CheckDestructuring(cx, data, pn, tc); } else { if (data) { - if (pn->pn_type != TOK_NAME) - goto no_var_name; - + if (pn->pn_type != TOK_NAME) { + ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR, + JSMSG_NO_VARIABLE_NAME); + return false; + } ok = BindDestructuringVar(cx, data, pn, tc); } else { ok = BindDestructuringLHS(cx, pn, tc); } } if (!ok) - goto out; + return false; } - - lhs = lhs->pn_next; - if (rhs) - rhs = rhs->pn_next; } } else { JS_ASSERT(left->pn_type == TOK_RC); - fpvd.numvars = left->pn_count; - fpvd.maxstep = 0; - rhs = NULL; - - while (lhs) { - JS_ASSERT(lhs->pn_type == TOK_COLON); - pn = lhs->pn_right; + for (JSParseNode *pair = left->pn_head; pair; pair = pair->pn_next) { + JS_ASSERT(pair->pn_type == TOK_COLON); + JSParseNode *pn = pair->pn_right; if (pn->pn_type == TOK_RB || pn->pn_type == TOK_RC) { - if (right) - rhs = FindPropertyValue(right, lhs->pn_left, &fpvd); - ok = CheckDestructuring(cx, data, pn, rhs, tc); + ok = CheckDestructuring(cx, data, pn, tc); } else if (data) { - if (pn->pn_type != TOK_NAME) - goto no_var_name; - + if (pn->pn_type != TOK_NAME) { + ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR, + JSMSG_NO_VARIABLE_NAME); + return false; + } ok = BindDestructuringVar(cx, data, pn, tc); } else { ok = BindDestructuringLHS(cx, pn, tc); } if (!ok) - goto out; - - lhs = lhs->pn_next; + return false; } } @@ -4545,38 +4377,26 @@ CheckDestructuring(JSContext *cx, BindData *data, */ if (data && data->binder == BindLet && - OBJ_BLOCK_COUNT(cx, tc->blockChain()) == 0) { - ok = !!js_DefineNativeProperty(cx, tc->blockChain(), - ATOM_TO_JSID(cx->runtime->atomState.emptyAtom), - UndefinedValue(), NULL, NULL, - JSPROP_ENUMERATE | JSPROP_PERMANENT, - Shape::HAS_SHORTID, 0, NULL); - if (!ok) - goto out; + OBJ_BLOCK_COUNT(cx, tc->blockChain()) == 0 && + !js_DefineNativeProperty(cx, tc->blockChain(), + ATOM_TO_JSID(cx->runtime->atomState.emptyAtom), + UndefinedValue(), NULL, NULL, + JSPROP_ENUMERATE | JSPROP_PERMANENT, + Shape::HAS_SHORTID, 0, NULL)) { + return false; } - ok = JS_TRUE; - - out: - if (fpvd.table.ops) - JS_DHashTableFinish(&fpvd.table); - return ok; - - no_var_name: - ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR, - JSMSG_NO_VARIABLE_NAME); - ok = JS_FALSE; - goto out; + return true; } /* - * This is a greatly pared down version of CheckDestructuring that extends the - * pn_pos.end source coordinate of each name in a destructuring binding such as + * Extend the pn_pos.end source coordinate of each name in a destructuring + * binding such as * * var [x, y] = [function () y, 42]; * - * to cover its corresponding initializer, so that the initialized binding does - * not appear to dominate any closures in its initializer. See bug 496134. + * to cover the entire initializer, so that the initialized bindings do not + * appear to dominate any closures in the initializer. See bug 496134. * * The quick-and-dirty dominance computation in Parser::setFunctionKinds is not * very precise. With one-pass SSA construction from structured source code @@ -4586,67 +4406,31 @@ CheckDestructuring(JSContext *cx, BindData *data, * See CheckDestructuring, immediately above. If you change either of these * functions, you might have to change the other to match. */ -static JSBool -UndominateInitializers(JSParseNode *left, JSParseNode *right, JSTreeContext *tc) +static void +UndominateInitializers(JSParseNode *left, const TokenPtr &end, JSTreeContext *tc) { - FindPropValData fpvd; - JSParseNode *lhs, *rhs; - - JS_ASSERT(left->pn_type != TOK_ARRAYCOMP); - JS_ASSERT(right); - -#if JS_HAS_DESTRUCTURING_SHORTHAND - if (right->pn_arity == PN_LIST && (right->pn_xflags & PNX_DESTRUCT)) { - ReportCompileErrorNumber(tc->parser->context, TS(tc->parser), right, JSREPORT_ERROR, - JSMSG_BAD_OBJECT_INIT); - return JS_FALSE; - } -#endif - - if (right->pn_type != left->pn_type) - return JS_TRUE; - - fpvd.table.ops = NULL; - lhs = left->pn_head; if (left->pn_type == TOK_RB) { - rhs = right->pn_head; - - while (lhs && rhs) { + for (JSParseNode *pn = left->pn_head; pn; pn = pn->pn_next) { /* Nullary comma is an elision; binary comma is an expression.*/ - if (lhs->pn_type != TOK_COMMA || lhs->pn_arity != PN_NULLARY) { - if (lhs->pn_type == TOK_RB || lhs->pn_type == TOK_RC) { - if (!UndominateInitializers(lhs, rhs, tc)) - return JS_FALSE; - } else { - lhs->pn_pos.end = rhs->pn_pos.end; - } + if (pn->pn_type != TOK_COMMA || pn->pn_arity != PN_NULLARY) { + if (pn->pn_type == TOK_RB || pn->pn_type == TOK_RC) + UndominateInitializers(pn, end, tc); + else + pn->pn_pos.end = end; } - - lhs = lhs->pn_next; - rhs = rhs->pn_next; } } else { JS_ASSERT(left->pn_type == TOK_RC); - fpvd.numvars = left->pn_count; - fpvd.maxstep = 0; - while (lhs) { - JS_ASSERT(lhs->pn_type == TOK_COLON); - JSParseNode *pn = lhs->pn_right; - - rhs = FindPropertyValue(right, lhs->pn_left, &fpvd); - if (pn->pn_type == TOK_RB || pn->pn_type == TOK_RC) { - if (rhs && !UndominateInitializers(pn, rhs, tc)) - return JS_FALSE; - } else { - if (rhs) - pn->pn_pos.end = rhs->pn_pos.end; - } - - lhs = lhs->pn_next; + for (JSParseNode *pair = left->pn_head; pair; pair = pair->pn_next) { + JS_ASSERT(pair->pn_type == TOK_COLON); + JSParseNode *pn = pair->pn_right; + if (pn->pn_type == TOK_RB || pn->pn_type == TOK_RC) + UndominateInitializers(pn, end, tc); + else + pn->pn_pos.end = end; } } - return JS_TRUE; } JSParseNode * @@ -4659,7 +4443,7 @@ Parser::destructuringExpr(BindData *data, TokenKind tt) tc->flags &= ~TCF_DECL_DESTRUCTURING; if (!pn) return NULL; - if (!CheckDestructuring(context, data, pn, NULL, tc)) + if (!CheckDestructuring(context, data, pn, tc)) return NULL; return pn; } @@ -5056,77 +4840,6 @@ NewBindingNode(JSAtom *atom, JSTreeContext *tc, bool let = false) return pn; } -#if JS_HAS_BLOCK_SCOPE -static bool -RebindLets(JSParseNode *pn, JSTreeContext *tc) -{ - if (!pn) - return true; - - switch (pn->pn_arity) { - case PN_LIST: - for (JSParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) - RebindLets(pn2, tc); - break; - - case PN_TERNARY: - RebindLets(pn->pn_kid1, tc); - RebindLets(pn->pn_kid2, tc); - RebindLets(pn->pn_kid3, tc); - break; - - case PN_BINARY: - RebindLets(pn->pn_left, tc); - RebindLets(pn->pn_right, tc); - break; - - case PN_UNARY: - RebindLets(pn->pn_kid, tc); - break; - - case PN_FUNC: - RebindLets(pn->pn_body, tc); - break; - - case PN_NAME: - RebindLets(pn->maybeExpr(), tc); - - if (pn->pn_defn) { - JS_ASSERT(pn->pn_blockid > tc->topStmt->blockid); - } else if (pn->pn_used) { - if (pn->pn_lexdef->pn_blockid == tc->topStmt->blockid) { - ForgetUse(pn); - - JSAtomListElement *ale = tc->decls.lookup(pn->pn_atom); - if (ale) { - while ((ale = ALE_NEXT(ale)) != NULL) { - if (ALE_ATOM(ale) == pn->pn_atom) { - LinkUseToDef(pn, ALE_DEFN(ale), tc); - return true; - } - } - } - - ale = tc->lexdeps.lookup(pn->pn_atom); - if (!ale) { - ale = MakePlaceholder(pn, tc); - if (!ale) - return NULL; - } - LinkUseToDef(pn, ALE_DEFN(ale), tc); - } - } - break; - - case PN_NAMESET: - RebindLets(pn->pn_tree, tc); - break; - } - - return true; -} -#endif /* JS_HAS_BLOCK_SCOPE */ - JSParseNode * Parser::switchStatement() { @@ -5461,7 +5174,7 @@ Parser::forStatement() case TOK_RB: case TOK_RC: /* Check for valid lvalues in var-less destructuring for-in. */ - if (pn1 == pn2 && !CheckDestructuring(context, NULL, pn2, NULL, tc)) + if (pn1 == pn2 && !CheckDestructuring(context, NULL, pn2, tc)) return NULL; if (versionNumber() == JSVERSION_1_7) { @@ -6395,7 +6108,7 @@ Parser::variables(bool inLetHead) if (!pn2) return NULL; - if (!CheckDestructuring(context, &data, pn2, NULL, tc)) + if (!CheckDestructuring(context, &data, pn2, tc)) return NULL; if ((tc->flags & TCF_IN_FOR_INIT) && tokenStream.peekToken() == TOK_IN) { @@ -6421,8 +6134,9 @@ Parser::variables(bool inLetHead) } #endif - if (!init || !UndominateInitializers(pn2, init, tc)) + if (!init) return NULL; + UndominateInitializers(pn2, init->pn_pos.end, tc); pn2 = JSParseNode::newBinaryOrAppend(TOK_ASSIGN, JSOP_NOP, pn2, init, tc); if (!pn2) @@ -6761,7 +6475,7 @@ Parser::assignExpr() return NULL; } JSParseNode *rhs = assignExpr(); - if (!rhs || !CheckDestructuring(context, NULL, pn, rhs, tc)) + if (!rhs || !CheckDestructuring(context, NULL, pn, tc)) return NULL; return JSParseNode::newBinaryOrAppend(TOK_ASSIGN, op, pn, rhs, tc); } @@ -7348,7 +7062,7 @@ Parser::comprehensionTail(JSParseNode *kid, uintN blockid, #if JS_HAS_DESTRUCTURING case TOK_LB: case TOK_LC: - if (!CheckDestructuring(context, &data, pn3, NULL, tc)) + if (!CheckDestructuring(context, &data, pn3, tc)) return NULL; if (versionNumber() == JSVERSION_1_7) { diff --git a/js/src/jsparse.h b/js/src/jsparse.h index 3ec835744006..f41b6764eebb 100644 --- a/js/src/jsparse.h +++ b/js/src/jsparse.h @@ -305,7 +305,7 @@ namespace js { struct GlobalScope { GlobalScope(JSContext *cx, JSObject *globalObj, JSCodeGenerator *cg) - : globalObj(globalObj), cg(cg), defs(ContextAllocPolicy(cx)) + : globalObj(globalObj), cg(cg), defs(cx) { } struct GlobalDef { @@ -334,7 +334,7 @@ struct GlobalScope { * A definition may either specify an existing global property, or a new * one that must be added after compilation succeeds. */ - Vector defs; + Vector defs; JSAtomList names; }; diff --git a/js/src/jspropertycache.cpp b/js/src/jspropertycache.cpp index 82ee232e9983..d69568c0d6f8 100644 --- a/js/src/jspropertycache.cpp +++ b/js/src/jspropertycache.cpp @@ -155,7 +155,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI */ JS_ASSERT(pobj->hasMethodBarrier()); JSObject &funobj = shape->methodObject(); - JS_ASSERT(&funobj == &pobj->nativeGetSlot(shape->slot).toObject()); + JS_ASSERT(funobj == pobj->nativeGetSlot(shape->slot).toObject()); vword.setFunObj(funobj); break; } diff --git a/js/src/jspropertytree.cpp b/js/src/jspropertytree.cpp index cef88daa3b55..79820b8447e0 100644 --- a/js/src/jspropertytree.cpp +++ b/js/src/jspropertytree.cpp @@ -375,7 +375,6 @@ js::PropertyTree::dumpShapeStats() meter(&bs, r.front()); } - double props = rt->liveObjectPropsPreSweep; double nodes = compartment->livePropTreeNodes; double dicts = compartment->liveDictModeNodes; @@ -387,8 +386,8 @@ js::PropertyTree::dumpShapeStats() double mean = JS_MeanAndStdDevBS(&bs, &sigma); fprintf(logfp, - "props %g nodes %g (dicts %g) beta %g meankids %g sigma %g max %u\n", - props, nodes, dicts, nodes / props, mean, sigma, bs.max); + "nodes %g (dicts %g) meankids %g sigma %g max %u\n", + nodes, dicts, mean, sigma, bs.max); JS_DumpHistogram(&bs, logfp); diff --git a/js/src/jsproto.tbl b/js/src/jsproto.tbl index de7d0273aa03..55b655a77f73 100644 --- a/js/src/jsproto.tbl +++ b/js/src/jsproto.tbl @@ -100,6 +100,7 @@ JS_PROTO(Float64Array, 35, js_InitTypedArrayClasses) JS_PROTO(Uint8ClampedArray, 36, js_InitTypedArrayClasses) JS_PROTO(Proxy, 37, js_InitProxyClass) JS_PROTO(AnyName, 38, js_InitNullClass) +JS_PROTO(WeakMap, 39, js_InitWeakMapClass) #undef XML_INIT #undef NAMESPACE_INIT diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 4e59462fb55d..cb7df3f59b73 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -955,7 +955,7 @@ proxy_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool { // TODO: throwing away strict bool deleted; - if (!JSProxy::delete_(cx, obj, id, &deleted)) + if (!JSProxy::delete_(cx, obj, id, &deleted) || !js_SuppressDeletedProperty(cx, obj, id)) return false; rval->setBoolean(deleted); return true; @@ -1168,16 +1168,6 @@ NewProxyObject(JSContext *cx, JSProxyHandler *handler, const Value &priv, JSObje return obj; } -static JSObject * -NonNullObject(JSContext *cx, const Value &v) -{ - if (v.isPrimitive()) { - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT); - return NULL; - } - return &v.toObject(); -} - static JSBool proxy_create(JSContext *cx, uintN argc, Value *vp) { diff --git a/js/src/jsprvtd.h b/js/src/jsprvtd.h index 342d46651542..6516470f2eaf 100644 --- a/js/src/jsprvtd.h +++ b/js/src/jsprvtd.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 diff --git a/js/src/jsscan.cpp b/js/src/jsscan.cpp index e577b35cb87a..95f54a3ceed9 100644 --- a/js/src/jsscan.cpp +++ b/js/src/jsscan.cpp @@ -197,33 +197,33 @@ TokenStream::init(const jschar *base, size_t length, const char *fn, uintN ln, J * initialize them for each TokenStream is trivial. See bug 639420. */ memset(oneCharTokens, 0, sizeof(oneCharTokens)); - oneCharTokens[';'] = TOK_SEMI; - oneCharTokens[','] = TOK_COMMA; - oneCharTokens['?'] = TOK_HOOK; - oneCharTokens['['] = TOK_LB; - oneCharTokens[']'] = TOK_RB; - oneCharTokens['{'] = TOK_LC; - oneCharTokens['}'] = TOK_RC; - oneCharTokens['('] = TOK_LP; - oneCharTokens[')'] = TOK_RP; + oneCharTokens[unsigned(';')] = TOK_SEMI; + oneCharTokens[unsigned(',')] = TOK_COMMA; + oneCharTokens[unsigned('?')] = TOK_HOOK; + oneCharTokens[unsigned('[')] = TOK_LB; + oneCharTokens[unsigned(']')] = TOK_RB; + oneCharTokens[unsigned('{')] = TOK_LC; + oneCharTokens[unsigned('}')] = TOK_RC; + oneCharTokens[unsigned('(')] = TOK_LP; + oneCharTokens[unsigned(')')] = TOK_RP; /* See getChar() for an explanation of maybeEOL[]. */ memset(maybeEOL, 0, sizeof(maybeEOL)); - maybeEOL['\n'] = true; - maybeEOL['\r'] = true; - maybeEOL[LINE_SEPARATOR & 0xff] = true; - maybeEOL[PARA_SEPARATOR & 0xff] = true; + maybeEOL[unsigned('\n')] = true; + maybeEOL[unsigned('\r')] = true; + maybeEOL[unsigned(LINE_SEPARATOR & 0xff)] = true; + maybeEOL[unsigned(PARA_SEPARATOR & 0xff)] = true; /* See getTokenInternal() for an explanation of maybeStrSpecial[]. */ memset(maybeStrSpecial, 0, sizeof(maybeStrSpecial)); - maybeStrSpecial['"'] = true; - maybeStrSpecial['\''] = true; - maybeStrSpecial['\\'] = true; - maybeStrSpecial['\n'] = true; - maybeStrSpecial['\r'] = true; - maybeStrSpecial[LINE_SEPARATOR & 0xff] = true; - maybeStrSpecial[PARA_SEPARATOR & 0xff] = true; - maybeStrSpecial[EOF & 0xff] = true; + maybeStrSpecial[unsigned('"')] = true; + maybeStrSpecial[unsigned('\'')] = true; + maybeStrSpecial[unsigned('\\')] = true; + maybeStrSpecial[unsigned('\n')] = true; + maybeStrSpecial[unsigned('\r')] = true; + maybeStrSpecial[unsigned(LINE_SEPARATOR & 0xff)] = true; + maybeStrSpecial[unsigned(PARA_SEPARATOR & 0xff)] = true; + maybeStrSpecial[unsigned(EOF & 0xff)] = true; return true; } diff --git a/js/src/jsscope.cpp b/js/src/jsscope.cpp index 081ff23a1542..029f43b5e7f2 100644 --- a/js/src/jsscope.cpp +++ b/js/src/jsscope.cpp @@ -763,9 +763,7 @@ JSObject::addPropertyInternal(JSContext *cx, jsid id, shape->parent->setTable(NULL); shape->setTable(table); } -#ifdef DEBUG - LIVE_SCOPE_METER(cx, ++cx->runtime->liveObjectProps); -#endif + CHECK_SHAPE_CONSISTENCY(this); METER(adds); return shape; @@ -1219,7 +1217,6 @@ JSObject::removeProperty(JSContext *cx, jsid id) } CHECK_SHAPE_CONSISTENCY(this); - LIVE_SCOPE_METER(cx, --cx->runtime->liveObjectProps); METER(removes); return true; } @@ -1227,8 +1224,6 @@ JSObject::removeProperty(JSContext *cx, jsid id) void JSObject::clear(JSContext *cx) { - LIVE_SCOPE_METER(cx, cx->runtime->liveObjectProps -= propertyCount()); - Shape *shape = lastProp; JS_ASSERT(inDictionaryMode() == shape->inDictionary()); @@ -1288,7 +1283,7 @@ JSObject::methodShapeChange(JSContext *cx, const Shape &shape) if (shape.isMethod()) { #ifdef DEBUG const Value &prev = nativeGetSlot(shape.slot); - JS_ASSERT(&shape.methodObject() == &prev.toObject()); + JS_ASSERT(shape.methodObject() == prev.toObject()); JS_ASSERT(canHaveMethodBarrier()); JS_ASSERT(hasMethodBarrier()); JS_ASSERT(!shape.rawSetter || shape.rawSetter == js_watch_set); diff --git a/js/src/jsscopeinlines.h b/js/src/jsscopeinlines.h index 35713af455d6..f707abff0349 100644 --- a/js/src/jsscopeinlines.h +++ b/js/src/jsscopeinlines.h @@ -155,7 +155,7 @@ JSObject::initString(JSContext *cx, JSString *str) JSObject::JSSLOT_STRING_LENGTH); setPrimitiveThis(js::StringValue(str)); - JS_ASSERT(str->length() < JSString::MAX_LENGTH); + JS_ASSERT(str->length() <= JSString::MAX_LENGTH); setSlot(JSSLOT_STRING_LENGTH, js::Int32Value(int32(str->length()))); return true; } diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 8e13dade38c2..02f60153b193 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1852,6 +1852,22 @@ js_GetScriptLineExtent(JSScript *script) return 1 + lineno - script->lineno; } +const char * +js::CurrentScriptFileAndLineSlow(JSContext *cx, uintN *linenop) +{ + if (!cx->hasfp()) { + *linenop = 0; + return NULL; + } + + JSStackFrame *fp = cx->fp(); + while (fp->isDummyFrame()) + fp = fp->prev(); + + *linenop = js_FramePCToLineNumber(cx, fp); + return fp->script()->filename; +} + class DisablePrincipalsTranscoding { JSSecurityCallbacks *callbacks; JSPrincipalsTranscoder temp; diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 45a520b57a9a..03cc4f199919 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -845,6 +845,27 @@ js_LineNumberToPC(JSScript *script, uintN lineno); extern JS_FRIEND_API(uintN) js_GetScriptLineExtent(JSScript *script); +namespace js { + +/* + * This function returns the file and line number of the script currently + * executing on cx. If there is no current script executing on cx (e.g., a + * native called directly through JSAPI (e.g., by setTimeout)), NULL and 0 are + * returned as the file and line. Additionally, this function avoids the full + * linear scan to compute line number when the caller guarnatees that the + * script compilation occurs at a JSOP_EVAL. + */ + +enum LineOption { + CALLED_FROM_JSOP_EVAL, + NOT_CALLED_FROM_JSOP_EVAL +}; + +inline const char * +CurrentScriptFileAndLine(JSContext *cx, uintN *linenop, LineOption = NOT_CALLED_FROM_JSOP_EVAL); + +} + static JS_INLINE JSOp js_GetOpcode(JSContext *cx, JSScript *script, jsbytecode *pc) { diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 5d18b8168e58..b1b548c0e2ec 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -41,6 +41,7 @@ #ifndef jsscriptinlines_h___ #define jsscriptinlines_h___ +#include "jsautooplen.h" #include "jscntxt.h" #include "jsfun.h" #include "jsopcode.h" @@ -109,6 +110,22 @@ Bindings::ensureShape(JSContext *cx) return true; } +extern const char * +CurrentScriptFileAndLineSlow(JSContext *cx, uintN *linenop); + +inline const char * +CurrentScriptFileAndLine(JSContext *cx, uintN *linenop, LineOption opt) +{ + if (opt == CALLED_FROM_JSOP_EVAL) { + JS_ASSERT(*cx->regs->pc == JSOP_EVAL); + JS_ASSERT(*(cx->regs->pc + JSOP_EVAL_LENGTH) == JSOP_LINENO); + *linenop = GET_UINT16(cx->regs->pc + JSOP_EVAL_LENGTH); + return cx->fp()->script()->filename; + } + + return CurrentScriptFileAndLineSlow(cx, linenop); +} + } // namespace js inline JSFunction * diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 509b7a5217ab..a12b7a62470f 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -1792,7 +1792,7 @@ class RegExpGuard if (flat) { patstr = flattenPattern(cx, fm.patstr); if (!patstr) - return false; + return NULL; } else { patstr = fm.patstr; } @@ -2457,7 +2457,7 @@ str_replace_flat_lambda(JSContext *cx, uintN argc, Value *vp, ReplaceData &rdata return false; CallArgs &args = rdata.singleShot; - args.callee().setObject(*rdata.lambda); + args.calleev().setObject(*rdata.lambda); args.thisv().setUndefined(); Value *sp = args.argv(); diff --git a/js/src/jstl.h b/js/src/jstl.h index 9796227b7594..c35bda02e7d3 100644 --- a/js/src/jstl.h +++ b/js/src/jstl.h @@ -40,6 +40,7 @@ #ifndef jstl_h_ #define jstl_h_ +#include "jspubtd.h" #include "jsbit.h" #include "jsstaticcheck.h" #include "jsstdint.h" @@ -233,28 +234,6 @@ PointerRangeSize(T *begin, T *end) return (size_t(end) - size_t(begin)) / sizeof(T); } -/* - * Allocation policies. These model the concept: - * - public copy constructor, assignment, destructor - * - void *malloc_(size_t) - * Responsible for OOM reporting on NULL return value. - * - void *realloc_(size_t) - * Responsible for OOM reporting on NULL return value. - * - void free_(void *) - * - reportAllocOverflow() - * Called on overflow before the container returns NULL. - */ - -/* Policy for using system memory functions and doing no error reporting. */ -class SystemAllocPolicy -{ - public: - void *malloc_(size_t bytes) { return js::OffTheBooks::malloc_(bytes); } - void *realloc_(void *p, size_t bytes) { return js::OffTheBooks::realloc_(p, bytes); } - void free_(void *p) { js::UnwantedForeground::free_(p); } - void reportAllocOverflow() const {} -}; - /* * This utility pales in comparison to Boost's aligned_storage. The utility * simply assumes that JSUint64 is enough alignment for anyone. This may need @@ -652,6 +631,14 @@ class RangeCheckedPointer T *operator&(); }; +template +JS_ALWAYS_INLINE T & +ImplicitCast(U &u) +{ + T &t = u; + return t; +} + } /* namespace js */ #endif /* jstl_h_ */ diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index 880db201129c..8e4b69dfec2f 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -1802,7 +1802,7 @@ VisitFrameSlots(Visitor &visitor, JSContext *cx, unsigned depth, JSStackFrame *f if (JS_UNLIKELY(fp->isEvalFrame())) { visitor.setStackSlotKind("eval"); - if (!visitor.visitStackSlots(&fp->calleeValue(), 2, fp)) + if (!visitor.visitStackSlots(&fp->calleev(), 2, fp)) return false; } else { /* @@ -4301,7 +4301,7 @@ TraceRecorder::snapshot(ExitType exitType) exit->numGlobalSlots = ngslots; exit->numStackSlots = stackSlots; exit->numStackSlotsBelowCurrentFrame = cx->fp()->isFunctionFrame() ? - nativeStackOffset(&cx->fp()->calleeValue()) / sizeof(double) : + nativeStackOffset(&cx->fp()->calleev()) / sizeof(double) : 0; exit->exitType = exitType; exit->pc = pc; @@ -5190,7 +5190,7 @@ TraceRecorder::prepareTreeCall(TreeFragment* inner) * compensate for any outer frames that the inner tree doesn't expect * but the outer tree has. */ - ptrdiff_t sp_adj = nativeStackOffset(&cx->fp()->calleeValue()); + ptrdiff_t sp_adj = nativeStackOffset(&cx->fp()->calleev()); /* Calculate the amount we have to lift the call stack by. */ ptrdiff_t rp_adj = callDepth * sizeof(FrameInfo*); @@ -8070,7 +8070,7 @@ TraceRecorder::scopeChainProp(JSObject* chainHead, Value*& vp, LIns*& ins, NameR // Call name the compiler resolves statically and we do not need // to match shapes of the Call objects. chainHead = cx->fp()->callee().getParent(); - head_ins = w.ldpObjParent(get(&cx->fp()->calleeValue())); + head_ins = w.ldpObjParent(get(&cx->fp()->calleev())); } else { head_ins = scopeChain(); } @@ -8159,7 +8159,7 @@ TraceRecorder::callProp(JSObject* obj, JSProperty* prop, jsid id, Value*& vp, LIns* obj_ins; JSObject* parent = cx->fp()->callee().getParent(); - LIns* parent_ins = w.ldpObjParent(get(&cx->fp()->calleeValue())); + LIns* parent_ins = w.ldpObjParent(get(&cx->fp()->calleev())); CHECK_STATUS(traverseScopeChain(parent, parent_ins, obj, obj_ins)); if (!cfp) { @@ -10012,7 +10012,7 @@ TraceRecorder::getThis(LIns*& this_ins) * trace-constant. getThisObject writes back to fp->thisValue(), so do * the same on trace. */ - if (!fp->computeThis(cx)) + if (!ComputeThis(cx, fp)) RETURN_ERROR("computeThis failed"); /* thisv is a reference, so it'll see the newly computed |this|. */ @@ -10342,7 +10342,7 @@ TraceRecorder::record_EnterFrame() for (; vp < vpstop; ++vp) nativeFrameTracker.set(vp, NULL); - LIns* callee_ins = get(&cx->fp()->calleeValue()); + LIns* callee_ins = get(&cx->fp()->calleev()); LIns* scopeChain_ins = w.ldpObjParent(callee_ins); // set scopeChain for real @@ -10539,7 +10539,7 @@ TraceRecorder::record_JSOP_ARGUMENTS() LIns* a_ins = getFrameObjPtr(fp->addressOfArgs()); LIns* args_ins; - LIns* callee_ins = get(&fp->calleeValue()); + LIns* callee_ins = get(&fp->calleev()); if (a_ins->isImmP()) { // |arguments| is set to 0 by EnterFrame on this trace, so call to create it. args_ins = newArguments(callee_ins); @@ -12276,7 +12276,7 @@ TraceRecorder::setProperty(JSObject* obj, LIns* obj_ins, const Value &v, LIns* v // Handle setting an existing own property. if (pobj == obj) { if (*cx->regs->pc == JSOP_SETMETHOD) { - if (shape->isMethod() && &shape->methodObject() == &v.toObject()) + if (shape->isMethod() && shape->methodObject() == v.toObject()) return RECORD_CONTINUE; RETURN_STOP("setmethod: property exists"); } @@ -13521,7 +13521,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_GETFCSLOT() { JSObject& callee = cx->fp()->callee(); - LIns* callee_ins = get(&cx->fp()->calleeValue()); + LIns* callee_ins = get(&cx->fp()->calleev()); LIns* upvars_ins = w.getObjPrivatizedSlot(callee_ins, JSObject::JSSLOT_FLAT_CLOSURE_UPVARS); @@ -15143,7 +15143,7 @@ TraceRecorder::record_JSOP_BINDNAME() // We don't have the scope chain on trace, so instead we get a start object // that is on the scope chain and doesn't skip the target object (the one // that contains the property). - Value *callee = &cx->fp()->calleeValue(); + Value *callee = &cx->fp()->calleev(); obj = callee->toObject().getParent(); if (obj == globalObj) { stack(0, w.immpObjGC(obj)); @@ -15578,7 +15578,7 @@ TraceRecorder::record_JSOP_LAMBDA_FC() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_CALLEE() { - stack(0, get(&cx->fp()->calleeValue())); + stack(0, get(&cx->fp()->calleev())); return ARECORD_CONTINUE; } diff --git a/js/src/jstracer.h b/js/src/jstracer.h index f88e3a908641..2788936ae9d2 100644 --- a/js/src/jstracer.h +++ b/js/src/jstracer.h @@ -231,13 +231,7 @@ public: TreeFragment* toTreeFragment(); }; -#ifdef NJ_NO_VARIADIC_MACROS - -#define debug_only_stmt(action) /* */ -static void debug_only_printf(int mask, const char *fmt, ...) JS_BEGIN_MACRO JS_END_MACRO -#define debug_only_print0(mask, str) JS_BEGIN_MACRO JS_END_MACRO - -#elif defined(JS_JIT_SPEW) +#if defined(JS_JIT_SPEW) // Top level Nanojit config object. extern nanojit::Config NJConfig; diff --git a/js/src/jstypedarray.cpp b/js/src/jstypedarray.cpp index 9441f64de4f5..53b4aa173ce6 100644 --- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -1337,7 +1337,7 @@ class TypedArrayTemplate if (size != 0 && count >= INT32_MAX / size) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NEED_DIET, "size and count"); - return false; + return NULL; } int32 bytelen = size * count; @@ -1425,7 +1425,9 @@ TypedArrayTemplate::copyIndexToValue(JSContext *cx, uint32 index, Value Class ArrayBuffer::jsclass = { "ArrayBuffer", - JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer), + JSCLASS_HAS_PRIVATE | + JSCLASS_CONCURRENT_FINALIZER | + JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer), PropertyStub, /* addProperty */ PropertyStub, /* delProperty */ PropertyStub, /* getProperty */ @@ -1690,7 +1692,7 @@ TypedArrayConstruct(JSContext *cx, jsint atype, uintN argc, Value *argv) default: JS_NOT_REACHED("shouldn't have gotten here"); - return false; + return NULL; } } diff --git a/js/src/jstypes.h b/js/src/jstypes.h index 3df17bb3e691..8ff593ed620c 100644 --- a/js/src/jstypes.h +++ b/js/src/jstypes.h @@ -307,9 +307,6 @@ #ifdef _MSC_VER # include "jscpucfg.h" /* We can't auto-detect MSVC configuration */ -# if _MSC_VER < 1400 -# define NJ_NO_VARIADIC_MACROS -# endif #else # include "jsautocfg.h" /* Use auto-detected configuration */ #endif diff --git a/js/src/jsvalue.h b/js/src/jsvalue.h index dac8ad90a61f..d00370be3a62 100644 --- a/js/src/jsvalue.h +++ b/js/src/jsvalue.h @@ -381,11 +381,21 @@ class Value data = STRING_TO_JSVAL_IMPL(str); } + JS_ALWAYS_INLINE + void setString(const JS::Anchor &str) { + setString(str.get()); + } + JS_ALWAYS_INLINE void setObject(JSObject &obj) { data = OBJECT_TO_JSVAL_IMPL(&obj); } + JS_ALWAYS_INLINE + void setObject(const JS::Anchor &obj) { + setObject(*obj.get()); + } + JS_ALWAYS_INLINE void setBoolean(bool b) { data = BOOLEAN_TO_JSVAL_IMPL(b); @@ -1243,5 +1253,87 @@ Debug_SetValueRangeToCrashOnTouch(Value *vec, size_t len) #endif } +/* + * Abstracts the layout of the (callee,this) receiver pair that is passed to + * natives and scripted functions. + */ +class CallReceiver +{ +#ifdef DEBUG + mutable bool usedRval_; +#endif + protected: + Value *argv_; + CallReceiver() {} + CallReceiver(Value *argv) : argv_(argv) { +#ifdef DEBUG + usedRval_ = false; +#endif + } + + public: + friend CallReceiver CallReceiverFromVp(Value *); + friend CallReceiver CallReceiverFromArgv(Value *); + Value *base() const { return argv_ - 2; } + JSObject &callee() const { JS_ASSERT(!usedRval_); return argv_[-2].toObject(); } + Value &calleev() const { JS_ASSERT(!usedRval_); return argv_[-2]; } + Value &thisv() const { return argv_[-1]; } + + Value &rval() const { +#ifdef DEBUG + usedRval_ = true; +#endif + return argv_[-2]; + } + + void calleeHasBeenReset() const { +#ifdef DEBUG + usedRval_ = false; +#endif + } +}; + +JS_ALWAYS_INLINE CallReceiver +CallReceiverFromVp(Value *vp) +{ + return CallReceiver(vp + 2); +} + +JS_ALWAYS_INLINE CallReceiver +CallReceiverFromArgv(Value *argv) +{ + return CallReceiver(argv); +} + +/* + * Abstracts the layout of the stack passed to natives from the engine and from + * natives to js::Invoke. + */ +class CallArgs : public CallReceiver +{ + uintN argc_; + protected: + CallArgs() {} + CallArgs(uintN argc, Value *argv) : CallReceiver(argv), argc_(argc) {} + public: + friend CallArgs CallArgsFromVp(uintN, Value *); + friend CallArgs CallArgsFromArgv(uintN, Value *); + Value &operator[](unsigned i) const { JS_ASSERT(i < argc_); return argv_[i]; } + Value *argv() const { return argv_; } + uintN argc() const { return argc_; } +}; + +JS_ALWAYS_INLINE CallArgs +CallArgsFromVp(uintN argc, Value *vp) +{ + return CallArgs(argc, vp + 2); +} + +JS_ALWAYS_INLINE CallArgs +CallArgsFromArgv(uintN argc, Value *argv) +{ + return CallArgs(argc, argv); +} + } /* namespace js */ #endif /* jsvalue_h__ */ diff --git a/js/src/jsvector.h b/js/src/jsvector.h index 3b37ad3c42f5..3d413c1f64b6 100644 --- a/js/src/jsvector.h +++ b/js/src/jsvector.h @@ -41,6 +41,7 @@ #ifndef jsvector_h_ #define jsvector_h_ +#include "jsalloc.h" #include "jstl.h" #include "jsprvtd.h" diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp new file mode 100644 index 000000000000..bdc54d653aa5 --- /dev/null +++ b/js/src/jsweakmap.cpp @@ -0,0 +1,357 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=4 sw=4 et tw=99: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * May 28, 2008. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Andreas Gal + * + * Alternatively, the contents of this file may be used under the terms of + * either of 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 ***** */ + +#include +#include "jsapi.h" +#include "jscntxt.h" +#include "jsgc.h" +#include "jshashtable.h" +#include "jsobj.h" +#include "jsgc.h" +#include "jsweakmap.h" + +#include "jsgcinlines.h" +#include "jsobjinlines.h" + +using namespace js; + +bool +JSObject::isWeakMap() const +{ + return getClass() == &WeakMap::jsclass; +} + +namespace js { + +WeakMap::WeakMap(JSContext *cx) : + map(cx), + next(NULL) +{ +} + +WeakMap * +WeakMap::fromJSObject(JSObject *obj) +{ + JS_ASSERT(obj->getClass() == &WeakMap::jsclass); + return (WeakMap *)obj->getPrivate(); +} + +static JSObject * +NonNullObject(JSContext *cx, Value *vp) +{ + if (vp->isPrimitive()) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT); + return NULL; + } + return &vp->toObject(); +} + +JSBool +WeakMap::has(JSContext *cx, uintN argc, Value *vp) +{ + JSObject *obj = ToObject(cx, &vp[1]); + if (!obj) + return false; + if (!obj->isWeakMap()) { + ReportIncompatibleMethod(cx, vp, &WeakMap::jsclass); + return false; + } + if (argc < 1) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, + "WeakMap.has", "0", "s"); + return false; + } + JSObject *key = NonNullObject(cx, &vp[2]); + if (!key) + return false; + WeakMap *weakmap = fromJSObject(obj); + if (weakmap) { + js::HashMap::Ptr ptr = weakmap->map.lookup(key); + if (ptr) { + *vp = BooleanValue(true); + return true; + } + } + + *vp = BooleanValue(false); + return true; +} + +JSBool +WeakMap::get(JSContext *cx, uintN argc, Value *vp) +{ + JSObject *obj = ToObject(cx, &vp[1]); + if (!obj) + return false; + if (!obj->isWeakMap()) { + ReportIncompatibleMethod(cx, vp, &WeakMap::jsclass); + return false; + } + if (argc < 1) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, + "WeakMap.get", "0", "s"); + return false; + } + JSObject *key = NonNullObject(cx, &vp[2]); + if (!key) + return false; + WeakMap *weakmap = fromJSObject(obj); + if (weakmap) { + js::HashMap::Ptr ptr = weakmap->map.lookup(key); + if (ptr) { + *vp = ptr->value; + return true; + } + } + + *vp = (argc > 1) ? vp[3] : UndefinedValue(); + return true; +} + +JSBool +WeakMap::delete_(JSContext *cx, uintN argc, Value *vp) +{ + JSObject *obj = ToObject(cx, &vp[1]); + if (!obj) + return false; + if (!obj->isWeakMap()) { + ReportIncompatibleMethod(cx, vp, &WeakMap::jsclass); + return false; + } + if (argc < 1) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, + "WeakMap.delete", "0", "s"); + return false; + } + JSObject *key = NonNullObject(cx, &vp[2]); + if (!key) + return false; + WeakMap *weakmap = fromJSObject(obj); + if (weakmap) { + js::HashMap::Ptr ptr = weakmap->map.lookup(key); + if (ptr) { + weakmap->map.remove(ptr); + *vp = BooleanValue(true); + return true; + } + } + + *vp = BooleanValue(false); + return true; +} + +JSBool +WeakMap::set(JSContext *cx, uintN argc, Value *vp) +{ + JSObject *obj = ToObject(cx, &vp[1]); + if (!obj) + return false; + if (!obj->isWeakMap()) { + ReportIncompatibleMethod(cx, vp, &WeakMap::jsclass); + return false; + } + if (argc < 1) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, + "WeakMap.set", "0", "s"); + return false; + } + JSObject *key = NonNullObject(cx, &vp[2]); + if (!key) + return false; + Value value = (argc > 1) ? vp[3] : UndefinedValue(); + + WeakMap *table = (WeakMap *)obj->getPrivate(); + if (!table) { + table = cx->new_(cx); + if (!table->map.init()) { + delete table; + goto out_of_memory; + } + obj->setPrivate(table); + } + + *vp = UndefinedValue(); + return table->map.put(key, value) != NULL; + + out_of_memory: + JS_ReportOutOfMemory(cx); + return false; +} + +void +WeakMap::mark(JSTracer *trc, JSObject *obj) +{ + WeakMap *table = fromJSObject(obj); + if (table) { + if (IS_GC_MARKING_TRACER(trc)) { + if (table->map.empty()) { + delete table; + obj->setPrivate(NULL); + return; + } + JSRuntime *rt = trc->context->runtime; + table->next = rt->gcWeakMapList; + rt->gcWeakMapList = obj; + } else { + for (js::HashMap::Range r = table->map.all(); !r.empty(); r.popFront()) { + JSObject *key = r.front().key; + Value &value = r.front().value; + js::gc::MarkObject(trc, *key, "key"); + js::gc::MarkValue(trc, value, "value"); + } + } + } +} + +/* + * Walk through the previously collected list of tables and mark rows + * iteratively. + */ +bool +WeakMap::markIteratively(JSTracer *trc) +{ + JSContext *cx = trc->context; + JSRuntime *rt = cx->runtime; + + bool again = false; + JSObject *obj = rt->gcWeakMapList; + while (obj) { + WeakMap *table = fromJSObject(obj); + for (js::HashMap::Range r = table->map.all(); !r.empty(); r.popFront()) { + JSObject *key = r.front().key; + Value &value = r.front().value; + if (value.isMarkable() && !IsAboutToBeFinalized(cx, key)) { + /* If the key is alive, mark the value if needed. */ + if (IsAboutToBeFinalized(cx, value.toGCThing())) { + js::gc::MarkValue(trc, value, "value"); + /* We revived a value with children, we have to iterate again. */ + if (value.isGCThing()) + again = true; + } + } + } + obj = table->next; + } + return again; +} + +void +WeakMap::sweep(JSContext *cx) +{ + JSRuntime *rt = cx->runtime; + + JSObject *obj = rt->gcWeakMapList; + while (obj) { + WeakMap *table = fromJSObject(obj); + for (js::HashMap::Enum e(table->map); !e.empty(); e.popFront()) { + if (IsAboutToBeFinalized(cx, e.front().key)) + e.removeFront(); + } + obj = table->next; + } + + rt->gcWeakMapList = NULL; +} + +void +WeakMap::finalize(JSContext *cx, JSObject *obj) +{ + WeakMap *table = fromJSObject(obj); + if (table) + delete table; +} + +JSBool +WeakMap::construct(JSContext *cx, uintN argc, Value *vp) +{ + JSObject *obj = NewBuiltinClassInstance(cx, &WeakMap::jsclass); + if (!obj) + return false; + + obj->setPrivate(NULL); + + vp->setObject(*obj); + return true; +} + +Class WeakMap::jsclass = { + "WeakMap", + JSCLASS_HAS_PRIVATE | + JSCLASS_HAS_CACHED_PROTO(JSProto_WeakMap), + PropertyStub, /* addProperty */ + PropertyStub, /* delProperty */ + PropertyStub, /* getProperty */ + StrictPropertyStub, /* setProperty */ + EnumerateStub, + ResolveStub, + ConvertStub, + WeakMap::finalize, + NULL, /* reserved0 */ + NULL, /* checkAccess */ + NULL, /* call */ + NULL, /* construct */ + NULL, /* xdrObject */ + NULL, /* hasInstance */ + WeakMap::mark +}; + +} + +JSFunctionSpec WeakMap::methods[] = { + JS_FN_TYPE("has", WeakMap::has, 1, 0, JS_TypeHandlerBool), + JS_FN_TYPE("get", WeakMap::get, 2, 0, JS_TypeHandlerDynamic), + JS_FN_TYPE("delete", WeakMap::delete_, 1, 0, JS_TypeHandlerBool), + JS_FN_TYPE("set", WeakMap::set, 2, 0, JS_TypeHandlerVoid), + JS_FS_END +}; + +JSObject * +js_InitWeakMapClass(JSContext *cx, JSObject *obj) +{ + JSObject *proto = js_InitClass(cx, obj, NULL, &WeakMap::jsclass, WeakMap::construct, 0, + JS_TypeHandlerNew, NULL, WeakMap::methods, NULL, NULL); + if (!proto) + return NULL; + + proto->setPrivate(NULL); + + return proto; +} diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h new file mode 100644 index 000000000000..055f73f19920 --- /dev/null +++ b/js/src/jsweakmap.h @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=4 sw=4 et tw=99: + * + * ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released + * May 28, 2008. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Andreas Gal + * + * Alternatively, the contents of this file may be used under the terms of + * either of 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 ***** */ + +#ifndef jsweakmap_h___ +#define jsweakmap_h___ + +#include "jsapi.h" +#include "jscntxt.h" +#include "jsobj.h" + +namespace js { + +typedef js::HashMap ObjectValueMap; + +class WeakMap { + ObjectValueMap map; + JSObject *next; + + static WeakMap *fromJSObject(JSObject *obj); + + static JSBool has(JSContext *cx, uintN argc, Value *vp); + static JSBool get(JSContext *cx, uintN argc, Value *vp); + static JSBool delete_(JSContext *cx, uintN argc, Value *vp); + static JSBool set(JSContext *cx, uintN argc, Value *vp); + + + protected: + static void mark(JSTracer *trc, JSObject *obj); + static void finalize(JSContext *cx, JSObject *obj); + + public: + WeakMap(JSContext *cx); + + static JSBool construct(JSContext *cx, uintN argc, Value *vp); + + static bool markIteratively(JSTracer *trc); + static void sweep(JSContext *cx); + + static Class jsclass; + static JSFunctionSpec methods[]; +}; + +} + +extern JSObject * +js_InitWeakMapClass(JSContext *cx, JSObject *obj); + +#endif diff --git a/js/src/lirasm/lirasm.cpp b/js/src/lirasm/lirasm.cpp index ea22d52c1d9a..37e2e377be07 100644 --- a/js/src/lirasm/lirasm.cpp +++ b/js/src/lirasm/lirasm.cpp @@ -341,7 +341,8 @@ private: LirWriter *mVerboseWriter; LirWriter *mValidateWriter1; LirWriter *mValidateWriter2; - multimap mFwdJumps; + vector< pair > mJumps; + map mJumpLabels; size_t mLineno; LOpcode mOpcode; @@ -363,7 +364,8 @@ private: void bad(const string &msg); void nyi(const string &opname); void extract_any_label(string &lab, char lab_delim); - void resolve_forward_jumps(string &lab, LIns *ins); + void resolve_jumps(); + void add_jump_label(const string& lab, LIns* ins); void endFragment(); }; @@ -646,18 +648,9 @@ FragmentAssembler::assemble_jump(bool isCond) condition = NULL; } string name = pop_front(mTokens); - if (mLabels.find(name) != mLabels.end()) { - LIns *target = ref(name); - return mLir->insBranch(mOpcode, condition, target); - } else { - LIns *ins = mLir->insBranch(mOpcode, condition, NULL); -#ifdef __SUNPRO_CC - mFwdJumps.insert(make_pair(name, ins)); -#else - mFwdJumps.insert(make_pair(name, ins)); -#endif - return ins; - } + LIns *ins = mLir->insBranch(mOpcode, condition, NULL); + mJumps.push_back(make_pair(name, ins)); + return ins; } LIns * @@ -831,23 +824,17 @@ FragmentAssembler::assemble_jump_jov() LIns *b = ref(mTokens[1]); string name = mTokens[2]; - if (mLabels.find(name) != mLabels.end()) { - LIns *target = ref(name); - return mLir->insBranchJov(mOpcode, a, b, target); - } else { - LIns *ins = mLir->insBranchJov(mOpcode, a, b, NULL); -#ifdef __SUNPRO_CC - mFwdJumps.insert(make_pair(name, ins)); -#else - mFwdJumps.insert(make_pair(name, ins)); -#endif - return ins; - } + LIns *ins = mLir->insBranchJov(mOpcode, a, b, NULL); + mJumps.push_back(make_pair(name, ins)); + return ins; } void FragmentAssembler::endFragment() { + // Resolve all of the jumps in this fragment. + resolve_jumps(); + if (mReturnTypeBits == 0) { cerr << "warning: no return type in fragment '" << mFragName << "'" << endl; @@ -938,19 +925,28 @@ FragmentAssembler::extract_any_label(string &lab, char lab_delim) } void -FragmentAssembler::resolve_forward_jumps(string &lab, LIns *ins) +FragmentAssembler::resolve_jumps() { - typedef multimap mulmap; -#ifdef __SUNPRO_CC - typedef mulmap::iterator ci; -#else - typedef mulmap::const_iterator ci; -#endif - pair range = mFwdJumps.equal_range(lab); - for (ci i = range.first; i != range.second; ++i) { - i->second->setTarget(ins); + typedef vector< pair > pairvec; + typedef pairvec::const_iterator pv_ci; + + typedef map< string, LIns* > labelmap; + typedef labelmap::const_iterator lm_ci; + + for ( pv_ci i = mJumps.begin(); i != mJumps.end(); ++i ) { + lm_ci target = mJumpLabels.find(i->first); + if ( target == mJumpLabels.end() ) + bad("No label exists for jump target '" + i->first + "'"); + i->second->setTarget( target->second ); } - mFwdJumps.erase(lab); +} + +void +FragmentAssembler::add_jump_label(const string& lab, LIns* ins) +{ + if ( mJumpLabels.find(lab) != mJumpLabels.end() ) + bad("Label '" + lab + "' found at multiple locations."); + mJumpLabels[lab] = ins; } void @@ -989,10 +985,10 @@ FragmentAssembler::assembleFragment(LirTokenStream &in, bool implicitBegin, cons LIns *ins = NULL; extract_any_label(lab, ':'); - /* Save label and do any back-patching of deferred forward-jumps. */ + /* Save label as a jump label */ if (!lab.empty()) { ins = mLir->ins0(LIR_label); - resolve_forward_jumps(lab, ins); + add_jump_label(lab, ins); lab.clear(); } extract_any_label(lab, '='); @@ -1222,9 +1218,8 @@ FragmentAssembler::assembleFragment(LirTokenStream &in, bool implicitBegin, cons case LIR_label: ins = mLir->ins0(LIR_label); - if (!lab.empty()) { - resolve_forward_jumps(lab, ins); - } + add_jump_label(lab, ins); + lab.clear(); break; case LIR_file: @@ -2233,7 +2228,8 @@ usageAndQuit(const string& progname) " -v --verbose print LIR and assembly code\n" " --execute execute LIR\n" " --[no-]optimize enable or disable optimization of the LIR (default=off)\n" - " --random [N] generate a random LIR block of size N (default=1000)\n" + " --random [N] generate a random LIR block of size N (default=100)\n" + " --stkskip [N] push approximately N Kbytes of stack before execution (default=100)\n" "\n" "Build query options (these print a value for this build of lirasm and exit)\n" " --show-arch show the architecture ('i386', 'X64', 'arm', 'ppc',\n" @@ -2265,10 +2261,33 @@ struct CmdLineOptions { bool execute; bool optimize; int random; + int stkskip; string filename; Config config; }; + +bool parseOptionalInt(int argc, char** argv, int* i, int* value, int defaultValue) +{ + if (*i == argc - 1) { + *value = defaultValue; // no numeric argument, use default + } else { + char* endptr; + int res = strtol(argv[*i+1], &endptr, 10); + if ('\0' == *endptr) { + // We don't bother checking for overflow. + if (res <= 0) { + return false; + } + *value = res; // next arg is a number, use that for the value + (*i)++; + } else { + *value = defaultValue; // next arg is not a number + } + } + return true; +} + static void processCmdLine(int argc, char **argv, CmdLineOptions& opts) { @@ -2277,6 +2296,7 @@ processCmdLine(int argc, char **argv, CmdLineOptions& opts) opts.execute = false; opts.random = 0; opts.optimize = false; + opts.stkskip = 0; // Architecture-specific options. #if defined NANOJIT_IA32 @@ -2301,22 +2321,12 @@ processCmdLine(int argc, char **argv, CmdLineOptions& opts) else if (arg == "--no-optimize") opts.optimize = false; else if (arg == "--random") { - const int defaultSize = 100; - if (i == argc - 1) { - opts.random = defaultSize; // no numeric argument, use default - } else { - char* endptr; - int res = strtol(argv[i+1], &endptr, 10); - if ('\0' == *endptr) { - // We don't bother checking for overflow. - if (res <= 0) - errMsgAndQuit(opts.progname, "--random argument must be greater than zero"); - opts.random = res; // next arg is a number, use that for the size - i++; - } else { - opts.random = defaultSize; // next arg is not a number - } - } + if (!parseOptionalInt(argc, argv, &i, &opts.random, 100)) + errMsgAndQuit(opts.progname, "--random argument must be greater than zero"); + } + else if (arg == "--stkskip") { + if (!parseOptionalInt(argc, argv, &i, &opts.stkskip, 100)) + errMsgAndQuit(opts.progname, "--stkskip argument must be greater than zero"); } else if (arg == "--show-arch") { const char* str = @@ -2415,6 +2425,45 @@ processCmdLine(int argc, char **argv, CmdLineOptions& opts) #endif } +int32_t* dummy; + +void +executeFragment(const LirasmFragment& fragment, int skip) +{ + // Allocate a large frame, and make sure we don't optimize it away. + int32_t space[512]; + dummy = space; + + if (skip > 0) { + executeFragment(fragment, skip-1); + } else { + switch (fragment.mReturnType) { + case RT_INT: { + int res = fragment.rint(); + cout << "Output is: " << res << endl; + break; + } +#ifdef NANOJIT_64BIT + case RT_QUAD: { + int res = fragment.rquad(); + cout << "Output is: " << res << endl; + break; + } +#endif + case RT_DOUBLE: { + double res = fragment.rdouble(); + cout << "Output is: " << res << endl; + break; + } + case RT_GUARD: { + LasmSideExit *ls = (LasmSideExit*) fragment.rguard()->exit; + cout << "Exited block on line: " << ls->line << endl; + break; + } + } + } +} + int main(int argc, char **argv) { @@ -2436,30 +2485,7 @@ main(int argc, char **argv) i = lasm.mFragments.find("main"); if (i == lasm.mFragments.end()) errMsgAndQuit(opts.progname, "error: at least one fragment must be named 'main'"); - switch (i->second.mReturnType) { - case RT_INT: { - int res = i->second.rint(); - cout << "Output is: " << res << endl; - break; - } -#ifdef NANOJIT_64BIT - case RT_QUAD: { - int res = i->second.rquad(); - cout << "Output is: " << res << endl; - break; - } -#endif - case RT_DOUBLE: { - double res = i->second.rdouble(); - cout << "Output is: " << res << endl; - break; - } - case RT_GUARD: { - LasmSideExit *ls = (LasmSideExit*) i->second.rguard()->exit; - cout << "Exited block on line: " << ls->line << endl; - break; - } - } + executeFragment(i->second, opts.stkskip); } else { for (i = lasm.mFragments.begin(); i != lasm.mFragments.end(); i++) dump_srecords(cout, i->second.fragptr); diff --git a/js/src/lirasm/tests/backjump.in b/js/src/lirasm/tests/backjump.in new file mode 100644 index 000000000000..de54e5eb5b27 --- /dev/null +++ b/js/src/lirasm/tests/backjump.in @@ -0,0 +1,17 @@ + ptr = allocp 8 + zero = immi 0 + one = immi 1 + neg_one = immi -1 + sti one ptr 0 + sti zero ptr 4 +start: a = ldi ptr 0 + x = ldi ptr 4 + b = muli a neg_one + y = addi x one + sti y ptr 4 + sti b ptr 0 + t = eqi b one + jf t start +end: reti y + + diff --git a/js/src/lirasm/tests/backjump.out b/js/src/lirasm/tests/backjump.out new file mode 100644 index 000000000000..ca4935610b4b --- /dev/null +++ b/js/src/lirasm/tests/backjump.out @@ -0,0 +1 @@ +Output is: 2 diff --git a/js/src/lirasm/tests/bug643969.in b/js/src/lirasm/tests/bug643969.in new file mode 100644 index 000000000000..4be05294da27 --- /dev/null +++ b/js/src/lirasm/tests/bug643969.in @@ -0,0 +1,27 @@ + + ptr = allocp 8 + j start + +success: zero = immd 0.0 + retd zero + + + ; do a store+load so we don't optimize away the test +start: a = immd 1.0 + b = immd 2.0 + c = addd a b + std c ptr 0 + + expect = immd 4.0 + actual = ldd ptr 0 + + ; Test is for this code pattern, i386/x64 backend + ; could generate bad code for the != case of LIR_jf + ; if the branch is backwards. (Note that we compare 3.0 + ; to 4.0 because we need the test to fail.) + cond = eqd expect actual + jf cond success + + bad = immd -1.0 + retd bad + diff --git a/js/src/lirasm/tests/bug643969.out b/js/src/lirasm/tests/bug643969.out new file mode 100644 index 000000000000..e1b88ffcb7d9 --- /dev/null +++ b/js/src/lirasm/tests/bug643969.out @@ -0,0 +1 @@ +Output is: 0 diff --git a/js/src/lirasm/tests/largeframe.in b/js/src/lirasm/tests/largeframe.in new file mode 100644 index 000000000000..4c81e2ea9404 --- /dev/null +++ b/js/src/lirasm/tests/largeframe.in @@ -0,0 +1,12 @@ +; Allocate frame larger than a Win32 page +; and write to the end of the frame first. +; This test is just an exerciser for the page +; probing code, as lirasm will not crash without it. + +foo = allocp 8192 +bar = allocp 4 +k = immi 555 +sti k bar 0 +sti k foo 0 +res = ldi bar 0 +reti res diff --git a/js/src/lirasm/tests/largeframe.out b/js/src/lirasm/tests/largeframe.out new file mode 100644 index 000000000000..8df33e7789dd --- /dev/null +++ b/js/src/lirasm/tests/largeframe.out @@ -0,0 +1 @@ +Output is: 555 diff --git a/js/src/methodjit/BaseAssembler.h b/js/src/methodjit/BaseAssembler.h index 326ab8c1a888..6ad46e36df55 100644 --- a/js/src/methodjit/BaseAssembler.h +++ b/js/src/methodjit/BaseAssembler.h @@ -130,6 +130,8 @@ class Assembler : public ValueAssembler static const RegisterID ClobberInCall = JSC::X86Registers::ecx; #elif defined(JS_CPU_ARM) static const RegisterID ClobberInCall = JSC::ARMRegisters::r2; +#elif defined(JS_CPU_SPARC) + static const RegisterID ClobberInCall = JSC::SparcRegisters::l1; #endif /* :TODO: OOM */ @@ -178,6 +180,10 @@ static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::X86Registe static const JSC::MacroAssembler::RegisterID JSReturnReg_Type = JSC::ARMRegisters::r2; static const JSC::MacroAssembler::RegisterID JSReturnReg_Data = JSC::ARMRegisters::r1; static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::ARMRegisters::r1; +#elif defined(JS_CPU_SPARC) +static const JSC::MacroAssembler::RegisterID JSReturnReg_Type = JSC::SparcRegisters::i0; +static const JSC::MacroAssembler::RegisterID JSReturnReg_Data = JSC::SparcRegisters::i1; +static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::SparcRegisters::i2; #endif size_t distanceOf(Label l) { @@ -288,7 +294,7 @@ static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::ARMRegiste static const uint64 DoubleNegMask = 0x8000000000000000ULL; loadDouble(&DoubleNegMask, Registers::FPConversionTemp); xorDouble(Registers::FPConversionTemp, fpreg); -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC negDouble(fpreg, fpreg); #endif } @@ -392,10 +398,18 @@ static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::ARMRegiste // Windows x64 requires extra space in between calls. #ifdef _WIN64 static const uint32 ShadowStackSpace = 32; +#elif defined(JS_CPU_SPARC) + static const uint32 ShadowStackSpace = 92; #else static const uint32 ShadowStackSpace = 0; #endif +#if defined(JS_CPU_SPARC) + static const uint32 BaseStackSpace = 104; +#else + static const uint32 BaseStackSpace = 0; +#endif + // Prepare the stack for a call sequence. This must be called AFTER all // volatile regs have been saved, and BEFORE pushArg() is used. The stack // is assumed to be aligned to 16-bytes plus any pushes that occured via @@ -454,7 +468,7 @@ static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::ARMRegiste // // Note that it's not required we're in a call - stackAdjust can be 0. JS_ASSERT(marker.base <= extraStackSpace); - return Address(stackPointerRegister, stackAdjust + extraStackSpace - marker.base); + return Address(stackPointerRegister, BaseStackSpace + stackAdjust + extraStackSpace - marker.base); } // This is an internal function only for use inside a setupABICall(), diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index f386bc77ff14..bfd76c8097a1 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -5319,7 +5319,7 @@ mjit::Compiler::jsop_bindname(JSAtom *atom, bool usePropCache) masm.loadPtr(Address(JSFrameReg, JSStackFrame::offsetOfScopeChain()), pic.objReg); pic.shapeGuard = masm.label(); - Jump inlineJump = masm.branchPtr(Assembler::NotEqual, masm.payloadOf(parent), ImmPtr(0)); + Jump inlineJump = masm.branchPtr(Assembler::NotEqual, parent, ImmPtr(0)); { RESERVE_OOL_SPACE(stubcc.masm); pic.slowPathStart = stubcc.linkExit(inlineJump, Uses(0)); @@ -5397,7 +5397,7 @@ mjit::Compiler::jsop_bindname(JSAtom *atom, bool usePropCache) Address address(reg, offsetof(JSObject, parent)); - Jump j = masm.branchPtr(Assembler::NotEqual, masm.payloadOf(address), ImmPtr(0)); + Jump j = masm.branchPtr(Assembler::NotEqual, address, ImmPtr(0)); stubcc.linkExit(j, Uses(0)); stubcc.leave(); diff --git a/js/src/methodjit/FastOps.cpp b/js/src/methodjit/FastOps.cpp index 5e21ca1c2ef4..5253e12f1680 100644 --- a/js/src/methodjit/FastOps.cpp +++ b/js/src/methodjit/FastOps.cpp @@ -1757,13 +1757,13 @@ mjit::Compiler::jsop_stricteq(JSOp op) Assembler::Condition oppositeCond = (op == JSOP_STRICTEQ) ? Assembler::NotEqual : Assembler::Equal; -#if defined JS_CPU_X86 || defined JS_CPU_ARM +#ifndef JS_CPU_X64 static const int CanonicalNaNType = 0x7FF80000; masm.setPtr(oppositeCond, treg, Imm32(CanonicalNaNType), result); -#elif defined JS_CPU_X64 +#else static const void *CanonicalNaNType = (void *)0x7FF8000000000000; - masm.move(ImmPtr(CanonicalNaNType), JSC::X86Registers::r11); - masm.setPtr(oppositeCond, treg, JSC::X86Registers::r11, result); + masm.move(ImmPtr(CanonicalNaNType), Registers::ScratchReg); + masm.setPtr(oppositeCond, treg, Registers::ScratchReg, result); #endif frame.popn(2); @@ -1787,13 +1787,13 @@ mjit::Compiler::jsop_stricteq(JSOp op) } /* This is only true if the other side is |null|. */ -#if defined JS_CPU_X86 || defined JS_CPU_ARM +#ifndef JS_CPU_X64 JSValueTag mask = known->getKnownTag(); if (frame.shouldAvoidTypeRemat(test)) masm.set32(cond, masm.tagOf(frame.addressOf(test)), Imm32(mask), result); else masm.set32(cond, frame.tempRegForType(test), Imm32(mask), result); -#elif defined JS_CPU_X64 +#else RegisterID maskReg = frame.allocReg(); masm.move(ImmTag(known->getKnownTag()), maskReg); @@ -1872,7 +1872,7 @@ mjit::Compiler::jsop_stricteq(JSOp op) return; } -#ifndef JS_CPU_ARM +#if !defined JS_CPU_ARM && !defined JS_CPU_SPARC /* Try an integer fast-path. */ bool needStub = false; if (!lhs->isTypeKnown()) { diff --git a/js/src/methodjit/FrameState-inl.h b/js/src/methodjit/FrameState-inl.h index 60194def34d0..1ea75ab39c5c 100644 --- a/js/src/methodjit/FrameState-inl.h +++ b/js/src/methodjit/FrameState-inl.h @@ -188,7 +188,7 @@ FrameState::convertInt32ToDouble(Assembler &masm, FrameEntry *fe, FPRegisterID f if (fe->data.inRegister()) masm.convertInt32ToDouble(fe->data.reg(), fpreg); else - masm.convertInt32ToDouble(addressOf(fe), fpreg); + masm.convertInt32ToDouble(masm.payloadOf(addressOf(fe)), fpreg); } inline bool diff --git a/js/src/methodjit/ICLabels.h b/js/src/methodjit/ICLabels.h index cddcf7a68f95..2edaead2d23f 100644 --- a/js/src/methodjit/ICLabels.h +++ b/js/src/methodjit/ICLabels.h @@ -64,7 +64,7 @@ namespace ic { * implementation. */ -#if defined JS_CPU_X64 || defined JS_CPU_ARM +#if defined JS_CPU_X64 || defined JS_CPU_ARM || defined JS_CPU_SPARC # define JS_HAS_IC_LABELS #endif @@ -172,7 +172,7 @@ struct GetPropLabels : MacroAssemblerTypedefs { int getInlineTypeJumpOffset() { #if defined JS_CPU_X86 || defined JS_CPU_X64 return INLINE_TYPE_JUMP; -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC return POST_INST_OFFSET(inlineTypeJumpOffset); #endif } @@ -180,7 +180,7 @@ struct GetPropLabels : MacroAssemblerTypedefs { void setInlineTypeJumpOffset(int offset) { #if defined JS_CPU_X86 || defined JS_CPU_X64 JS_ASSERT(INLINE_TYPE_JUMP == offset); -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC inlineTypeJumpOffset = offset; JS_ASSERT(offset == inlineTypeJumpOffset); #endif @@ -223,6 +223,11 @@ struct GetPropLabels : MacroAssemblerTypedefs { /* Offset from the shape guard start to the shape guard jump. */ static const int32 INLINE_SHAPE_JUMP = 12; + /* Offset from the fast path to the type guard jump. */ + int32 inlineTypeJumpOffset : 8; +#elif defined JS_CPU_SPARC + static const int32 INLINE_SHAPE_JUMP = 48; + static const int32 INLINE_TYPE_JUMP = 48; /* Offset from the fast path to the type guard jump. */ int32 inlineTypeJumpOffset : 8; #endif diff --git a/js/src/methodjit/ICRepatcher.h b/js/src/methodjit/ICRepatcher.h index 59d8e78a0ccc..24b08b9634d0 100644 --- a/js/src/methodjit/ICRepatcher.h +++ b/js/src/methodjit/ICRepatcher.h @@ -72,7 +72,7 @@ class Repatcher : public JSC::RepatchBuffer /* Patch a stub call. */ void relink(CodeLocationCall call, FunctionPtr stub) { -#if defined JS_CPU_X64 || defined JS_CPU_X86 +#if defined JS_CPU_X64 || defined JS_CPU_X86 || defined JS_CPU_SPARC JSC::RepatchBuffer::relink(call, stub); #elif defined JS_CPU_ARM /* @@ -95,7 +95,7 @@ class Repatcher : public JSC::RepatchBuffer /* Patch the offset of a Value load emitted by loadValueWithAddressOffsetPatch. */ void patchAddressOffsetForValueLoad(CodeLocationLabel label, uint32 offset) { -#if defined JS_CPU_X64 || defined JS_CPU_ARM +#if defined JS_CPU_X64 || defined JS_CPU_ARM || defined JS_CPU_SPARC repatch(label.dataLabel32AtOffset(0), offset); #elif defined JS_CPU_X86 static const unsigned LOAD_TYPE_OFFSET = 6; @@ -115,7 +115,7 @@ class Repatcher : public JSC::RepatchBuffer } void patchAddressOffsetForValueStore(CodeLocationLabel label, uint32 offset, bool typeConst) { -#if defined JS_CPU_ARM || defined JS_CPU_X64 +#if defined JS_CPU_ARM || defined JS_CPU_X64 || defined JS_CPU_SPARC (void) typeConst; repatch(label.dataLabel32AtOffset(0), offset); #elif defined JS_CPU_X86 diff --git a/js/src/methodjit/InvokeHelpers.cpp b/js/src/methodjit/InvokeHelpers.cpp index 2ac0d2d72bc4..1f651f2bee96 100644 --- a/js/src/methodjit/InvokeHelpers.cpp +++ b/js/src/methodjit/InvokeHelpers.cpp @@ -317,7 +317,7 @@ stubs::CompileFunction(VMFrame &f, uint32 nactual) return NULL; } - CallArgs args(fp->formalArgs(), fp->numFormalArgs()); + CallArgs args = CallArgsFromArgv(fp->numFormalArgs(), fp->formalArgs()); if (!cx->typeMonitorCall(args, fp->isConstructing())) return NULL; @@ -384,7 +384,7 @@ UncachedInlineCall(VMFrame &f, uint32 flags, void **pret, bool *unjittable, uint if (!cx->compartment->types.checkPendingRecompiles(cx)) return false; } else { - CallArgs args(vp + 2, argc); + CallArgs args = CallArgsFromVp(argc, vp); if (!cx->typeMonitorCall(args, flags & JSFRAME_CONSTRUCTING)) return false; } @@ -496,8 +496,10 @@ stubs::Eval(VMFrame &f, uint32 argc) } JS_ASSERT(f.regs.fp == f.cx->fp()); - if (!DirectEval(f.cx, argc, vp)) + if (!DirectEval(f.cx, CallArgsFromVp(argc, vp))) THROW(); + + f.regs.sp = vp + 1; } void @@ -736,7 +738,7 @@ AtSafePoint(JSContext *cx) { JSStackFrame *fp = cx->fp(); if (fp->hasImacropc()) - return false; + return NULL; JSScript *script = fp->script(); return script->maybeNativeCodeForPC(fp->isConstructing(), cx->regs->pc); diff --git a/js/src/methodjit/MachineRegs.h b/js/src/methodjit/MachineRegs.h index d3d259453949..6ab9521e74e8 100644 --- a/js/src/methodjit/MachineRegs.h +++ b/js/src/methodjit/MachineRegs.h @@ -107,6 +107,7 @@ struct Registers { static const RegisterID TypeMaskReg = JSC::X86Registers::r13; static const RegisterID PayloadMaskReg = JSC::X86Registers::r14; static const RegisterID ValueReg = JSC::X86Registers::r10; + static const RegisterID ScratchReg = JSC::X86Registers::r11; #endif // Register that homes the current JSStackFrame. @@ -116,6 +117,8 @@ struct Registers { static const RegisterID JSFrameReg = JSC::X86Registers::ebx; #elif defined(JS_CPU_ARM) static const RegisterID JSFrameReg = JSC::ARMRegisters::r11; +#elif defined(JS_CPU_SPARC) + static const RegisterID JSFrameReg = JSC::SparcRegisters::l0; #endif #if defined(JS_CPU_X86) || defined(JS_CPU_X64) @@ -136,6 +139,14 @@ struct Registers { static const RegisterID ArgReg0 = JSC::ARMRegisters::r0; static const RegisterID ArgReg1 = JSC::ARMRegisters::r1; static const RegisterID ArgReg2 = JSC::ARMRegisters::r2; +#elif JS_CPU_SPARC + static const RegisterID ReturnReg = JSC::SparcRegisters::o0; + static const RegisterID ArgReg0 = JSC::SparcRegisters::o0; + static const RegisterID ArgReg1 = JSC::SparcRegisters::o1; + static const RegisterID ArgReg2 = JSC::SparcRegisters::o2; + static const RegisterID ArgReg3 = JSC::SparcRegisters::o3; + static const RegisterID ArgReg4 = JSC::SparcRegisters::o4; + static const RegisterID ArgReg5 = JSC::SparcRegisters::o5; #endif static const RegisterID StackPointer = JSC::MacroAssembler::stackPointerRegister; @@ -219,6 +230,30 @@ struct Registers { // r14 is LR and is used for return sequences. // r15 is PC (program counter). + static const uint32 SingleByteRegs = TempRegs | SavedRegs; +#elif defined(JS_CPU_SPARC) + static const uint32 TempRegs = + (1 << JSC::SparcRegisters::o0) + | (1 << JSC::SparcRegisters::o1) + | (1 << JSC::SparcRegisters::o2) + | (1 << JSC::SparcRegisters::o3) + | (1 << JSC::SparcRegisters::o4) + | (1 << JSC::SparcRegisters::o5); + + static const uint32 SavedRegs = + (1 << JSC::SparcRegisters::l2) + | (1 << JSC::SparcRegisters::l3) + | (1 << JSC::SparcRegisters::l4) + | (1 << JSC::SparcRegisters::l5) + | (1 << JSC::SparcRegisters::l6) + | (1 << JSC::SparcRegisters::l7) + | (1 << JSC::SparcRegisters::i0) + | (1 << JSC::SparcRegisters::i1) + | (1 << JSC::SparcRegisters::i2) + | (1 << JSC::SparcRegisters::i3) + | (1 << JSC::SparcRegisters::i4) + | (1 << JSC::SparcRegisters::i5); + static const uint32 SingleByteRegs = TempRegs | SavedRegs; #else # error "Unsupported platform" @@ -252,6 +287,8 @@ struct Registers { # endif #elif defined(JS_CPU_ARM) return 4; +#elif defined(JS_CPU_SPARC) + return 6; #endif } @@ -293,6 +330,15 @@ struct Registers { JSC::ARMRegisters::r2, JSC::ARMRegisters::r3 }; +#elif defined(JS_CPU_SPARC) + static const RegisterID regs[] = { + JSC::SparcRegisters::o0, + JSC::SparcRegisters::o1, + JSC::SparcRegisters::o2, + JSC::SparcRegisters::o3, + JSC::SparcRegisters::o4, + JSC::SparcRegisters::o5 + }; #endif JS_ASSERT(numArgRegs(conv) == JS_ARRAY_LENGTH(regs)); if (i > JS_ARRAY_LENGTH(regs)) @@ -326,6 +372,24 @@ struct Registers { | (1 << JSC::ARMRegisters::d2) ) << TotalRegisters; static const FPRegisterID FPConversionTemp = JSC::ARMRegisters::d3; +#elif defined(JS_CPU_SPARC) + static const uint32 TotalFPRegisters = 16; + static const uint32 TempFPRegs = + (1 << JSC::SparcRegisters::f2) + | (1 << JSC::SparcRegisters::f4) + | (1 << JSC::SparcRegisters::f6) + | (1 << JSC::SparcRegisters::f8) + | (1 << JSC::SparcRegisters::f10) + | (1 << JSC::SparcRegisters::f12) + | (1 << JSC::SparcRegisters::f14) + | (1 << JSC::SparcRegisters::f16) + | (1 << JSC::SparcRegisters::f18) + | (1 << JSC::SparcRegisters::f20) + | (1 << JSC::SparcRegisters::f22) + | (1 << JSC::SparcRegisters::f24) + | (1 << JSC::SparcRegisters::f26) + | (1 << JSC::SparcRegisters::f28); + static const FPRegisterID FPConversionTemp = JSC::SparcRegisters::f0; #else # error "Unsupported platform" #endif diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 559ae1dcc3d6..5cf26d502b6a 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -184,7 +184,7 @@ JS_STATIC_ASSERT(offsetof(VMFrame, regs.fp) == 0x38); JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF800000000000LL); JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x00007FFFFFFFFFFFLL); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampoline) "\n" SYMBOL_STRING(JaegerTrampoline) ":" "\n" @@ -231,7 +231,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" "jmp *0(%rsp)" "\n" ); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n" SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" @@ -251,7 +251,7 @@ SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" "ret" "\n" ); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerThrowpoline) "\n" SYMBOL_STRING(JaegerThrowpoline) ":" "\n" @@ -286,7 +286,7 @@ SYMBOL_STRING(JaegerThrowpoline) ":" "\n" JS_STATIC_ASSERT(offsetof(VMFrame, savedEBX) == 0x2c); JS_STATIC_ASSERT(offsetof(VMFrame, regs.fp) == 0x1C); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampoline) "\n" SYMBOL_STRING(JaegerTrampoline) ":" "\n" @@ -317,7 +317,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" "jmp *72(%esp)" "\n" ); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n" SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" @@ -337,7 +337,7 @@ SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" "ret" "\n" ); -asm volatile ( +asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerThrowpoline) "\n" SYMBOL_STRING(JaegerThrowpoline) ":" "\n" @@ -390,7 +390,7 @@ JS_STATIC_ASSERT(JSReturnReg_Type == JSC::ARMRegisters::r2); #define FUNCTION_HEADER_EXTRA #endif -asm volatile ( +asm ( ".text\n" FUNCTION_HEADER_EXTRA ".globl " SYMBOL_STRING(JaegerTrampoline) "\n" @@ -449,7 +449,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" " bx r4" "\n" ); -asm volatile ( +asm ( ".text\n" FUNCTION_HEADER_EXTRA ".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n" @@ -469,7 +469,7 @@ SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" " pop {r4-r11,pc}" "\n" ); -asm volatile ( +asm ( ".text\n" FUNCTION_HEADER_EXTRA ".globl " SYMBOL_STRING(JaegerThrowpoline) "\n" @@ -494,7 +494,7 @@ SYMBOL_STRING(JaegerThrowpoline) ":" "\n" " pop {r4-r11,pc}" "\n" ); -asm volatile ( +asm ( ".text\n" FUNCTION_HEADER_EXTRA ".globl " SYMBOL_STRING(JaegerStubVeneer) "\n" @@ -509,6 +509,7 @@ SYMBOL_STRING(JaegerStubVeneer) ":" "\n" " pop {ip,pc}" "\n" ); +# elif defined(JS_CPU_SPARC) # else # error "Unsupported CPU!" # endif diff --git a/js/src/methodjit/MethodJIT.h b/js/src/methodjit/MethodJIT.h index 1d865f3db06a..5cab9bd23aa9 100644 --- a/js/src/methodjit/MethodJIT.h +++ b/js/src/methodjit/MethodJIT.h @@ -47,6 +47,7 @@ #if !defined JS_CPU_X64 && \ !defined JS_CPU_X86 && \ + !defined JS_CPU_SPARC && \ !defined JS_CPU_ARM # error "Oh no, you should define a platform so this compiles." #endif @@ -61,6 +62,39 @@ namespace mjit { struct JITScript; } struct VMFrame { +#if defined(JS_CPU_SPARC) + void *savedL0; + void *savedL1; + void *savedL2; + void *savedL3; + void *savedL4; + void *savedL5; + void *savedL6; + void *savedL7; + void *savedI0; + void *savedI1; + void *savedI2; + void *savedI3; + void *savedI4; + void *savedI5; + void *savedI6; + void *savedI7; + + void *str_p; + + void *outgoing_p0; + void *outgoing_p1; + void *outgoing_p2; + void *outgoing_p3; + void *outgoing_p4; + void *outgoing_p5; + + void *outgoing_p6; + + void *reserve_0; + void *reserve_1; +#endif + union Arguments { struct { void *ptr; @@ -144,6 +178,13 @@ struct VMFrame inline void** returnAddressLocation() { return reinterpret_cast(this) - 1; } +#elif defined(JS_CPU_SPARC) + JSStackFrame *topRetrunAddr; + void* veneerReturn; + void* _align; + inline void** returnAddressLocation() { + return reinterpret_cast(&this->veneerReturn); + } #else # error "The VMFrame layout isn't defined for your processor architecture!" #endif diff --git a/js/src/methodjit/MonoIC.h b/js/src/methodjit/MonoIC.h index 337ae99ac252..a54c7356d754 100644 --- a/js/src/methodjit/MonoIC.h +++ b/js/src/methodjit/MonoIC.h @@ -125,15 +125,15 @@ struct SetGlobalNameIC : public GlobalNameIC JSC::JITCode extraStub; /* SET only, if we had to generate an out-of-line path. */ - int inlineShapeJump : 10; /* Offset into inline path for shape jump. */ - int extraShapeGuard : 6; /* Offset into stub for shape guard. */ + int32 inlineShapeJump : 10; /* Offset into inline path for shape jump. */ + int32 extraShapeGuard : 6; /* Offset into stub for shape guard. */ bool objConst : 1; /* True if the object is constant. */ RegisterID objReg : 5; /* Register for object, if objConst is false. */ RegisterID shapeReg : 5; /* Register for shape; volatile. */ bool hasExtraStub : 1; /* Extra stub is preset. */ - int fastRejoinOffset : 16; /* Offset from fastPathStart to rejoin. */ - int extraStoreOffset : 16; /* Offset into store code. */ + int32 fastRejoinOffset : 16; /* Offset from fastPathStart to rejoin. */ + int32 extraStoreOffset : 16; /* Offset into store code. */ /* SET only. */ ValueRemat vr; /* RHS value. */ diff --git a/js/src/methodjit/NunboxAssembler.h b/js/src/methodjit/NunboxAssembler.h index 7d7c31888caa..b9656830e9af 100644 --- a/js/src/methodjit/NunboxAssembler.h +++ b/js/src/methodjit/NunboxAssembler.h @@ -74,16 +74,24 @@ struct ImmPayload : JSC::MacroAssembler::Imm32 class NunboxAssembler : public JSC::MacroAssembler { + public: +#ifdef IS_BIG_ENDIAN + static const uint32 PAYLOAD_OFFSET = 4; + static const uint32 TAG_OFFSET = 0; +#else static const uint32 PAYLOAD_OFFSET = 0; static const uint32 TAG_OFFSET = 4; +#endif public: static const JSC::MacroAssembler::Scale JSVAL_SCALE = JSC::MacroAssembler::TimesEight; - template - T payloadOf(T address) { - JS_ASSERT(PAYLOAD_OFFSET == 0); - return address; + Address payloadOf(Address address) { + return Address(address.base, address.offset + PAYLOAD_OFFSET); + } + + BaseIndex payloadOf(BaseIndex address) { + return BaseIndex(address.base, address.index, address.scale, address.offset + PAYLOAD_OFFSET); } Address tagOf(Address address) { @@ -194,7 +202,7 @@ class NunboxAssembler : public JSC::MacroAssembler JS_ASSERT(differenceBetween(start, endType) == 6); JS_ASSERT(differenceBetween(endType, endPayload) == 6); return start; -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC /* * On ARM, the first instruction loads the offset from a literal pool, so the label * returned points at that instruction. @@ -226,7 +234,7 @@ class NunboxAssembler : public JSC::MacroAssembler JS_ASSERT(differenceBetween(start, endType) == 6); JS_ASSERT(differenceBetween(endType, endPayload) == 6); return start; -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC return store64WithAddressOffsetPatch(treg, dreg, address); #endif } @@ -242,7 +250,7 @@ class NunboxAssembler : public JSC::MacroAssembler JS_ASSERT(differenceBetween(start, endType) == 10); JS_ASSERT(differenceBetween(endType, endPayload) == 6); return start; -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC return store64WithAddressOffsetPatch(type, dreg, address); #endif } @@ -262,7 +270,7 @@ class NunboxAssembler : public JSC::MacroAssembler JS_ASSERT(differenceBetween(start, endType) == 10); JS_ASSERT(differenceBetween(endType, endPayload) == 10); return start; -#elif defined JS_CPU_ARM +#elif defined JS_CPU_ARM || defined JS_CPU_SPARC return store64WithAddressOffsetPatch(type, payload, address); #endif } @@ -329,7 +337,7 @@ class NunboxAssembler : public JSC::MacroAssembler } void loadPrivate(Address privAddr, RegisterID to) { - loadPtr(privAddr, to); + loadPtr(payloadOf(privAddr), to); } void loadObjPrivate(RegisterID base, RegisterID to) { @@ -444,6 +452,8 @@ class NunboxAssembler : public JSC::MacroAssembler m_assembler.movd_rr(srcDest, dataReg); m_assembler.psrldq_rr(srcDest, 4); m_assembler.movd_rr(srcDest, typeReg); +#elif defined JS_CPU_SPARC + breakDoubleTo32(srcDest, typeReg, dataReg); #else JS_NOT_REACHED("implement this - push double, pop pop is easiest"); #endif diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index df2608fa6b53..0c08c73ffdd2 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -346,7 +346,7 @@ class SetPropCompiler : public PICStubCompiler } else { /* Check capacity. */ Address capacity(pic.objReg, offsetof(JSObject, capacity)); - masm.load32(masm.payloadOf(capacity), pic.shapeReg); + masm.load32(capacity, pic.shapeReg); Jump overCapacity = masm.branch32(Assembler::LessThanOrEqual, pic.shapeReg, Imm32(shape->slot)); if (!slowExits.append(overCapacity)) @@ -1853,7 +1853,7 @@ ic::SetProp(VMFrame &f, ic::PICInfo *pic) if (status == Lookup_Error) THROW(); } - + Value rval = f.regs.sp[-1]; nstub(f, atom); } diff --git a/js/src/methodjit/PolyIC.h b/js/src/methodjit/PolyIC.h index fde0fea9ed67..25382592394b 100644 --- a/js/src/methodjit/PolyIC.h +++ b/js/src/methodjit/PolyIC.h @@ -94,7 +94,7 @@ struct BaseIC : public MacroAssemblerTypedefs { // Offset from start of stub to jump target of second shape guard as Nitro // asm data location. This is 0 if there is only one shape guard in the // last stub. - int secondShapeGuard : 11; + int32 secondShapeGuard : 11; // Opcode this was compiled for. JSOp op : 9; @@ -255,9 +255,9 @@ struct GetElementIC : public BasePolyIC { // These offsets are used for string-key dependent stubs, such as named // property accesses. They are separated from the int-key dependent stubs, // in order to guarantee that the id type needs only one guard per type. - int atomGuard : 8; // optional, non-zero if present - int firstShapeGuard : 8; // always set - int secondShapeGuard : 8; // optional, non-zero if present + int32 atomGuard : 8; // optional, non-zero if present + int32 firstShapeGuard : 11; // always set + int32 secondShapeGuard : 11; // optional, non-zero if present bool hasLastStringStub : 1; JITCode lastStringStub; @@ -336,7 +336,7 @@ struct SetElementIC : public BaseIC { // A bitmask of registers that are volatile and must be preserved across // stub calls inside the IC. - uint32 volatileMask : 16; + uint32 volatileMask; // If true, then keyValue contains a constant index value >= 0. Otherwise, // keyReg contains a dynamic integer index in any range. diff --git a/js/src/methodjit/Retcon.cpp b/js/src/methodjit/Retcon.cpp index cc5265ec7530..ef981478b730 100644 --- a/js/src/methodjit/Retcon.cpp +++ b/js/src/methodjit/Retcon.cpp @@ -71,7 +71,7 @@ AutoScriptRetrapper::untrap(jsbytecode *pc) { if (!traps.append(pc)) return false; - *pc = JS_GetTrapOpcode(cx, script, pc); + *pc = JS_GetTrapOpcode(traps.allocPolicy().context(), script, pc); return true; } diff --git a/js/src/methodjit/Retcon.h b/js/src/methodjit/Retcon.h index 3ea766bc7a69..7373115945e5 100644 --- a/js/src/methodjit/Retcon.h +++ b/js/src/methodjit/Retcon.h @@ -63,14 +63,13 @@ namespace mjit { class AutoScriptRetrapper { public: - AutoScriptRetrapper(JSContext *cx1, JSScript *script1) : - cx(cx1), script(script1), traps(cx) {}; + AutoScriptRetrapper(JSContext *cx, JSScript *script1) : + script(script1), traps(cx) {}; ~AutoScriptRetrapper(); bool untrap(jsbytecode *pc); private: - JSContext *cx; JSScript *script; Vector traps; }; diff --git a/js/src/methodjit/StubCalls.cpp b/js/src/methodjit/StubCalls.cpp index 255900e1b025..521ac2484caa 100644 --- a/js/src/methodjit/StubCalls.cpp +++ b/js/src/methodjit/StubCalls.cpp @@ -1383,7 +1383,7 @@ stubs::This(VMFrame &f) THROW(); } - if (!f.fp()->computeThis(f.cx)) + if (!ComputeThis(f.cx, f.fp())) THROW(); f.regs.sp[-1] = f.fp()->thisValue(); } @@ -1659,18 +1659,21 @@ CanIncDecWithoutOverflow(int32_t i) return (i > JSVAL_INT_MIN) && (i < JSVAL_INT_MAX); } -template +template static inline bool ObjIncOp(VMFrame &f, JSObject *obj, jsid id) { JSContext *cx = f.cx; - JSStackFrame *fp = f.fp(); f.regs.sp[0].setNull(); f.regs.sp++; if (!obj->getProperty(cx, id, &f.regs.sp[-1])) return false; + uint32 setPropFlags = qualified + ? JSRESOLVE_ASSIGNING + : JSRESOLVE_ASSIGNING | JSRESOLVE_QUALIFIED; + Value &ref = f.regs.sp[-1]; int32_t tmp; if (JS_LIKELY(ref.isInt32() && CanIncDecWithoutOverflow(tmp = ref.toInt32()))) { @@ -1678,11 +1681,12 @@ ObjIncOp(VMFrame &f, JSObject *obj, jsid id) ref.getInt32Ref() = tmp + N; else ref.getInt32Ref() = tmp += N; - fp->setAssigning(); - JSBool ok = obj->setProperty(cx, id, &ref, strict); - fp->clearAssigning(); - if (!ok) - return false; + + { + JSAutoResolveFlags rf(cx, setPropFlags); + if (!obj->setProperty(cx, id, &ref, strict)) + return false; + } /* * We must set regs.sp[-1] to tmp for both post and pre increments @@ -1701,16 +1705,18 @@ ObjIncOp(VMFrame &f, JSObject *obj, jsid id) d += N; ref.setNumber(d); } + v.setNumber(d); if (!f.script()->typeMonitorOverflow(cx, f.pc())) return false; if (!cx->typeMonitorAssign(obj, id, v)) return false; - fp->setAssigning(); - JSBool ok = obj->setProperty(cx, id, &v, strict); - fp->clearAssigning(); - if (!ok) - return false; + + { + JSAutoResolveFlags rf(cx, setPropFlags); + if (!obj->setProperty(cx, id, &v, strict)) + return false; + } } return true; @@ -1751,7 +1757,7 @@ NameIncDec(VMFrame &f, JSObject *obj, JSAtom *origAtom) ReportAtomNotDefined(cx, atom); return false; } - return ObjIncOp(f, obj, id); + return ObjIncOp(f, obj, id); } template @@ -1761,7 +1767,7 @@ stubs::PropInc(VMFrame &f, JSAtom *atom) JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]); if (!obj) THROW(); - if (!ObjIncOp<1, true, strict>(f, obj, ATOM_TO_JSID(atom))) + if (!ObjIncOp<1, true, strict, true>(f, obj, ATOM_TO_JSID(atom))) THROW(); f.regs.sp[-2] = f.regs.sp[-1]; } @@ -1776,7 +1782,7 @@ stubs::PropDec(VMFrame &f, JSAtom *atom) JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]); if (!obj) THROW(); - if (!ObjIncOp<-1, true, strict>(f, obj, ATOM_TO_JSID(atom))) + if (!ObjIncOp<-1, true, strict, true>(f, obj, ATOM_TO_JSID(atom))) THROW(); f.regs.sp[-2] = f.regs.sp[-1]; } @@ -1791,7 +1797,7 @@ stubs::IncProp(VMFrame &f, JSAtom *atom) JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]); if (!obj) THROW(); - if (!ObjIncOp<1, false, strict>(f, obj, ATOM_TO_JSID(atom))) + if (!ObjIncOp<1, false, strict, true>(f, obj, ATOM_TO_JSID(atom))) THROW(); f.regs.sp[-2] = f.regs.sp[-1]; } @@ -1806,7 +1812,7 @@ stubs::DecProp(VMFrame &f, JSAtom *atom) JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]); if (!obj) THROW(); - if (!ObjIncOp<-1, false, strict>(f, obj, ATOM_TO_JSID(atom))) + if (!ObjIncOp<-1, false, strict, true>(f, obj, ATOM_TO_JSID(atom))) THROW(); f.regs.sp[-2] = f.regs.sp[-1]; } @@ -1824,7 +1830,7 @@ stubs::ElemInc(VMFrame &f) jsid id; if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1])) THROW(); - if (!ObjIncOp<1, true, strict>(f, obj, id)) + if (!ObjIncOp<1, true, strict, true>(f, obj, id)) THROW(); f.regs.sp[-3] = f.regs.sp[-1]; } @@ -1842,7 +1848,7 @@ stubs::ElemDec(VMFrame &f) jsid id; if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1])) THROW(); - if (!ObjIncOp<-1, true, strict>(f, obj, id)) + if (!ObjIncOp<-1, true, strict, true>(f, obj, id)) THROW(); f.regs.sp[-3] = f.regs.sp[-1]; } @@ -1860,7 +1866,7 @@ stubs::IncElem(VMFrame &f) jsid id; if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1])) THROW(); - if (!ObjIncOp<1, false, strict>(f, obj, id)) + if (!ObjIncOp<1, false, strict, true>(f, obj, id)) THROW(); f.regs.sp[-3] = f.regs.sp[-1]; } @@ -1878,7 +1884,7 @@ stubs::DecElem(VMFrame &f) jsid id; if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1])) THROW(); - if (!ObjIncOp<-1, false, strict>(f, obj, id)) + if (!ObjIncOp<-1, false, strict, true>(f, obj, id)) THROW(); f.regs.sp[-3] = f.regs.sp[-1]; } diff --git a/js/src/methodjit/TrampolineSparc.s b/js/src/methodjit/TrampolineSparc.s new file mode 100644 index 000000000000..7fb929f378d5 --- /dev/null +++ b/js/src/methodjit/TrampolineSparc.s @@ -0,0 +1,117 @@ +! -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +! ***** 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 Mozilla SpiderMonkey JavaScript 1.9 code, released +! May 28, 2008. +! +! The Initial Developer of the Original Code is +! Leon Sha +! +! Portions created by the Initial Developer are Copyright (C) 2010-2011 +! the Initial Developer. All Rights Reserved. +! +! Contributor(s): +! +! 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 ***** + +.text + +! JSBool JaegerTrampoline(JSContext *cx, JSStackFrame *fp, void *code, +! , uintptr_t inlineCallCount) +.global JaegerTrampoline +.type JaegerTrampoline, #function +JaegerTrampoline: + save %sp,-160,%sp + st %i3, [%fp - 20] ! stackLimit + st %i0, [%fp - 24] ! cx + st %i1, [%fp - 16] ! entryFp + st %i1, [%fp - 28] ! regs->fp + mov %i1, %l0 ! fp + call SetVMFrameRegs + mov %sp, %o0 + call PushActiveVMFrame + mov %sp, %o0 + jmp %i2 + st %i7, [%fp - 12] ! return address +.size JaegerTrampoline, . - JaegerTrampoline + +! void JaegerTrampolineReturn() +.global JaegerTrampolineReturn +.type JaegerTrampolineReturn, #function +JaegerTrampolineReturn: + st %i0, [%l0 + 0x18] /* fp->rval type */ + st %i1, [%l0 + 0x1c] /* fp->rval data */ + call PopActiveVMFrame + mov %sp, %o0 + ld [%fp - 12], %i7 ! return address + mov 1, %i0 + ret + restore +.size JaegerTrampolineReturn, . - JaegerTrampolineReturn + +! void *JaegerThrowpoline(js::VMFrame *vmFrame) +.global JaegerThrowpoline +.type JaegerThrowpoline, #function +JaegerThrowpoline: + call js_InternalThrow + mov %sp,%o0 + tst %o0 + be throwpoline_exit + nop + jmp %o0 + nop +throwpoline_exit: + ta 3 + mov %sp, %o2 + mov %fp, %o3 + ldd [%o2 + (0*8)], %l0 + ldd [%o2 + (1*8)], %l2 + ldd [%o2 + (2*8)], %l4 + ldd [%o2 + (3*8)], %l6 + ldd [%o2 + (4*8)], %i0 + ldd [%o2 + (5*8)], %i2 + ldd [%o2 + (6*8)], %i4 + ldd [%o2 + (7*8)], %i6 + ld [%o3 - 12], %i7 ! return address + mov %o2, %sp + call PopActiveVMFrame + mov %sp, %o0 + clr %i0 + ret + restore +.size JaegerThrowpoline, . - JaegerThrowpoline + +.global InjectJaegerReturn +.type InjectJaegerReturn, #function +InjectJaegerReturn: + ld [%l0 + 0x18], %i0 /* fp->rval type */ + ld [%l0 + 0x1c], %i1 /* fp->rval data */ + ld [%l0 + 0x14], %i7 /* fp->ncode */ + sub %i7, 8, %i7 + ld [%fp - 28], %l0 + ret + nop +.size InjectJaegerReturn, . - InjectJaegerReturn diff --git a/js/src/methodjit/TypedArrayIC.h b/js/src/methodjit/TypedArrayIC.h index c17fac6f1885..1215e91ad687 100644 --- a/js/src/methodjit/TypedArrayIC.h +++ b/js/src/methodjit/TypedArrayIC.h @@ -46,7 +46,7 @@ namespace js { namespace mjit { -#if defined(JS_POLYIC) && (defined JS_CPU_X86 || defined JS_CPU_X64) +#ifdef JS_POLYIC_TYPED_ARRAY typedef JSC::MacroAssembler::RegisterID RegisterID; typedef JSC::MacroAssembler::FPRegisterID FPRegisterID; diff --git a/js/src/nanojit-import-rev b/js/src/nanojit-import-rev index 15b3dd9aaf3a..1b3fb0bc93cf 100644 --- a/js/src/nanojit-import-rev +++ b/js/src/nanojit-import-rev @@ -1 +1 @@ -ddf045b983f32d3f9a2cfc666ecbe825efe9b182 +74e1b2344f722020fb10e11d7b115373c43c37b6 diff --git a/js/src/nanojit/Assembler.cpp b/js/src/nanojit/Assembler.cpp index 858bb8451395..fe37dfe52255 100755 --- a/js/src/nanojit/Assembler.cpp +++ b/js/src/nanojit/Assembler.cpp @@ -1329,8 +1329,13 @@ namespace nanojit // Evict all registers, most conservative approach. intersectRegisterState(label->regs); } - NIns *branch = asm_branch(branchOnFalse, cond, 0); - _patches.put(branch,to); + Branches branches = asm_branch(branchOnFalse, cond, 0); + if (branches.branch1) { + _patches.put(branches.branch1,to); + } + if (branches.branch2) { + _patches.put(branches.branch2,to); + } } } diff --git a/js/src/nanojit/Assembler.h b/js/src/nanojit/Assembler.h index f601eb6fb735..83f43035a104 100644 --- a/js/src/nanojit/Assembler.h +++ b/js/src/nanojit/Assembler.h @@ -231,6 +231,23 @@ namespace nanojit LabelState *get(LIns *); }; + /** + * Some architectures (i386, X64) can emit two branches that need patching + * in some situations. This is returned by asm_branch() implementations + * with 0, 1 or 2 of these fields set to a non-NULL value. (If only 1 is set, + * it must be patch1, not patch2.) + */ + struct Branches + { + NIns* const branch1; + NIns* const branch2; + inline explicit Branches(NIns* b1 = NULL, NIns* b2 = NULL) + : branch1(b1) + , branch2(b2) + { + } + }; + /** map tracking the register allocation state at each bailout point * (represented by SideExit*) in a trace fragment. */ typedef HashMap RegAllocMap; @@ -481,7 +498,7 @@ namespace nanojit void asm_nongp_copy(Register r, Register s); void asm_call(LIns*); Register asm_binop_rhs_reg(LIns* ins); - NIns* asm_branch(bool branchOnFalse, LIns* cond, NIns* targ); + Branches asm_branch(bool branchOnFalse, LIns* cond, NIns* targ); NIns* asm_branch_ov(LOpcode op, NIns* targ); void asm_jtbl(LIns* ins, NIns** table); void asm_insert_random_nop(); diff --git a/js/src/nanojit/Containers.cpp b/js/src/nanojit/Containers.cpp index ecbe042269c3..ac7c32004f71 100644 --- a/js/src/nanojit/Containers.cpp +++ b/js/src/nanojit/Containers.cpp @@ -80,7 +80,7 @@ namespace nanojit int cap2 = cap; do { cap2 <<= 1; - } while (w > cap2); + } while (w >= cap2); int64_t *bits2 = (int64_t*) allocator.alloc(cap2 * sizeof(int64_t)); int j=0; for (; j < cap; j++) diff --git a/js/src/nanojit/Containers.h b/js/src/nanojit/Containers.h index cd4fe6656801..d3439664b76c 100644 --- a/js/src/nanojit/Containers.h +++ b/js/src/nanojit/Containers.h @@ -88,6 +88,7 @@ namespace nanojit int w = bitnum2word(i); if (w >= cap) grow(w); + NanoAssert(w < cap); bits[w] |= bitnum2mask(i); } diff --git a/js/src/nanojit/Native.h b/js/src/nanojit/Native.h index 601087f7bc24..7c2a8da95fa7 100644 --- a/js/src/nanojit/Native.h +++ b/js/src/nanojit/Native.h @@ -169,7 +169,7 @@ namespace nanojit { #define asm_output(...) do { \ if (_logc->lcbits & LC_Native) { \ outline[0]='\0'; \ - VMPI_sprintf(outline, "%p ", (void*)_nIns); \ + VMPI_sprintf(outline, "%p ", _nIns); \ if (_logc->lcbits & LC_Bytes) { \ appendHexVals(outline, (char*)_nIns, (char*)_nInsAfter); \ padTo(outline, 3*15); \ diff --git a/js/src/nanojit/NativeARM.cpp b/js/src/nanojit/NativeARM.cpp index 5317e3b9ea8d..8559e5677344 100644 --- a/js/src/nanojit/NativeARM.cpp +++ b/js/src/nanojit/NativeARM.cpp @@ -2291,7 +2291,7 @@ Assembler::asm_cmpd(LIns* ins) /* Call this with targ set to 0 if the target is not yet known and the branch * will be patched up later. */ -NIns* +Branches Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) { LOpcode condop = cond->opcode(); @@ -2351,7 +2351,7 @@ Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) asm_cmp(cond); - return at; + return Branches(at); } NIns* Assembler::asm_branch_ov(LOpcode op, NIns* target) diff --git a/js/src/nanojit/NativeMIPS.cpp b/js/src/nanojit/NativeMIPS.cpp index dea3c83cd99b..08274dc3d7d7 100644 --- a/js/src/nanojit/NativeMIPS.cpp +++ b/js/src/nanojit/NativeMIPS.cpp @@ -1618,7 +1618,7 @@ namespace nanojit return patch; } - NIns* Assembler::asm_branch(bool branchOnFalse, LIns *cond, NIns * const targ) + Branches Assembler::asm_branch(bool branchOnFalse, LIns *cond, NIns * const targ) { NanoAssert(cond->isCmp()); LOpcode condop = cond->opcode(); @@ -1628,7 +1628,7 @@ namespace nanojit Register ra = findRegFor(a, allow); Register rb = (b==a) ? ra : findRegFor(b, allow & ~rmask(ra)); - return asm_bxx(branchOnFalse, condop, ra, rb, targ); + return Branches(asm_bxx(branchOnFalse, condop, ra, rb, targ)); } void Assembler::asm_j(NIns * const targ, bool bdelay) diff --git a/js/src/nanojit/NativePPC.cpp b/js/src/nanojit/NativePPC.cpp index 4f032a2d0baf..5bf8b38f233e 100644 --- a/js/src/nanojit/NativePPC.cpp +++ b/js/src/nanojit/NativePPC.cpp @@ -420,7 +420,7 @@ namespace nanojit return ((d << shift) >> shift) == d; } - NIns* Assembler::asm_branch(bool onfalse, LIns *cond, NIns * const targ) { + Branches Assembler::asm_branch(bool onfalse, LIns *cond, NIns * const targ) { LOpcode condop = cond->opcode(); NanoAssert(cond->isCmp()); @@ -434,7 +434,7 @@ namespace nanojit #endif patch = asm_branch_far(onfalse, cond, targ); asm_cmp(condop, cond->oprnd1(), cond->oprnd2(), CR7); - return patch; + return Branches(patch); } NIns* Assembler::asm_branch_near(bool onfalse, LIns *cond, NIns * const targ) { diff --git a/js/src/nanojit/NativeSH4.cpp b/js/src/nanojit/NativeSH4.cpp index 689b1a696b85..539f8f86d09f 100644 --- a/js/src/nanojit/NativeSH4.cpp +++ b/js/src/nanojit/NativeSH4.cpp @@ -1449,7 +1449,7 @@ namespace nanojit return patch_target; } - NIns *Assembler::asm_branch(bool branchOnFalse, LIns *condition, NIns *target) { + Branches Assembler::asm_branch(bool branchOnFalse, LIns *condition, NIns *target) { NanoAssert(condition->isCmp()); LOpcode opcode = condition->opcode(); @@ -1459,7 +1459,7 @@ namespace nanojit asm_cmp(opcode, condition); - return patch_target; + return Branches(patch_target); } void Assembler::nBeginAssembly() { diff --git a/js/src/nanojit/NativeSparc.cpp b/js/src/nanojit/NativeSparc.cpp index 1636f9bc4cc1..8142082d6880 100644 --- a/js/src/nanojit/NativeSparc.cpp +++ b/js/src/nanojit/NativeSparc.cpp @@ -39,6 +39,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include #include #include #include "nanojit.h" @@ -998,14 +999,14 @@ namespace nanojit LDSW32(rs, ds, t); } - NIns* Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) + Branches Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) { NIns* at = 0; LOpcode condop = cond->opcode(); NanoAssert(cond->isCmp()); if (isCmpDOpcode(condop)) { - return asm_branchd(branchOnFalse, cond, targ); + return Branches(asm_branchd(branchOnFalse, cond, targ)); } underrunProtect(32); @@ -1064,7 +1065,7 @@ namespace nanojit BCC(0, tt); } asm_cmp(cond); - return at; + return Branches(at); } NIns* Assembler::asm_branch_ov(LOpcode op, NIns* targ) diff --git a/js/src/nanojit/NativeX64.cpp b/js/src/nanojit/NativeX64.cpp index d26d5c6f1219..343e67bd5f46 100644 --- a/js/src/nanojit/NativeX64.cpp +++ b/js/src/nanojit/NativeX64.cpp @@ -1246,13 +1246,13 @@ namespace nanojit asm_cmpi(cond); } - NIns* Assembler::asm_branch(bool onFalse, LIns* cond, NIns* target) { - NIns* patch = asm_branch_helper(onFalse, cond, target); + Branches Assembler::asm_branch(bool onFalse, LIns* cond, NIns* target) { + Branches branches = asm_branch_helper(onFalse, cond, target); asm_cmp(cond); - return patch; + return branches; } - NIns* Assembler::asm_branch_helper(bool onFalse, LIns *cond, NIns *target) { + Branches Assembler::asm_branch_helper(bool onFalse, LIns *cond, NIns *target) { if (target && !isTargetWithinS32(target)) { // A conditional jump beyond 32-bit range, so invert the // branch/compare and emit an unconditional jump to the target: @@ -1269,7 +1269,7 @@ namespace nanojit : asm_branchi_helper(onFalse, cond, target); } - NIns* Assembler::asm_branchi_helper(bool onFalse, LIns *cond, NIns *target) { + Branches Assembler::asm_branchi_helper(bool onFalse, LIns *cond, NIns *target) { // We must ensure there's room for the instruction before calculating // the offset. And the offset determines the opcode (8bit or 32bit). LOpcode condop = cond->opcode(); @@ -1330,7 +1330,7 @@ namespace nanojit } } } - return _nIns; // address of instruction to patch + return Branches(_nIns); // address of instruction to patch } NIns* Assembler::asm_branch_ov(LOpcode, NIns* target) { @@ -1412,15 +1412,17 @@ namespace nanojit // LIR_jt jae ja swap+jae swap+ja jp over je // LIR_jf jb jbe swap+jb swap+jbe jne+jp - NIns* Assembler::asm_branchd_helper(bool onFalse, LIns *cond, NIns *target) { + Branches Assembler::asm_branchd_helper(bool onFalse, LIns *cond, NIns *target) { LOpcode condop = cond->opcode(); - NIns *patch; + NIns *patch1 = NULL; + NIns *patch2 = NULL; if (condop == LIR_eqd) { if (onFalse) { // branch if unordered or != JP(16, target); // underrun of 12 needed, round up for overhang --> 16 + patch1 = _nIns; JNE(0, target); // no underrun needed, previous was enough - patch = _nIns; + patch2 = _nIns; } else { // jp skip (2byte) // jeq target @@ -1428,7 +1430,7 @@ namespace nanojit underrunProtect(16); // underrun of 7 needed but we write 2 instr --> 16 NIns *skip = _nIns; JE(0, target); // no underrun needed, previous was enough - patch = _nIns; + patch1 = _nIns; JP8(0, skip); // ditto } } @@ -1443,9 +1445,9 @@ namespace nanojit case LIR_ged: if (onFalse) JB(8, target); else JAE(8, target); break; default: NanoAssert(0); break; } - patch = _nIns; + patch1 = _nIns; } - return patch; + return Branches(patch1, patch2); } void Assembler::asm_condd(LIns *ins) { @@ -1956,6 +1958,24 @@ namespace nanojit uint32_t aligned = alignUp(stackNeeded + stackPushed, NJ_ALIGN_STACK); uint32_t amt = aligned - stackPushed; +#ifdef _WIN64 + // Windows uses a single guard page for extending the stack, so + // new stack pages must be first touched in stack-growth order. + // We touch each whole page that will be allocated to the frame + // (following the saved FP) to cause the OS to commit the page if + // necessary. Since we don't calculate page boundaries, but just + // probe at intervals of the pagesize, it is possible that the + // last page of the frame will be touched unnecessarily. Note that + // we must generate the probes in the reverse order of their execution. + // We require that the page size be a power of 2. + uint32_t pageSize = uint32_t(VMPI_getVMPageSize()); + NanoAssert((pageSize & (pageSize-1)) == 0); + uint32_t pageRounded = amt & ~(pageSize-1); + for (int32_t d = pageRounded; d > 0; d -= pageSize) { + MOVLMI(RBP, -d, 0); + } +#endif + // Reserve stackNeeded bytes, padded // to preserve NJ_ALIGN_STACK-byte alignment. if (amt) { @@ -2015,17 +2035,6 @@ namespace nanojit return; // don't patch } ((int32_t*)next)[-1] = int32_t(target - next); - if (next[0] == 0x0F && next[1] == 0x8A) { - // code is jne,jp, for LIR_jf(feq) - // we just patched the jne, now patch the jp. - next += 6; - NanoAssert(((int32_t*)next)[-1] == 0); - if (!isS32(target - next)) { - setError(BranchTooFar); - return; // don't patch - } - ((int32_t*)next)[-1] = int32_t(target - next); - } } Register Assembler::nRegisterAllocFromSet(RegisterMask set) { diff --git a/js/src/nanojit/NativeX64.h b/js/src/nanojit/NativeX64.h index 872b5f20ee1a..fcf4205f7ca6 100644 --- a/js/src/nanojit/NativeX64.h +++ b/js/src/nanojit/NativeX64.h @@ -426,9 +426,9 @@ namespace nanojit void asm_cmpi(LIns*);\ void asm_cmpi_imm(LIns*);\ void asm_cmpd(LIns*);\ - NIns* asm_branch_helper(bool, LIns*, NIns*);\ - NIns* asm_branchi_helper(bool, LIns*, NIns*);\ - NIns* asm_branchd_helper(bool, LIns*, NIns*);\ + Branches asm_branch_helper(bool, LIns*, NIns*);\ + Branches asm_branchi_helper(bool, LIns*, NIns*);\ + Branches asm_branchd_helper(bool, LIns*, NIns*);\ void asm_div(LIns *ins);\ void asm_div_mod(LIns *ins);\ int max_stk_used;\ diff --git a/js/src/nanojit/Nativei386.cpp b/js/src/nanojit/Nativei386.cpp index 0aa47a728ef6..19dcce2c113b 100644 --- a/js/src/nanojit/Nativei386.cpp +++ b/js/src/nanojit/Nativei386.cpp @@ -910,10 +910,27 @@ namespace nanojit uint32_t aligned = alignUp(stackNeeded + stackPushed, NJ_ALIGN_STACK); uint32_t amt = aligned - stackPushed; +#ifdef _WIN32 + // Windows uses a single guard page for extending the stack, so + // new stack pages must be first touched in stack-growth order. + // We touch each whole page that will be allocated to the frame + // (following the saved FP) to cause the OS to commit the page if + // necessary. Since we don't calculate page boundaries, but just + // probe at intervals of the pagesize, it is possible that the + // last page of the frame will be touched unnecessarily. Note that + // we must generate the probes in the reverse order of their execution. + // We require that the page size be a power of 2. + size_t pageSize = VMPI_getVMPageSize(); + NanoAssert((pageSize & (pageSize-1)) == 0); + size_t pageRounded = amt & ~(pageSize-1); + for (int32_t d = pageRounded; d > 0; d -= pageSize) { + STi(rEBP, -d, 0); + } +#endif + // Reserve stackNeeded bytes, padded // to preserve NJ_ALIGN_STACK-byte alignment. - if (amt) - { + if (amt) { SUBi(SP, amt); } @@ -1469,14 +1486,14 @@ namespace nanojit } } - NIns* Assembler::asm_branch_helper(bool branchOnFalse, LIns* cond, NIns* targ) + Branches Assembler::asm_branch_helper(bool branchOnFalse, LIns* cond, NIns* targ) { return isCmpDOpcode(cond->opcode()) ? asm_branchd_helper(branchOnFalse, cond, targ) : asm_branchi_helper(branchOnFalse, cond, targ); } - NIns* Assembler::asm_branchi_helper(bool branchOnFalse, LIns* cond, NIns* targ) + Branches Assembler::asm_branchi_helper(bool branchOnFalse, LIns* cond, NIns* targ) { if (branchOnFalse) { // op == LIR_xf/LIR_jf @@ -1507,14 +1524,14 @@ namespace nanojit default: NanoAssert(0); break; } } - return _nIns; + return Branches(_nIns); } - NIns* Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) + Branches Assembler::asm_branch(bool branchOnFalse, LIns* cond, NIns* targ) { - NIns* at = asm_branch_helper(branchOnFalse, cond, targ); + Branches branches = asm_branch_helper(branchOnFalse, cond, targ); asm_cmp(cond); - return at; + return branches; } NIns* Assembler::asm_branch_ov(LOpcode, NIns* target) @@ -2578,9 +2595,10 @@ namespace nanojit } } - NIns* Assembler::asm_branchd_helper(bool branchOnFalse, LIns* cond, NIns *targ) + Branches Assembler::asm_branchd_helper(bool branchOnFalse, LIns* cond, NIns *targ) { - NIns* at = 0; + NIns* patch1 = NULL; + NIns* patch2 = NULL; LOpcode opcode = cond->opcode(); if (_config.i386_sse2) { @@ -2594,8 +2612,10 @@ namespace nanojit if (cond->oprnd1() == cond->oprnd2()) { JP(targ); } else { - JP(targ); + JP(targ); // unordered + patch1 = _nIns; JNE(targ); + patch2 = _nIns; } break; case LIR_ltd: @@ -2617,8 +2637,8 @@ namespace nanojit underrunProtect(16); // underrun of 7 needed but we write 2 instr --> 16 NIns *skip = _nIns; JE(targ); - at = _nIns; - JP(skip); + patch1 = _nIns; + JP(skip); // unordered } break; case LIR_ltd: @@ -2635,10 +2655,10 @@ namespace nanojit JNP(targ); } - if (!at) - at = _nIns; + if (!patch1) + patch1 = _nIns; - return at; + return Branches(patch1, patch2); } // WARNING: This function cannot generate any code that will affect the diff --git a/js/src/nanojit/Nativei386.h b/js/src/nanojit/Nativei386.h index e7d0d32b630c..4a85f5d92f15 100644 --- a/js/src/nanojit/Nativei386.h +++ b/js/src/nanojit/Nativei386.h @@ -202,9 +202,9 @@ namespace nanojit void asm_cmp(LIns *cond); \ void asm_cmpi(LIns *cond); \ void asm_cmpd(LIns *cond);\ - NIns* asm_branch_helper(bool, LIns* cond, NIns*);\ - NIns* asm_branchi_helper(bool, LIns* cond, NIns*);\ - NIns* asm_branchd_helper(bool, LIns* cond, NIns*);\ + Branches asm_branch_helper(bool, LIns* cond, NIns*);\ + Branches asm_branchi_helper(bool, LIns* cond, NIns*);\ + Branches asm_branchd_helper(bool, LIns* cond, NIns*);\ void asm_div_mod(LIns *cond); \ void asm_load(int d, Register r); \ void asm_immd(Register r, uint64_t q, double d, bool canClobberCCs); \ diff --git a/js/src/ref-config/AIX4.1.mk b/js/src/ref-config/AIX4.1.mk deleted file mode 100644 index 09c7cb94cf39..000000000000 --- a/js/src/ref-config/AIX4.1.mk +++ /dev/null @@ -1,65 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for AIX -# - -CC = xlC_r -CCC = xlC_r - -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 - -OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -lbsd -lsvld -lm -#-lpthreads -lc_r - -MKSHLIB = $(LD) -bM:SRE -bh:4 -bnoentry -berok -XLDFLAGS += -lc - -ifdef JS_THREADSAFE -XLDFLAGS += -lsvld -endif diff --git a/js/src/ref-config/AIX4.2.mk b/js/src/ref-config/AIX4.2.mk deleted file mode 100644 index 1e3f1f183d1d..000000000000 --- a/js/src/ref-config/AIX4.2.mk +++ /dev/null @@ -1,64 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for AIX -# - -CC = xlC_r -CCC = xlC_r -CFLAGS += -qarch=com -qnoansialias -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DHAVE_LOCALTIME_R - -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 - -#-lpthreads -lc_r - -MKSHLIB = /usr/lpp/xlC/bin/makeC++SharedLib_r -p 0 -G -berok - -ifdef JS_THREADSAFE -XLDFLAGS += -ldl -endif - diff --git a/js/src/ref-config/AIX4.3.mk b/js/src/ref-config/AIX4.3.mk deleted file mode 100644 index df05d8c9256b..000000000000 --- a/js/src/ref-config/AIX4.3.mk +++ /dev/null @@ -1,65 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for AIX -# - -CC = xlC_r -CCC = xlC_r -CFLAGS += -qarch=com -qnoansialias -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV -DAIX4_3 -DHAVE_LOCALTIME_R - -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< -ARCH := aix -CPU_ARCH = rs6000 -GFX_ARCH = x -INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1 - -#-lpthreads -lc_r - -MKSHLIB_BIN = /usr/ibmcxx/bin/makeC++SharedLib_r -MKSHLIB = $(MKSHLIB_BIN) -p 0 -G -berok -bM:UR - -ifdef JS_THREADSAFE -XLDFLAGS += -ldl -endif - diff --git a/js/src/ref-config/Darwin.mk b/js/src/ref-config/Darwin.mk deleted file mode 100644 index 86c4b9d042dc..000000000000 --- a/js/src/ref-config/Darwin.mk +++ /dev/null @@ -1,85 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = $(CCC) -dynamiclib $(XMKSHLIBOPTS) -framework System - -SO_SUFFIX = dylib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -OS_CFLAGS += -DAVMPLUS_IA32 -DAVMPLUS_UNIX -NANOJIT_ARCH = i386 -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/Darwin1.3.mk b/js/src/ref-config/Darwin1.3.mk deleted file mode 100644 index 05d3767a0d28..000000000000 --- a/js/src/ref-config/Darwin1.3.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DRHAPSODY - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/Darwin1.4.mk b/js/src/ref-config/Darwin1.4.mk deleted file mode 100644 index f7b6af8ec0a0..000000000000 --- a/js/src/ref-config/Darwin1.4.mk +++ /dev/null @@ -1,41 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Mike McCabe -# -# 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 ***** - -include $(DEPTH)/config/Darwin1.3.mk diff --git a/js/src/ref-config/Darwin5.2.mk b/js/src/ref-config/Darwin5.2.mk deleted file mode 100644 index 9b9b6ff0977a..000000000000 --- a/js/src/ref-config/Darwin5.2.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/Darwin5.3.mk b/js/src/ref-config/Darwin5.3.mk deleted file mode 100644 index 9b9b6ff0977a..000000000000 --- a/js/src/ref-config/Darwin5.3.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/Darwin64.mk b/js/src/ref-config/Darwin64.mk deleted file mode 100644 index db195b566902..000000000000 --- a/js/src/ref-config/Darwin64.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_LDFLAGS += -m64 -OS_CFLAGS = -m64 -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN - -RANLIB = ranlib -MKSHLIB = $(CCC) -dynamiclib $(XMKSHLIBOPTS) -framework System - -SO_SUFFIX = dylib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86_64 -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/HP-UXB.10.10.mk b/js/src/ref-config/HP-UXB.10.10.mk deleted file mode 100644 index 8cd9d20671b8..000000000000 --- a/js/src/ref-config/HP-UXB.10.10.mk +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for HPUX -# - -# CC = gcc -# CCC = g++ -# CFLAGS += -Wall -Wno-format -fPIC - -CC = cc -Ae +Z -CCC = CC -Ae +a1 +eh +Z - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = hppa -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -ifeq ($(OS_RELEASE),B.10) -PLATFORM_FLAGS += -DHPUX10 -Dhpux10 -PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H -ifeq ($(OS_VERSION),.10) -PLATFORM_FLAGS += -DHPUX10_10 -endif -ifeq ($(OS_VERSION),.20) -PLATFORM_FLAGS += -DHPUX10_20 -endif -ifeq ($(OS_VERSION),.30) -PLATFORM_FLAGS += -DHPUX10_30 -endif -endif diff --git a/js/src/ref-config/HP-UXB.10.20.mk b/js/src/ref-config/HP-UXB.10.20.mk deleted file mode 100644 index 8cd9d20671b8..000000000000 --- a/js/src/ref-config/HP-UXB.10.20.mk +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for HPUX -# - -# CC = gcc -# CCC = g++ -# CFLAGS += -Wall -Wno-format -fPIC - -CC = cc -Ae +Z -CCC = CC -Ae +a1 +eh +Z - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = hppa -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -ifeq ($(OS_RELEASE),B.10) -PLATFORM_FLAGS += -DHPUX10 -Dhpux10 -PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H -ifeq ($(OS_VERSION),.10) -PLATFORM_FLAGS += -DHPUX10_10 -endif -ifeq ($(OS_VERSION),.20) -PLATFORM_FLAGS += -DHPUX10_20 -endif -ifeq ($(OS_VERSION),.30) -PLATFORM_FLAGS += -DHPUX10_30 -endif -endif diff --git a/js/src/ref-config/HP-UXB.11.00.mk b/js/src/ref-config/HP-UXB.11.00.mk deleted file mode 100644 index 239188d6011b..000000000000 --- a/js/src/ref-config/HP-UXB.11.00.mk +++ /dev/null @@ -1,80 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for HPUX -# - -ifdef NS_USE_NATIVE - CC = cc +Z +DAportable +DS2.0 +u4 -# LD = aCC +Z -b -Wl,+s -Wl,-B,symbolic -else - CC = gcc -Wall -Wno-format -fPIC - CCC = g++ -Wall -Wno-format -fPIC -endif - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = hppa -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_HPUX -DNATIVE -D_POSIX_C_SOURCE=199506L -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -XLDFLAGS = -lpthread - -ifeq ($(OS_RELEASE),B.10) -PLATFORM_FLAGS += -DHPUX10 -Dhpux10 -PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H -ifeq ($(OS_VERSION),.10) -PLATFORM_FLAGS += -DHPUX10_10 -endif -ifeq ($(OS_VERSION),.20) -PLATFORM_FLAGS += -DHPUX10_20 -endif -ifeq ($(OS_VERSION),.30) -PLATFORM_FLAGS += -DHPUX10_30 -endif -endif diff --git a/js/src/ref-config/HP-UXB.11.31.mk b/js/src/ref-config/HP-UXB.11.31.mk deleted file mode 100644 index 8c1cc40ad1da..000000000000 --- a/js/src/ref-config/HP-UXB.11.31.mk +++ /dev/null @@ -1,65 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for HPUX -# -ifdef NS_USE_NATIVE - CC = cc +Z +u4 -else - CC = gcc -Wall -Wno-format -fPIC - CCC = g++ -Wall -Wno-format -fPIC -endif - -RANLIB = echo -MKSHLIB = $(LD) -b - -SO_SUFFIX = sl - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = ia64 -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_HPUX \ - -DNATIVE -D_POSIX_C_SOURCE=199506L -DHAVE_LOCALTIME_R -OS_LIBS = -ldld - -XLDFLAGS = -lpthread diff --git a/js/src/ref-config/IRIX.mk b/js/src/ref-config/IRIX.mk deleted file mode 100644 index 88b162f22715..000000000000 --- a/js/src/ref-config/IRIX.mk +++ /dev/null @@ -1,87 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX -# - -CPU_ARCH = mips -GFX_ARCH = x - -RANLIB = /bin/true - -#NS_USE_GCC = 1 - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -AS = $(CC) -x assembler-with-cpp -ODD_CFLAGS = -Wall -Wno-format -ifdef BUILD_OPT -OPTIMIZER = -O6 -endif -else -ifeq ($(OS_RELEASE),6.2) -CC = cc -n32 -DIRIX6_2 -endif -ifeq ($(OS_RELEASE),6.3) -CC = cc -n32 -DIRIX6_3 -endif -ifeq ($(OS_RELEASE),6.5) -CC = cc -n32 -DIRIX6_5 -endif -CCC = CC -# LD = CC -ODD_CFLAGS = -fullwarn -xansi -ifdef BUILD_OPT -OPTIMIZER += -Olimit 4000 -endif -endif - -# For purify -HAVE_PURIFY = 1 -PURE_OS_CFLAGS = $(ODD_CFLAGS) -DXP_UNIX -DSVR4 -DSW_THREADS -DIRIX -DHAVE_LOCALTIME_R - -OS_CFLAGS = $(PURE_OS_CFLAGS) -MDupdate $(DEPENDENCIES) - -BSDECHO = echo -MKSHLIB = $(LD) -n32 -shared - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 diff --git a/js/src/ref-config/IRIX5.3.mk b/js/src/ref-config/IRIX5.3.mk deleted file mode 100644 index f38cc94874bb..000000000000 --- a/js/src/ref-config/IRIX5.3.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX5.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/ref-config/IRIX6.1.mk b/js/src/ref-config/IRIX6.1.mk deleted file mode 100644 index 354f1d119d91..000000000000 --- a/js/src/ref-config/IRIX6.1.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX6.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/ref-config/IRIX6.2.mk b/js/src/ref-config/IRIX6.2.mk deleted file mode 100644 index 354f1d119d91..000000000000 --- a/js/src/ref-config/IRIX6.2.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX6.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/ref-config/IRIX6.3.mk b/js/src/ref-config/IRIX6.3.mk deleted file mode 100644 index 354f1d119d91..000000000000 --- a/js/src/ref-config/IRIX6.3.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX6.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/ref-config/IRIX6.5.mk b/js/src/ref-config/IRIX6.5.mk deleted file mode 100644 index 354f1d119d91..000000000000 --- a/js/src/ref-config/IRIX6.5.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for IRIX6.3 -# - -include $(DEPTH)/config/IRIX.mk diff --git a/js/src/ref-config/Linux_All.mk b/js/src/ref-config/Linux_All.mk deleted file mode 100644 index 6c289b4045b6..000000000000 --- a/js/src/ref-config/Linux_All.mk +++ /dev/null @@ -1,105 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for all versions of Linux -# - -CC = gcc -CCC = g++ -LD = g++ -CFLAGS += -Wall -Wno-format -MMD -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R -DLINUX - -RANLIB = echo -MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS) - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -# don't filter in x86-64 architecture -ifneq (x86_64,$(CPU_ARCH)) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS += -DX86_LINUX -DAVMPLUS_IA32 -DAVMPLUS_UNIX -DAVMPLUS_LINUX -NANOJIT_ARCH = i386 -endif # 86 -endif # !x86_64 - -#JIT disabled until x64 port is cleaned up -#ifeq ($(CPU_ARCH),x86_64) -#OS_CFLAGS += -DAVMPLUS_AMD64 -DAVMPLUS_64BIT -DAVMPLUS_UNIX -DAVMPLUS_LINUX -#NANOJIT_ARCH = i386 -#endif - -ifeq ($(CPU_ARCH),arm) -OS_CFLAGS += -DAVMPLUS_ARM -DAVMPLUS_UNIX -DAVMPLUS_LINUX -NANOJIT_ARCH = ARM -endif - -GFX_ARCH = x - -OS_LIBS = -lm -lc - -ASFLAGS += -x assembler-with-cpp - - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -ifeq ($(CPU_ARCH),x86_64) -# Use VA_COPY() standard macro on x86-64 -# FIXME: better use it everywhere -OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy -endif - -ifeq ($(CPU_ARCH),x86_64) -# We need PIC code for shared libraries -# FIXME: better patch rules.mk & fdlibm/Makefile* -OS_CFLAGS += -DPIC -fPIC -endif diff --git a/js/src/ref-config/Mac_OS10.0.mk b/js/src/ref-config/Mac_OS10.0.mk deleted file mode 100644 index 74ba151e3b57..000000000000 --- a/js/src/ref-config/Mac_OS10.0.mk +++ /dev/null @@ -1,82 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Steve Zellers (zellers@apple.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 ***** - -# -# Config for Mac OS X as of PR3 -# Just ripped from Linux config -# - -CC = cc -CCC = g++ -CFLAGS += -Wall -Wno-format -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE --DRHAPSODY - -RANLIB = ranlib -MKSHLIB = libtool -dynamic $(XMKSHLIBOPTS) -framework System - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = $(shell uname -m) -ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 -OS_CFLAGS+= -DX86_LINUX -endif -GFX_ARCH = x - -OS_LIBS = -lc -framework System - -ASFLAGS += -x assembler-with-cpp - -ifeq ($(CPU_ARCH),alpha) - -# Ask the C compiler on alpha linux to let us work with denormalized -# double values, which are required by the ECMA spec. - -OS_CFLAGS += -mieee -endif - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 - -# Don't allow Makefile.ref to use libmath -NO_LIBM = 1 - diff --git a/js/src/ref-config/OSF1V4.0.mk b/js/src/ref-config/OSF1V4.0.mk deleted file mode 100644 index 337ca745926d..000000000000 --- a/js/src/ref-config/OSF1V4.0.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for Data General DG/UX -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -mieee -Wall -Wno-format -else -CC = cc -CCC = cxx -CFLAGS += -ieee -std -# LD = cxx -endif - -RANLIB = echo -MKSHLIB = $(LD) -shared -taso -all -expect_unresolved "*" - -# -# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if -# you're not using DG's compiler. It shouldn't hurt if you are. -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE -DOSF1 -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/ref-config/OSF1V5.0.mk b/js/src/ref-config/OSF1V5.0.mk deleted file mode 100644 index b65738c4e43c..000000000000 --- a/js/src/ref-config/OSF1V5.0.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for Tru64 Unix 5.0 -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -mieee -Wall -Wno-format -else -CC = cc -CCC = cxx -CFLAGS += -ieee -std -pthread -# LD = cxx -endif - -RANLIB = echo -MKSHLIB = $(LD) -shared -all -expect_unresolved "*" - -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_POSIX4A_DRAFT10_SOURCE -DOSF1 -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/ref-config/SunOS4.1.4.mk b/js/src/ref-config/SunOS4.1.4.mk deleted file mode 100644 index 62f4815b4627..000000000000 --- a/js/src/ref-config/SunOS4.1.4.mk +++ /dev/null @@ -1,101 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS4.1 -# - -CC = gcc -CCC = g++ -RANLIB = ranlib - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -# A pile of -D's to build xfe on sunos -MOZ_CFLAGS = -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP \ - -DNO_REGCOMP -DUSE_GETWD -DNO_MEMMOVE -DNO_ALLOCA \ - -DBOGUS_MB_MAX -DNO_CONST - -# Purify doesn't like -MDupdate -NOMD_OS_CFLAGS = -DXP_UNIX -Wall -Wno-format -DSW_THREADS -DSUNOS4 -DNEED_SYSCALL \ - $(MOZ_CFLAGS) - -OS_CFLAGS = $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) -OS_LIBS = -ldl -lm - -MKSHLIB = $(LD) -L$(MOTIF)/lib - -HAVE_PURIFY = 1 -MOTIF = /home/motif/usr -MOTIFLIB = -L$(MOTIF)/lib -lXm -INCLUDES += -I/usr/X11R5/include -I$(MOTIF)/include - -NOSUCHFILE = /solaris-rm-f-sucks - -LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm - -EN_LOCALE = en_US -DE_LOCALE = de -FR_LOCALE = fr -JP_LOCALE = ja -SJIS_LOCALE = ja_JP.SJIS -KR_LOCALE = ko -CN_LOCALE = zh -TW_LOCALE = zh_TW -I2_LOCALE = i2 -IT_LOCALE = it -SV_LOCALE = sv -ES_LOCALE = es -NL_LOCALE = nl -PT_LOCALE = pt - -LOC_LIB_DIR = /usr/openwin/lib/locale - -BSDECHO = echo - -# -# These defines are for building unix plugins -# -BUILD_UNIX_PLUGINS = 1 -DSO_LDOPTS = -DSO_LDFLAGS = diff --git a/js/src/ref-config/SunOS5.10.mk b/js/src/ref-config/SunOS5.10.mk deleted file mode 100644 index dc0b0a091898..000000000000 --- a/js/src/ref-config/SunOS5.10.mk +++ /dev/null @@ -1,50 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.10, using vendor gcc and NSPR -# - -include $(DEPTH)/config/SunOS5.5.mk - -INCLUDES += -I/usr/sfw/include/mozilla/nspr -OTHER_LIBS += -L/usr/sfw/lib/mozilla -R/usr/sfw/lib/mozilla - -CC=gcc - diff --git a/js/src/ref-config/SunOS5.3.mk b/js/src/ref-config/SunOS5.3.mk deleted file mode 100644 index bd615dee404f..000000000000 --- a/js/src/ref-config/SunOS5.3.mk +++ /dev/null @@ -1,91 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.3 -# - -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format - -#CC = /opt/SUNWspro/SC3.0.1/bin/cc -RANLIB = echo - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifndef JS_NO_ULTRA -ULTRA_OPTIONS := -xarch=v8plus -ULTRA_OPTIONSD := -DULTRA_SPARC -else -ULTRA_OPTIONS := -xarch=v8 -ULTRA_OPTIONSD := -endif - -ifeq ($(OS_CPUARCH),sun4u) -DEFINES += $(ULTRA_OPTIONSD) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD) -else -ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD) -endif -endif - -ifeq ($(OS_CPUARCH),sun4m) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,-xarch=v8 -else -ASFLAGS += -xarch=v8 -endif -endif - -MKSHLIB = $(LD) -G diff --git a/js/src/ref-config/SunOS5.4.mk b/js/src/ref-config/SunOS5.4.mk deleted file mode 100644 index de019247a2d7..000000000000 --- a/js/src/ref-config/SunOS5.4.mk +++ /dev/null @@ -1,92 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.4 -# - -ifdef NS_USE_NATIVE -CC = cc -CCC = CC -else -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format -endif - -RANLIB = echo - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D__svr4 -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifndef JS_NO_ULTRA -ULTRA_OPTIONS := -xarch=v8plus -ULTRA_OPTIONSD := -DULTRA_SPARC -else -ULTRA_OPTIONS := -xarch=v8 -ULTRA_OPTIONSD := -endif - -ifeq ($(OS_CPUARCH),sun4u) -DEFINES += $(ULTRA_OPTIONSD) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD) -else -ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD) -endif -endif - -ifeq ($(OS_CPUARCH),sun4m) -ifeq ($(findstring gcc,$(CC)),gcc) -DEFINES += -Wa,-xarch=v8 -else -ASFLAGS += -xarch=v8 -endif -endif - -MKSHLIB = $(LD) -G diff --git a/js/src/ref-config/SunOS5.5.1.mk b/js/src/ref-config/SunOS5.5.1.mk deleted file mode 100644 index 648f72ffa0d5..000000000000 --- a/js/src/ref-config/SunOS5.5.1.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.5.1 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/ref-config/SunOS5.5.mk b/js/src/ref-config/SunOS5.5.mk deleted file mode 100644 index e26b3a3e0ec1..000000000000 --- a/js/src/ref-config/SunOS5.5.mk +++ /dev/null @@ -1,87 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.5 -# - -AS = /usr/ccs/bin/as -ifndef NS_USE_NATIVE -CC = gcc -CCC = g++ -CFLAGS += -Wall -Wno-format -else -CC = cc -CCC = CC -endif - -RANLIB = echo - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifeq ($(OS_CPUARCH),sun4u) # ultra sparc? -ifeq ($(CC),gcc) # using gcc? -ifndef JS_NO_ULTRA # do we want ultra? -ifdef JS_THREADSAFE # only in thread-safe mode -DEFINES += -DULTRA_SPARC -DEFINES += -Wa,-xarch=v8plus,-DULTRA_SPARC -else -ASFLAGS += -xarch=v8plus -DULTRA_SPARC -endif -endif -endif -endif - -MKSHLIB = $(LD) -G - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 diff --git a/js/src/ref-config/SunOS5.6.mk b/js/src/ref-config/SunOS5.6.mk deleted file mode 100644 index efe11528435a..000000000000 --- a/js/src/ref-config/SunOS5.6.mk +++ /dev/null @@ -1,89 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.5 -# - -AS = /usr/ccs/bin/as -ifndef NS_USE_NATIVE - CC = gcc - CCC = g++ - CFLAGS += -Wall -Wno-format -else - CC = cc - CCC = CC - CFLAGS += -mt -KPIC -# LD = CC -endif - -RANLIB = echo - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = sparc -GFX_ARCH = x - -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl -ldl - -ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0 - -HAVE_PURIFY = 1 - -NOSUCHFILE = /solaris-rm-f-sucks - -ifeq ($(OS_CPUARCH),sun4u) # ultra sparc? -ifeq ($(CC),gcc) # using gcc? -ifndef JS_NO_ULTRA # do we want ultra? -ifdef JS_THREADSAFE # only in thread-safe mode -DEFINES += -DULTRA_SPARC -DEFINES += -Wa,-xarch=v8plus,-DULTRA_SPARC -else -ASFLAGS += -xarch=v8plus -DULTRA_SPARC -endif -endif -endif -endif - -MKSHLIB = $(LD) -G - -# Use the editline library to provide line-editing support. -JS_EDITLINE = 1 diff --git a/js/src/ref-config/SunOS5.7.mk b/js/src/ref-config/SunOS5.7.mk deleted file mode 100644 index 2cb02f29590f..000000000000 --- a/js/src/ref-config/SunOS5.7.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.7 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/ref-config/SunOS5.8.mk b/js/src/ref-config/SunOS5.8.mk deleted file mode 100644 index dd8a32d47b18..000000000000 --- a/js/src/ref-config/SunOS5.8.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.8 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/ref-config/SunOS5.9.mk b/js/src/ref-config/SunOS5.9.mk deleted file mode 100644 index b01ec9c26fcd..000000000000 --- a/js/src/ref-config/SunOS5.9.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for SunOS5.9 -# - -include $(DEPTH)/config/SunOS5.5.mk diff --git a/js/src/ref-config/WINNT4.0.mk b/js/src/ref-config/WINNT4.0.mk deleted file mode 100644 index 1d36f91b84fe..000000000000 --- a/js/src/ref-config/WINNT4.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/ref-config/WINNT5.0.mk b/js/src/ref-config/WINNT5.0.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/ref-config/WINNT5.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/ref-config/WINNT5.1.mk b/js/src/ref-config/WINNT5.1.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/ref-config/WINNT5.1.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/ref-config/WINNT5.2.mk b/js/src/ref-config/WINNT5.2.mk deleted file mode 100644 index 5fbcbfe09f38..000000000000 --- a/js/src/ref-config/WINNT5.2.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -DAVMPLUS_WIN32 -DAVMPLUS_IA32 -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/ref-config/WINNT6.0.mk b/js/src/ref-config/WINNT6.0.mk deleted file mode 100644 index 7681e016d6a5..000000000000 --- a/js/src/ref-config/WINNT6.0.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config for Windows NT using MS Visual C++ (version?) -# - -CC = cl -CXX = cl - -RANLIB = echo - -PDBFILE = $(basename $(@F)).pdb - -#.c.o: -# $(CC) -c -MD $*.d $(CFLAGS) $< - -CPU_ARCH = x86 # XXX fixme -GFX_ARCH = win32 - -# MSVC compiler options for both debug/optimize -# -nologo - suppress copyright message -# -W3 - Warning level 3 -# -Gm - enable minimal rebuild -# -Z7 - put debug info into the executable, not in .pdb file -# -Zi - put debug info into .pdb file -# -YX - automatic precompiled headers -# -GX - enable C++ exception support -WIN_CFLAGS = -nologo -W3 - -# MSVC compiler options for debug builds linked to MSVCRTD.DLL -# -MDd - link with MSVCRTD.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_IDG_CFLAGS = -MDd -Od -Z7 - -# MSVC compiler options for debug builds linked to MSVCRT.DLL -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, debug C-runtime) -# -Od - minimal optimization -WIN_DEBUG_CFLAGS = -MD -Od -Zi -Fd$(OBJDIR)/$(PDBFILE) - -# MSVC compiler options for release (optimized) builds -# -MD - link with MSVCRT.LIB (Dynamically-linked, multi-threaded, C-runtime) -# -O2 - Optimize for speed -# -G5 - Optimize for Pentium -WIN_OPT_CFLAGS = -MD -O2 - -ifdef BUILD_OPT -OPTIMIZER = $(WIN_OPT_CFLAGS) -else -ifdef BUILD_IDG -OPTIMIZER = $(WIN_IDG_CFLAGS) -else -OPTIMIZER = $(WIN_DEBUG_CFLAGS) -endif -endif - -OS_CFLAGS = -D_X86_=1 -DXP_WIN -DXP_WIN32 -DWIN32 -D_WINDOWS -D_WIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 $(WIN_CFLAGS) -JSDLL_CFLAGS = -DEXPORT_JS_API -OS_LIBS = -lm -lc - -PREBUILT_CPUCFG = 1 -USE_MSVC = 1 - -LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib \ - winmm.lib \ - -nologo\ - -subsystem:windows -dll -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib -nologo\ - -subsystem:console -debug -pdb:$(OBJDIR)/$(PDBFILE)\ - -machine:I386\ - -opt:ref -opt:noicf - -# CAFEDIR = t:/cafe -# JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip -# JAVAC = $(CAFEDIR)/Bin/sj.exe -# JAVAH = $(CAFEDIR)/Java/Bin/javah.exe -# JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32 diff --git a/js/src/ref-config/dgux.mk b/js/src/ref-config/dgux.mk deleted file mode 100644 index 3b5967e3d1fc..000000000000 --- a/js/src/ref-config/dgux.mk +++ /dev/null @@ -1,64 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# 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 ***** - -# -# Config stuff for Data General DG/UX -# - -# -# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com) -# - -AS = as -CC = gcc -CCC = g++ - -RANLIB = echo - -# -# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if -# you're not using DG's compiler. It shouldn't hurt if you are. -# -# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in -# prtime.c -# -OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE -DHAVE_LOCALTIME_R -OS_LIBS = -lsocket -lnsl - -NOSUCHFILE = /no-such-file diff --git a/js/src/rules.mk b/js/src/rules.mk deleted file mode 100644 index 5a1e0533f54b..000000000000 --- a/js/src/rules.mk +++ /dev/null @@ -1,206 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** 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 Mozilla Communicator client code, released -# March 31, 1998. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998-1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Michael Ang -# -# Alternatively, the contents of this file may be used under the terms of -# either of 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 ***** - -# -# JSRef GNUmake makefile rules -# - -ifdef USE_MSVC -LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.obj)) -PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.obj)) -else -LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.o)) -LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o)) -PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.o)) -endif - -CPPFILES = $(LIB_CPPFILES) $(PROG_CPPFILES) -OBJS = $(LIB_OBJS) $(PROG_OBJS) - -ifdef USE_MSVC -# TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet -TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now -else -TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) -endif - -all: - +$(LOOP_OVER_PREDIRS) -ifneq "$(strip $(TARGETS))" "" - $(MAKE) -f Makefile.ref $(TARGETS) -endif - +$(LOOP_OVER_DIRS) - -$(OBJDIR)/%: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $@ $(CFLAGS) $(OPTIMIZER) $< $(LDFLAGS) - -# This rule must come before the rule with no dep on header -$(OBJDIR)/%.o: %.cpp %.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $< - -$(OBJDIR)/jsinterp.o: jsinterp.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp - -$(OBJDIR)/jsbuiltins.o: jsbuiltins.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp - -$(OBJDIR)/%.o: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $< - -$(OBJDIR)/%.o: %.s - @$(MAKE_OBJDIR) - $(AS) -o $@ $(ASFLAGS) $< - -# This rule must come before rule with no dep on header -$(OBJDIR)/%.obj: %.cpp %.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $< - -$(OBJDIR)/jsinterp.obj: jsinterp.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp - -$(OBJDIR)/jsbuiltins.obj: jsbuiltins.cpp jsinterp.h - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp - -$(OBJDIR)/%.obj: %.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $< - -$(OBJDIR)/js.obj: js.cpp - @$(MAKE_OBJDIR) - $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $< - -ifeq ($(OS_ARCH),OS2) -$(LIBRARY): $(LIB_OBJS) - $(AR) $@ $? $(AR_OS2_SUFFIX) - $(RANLIB) $@ -else -ifdef USE_MSVC -$(SHARED_LIBRARY): $(LIB_OBJS) - link.exe $(LIB_LINK_FLAGS) /base:0x61000000 $(OTHER_LIBS) \ - /out:"$@" /pdb:none\ - /implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^ -else -$(LIBRARY): $(LIB_OBJS) - $(AR) rv $@ $? - $(RANLIB) $@ - -$(SHARED_LIBRARY): $(LIB_OBJS) - $(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS) -endif -endif - -# Java stuff -$(CLASSDIR)/$(OBJDIR)/$(JARPATH)/%.class: %.java - mkdir -p $(@D) - $(JAVAC) $(JAVAC_FLAGS) $< - -define MAKE_OBJDIR -if test ! -d $(@D); then rm -rf $(@D); mkdir -p $(@D); fi -endef - -ifdef DIRS -LOOP_OVER_DIRS = \ - @for d in $(DIRS); do \ - if test -d $$d; then \ - set -e; \ - echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \ - cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \ - set +e; \ - else \ - echo "Skipping non-directory $$d..."; \ - fi; \ - done -endif - -ifdef PREDIRS -LOOP_OVER_PREDIRS = \ - @for d in $(PREDIRS); do \ - if test -d $$d; then \ - set -e; \ - echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \ - cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \ - set +e; \ - else \ - echo "Skipping non-directory $$d..."; \ - fi; \ - done -endif - -export: - +$(LOOP_OVER_PREDIRS) - mkdir -p $(DIST)/include $(DIST)/$(LIBDIR) $(DIST)/bin -ifneq "$(strip $(HFILES))" "" - $(CP) $(HFILES) $(DIST)/include -endif -ifneq "$(strip $(LIBRARY))" "" - $(CP) $(LIBRARY) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(JARS))" "" - $(CP) $(JARS) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(SHARED_LIBRARY))" "" - $(CP) $(SHARED_LIBRARY) $(DIST)/$(LIBDIR) -endif -ifneq "$(strip $(PROGRAM))" "" - $(CP) $(PROGRAM) $(DIST)/bin -endif - +$(LOOP_OVER_DIRS) - -clean: - +$(LOOP_OVER_PREDIRS) - rm -rf $(OBJS) $(GARBAGE) - -clobber: - +$(LOOP_OVER_PREDIRS) - rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES) $(GARBAGE) - if test -d $(OBJDIR); then rmdir $(OBJDIR); fi - -tar: - tar cvf $(TARNAME) $(TARFILES) - gzip $(TARNAME) - diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index da738aa460f7..2360e7dd313a 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -404,6 +404,8 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY, JSBool la JSString *str; char *buffer; size_t size; + jschar *uc_buffer; + size_t uc_len; int lineno; int startline; FILE *file; @@ -522,11 +524,20 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY, JSBool la hitEOF = JS_TRUE; break; } - } while (!JS_BufferIsCompilableUnit(cx, obj, buffer, len)); + } while (!JS_BufferIsCompilableUnit(cx, JS_TRUE, obj, buffer, len)); if (hitEOF && !buffer) break; + if (!JS_DecodeUTF8(cx, buffer, len, NULL, &uc_len)) { + JS_ReportError(cx, "Invalid UTF-8 in input"); + gExitCode = EXITCODE_RUNTIME_ERROR; + return; + } + + uc_buffer = (jschar*)malloc(uc_len * sizeof(jschar)); + JS_DecodeUTF8(cx, buffer, len, uc_buffer, &uc_len); + /* Clear any pending exception from previous failed compiles. */ JS_ClearPendingException(cx); @@ -534,8 +545,8 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY, JSBool la oldopts = JS_GetOptions(cx); if (!compileOnly) JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO); - scriptObj = JS_CompileScript(cx, obj, buffer, len, "typein", - startline); + scriptObj = JS_CompileUCScript(cx, obj, uc_buffer, uc_len, "typein", + startline); if (!compileOnly) JS_SetOptions(cx, oldopts); @@ -553,6 +564,7 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY, JSBool la } } *buffer = '\0'; + free(uc_buffer); } while (!hitEOF && !gQuitting); free(buffer); @@ -577,6 +589,8 @@ usage(void) " -w Report strict warnings\n" " -W Do not report strict warnings\n" " -x Toggle JSOPTION_XML flag\n" + " -U Enable UTF-8 C-strings; also affects scripts loaded via\n" + " run, snarf, read, or entered into the REPL\n" " -C Compile-only; do not execute\n" " -i Enable interactive read-eval-print loop\n" " -j Enable the TraceMonkey tracing JIT\n" @@ -957,6 +971,9 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc) break; #endif + case 'U': /* Already handled in main() */ + break; + default: return usage(); } @@ -1127,8 +1144,21 @@ FileAsString(JSContext *cx, const char *pathname) JS_ReportError(cx, "can't read %s: %s", pathname, (ptrdiff_t(cc) < 0) ? strerror(errno) : "short read"); } else { + jschar *ucbuf; + size_t uclen; + len = (size_t)cc; - str = JS_NewStringCopyN(cx, buf, len); + + if (!JS_DecodeUTF8(cx, buf, len, NULL, &uclen)) { + JS_ReportError(cx, "Invalid UTF-8 in file '%s'", pathname); + gExitCode = EXITCODE_RUNTIME_ERROR; + return NULL; + } + + ucbuf = (jschar*)malloc(uclen * sizeof(jschar)); + JS_DecodeUTF8(cx, buf, len, ucbuf, &uclen); + str = JS_NewUCStringCopyN(cx, ucbuf, uclen); + free(ucbuf); } JS_free(cx, buf); } @@ -5956,6 +5986,13 @@ main(int argc, char **argv, char **envp) argc--; argv++; + int i; + for (i = 0; i < argc; i++) { + if (argv[i][0] == '-' && argv[i][1] == 'U' && argv[i][2] == '\0') { + JS_SetCStringsAreUTF8(); + } + } + #ifdef XP_WIN // Set the timer calibration delay count to 0 so we get high // resolution right away, which we need for precise benchmarking. diff --git a/js/src/tests/ecma_5/String/jstests.list b/js/src/tests/ecma_5/String/jstests.list index b9cdebc4b589..7eba4e98e66f 100644 --- a/js/src/tests/ecma_5/String/jstests.list +++ b/js/src/tests/ecma_5/String/jstests.list @@ -5,3 +5,4 @@ script 15.5.4.11-01.js script split-01.js script split-undefined-separator.js script split-xregexp.js +script string-object-length.js diff --git a/js/src/tests/ecma_5/String/string-object-length.js b/js/src/tests/ecma_5/String/string-object-length.js new file mode 100644 index 000000000000..a68a3f6f8305 --- /dev/null +++ b/js/src/tests/ecma_5/String/string-object-length.js @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +var BUGNUMBER = 650621; +var summary = 'String object length test'; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +assertEq(raisesException(InternalError)('for (args = "" ;;) args+=new String(args)+1'), true); + +reportCompare(true, true); + diff --git a/js/src/tests/js1_8_5/extensions/jstests.list b/js/src/tests/js1_8_5/extensions/jstests.list index db83c5a9d99d..c8dabff618fd 100644 --- a/js/src/tests/js1_8_5/extensions/jstests.list +++ b/js/src/tests/js1_8_5/extensions/jstests.list @@ -40,3 +40,5 @@ script regress-631723.js skip-if(!xulRuntime.shell) script regress-636818.js script regress-636697.js script is-generator.js +script weakmap.js +script regress-650753.js diff --git a/js/src/tests/js1_8_5/extensions/regress-650753.js b/js/src/tests/js1_8_5/extensions/regress-650753.js new file mode 100644 index 000000000000..a518ec52a3aa --- /dev/null +++ b/js/src/tests/js1_8_5/extensions/regress-650753.js @@ -0,0 +1,8 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +var x = {}, h = new WeakMap; +h.set(x, null); +gc(); + +reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/js1_8_5/extensions/weakmap.js b/js/src/tests/js1_8_5/extensions/weakmap.js new file mode 100644 index 000000000000..92eee6f872ae --- /dev/null +++ b/js/src/tests/js1_8_5/extensions/weakmap.js @@ -0,0 +1,103 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: + * Andreas Gal + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 547941; +var summary = 'js weak maps'; +var actual = ''; +var expect = ''; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + var TestPassCount = 0; + var TestFailCount = 0; + var TestTodoCount = 0; + + var TODO = 1; + + function check(fun, todo) { + var thrown = null; + var success = false; + try { + success = fun(); + } catch (x) { + thrown = x; + } + + if (thrown) + success = false; + + if (todo) { + TestTodoCount++; + + if (success) { + var ex = new Error; + print ("=== TODO but PASSED? ==="); + print (ex.stack); + print ("========================"); + } + + return; + } + + if (success) { + TestPassCount++; + } else { + TestFailCount++; + + var ex = new Error; + print ("=== FAILED ==="); + print (ex.stack); + if (thrown) { + print (" threw exception:"); + print (thrown); + } + print ("=============="); + } + } + + function checkThrows(fun, todo) { + let thrown = false; + try { + fun(); + } catch (x) { + thrown = true; + } + + check(function() thrown, todo); + } + + var key = {}; + var map = WeakMap(); + + check(function() !map.has(key)); + map.set(key, 42); + check(function() map.get(key) == 42); + check(function() typeof map.get({}) == "undefined"); + check(function() map.get({}, "foo") == "foo"); + + gc(); gc(); gc(); + + check(function() map.get(key) == 42); + map.delete(key); + check(function() typeof map.get(key) == "undefined"); + check(function() !map.has(key)); + + print ("done"); + + reportCompare(0, TestFailCount, "weak map tests"); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8_5/regress/jstests.list b/js/src/tests/js1_8_5/regress/jstests.list index 70a208b23637..4d8bcc0714b4 100644 --- a/js/src/tests/js1_8_5/regress/jstests.list +++ b/js/src/tests/js1_8_5/regress/jstests.list @@ -100,4 +100,8 @@ script regress-636394.js script regress-636364.js script regress-640075.js script regress-642247.js +script regress-646820-1.js +script regress-646820-2.js +script regress-646820-3.js script regress-643222.js +script regress-614714.js diff --git a/js/src/tests/js1_8_5/regress/regress-614714.js b/js/src/tests/js1_8_5/regress/regress-614714.js new file mode 100644 index 000000000000..4d387279cdb8 --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-614714.js @@ -0,0 +1,12 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +function f(reportCompare) { + if (typeof clear === 'function') + clear(this); + return f; +} + +// This must be called before clear(). +reportCompare(0, 0, 'ok'); +f(); // don't assert diff --git a/js/src/tests/js1_8_5/regress/regress-646820-1.js b/js/src/tests/js1_8_5/regress/regress-646820-1.js new file mode 100644 index 000000000000..535878d50976 --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-646820-1.js @@ -0,0 +1,9 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +(function () { + var [x, y] = [1, function () x]; + assertEq(y(), 1); +})(); + +reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/js1_8_5/regress/regress-646820-2.js b/js/src/tests/js1_8_5/regress/regress-646820-2.js new file mode 100644 index 000000000000..a6c9d5a818df --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-646820-2.js @@ -0,0 +1,11 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +(function () { + var obj = {prop: 1}; + var [x, {prop: y}] = [function () y, obj]; + assertEq(y, 1); + assertEq(x(), 1); +})(); + +reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/js1_8_5/regress/regress-646820-3.js b/js/src/tests/js1_8_5/regress/regress-646820-3.js new file mode 100644 index 000000000000..15166f78f826 --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-646820-3.js @@ -0,0 +1,9 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +(function () { + var [x, y] = {"0": function () y, "1": 13}; + assertEq(x(), 13); +})(); + +reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/manifest.py b/js/src/tests/manifest.py index 0603e208200b..c51c8015b277 100644 --- a/js/src/tests/manifest.py +++ b/js/src/tests/manifest.py @@ -9,7 +9,7 @@ from tests import TestCase def split_path_into_dirs(path): - dirs = [] + dirs = [path] while path != "/": path = os.path.dirname(path) dirs.append(path) @@ -43,8 +43,9 @@ class XULInfo: path = None for dir in dirs: - path = os.path.join(dir, 'config/autoconf.mk') - if os.path.isfile(path): + _path = os.path.join(dir, 'config/autoconf.mk') + if os.path.isfile(_path): + path = _path break if path == None: diff --git a/js/src/tracejit/Writer.h b/js/src/tracejit/Writer.h index 1e5e751a1e9e..448560553e51 100644 --- a/js/src/tracejit/Writer.h +++ b/js/src/tracejit/Writer.h @@ -55,7 +55,7 @@ namespace nj = nanojit; #define JS_JIT_SPEW #endif -#if defined(JS_JIT_SPEW) || defined(NJ_NO_VARIADIC_MACROS) +#if defined(JS_JIT_SPEW) enum LC_TMBits { /* diff --git a/js/src/v8/base.js b/js/src/v8/base.js index f8edc5564901..ffabf24ddafc 100644 --- a/js/src/v8/base.js +++ b/js/src/v8/base.js @@ -78,7 +78,7 @@ BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. -BenchmarkSuite.version = '5'; +BenchmarkSuite.version = '6'; // To make the benchmark results predictable, we replace Math.random @@ -198,15 +198,33 @@ BenchmarkSuite.prototype.NotifyError = function(error) { // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. -BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { - var elapsed = 0; - var start = new Date(); - for (var n = 0; elapsed < 1000; n++) { - benchmark.run(); - elapsed = new Date() - start; +BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark, data) { + function Measure(data) { + var elapsed = 0; + var start = new Date(); + for (var n = 0; elapsed < 1000; n++) { + benchmark.run(); + elapsed = new Date() - start; + } + if (data != null) { + data.runs += n; + data.elapsed += elapsed; + } + } + + if (data == null) { + // Measure the benchmark once for warm up and throw the result + // away. Return a fresh data object. + Measure(null); + return { runs: 0, elapsed: 0 }; + } else { + Measure(data); + // If we've run too few iterations, we continue for another second. + if (data.runs < 32) return data; + var usec = (data.elapsed * 1000) / data.runs; + this.NotifyStep(new BenchmarkResult(benchmark, usec)); + return null; } - var usec = (elapsed * 1000) / n; - this.NotifyStep(new BenchmarkResult(benchmark, usec)); } @@ -220,6 +238,7 @@ BenchmarkSuite.prototype.RunStep = function(runner) { var length = this.benchmarks.length; var index = 0; var suite = this; + var data; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the @@ -241,12 +260,13 @@ BenchmarkSuite.prototype.RunStep = function(runner) { function RunNextBenchmark() { try { - suite.RunSingleBenchmark(suite.benchmarks[index]); + data = suite.RunSingleBenchmark(suite.benchmarks[index], data); } catch (e) { suite.NotifyError(e); return null; } - return RunNextTearDown; + // If data is null, we're done with this benchmark. + return (data == null) ? RunNextTearDown : RunNextBenchmark(); } function RunNextTearDown() { @@ -262,4 +282,3 @@ BenchmarkSuite.prototype.RunStep = function(runner) { // Start out running the setup. return RunNextSetup(); } - diff --git a/js/src/v8/crypto.js b/js/src/v8/crypto.js index e284f67595f8..ffa69b53bbfe 100644 --- a/js/src/v8/crypto.js +++ b/js/src/v8/crypto.js @@ -31,7 +31,7 @@ // The code has been adapted for use as a benchmark by Google. -var Crypto = new BenchmarkSuite('Crypto', 203037, [ +var Crypto = new BenchmarkSuite('Crypto', 266181, [ new Benchmark("Encrypt", encrypt), new Benchmark("Decrypt", decrypt) ]); @@ -1406,7 +1406,9 @@ function rng_seed_int(x) { // Mix in the current time (w/milliseconds) into the pool function rng_seed_time() { - rng_seed_int(new Date().getTime()); + // Use pre-computed date to avoid making the benchmark + // results dependent on the current date. + rng_seed_int(1122926989487); } // Initialize the pool with junk if needed. @@ -1674,16 +1676,23 @@ coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db17 setupEngine(am3, 28); -var RSA = new RSAKey(); -var TEXT = "The quick brown fox jumped over the extremely lazy frogs!"; - -RSA.setPublic(nValue, eValue); -RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); +var TEXT = "The quick brown fox jumped over the extremely lazy frog! " + + "Now is the time for all good men to come to the party."; +var encrypted; function encrypt() { - return RSA.encrypt(TEXT); + var RSA = new RSAKey(); + RSA.setPublic(nValue, eValue); + RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); + encrypted = RSA.encrypt(TEXT); } function decrypt() { - return RSA.decrypt(TEXT); + var RSA = new RSAKey(); + RSA.setPublic(nValue, eValue); + RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); + var decrypted = RSA.decrypt(encrypted); + if (decrypted != TEXT) { + throw new Error("Crypto operation failed"); + } } diff --git a/js/src/v8/deltablue.js b/js/src/v8/deltablue.js index b18efa4306da..548fd96ffbda 100644 --- a/js/src/v8/deltablue.js +++ b/js/src/v8/deltablue.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 the V8 project authors. All rights reserved. // Copyright 1996 John Maloney and Mario Wolczko. // This program is free software; you can redistribute it and/or modify @@ -16,20 +16,20 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// This implementation of the DeltaBlue benchmark is derived -// from the Smalltalk implementation by John Maloney and Mario -// Wolczko. Some parts have been translated directly, whereas -// others have been modified more aggresively to make it feel +// This implementation of the DeltaBlue benchmark is derived +// from the Smalltalk implementation by John Maloney and Mario +// Wolczko. Some parts have been translated directly, whereas +// others have been modified more aggresively to make it feel // more like a JavaScript program. -var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [ +var DeltaBlue = new BenchmarkSuite('DeltaBlue', 66118, [ new Benchmark('DeltaBlue', deltaBlue) ]); /** - * A JavaScript implementation of the DeltaBlue constrain-solving + * A JavaScript implementation of the DeltaBlue constraint-solving * algorithm, as described in: * * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver" @@ -46,7 +46,7 @@ var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [ /* --- O b j e c t M o d e l --- */ -Object.prototype.inherits = function (shuper) { +Object.prototype.inheritsFrom = function (shuper) { function Inheriter() { } Inheriter.prototype = shuper.prototype; this.prototype = new Inheriter(); @@ -216,7 +216,7 @@ function UnaryConstraint(v, strength) { this.addConstraint(); } -UnaryConstraint.inherits(Constraint); +UnaryConstraint.inheritsFrom(Constraint); /** * Adds this constraint to the constraint graph @@ -294,7 +294,7 @@ function StayConstraint(v, str) { StayConstraint.superConstructor.call(this, v, str); } -StayConstraint.inherits(UnaryConstraint); +StayConstraint.inheritsFrom(UnaryConstraint); StayConstraint.prototype.execute = function () { // Stay constraints do nothing @@ -312,7 +312,7 @@ function EditConstraint(v, str) { EditConstraint.superConstructor.call(this, v, str); } -EditConstraint.inherits(UnaryConstraint); +EditConstraint.inheritsFrom(UnaryConstraint); /** * Edits indicate that a variable is to be changed by imperative code. @@ -346,16 +346,16 @@ function BinaryConstraint(var1, var2, strength) { this.addConstraint(); } -BinaryConstraint.inherits(Constraint); +BinaryConstraint.inheritsFrom(Constraint); /** - * Decides if this constratint can be satisfied and which way it + * Decides if this constraint can be satisfied and which way it * should flow based on the relative strength of the variables related, * and record that decision. */ BinaryConstraint.prototype.chooseMethod = function (mark) { if (this.v1.mark == mark) { - this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) + this.direction = (this.v2.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) ? Direction.FORWARD : Direction.NONE; } @@ -459,7 +459,7 @@ function ScaleConstraint(src, scale, offset, dest, strength) { ScaleConstraint.superConstructor.call(this, src, dest, strength); } -ScaleConstraint.inherits(BinaryConstraint); +ScaleConstraint.inheritsFrom(BinaryConstraint); /** * Adds this constraint to the constraint graph. @@ -515,7 +515,7 @@ function EqualityConstraint(var1, var2, strength) { EqualityConstraint.superConstructor.call(this, var1, var2, strength); } -EqualityConstraint.inherits(BinaryConstraint); +EqualityConstraint.inheritsFrom(BinaryConstraint); /** * Enforce this constraint. Assume that it is satisfied. diff --git a/js/src/v8/earley-boyer.js b/js/src/v8/earley-boyer.js index 54a919a7bd32..1be480e8eeb5 100644 --- a/js/src/v8/earley-boyer.js +++ b/js/src/v8/earley-boyer.js @@ -1,7 +1,7 @@ // This file is automatically generated by scheme2js, except for the // benchmark harness code at the beginning and end of the file. -var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 765819, [ +var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 666463, [ new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }), new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); }) ]); @@ -4647,7 +4647,7 @@ var const_earley; return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { return (test(k)); }, function(result) { - return ((sc_display(result)), (sc_newline()), true); + return ((sc_display(result)), (sc_newline()), result == 132); }))); }; } @@ -4675,8 +4675,10 @@ SC_ERROR_OUT = SC_DEFAULT_OUT; function RunBenchmark(name, count, run, warn) { for (var n = 0; n < count; ++n) { result = run(); + if (!warn(result)) { + throw new Error("Earley or Boyer did incorrect number of rewrites"); + } } } var BgL_runzd2benchmarkzd2 = RunBenchmark; - diff --git a/js/src/v8/raytrace.js b/js/src/v8/raytrace.js index 4561bbcf4bea..971ef7218ee6 100644 --- a/js/src/v8/raytrace.js +++ b/js/src/v8/raytrace.js @@ -5,45 +5,30 @@ // // It has been modified slightly by Google to work as a standalone // benchmark, but the all the computational code remains -// untouched. This file also contains a copy of the Prototype +// untouched. This file also contains a copy of parts of the Prototype // JavaScript framework which is used by the ray tracer. -var RayTrace = new BenchmarkSuite('RayTrace', 932666, [ +var RayTrace = new BenchmarkSuite('RayTrace', 739989, [ new Benchmark('RayTrace', renderScene) ]); -// Create dummy objects if we're not running in a browser. -if (typeof document == 'undefined') { - document = { }; - window = { opera: null }; - navigator = { userAgent: null, appVersion: "" }; -} +// Variable used to hold a number that can be used to verify that +// the scene was ray traced correctly. +var checkNumber; // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ +// The following is a copy of parts of the Prototype JavaScript library: -/* Prototype JavaScript framework, version 1.5.0 - * (c) 2005-2007 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://prototype.conio.net/ - * -/*--------------------------------------------------------------------------*/ +// Prototype JavaScript framework, version 1.5.0 +// (c) 2005-2007 Sam Stephenson +// +// Prototype is freely distributable under the terms of an MIT-style license. +// For details, see the Prototype web site: http://prototype.conio.net/ -//-------------------- -var Prototype = { - Version: '1.5.0', - BrowserFeatures: { - XPath: !!document.evaluate - }, - - ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', - emptyFunction: function() {}, - K: function(x) { return x } -} var Class = { create: function() { @@ -51,2497 +36,16 @@ var Class = { this.initialize.apply(this, arguments); } } -} +}; -var Abstract = new Object(); Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; -} - -Object.extend(Object, { - inspect: function(object) { - try { - if (object === undefined) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : object.toString(); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - }, - - keys: function(object) { - var keys = []; - for (var property in object) - keys.push(property); - return keys; - }, - - values: function(object) { - var values = []; - for (var property in object) - values.push(object[property]); - return values; - }, - - clone: function(object) { - return Object.extend({}, object); - } -}); - -Function.prototype.bind = function() { - var __method = this, args = $A(arguments), object = args.shift(); - return function() { - return __method.apply(object, args.concat($A(arguments))); - } -} - -Function.prototype.bindAsEventListener = function(object) { - var __method = this, args = $A(arguments), object = args.shift(); - return function(event) { - return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); - } -} - -Object.extend(Number.prototype, { - toColorPart: function() { - var digits = this.toString(16); - if (this < 16) return '0' + digits; - return digits; - }, - - succ: function() { - return this + 1; - }, - - times: function(iterator) { - $R(0, this, true).each(iterator); - return this; - } -}); - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) {} - } - - return returnValue; - } -} - -/*--------------------------------------------------------------------------*/ - -var PeriodicalExecuter = Class.create(); -PeriodicalExecuter.prototype = { - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.callback(this); - } finally { - this.currentlyExecuting = false; - } - } - } -} -String.interpret = function(value){ - return value == null ? '' : String(value); -} - -Object.extend(String.prototype, { - gsub: function(pattern, replacement) { - var result = '', source = this, match; - replacement = arguments.callee.prepareReplacement(replacement); - - while (source.length > 0) { - if (match = source.match(pattern)) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - }, - - sub: function(pattern, replacement, count) { - replacement = this.gsub.prepareReplacement(replacement); - count = count === undefined ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - }, - - scan: function(pattern, iterator) { - this.gsub(pattern, iterator); - return this; - }, - - truncate: function(length, truncation) { - length = length || 30; - truncation = truncation === undefined ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : this; - }, - - strip: function() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - }, - - stripTags: function() { - return this.replace(/<\/?[^>]+>/gi, ''); - }, - - stripScripts: function() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - }, - - extractScripts: function() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); - var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - }, - - evalScripts: function() { - return this.extractScripts().map(function(script) { return eval(script) }); - }, - - escapeHTML: function() { - var div = document.createElement('div'); - var text = document.createTextNode(this); - div.appendChild(text); - return div.innerHTML; - }, - - unescapeHTML: function() { - var div = document.createElement('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0] ? (div.childNodes.length > 1 ? - $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : - div.childNodes[0].nodeValue) : ''; - }, - - toQueryParams: function(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return {}; - - return match[1].split(separator || '&').inject({}, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var name = decodeURIComponent(pair[0]); - var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; - - if (hash[name] !== undefined) { - if (hash[name].constructor != Array) - hash[name] = [hash[name]]; - if (value) hash[name].push(value); - } - else hash[name] = value; - } - return hash; - }); - }, - - toArray: function() { - return this.split(''); - }, - - succ: function() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - }, - - camelize: function() { - var parts = this.split('-'), len = parts.length; - if (len == 1) return parts[0]; - - var camelized = this.charAt(0) == '-' - ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) - : parts[0]; - - for (var i = 1; i < len; i++) - camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); - - return camelized; - }, - - capitalize: function(){ - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - }, - - underscore: function() { - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); - }, - - dasherize: function() { - return this.gsub(/_/,'-'); - }, - - inspect: function(useDoubleQuotes) { - var escapedString = this.replace(/\\/g, '\\\\'); - if (useDoubleQuotes) - return '"' + escapedString.replace(/"/g, '\\"') + '"'; - else - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - } -}); - -String.prototype.gsub.prepareReplacement = function(replacement) { - if (typeof replacement == 'function') return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; -} - -String.prototype.parseQuery = String.prototype.toQueryParams; - -var Template = Class.create(); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; -Template.prototype = { - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - return this.template.gsub(this.pattern, function(match) { - var before = match[1]; - if (before == '\\') return match[2]; - return before + String.interpret(object[match[3]]); - }); - } -} - -var $break = new Object(); -var $continue = new Object(); - -var Enumerable = { - each: function(iterator) { - var index = 0; - try { - this._each(function(value) { - try { - iterator(value, index++); - } catch (e) { - if (e != $continue) throw e; - } - }); - } catch (e) { - if (e != $break) throw e; - } - return this; - }, - - eachSlice: function(number, iterator) { - var index = -number, slices = [], array = this.toArray(); - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.map(iterator); - }, - - all: function(iterator) { - var result = true; - this.each(function(value, index) { - result = result && !!(iterator || Prototype.K)(value, index); - if (!result) throw $break; - }); - return result; - }, - - any: function(iterator) { - var result = false; - this.each(function(value, index) { - if (result = !!(iterator || Prototype.K)(value, index)) - throw $break; - }); - return result; - }, - - collect: function(iterator) { - var results = []; - this.each(function(value, index) { - results.push((iterator || Prototype.K)(value, index)); - }); - return results; - }, - - detect: function(iterator) { - var result; - this.each(function(value, index) { - if (iterator(value, index)) { - result = value; - throw $break; - } - }); - return result; - }, - - findAll: function(iterator) { - var results = []; - this.each(function(value, index) { - if (iterator(value, index)) - results.push(value); - }); - return results; - }, - - grep: function(pattern, iterator) { - var results = []; - this.each(function(value, index) { - var stringValue = value.toString(); - if (stringValue.match(pattern)) - results.push((iterator || Prototype.K)(value, index)); - }) - return results; - }, - - include: function(object) { - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - }, - - inGroupsOf: function(number, fillWith) { - fillWith = fillWith === undefined ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - }, - - inject: function(memo, iterator) { - this.each(function(value, index) { - memo = iterator(memo, value, index); - }); - return memo; - }, - - invoke: function(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - }, - - max: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (result == undefined || value >= result) - result = value; - }); - return result; - }, - - min: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (result == undefined || value < result) - result = value; - }); - return result; - }, - - partition: function(iterator) { - var trues = [], falses = []; - this.each(function(value, index) { - ((iterator || Prototype.K)(value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - }, - - pluck: function(property) { - var results = []; - this.each(function(value, index) { - results.push(value[property]); - }); - return results; - }, - - reject: function(iterator) { - var results = []; - this.each(function(value, index) { - if (!iterator(value, index)) - results.push(value); - }); - return results; - }, - - sortBy: function(iterator) { - return this.map(function(value, index) { - return {value: value, criteria: iterator(value, index)}; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - }, - - toArray: function() { - return this.map(); - }, - - zip: function() { - var iterator = Prototype.K, args = $A(arguments); - if (typeof args.last() == 'function') - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - }, - - size: function() { - return this.toArray().length; - }, - - inspect: function() { - return '#'; - } -} - -Object.extend(Enumerable, { - map: Enumerable.collect, - find: Enumerable.detect, - select: Enumerable.findAll, - member: Enumerable.include, - entries: Enumerable.toArray -}); -var $A = Array.from = function(iterable) { - if (!iterable) return []; - if (iterable.toArray) { - return iterable.toArray(); - } else { - var results = []; - for (var i = 0, length = iterable.length; i < length; i++) - results.push(iterable[i]); - return results; - } -} - -Object.extend(Array.prototype, Enumerable); - -if (!Array.prototype._reverse) - Array.prototype._reverse = Array.prototype.reverse; - -Object.extend(Array.prototype, { - _each: function(iterator) { - for (var i = 0, length = this.length; i < length; i++) - iterator(this[i]); - }, - - clear: function() { - this.length = 0; - return this; - }, - - first: function() { - return this[0]; - }, - - last: function() { - return this[this.length - 1]; - }, - - compact: function() { - return this.select(function(value) { - return value != null; - }); - }, - - flatten: function() { - return this.inject([], function(array, value) { - return array.concat(value && value.constructor == Array ? - value.flatten() : [value]); - }); - }, - - without: function() { - var values = $A(arguments); - return this.select(function(value) { - return !values.include(value); - }); - }, - - indexOf: function(object) { - for (var i = 0, length = this.length; i < length; i++) - if (this[i] == object) return i; - return -1; - }, - - reverse: function(inline) { - return (inline !== false ? this : this.toArray())._reverse(); - }, - - reduce: function() { - return this.length > 1 ? this : this[0]; - }, - - uniq: function() { - return this.inject([], function(array, value) { - return array.include(value) ? array : array.concat([value]); - }); - }, - - clone: function() { - return [].concat(this); - }, - - size: function() { - return this.length; - }, - - inspect: function() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } -}); - -Array.prototype.toArray = Array.prototype.clone; - -function $w(string){ - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -if(window.opera){ - Array.prototype.concat = function(){ - var array = []; - for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); - for(var i = 0, length = arguments.length; i < length; i++) { - if(arguments[i].constructor == Array) { - for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) - array.push(arguments[i][j]); - } else { - array.push(arguments[i]); - } - } - return array; - } -} -var Hash = function(obj) { - Object.extend(this, obj || {}); }; -Object.extend(Hash, { - toQueryString: function(obj) { - var parts = []; - - this.prototype._each.call(obj, function(pair) { - if (!pair.key) return; - - if (pair.value && pair.value.constructor == Array) { - var values = pair.value.compact(); - if (values.length < 2) pair.value = values.reduce(); - else { - key = encodeURIComponent(pair.key); - values.each(function(value) { - value = value != undefined ? encodeURIComponent(value) : ''; - parts.push(key + '=' + encodeURIComponent(value)); - }); - return; - } - } - if (pair.value == undefined) pair[1] = ''; - parts.push(pair.map(encodeURIComponent).join('=')); - }); - - return parts.join('&'); - } -}); - -Object.extend(Hash.prototype, Enumerable); -Object.extend(Hash.prototype, { - _each: function(iterator) { - for (var key in this) { - var value = this[key]; - if (value && value == Hash.prototype[key]) continue; - - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, - - keys: function() { - return this.pluck('key'); - }, - - values: function() { - return this.pluck('value'); - }, - - merge: function(hash) { - return $H(hash).inject(this, function(mergedHash, pair) { - mergedHash[pair.key] = pair.value; - return mergedHash; - }); - }, - - remove: function() { - var result; - for(var i = 0, length = arguments.length; i < length; i++) { - var value = this[arguments[i]]; - if (value !== undefined){ - if (result === undefined) result = value; - else { - if (result.constructor != Array) result = [result]; - result.push(value) - } - } - delete this[arguments[i]]; - } - return result; - }, - - toQueryString: function() { - return Hash.toQueryString(this); - }, - - inspect: function() { - return '#'; - } -}); - -function $H(object) { - if (object && object.constructor == Hash) return object; - return new Hash(object); -}; -ObjectRange = Class.create(); -Object.extend(ObjectRange.prototype, Enumerable); -Object.extend(ObjectRange.prototype, { - initialize: function(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - }, - - _each: function(iterator) { - var value = this.start; - while (this.include(value)) { - iterator(value); - value = value.succ(); - } - }, - - include: function(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } -}); - -var $R = function(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -} - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (typeof responder[callback] == 'function') { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) {} - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { - Ajax.activeRequestCount++; - }, - onComplete: function() { - Ajax.activeRequestCount--; - } -}); - -Ajax.Base = function() {}; -Ajax.Base.prototype = { - setOptions: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '' - } - Object.extend(this.options, options || {}); - - this.options.method = this.options.method.toLowerCase(); - if (typeof this.options.parameters == 'string') - this.options.parameters = this.options.parameters.toQueryParams(); - } -} - -Ajax.Request = Class.create(); -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -Ajax.Request.prototype = Object.extend(new Ajax.Base(), { - _complete: false, - - initialize: function(url, options) { - this.transport = Ajax.getTransport(); - this.setOptions(options); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = this.options.parameters; - - if (!['get', 'post'].include(this.method)) { - // simulate other verbs over post - params['_method'] = this.method; - this.method = 'post'; - } - - params = Hash.toQueryString(params); - if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' - - // when GET, append parameters to URL - if (this.method == 'get' && params) - this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; - - try { - Ajax.Responders.dispatch('onCreate', this, this.transport); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) - setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - var body = this.method == 'post' ? (this.options.postBody || params) : null; - - this.transport.send(body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - // user-defined headers - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (typeof extras.push == 'function') - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - return !this.transport.status - || (this.transport.status >= 200 && this.transport.status < 300); - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState]; - var transport = this.transport, json = this.evalJSON(); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + this.transport.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(transport, json); - } catch (e) { - this.dispatchException(e); - } - - if ((this.getHeader('Content-type') || 'text/javascript').strip(). - match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(transport, json); - Ajax.Responders.dispatch('on' + state, this, transport, json); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - // avoid memory leak in MSIE: clean up - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name); - } catch (e) { return null } - }, - - evalJSON: function() { - try { - var json = this.getHeader('X-JSON'); - return json ? eval('(' + json + ')') : null; - } catch (e) { return null } - }, - - evalResponse: function() { - try { - return eval(this.transport.responseText); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Updater = Class.create(); - -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { - initialize: function(container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - } - - this.transport = Ajax.getTransport(); - this.setOptions(options); - - var onComplete = this.options.onComplete || Prototype.emptyFunction; - this.options.onComplete = (function(transport, param) { - this.updateContent(); - onComplete(transport, param); - }).bind(this); - - this.request(url); - }, - - updateContent: function() { - var receiver = this.container[this.success() ? 'success' : 'failure']; - var response = this.transport.responseText; - - if (!this.options.evalScripts) response = response.stripScripts(); - - if (receiver = $(receiver)) { - if (this.options.insertion) - new this.options.insertion(receiver, response); - else - receiver.update(response); - } - - if (this.success()) { - if (this.onComplete) - setTimeout(this.onComplete.bind(this), 10); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(); -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { - initialize: function(container, url, options) { - this.setOptions(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = {}; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(request) { - if (this.options.decay) { - this.decay = (request.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = request.responseText; - } - this.timer = setTimeout(this.onTimerEvent.bind(this), - this.decay * this.frequency * 1000); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); -function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - if (typeof element == 'string') - element = document.getElementById(element); - return Element.extend(element); -} - -if (Prototype.BrowserFeatures.XPath) { - document._getElementsByXPath = function(expression, parentElement) { - var results = []; - var query = document.evaluate(expression, $(parentElement) || document, - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(query.snapshotItem(i)); - return results; - }; -} - -document.getElementsByClassName = function(className, parentElement) { - if (Prototype.BrowserFeatures.XPath) { - var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; - return document._getElementsByXPath(q, parentElement); - } else { - var children = ($(parentElement) || document.body).getElementsByTagName('*'); - var elements = [], child; - for (var i = 0, length = children.length; i < length; i++) { - child = children[i]; - if (Element.hasClassName(child, className)) - elements.push(Element.extend(child)); - } - return elements; - } -}; - -/*--------------------------------------------------------------------------*/ - -if (!window.Element) - var Element = new Object(); - -Element.extend = function(element) { - if (!element || _nativeExtensions || element.nodeType == 3) return element; - - if (!element._extended && element.tagName && element != window) { - var methods = Object.clone(Element.Methods), cache = Element.extend.cache; - - if (element.tagName == 'FORM') - Object.extend(methods, Form.Methods); - if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) - Object.extend(methods, Form.Element.Methods); - - Object.extend(methods, Element.Methods.Simulated); - - for (var property in methods) { - var value = methods[property]; - if (typeof value == 'function' && !(property in element)) - element[property] = cache.findOrStore(value); - } - } - - element._extended = true; - return element; -}; - -Element.extend.cache = { - findOrStore: function(value) { - return this[value] = this[value] || function() { - return value.apply(null, [this].concat($A(arguments))); - } - } -}; - -Element.Methods = { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function(element) { - element = $(element); - Element[Element.visible(element) ? 'hide' : 'show'](element); - return element; - }, - - hide: function(element) { - $(element).style.display = 'none'; - return element; - }, - - show: function(element) { - $(element).style.display = ''; - return element; - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - }, - - update: function(element, html) { - html = typeof html == 'undefined' ? '' : html.toString(); - $(element).innerHTML = html.stripScripts(); - setTimeout(function() {html.evalScripts()}, 10); - return element; - }, - - replace: function(element, html) { - element = $(element); - html = typeof html == 'undefined' ? '' : html.toString(); - if (element.outerHTML) { - element.outerHTML = html.stripScripts(); - } else { - var range = element.ownerDocument.createRange(); - range.selectNodeContents(element); - element.parentNode.replaceChild( - range.createContextualFragment(html.stripScripts()), element); - } - setTimeout(function() {html.evalScripts()}, 10); - return element; - }, - - inspect: function(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - $H({'id': 'id', 'className': 'class'}).each(function(pair) { - var property = pair.first(), attribute = pair.last(); - var value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - }); - return result + '>'; - }, - - recursivelyCollect: function(element, property) { - element = $(element); - var elements = []; - while (element = element[property]) - if (element.nodeType == 1) - elements.push(Element.extend(element)); - return elements; - }, - - ancestors: function(element) { - return $(element).recursivelyCollect('parentNode'); - }, - - descendants: function(element) { - return $A($(element).getElementsByTagName('*')); - }, - - immediateDescendants: function(element) { - if (!(element = $(element).firstChild)) return []; - while (element && element.nodeType != 1) element = element.nextSibling; - if (element) return [element].concat($(element).nextSiblings()); - return []; - }, - - previousSiblings: function(element) { - return $(element).recursivelyCollect('previousSibling'); - }, - - nextSiblings: function(element) { - return $(element).recursivelyCollect('nextSibling'); - }, - - siblings: function(element) { - element = $(element); - return element.previousSiblings().reverse().concat(element.nextSiblings()); - }, - - match: function(element, selector) { - if (typeof selector == 'string') - selector = new Selector(selector); - return selector.match($(element)); - }, - - up: function(element, expression, index) { - return Selector.findElement($(element).ancestors(), expression, index); - }, - - down: function(element, expression, index) { - return Selector.findElement($(element).descendants(), expression, index); - }, - - previous: function(element, expression, index) { - return Selector.findElement($(element).previousSiblings(), expression, index); - }, - - next: function(element, expression, index) { - return Selector.findElement($(element).nextSiblings(), expression, index); - }, - - getElementsBySelector: function() { - var args = $A(arguments), element = $(args.shift()); - return Selector.findChildElements(element, args); - }, - - getElementsByClassName: function(element, className) { - return document.getElementsByClassName(className, element); - }, - - readAttribute: function(element, name) { - element = $(element); - if (document.all && !window.opera) { - var t = Element._attributeTranslations; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - var attribute = element.attributes[name]; - if(attribute) return attribute.nodeValue; - } - return element.getAttribute(name); - }, - - getHeight: function(element) { - return $(element).getDimensions().height; - }, - - getWidth: function(element) { - return $(element).getDimensions().width; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - var elementClassName = element.className; - if (elementClassName.length == 0) return false; - if (elementClassName == className || - elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) - return true; - return false; - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element).add(className); - return element; - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element).remove(className); - return element; - }, - - toggleClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); - return element; - }, - - observe: function() { - Event.observe.apply(Event, arguments); - return $A(arguments).first(); - }, - - stopObserving: function() { - Event.stopObserving.apply(Event, arguments); - return $A(arguments).first(); - }, - - // removes whitespace-only text node children - cleanWhitespace: function(element) { - element = $(element); - var node = element.firstChild; - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - }, - - empty: function(element) { - return $(element).innerHTML.match(/^\s*$/); - }, - - descendantOf: function(element, ancestor) { - element = $(element), ancestor = $(ancestor); - while (element = element.parentNode) - if (element == ancestor) return true; - return false; - }, - - scrollTo: function(element) { - element = $(element); - var pos = Position.cumulativeOffset(element); - window.scrollTo(pos[0], pos[1]); - return element; - }, - - getStyle: function(element, style) { - element = $(element); - if (['float','cssFloat'].include(style)) - style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); - style = style.camelize(); - var value = element.style[style]; - if (!value) { - if (document.defaultView && document.defaultView.getComputedStyle) { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } else if (element.currentStyle) { - value = element.currentStyle[style]; - } - } - - if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) - value = element['offset'+style.capitalize()] + 'px'; - - if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) - if (Element.getStyle(element, 'position') == 'static') value = 'auto'; - if(style == 'opacity') { - if(value) return parseFloat(value); - if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if(value[1]) return parseFloat(value[1]) / 100; - return 1.0; - } - return value == 'auto' ? null : value; - }, - - setStyle: function(element, style) { - element = $(element); - for (var name in style) { - var value = style[name]; - if(name == 'opacity') { - if (value == 1) { - value = (/Gecko/.test(navigator.userAgent) && - !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); - } else if(value == '') { - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); - } else { - if(value < 0.00001) value = 0; - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + - 'alpha(opacity='+value*100+')'; - } - } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; - element.style[name.camelize()] = value; - } - return element; - }, - - getDimensions: function(element) { - element = $(element); - var display = $(element).getStyle('display'); - if (display != 'none' && display != null) // Safari bug - return {width: element.offsetWidth, height: element.offsetHeight}; - - // All *Width and *Height properties give 0 on elements with display none, - // so enable the element temporarily - var els = element.style; - var originalVisibility = els.visibility; - var originalPosition = els.position; - var originalDisplay = els.display; - els.visibility = 'hidden'; - els.position = 'absolute'; - els.display = 'block'; - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - els.display = originalDisplay; - els.position = originalPosition; - els.visibility = originalVisibility; - return {width: originalWidth, height: originalHeight}; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - // Opera returns the offset relative to the positioning context, when an - // element is position relative but top and left have not been defined - if (window.opera) { - element.style.top = 0; - element.style.left = 0; - } - } - return element; - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - return element; - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return element; - element._overflow = element.style.overflow || 'auto'; - if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') - element.style.overflow = 'hidden'; - return element; - }, - - undoClipping: function(element) { - element = $(element); - if (!element._overflow) return element; - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; - element._overflow = null; - return element; - } -}; - -Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); - -Element._attributeTranslations = {}; - -Element._attributeTranslations.names = { - colspan: "colSpan", - rowspan: "rowSpan", - valign: "vAlign", - datetime: "dateTime", - accesskey: "accessKey", - tabindex: "tabIndex", - enctype: "encType", - maxlength: "maxLength", - readonly: "readOnly", - longdesc: "longDesc" -}; - -Element._attributeTranslations.values = { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - - title: function(element) { - var node = element.getAttributeNode('title'); - return node.specified ? node.nodeValue : null; - } -}; - -Object.extend(Element._attributeTranslations.values, { - href: Element._attributeTranslations.values._getAttr, - src: Element._attributeTranslations.values._getAttr, - disabled: Element._attributeTranslations.values._flag, - checked: Element._attributeTranslations.values._flag, - readonly: Element._attributeTranslations.values._flag, - multiple: Element._attributeTranslations.values._flag -}); - -Element.Methods.Simulated = { - hasAttribute: function(element, attribute) { - var t = Element._attributeTranslations; - attribute = t.names[attribute] || attribute; - return $(element).getAttributeNode(attribute).specified; - } -}; - -// IE is missing .innerHTML support for TABLE-related elements -if (document.all && !window.opera){ - Element.Methods.update = function(element, html) { - element = $(element); - html = typeof html == 'undefined' ? '' : html.toString(); - var tagName = element.tagName.toUpperCase(); - if (['THEAD','TBODY','TR','TD'].include(tagName)) { - var div = document.createElement('div'); - switch (tagName) { - case 'THEAD': - case 'TBODY': - div.innerHTML = '' + html.stripScripts() + '
'; - depth = 2; - break; - case 'TR': - div.innerHTML = '' + html.stripScripts() + '
'; - depth = 3; - break; - case 'TD': - div.innerHTML = '
' + html.stripScripts() + '
'; - depth = 4; - } - $A(element.childNodes).each(function(node){ - element.removeChild(node) - }); - depth.times(function(){ div = div.firstChild }); - - $A(div.childNodes).each( - function(node){ element.appendChild(node) }); - } else { - element.innerHTML = html.stripScripts(); - } - setTimeout(function() {html.evalScripts()}, 10); - return element; - } -}; - -Object.extend(Element, Element.Methods); - -var _nativeExtensions = false; - -if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) - ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { - var className = 'HTML' + tag + 'Element'; - if(window[className]) return; - var klass = window[className] = {}; - klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; - }); - -Element.addMethods = function(methods) { - Object.extend(Element.Methods, methods || {}); - - function copy(methods, destination, onlyIfAbsent) { - onlyIfAbsent = onlyIfAbsent || false; - var cache = Element.extend.cache; - for (var property in methods) { - var value = methods[property]; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = cache.findOrStore(value); - } - } - - if (typeof HTMLElement != 'undefined') { - copy(Element.Methods, HTMLElement.prototype); - copy(Element.Methods.Simulated, HTMLElement.prototype, true); - copy(Form.Methods, HTMLFormElement.prototype); - [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { - copy(Form.Element.Methods, klass.prototype); - }); - _nativeExtensions = true; - } -} - -var Toggle = new Object(); -Toggle.display = Element.toggle; - -/*--------------------------------------------------------------------------*/ - -Abstract.Insertion = function(adjacency) { - this.adjacency = adjacency; -} - -Abstract.Insertion.prototype = { - initialize: function(element, content) { - this.element = $(element); - this.content = content.stripScripts(); - - if (this.adjacency && this.element.insertAdjacentHTML) { - try { - this.element.insertAdjacentHTML(this.adjacency, this.content); - } catch (e) { - var tagName = this.element.tagName.toUpperCase(); - if (['TBODY', 'TR'].include(tagName)) { - this.insertContent(this.contentFromAnonymousTable()); - } else { - throw e; - } - } - } else { - this.range = this.element.ownerDocument.createRange(); - if (this.initializeRange) this.initializeRange(); - this.insertContent([this.range.createContextualFragment(this.content)]); - } - - setTimeout(function() {content.evalScripts()}, 10); - }, - - contentFromAnonymousTable: function() { - var div = document.createElement('div'); - div.innerHTML = '' + this.content + '
'; - return $A(div.childNodes[0].childNodes[0].childNodes); - } -} - -var Insertion = new Object(); - -Insertion.Before = Class.create(); -Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { - initializeRange: function() { - this.range.setStartBefore(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, this.element); - }).bind(this)); - } -}); - -Insertion.Top = Class.create(); -Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(true); - }, - - insertContent: function(fragments) { - fragments.reverse(false).each((function(fragment) { - this.element.insertBefore(fragment, this.element.firstChild); - }).bind(this)); - } -}); - -Insertion.Bottom = Class.create(); -Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.appendChild(fragment); - }).bind(this)); - } -}); - -Insertion.After = Class.create(); -Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { - initializeRange: function() { - this.range.setStartAfter(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, - this.element.nextSibling); - }).bind(this)); - } -}); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set($A(this).concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set($A(this).without(classNameToRemove).join(' ')); - }, - - toString: function() { - return $A(this).join(' '); - } -}; - -Object.extend(Element.ClassNames.prototype, Enumerable); -var Selector = Class.create(); -Selector.prototype = { - initialize: function(expression) { - this.params = {classNames: []}; - this.expression = expression.toString().strip(); - this.parseExpression(); - this.compileMatcher(); - }, - - parseExpression: function() { - function abort(message) { throw 'Parse error in selector: ' + message; } - - if (this.expression == '') abort('empty expression'); - - var params = this.params, expr = this.expression, match, modifier, clause, rest; - while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { - params.attributes = params.attributes || []; - params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); - expr = match[1]; - } - - if (expr == '*') return this.params.wildcard = true; - - while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { - modifier = match[1], clause = match[2], rest = match[3]; - switch (modifier) { - case '#': params.id = clause; break; - case '.': params.classNames.push(clause); break; - case '': - case undefined: params.tagName = clause.toUpperCase(); break; - default: abort(expr.inspect()); - } - expr = rest; - } - - if (expr.length > 0) abort(expr.inspect()); - }, - - buildMatchExpression: function() { - var params = this.params, conditions = [], clause; - - if (params.wildcard) - conditions.push('true'); - if (clause = params.id) - conditions.push('element.readAttribute("id") == ' + clause.inspect()); - if (clause = params.tagName) - conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); - if ((clause = params.classNames).length > 0) - for (var i = 0, length = clause.length; i < length; i++) - conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); - if (clause = params.attributes) { - clause.each(function(attribute) { - var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; - var splitValueBy = function(delimiter) { - return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; - } - - switch (attribute.operator) { - case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; - case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; - case '|=': conditions.push( - splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() - ); break; - case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; - case '': - case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; - default: throw 'Unknown operator ' + attribute.operator + ' in selector'; - } - }); - } - - return conditions.join(' && '); - }, - - compileMatcher: function() { - this.match = new Function('element', 'if (!element.tagName) return false; \ - element = $(element); \ - return ' + this.buildMatchExpression()); - }, - - findElements: function(scope) { - var element; - - if (element = $(this.params.id)) - if (this.match(element)) - if (!scope || Element.childOf(element, scope)) - return [element]; - - scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); - - var results = []; - for (var i = 0, length = scope.length; i < length; i++) - if (this.match(element = scope[i])) - results.push(Element.extend(element)); - - return results; - }, - - toString: function() { - return this.expression; - } -} - -Object.extend(Selector, { - matchElements: function(elements, expression) { - var selector = new Selector(expression); - return elements.select(selector.match.bind(selector)).map(Element.extend); - }, - - findElement: function(elements, expression, index) { - if (typeof expression == 'number') index = expression, expression = false; - return Selector.matchElements(elements, expression || '*')[index || 0]; - }, - - findChildElements: function(element, expressions) { - return expressions.map(function(expression) { - return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { - var selector = new Selector(expr); - return results.inject([], function(elements, result) { - return elements.concat(selector.findElements(result || element)); - }); - }); - }).flatten(); - } -}); - -function $$() { - return Selector.findChildElements(document, $A(arguments)); -} -var Form = { - reset: function(form) { - $(form).reset(); - return form; - }, - - serializeElements: function(elements, getHash) { - var data = elements.inject({}, function(result, element) { - if (!element.disabled && element.name) { - var key = element.name, value = $(element).getValue(); - if (value != undefined) { - if (result[key]) { - if (result[key].constructor != Array) result[key] = [result[key]]; - result[key].push(value); - } - else result[key] = value; - } - } - return result; - }); - - return getHash ? data : Hash.toQueryString(data); - } -}; - -Form.Methods = { - serialize: function(form, getHash) { - return Form.serializeElements(Form.getElements(form), getHash); - }, - - getElements: function(form) { - return $A($(form).getElementsByTagName('*')).inject([], - function(elements, child) { - if (Form.Element.Serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - } - ); - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - form.getElements().each(function(element) { - element.blur(); - element.disabled = 'true'; - }); - return form; - }, - - enable: function(form) { - form = $(form); - form.getElements().each(function(element) { - element.disabled = ''; - }); - return form; - }, - - findFirstElement: function(form) { - return $(form).getElements().find(function(element) { - return element.type != 'hidden' && !element.disabled && - ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - form.findFirstElement().activate(); - return form; - } -} - -Object.extend(Form, Form.Methods); - -/*--------------------------------------------------------------------------*/ - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -} - -Form.Element.Methods = { - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = {}; - pair[element.name] = value; - return Hash.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - element.focus(); - if (element.select && ( element.tagName.toLowerCase() != 'input' || - !['button', 'reset', 'submit'].include(element.type) ) ) - element.select(); - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.blur(); - element.disabled = false; - return element; - } -} - -Object.extend(Form.Element, Form.Element.Methods); -var Field = Form.Element; -var $F = Form.Element.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = { - input: function(element) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element); - default: - return Form.Element.Serializers.textarea(element); - } - }, - - inputSelector: function(element) { - return element.checked ? element.value : null; - }, - - textarea: function(element) { - return element.value; - }, - - select: function(element) { - return this[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - }, - - selectOne: function(element) { - var index = element.selectedIndex; - return index >= 0 ? this.optionValue(element.options[index]) : null; - }, - - selectMany: function(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(this.optionValue(opt)); - } - return values; - }, - - optionValue: function(opt) { - // extend element because hasAttribute may not be native - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; - } -} - -/*--------------------------------------------------------------------------*/ - -Abstract.TimedObserver = function() {} -Abstract.TimedObserver.prototype = { - initialize: function(element, frequency, callback) { - this.frequency = frequency; - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - var value = this.getValue(); - var changed = ('string' == typeof this.lastValue && 'string' == typeof value - ? this.lastValue != value : String(this.lastValue) != String(value)); - if (changed) { - this.callback(this.element, value); - this.lastValue = value; - } - } -} - -Form.Element.Observer = Class.create(); -Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(); -Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = function() {} -Abstract.EventObserver.prototype = { - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback.bind(this)); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -} - -Form.Element.EventObserver = Class.create(); -Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(); -Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); -if (!window.Event) { - var Event = new Object(); -} - -Object.extend(Event, { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - - element: function(event) { - return event.target || event.srcElement; - }, - - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, - - pointerX: function(event) { - return event.pageX || (event.clientX + - (document.documentElement.scrollLeft || document.body.scrollLeft)); - }, - - pointerY: function(event) { - return event.pageY || (event.clientY + - (document.documentElement.scrollTop || document.body.scrollTop)); - }, - - stop: function(event) { - if (event.preventDefault) { - event.preventDefault(); - event.stopPropagation(); - } else { - event.returnValue = false; - event.cancelBubble = true; - } - }, - - // find the first node with the given tagName, starting from the - // node the event was triggered on; traverses the DOM upwards - findElement: function(event, tagName) { - var element = Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))) - element = element.parentNode; - return element; - }, - - observers: false, - - _observeAndCache: function(element, name, observer, useCapture) { - if (!this.observers) this.observers = []; - if (element.addEventListener) { - this.observers.push([element, name, observer, useCapture]); - element.addEventListener(name, observer, useCapture); - } else if (element.attachEvent) { - this.observers.push([element, name, observer, useCapture]); - element.attachEvent('on' + name, observer); - } - }, - - unloadCache: function() { - if (!Event.observers) return; - for (var i = 0, length = Event.observers.length; i < length; i++) { - Event.stopObserving.apply(this, Event.observers[i]); - Event.observers[i][0] = null; - } - Event.observers = false; - }, - - observe: function(element, name, observer, useCapture) { - element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.attachEvent)) - name = 'keydown'; - - Event._observeAndCache(element, name, observer, useCapture); - }, - - stopObserving: function(element, name, observer, useCapture) { - element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.detachEvent)) - name = 'keydown'; - - if (element.removeEventListener) { - element.removeEventListener(name, observer, useCapture); - } else if (element.detachEvent) { - try { - element.detachEvent('on' + name, observer); - } catch (e) {} - } - } -}); - -/* prevent memory leaks in IE */ -if (navigator.appVersion.match(/\bMSIE\b/)) - Event.observe(window, 'unload', Event.unloadCache, false); -var Position = { - // set to true if needed, warning: firefox performance problems - // NOT neeeded for page scrolling, only if draggable contained in - // scrollable elements - includeScrollOffsets: false, - - // must be called before calling withinIncludingScrolloffset, every time the - // page is scrolled - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - realOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return [valueL, valueT]; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return [valueL, valueT]; - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if(element.tagName=='BODY') break; - var p = Element.getStyle(element, 'position'); - if (p == 'relative' || p == 'absolute') break; - } - } while (element); - return [valueL, valueT]; - }, - - offsetParent: function(element) { - if (element.offsetParent) return element.offsetParent; - if (element == document.body) return element; - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return element; - - return document.body; - }, - - // caches x/y coordinate pair to use with overlap - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = this.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = this.realOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = this.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - // within must be called directly before - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - page: function(forElement) { - var valueT = 0, valueL = 0; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - // Safari fix - if (element.offsetParent==document.body) - if (Element.getStyle(element,'position')=='absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - if (!window.opera || element.tagName=='BODY') { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - - return [valueL, valueT]; - }, - - clone: function(source, target) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || {}) - - // find page position of source - source = $(source); - var p = Position.page(source); - - // find coordinate system to use - target = $(target); - var delta = [0, 0]; - var parent = null; - // delta [0,0] will do fine with position: fixed elements, - // position:absolute needs offsetParent deltas - if (Element.getStyle(target,'position') == 'absolute') { - parent = Position.offsetParent(target); - delta = Position.page(parent); - } - - // correct by body offsets (fixes Safari) - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - // set position - if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if(options.setWidth) target.style.width = source.offsetWidth + 'px'; - if(options.setHeight) target.style.height = source.offsetHeight + 'px'; - }, - - absolutize: function(element) { - element = $(element); - if (element.style.position == 'absolute') return; - Position.prepare(); - - var offsets = Position.positionedOffset(element); - var top = offsets[1]; - var left = offsets[0]; - var width = element.clientWidth; - var height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - }, - - relativize: function(element) { - element = $(element); - if (element.style.position == 'relative') return; - Position.prepare(); - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - } -} - -// Safari returns margins on body which is incorrect if the child is absolutely -// positioned. For performance reasons, redefine Position.cumulativeOffset for -// KHTML/WebKit only. -if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { - Position.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return [valueL, valueT]; - } -} - -Element.addMethods(); - // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -2669,6 +173,13 @@ Flog.RayTracer.Color.prototype = { return result; }, + brightness : function() { + var r = Math.floor(this.red*255); + var g = Math.floor(this.green*255); + var b = Math.floor(this.blue*255); + return (r * 77 + g * 150 + b * 29) >> 8; + }, + toString : function () { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); @@ -2694,12 +205,6 @@ Flog.RayTracer.Light.prototype = { this.intensity = (intensity ? intensity : 10.0); }, - getIntensity: function(distance){ - if(distance >= intensity) return 0; - - return Math.pow((intensity - distance) / strength, 0.2); - }, - toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } @@ -2909,31 +414,6 @@ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; -Flog.RayTracer.Shape.BaseShape = Class.create(); - -Flog.RayTracer.Shape.BaseShape.prototype = { - position: null, - material: null, - - initialize : function() { - this.position = new Vector(0,0,0); - this.material = new Flog.RayTracer.Material.SolidMaterial( - new Flog.RayTracer.Color(1,0,1), - 0, - 0, - 0 - ); - }, - - toString : function () { - return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; - } -} -/* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; -if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; - Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { @@ -3152,11 +632,15 @@ Flog.RayTracer.Engine.prototype = { this.canvas.fillStyle = color.toString(); this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); } else { + if (x === y) { + checkNumber += color.brightness(); + } // print(x * pxW, y * pxH, pxW, pxH); } }, renderScene: function(scene, canvas){ + checkNumber = 0; /* Get canvas */ if (canvas) { this.canvas = canvas.getContext("2d"); @@ -3179,6 +663,9 @@ Flog.RayTracer.Engine.prototype = { this.setPixel(x, y, color); } } + if (checkNumber !== 2321) { + throw new Error("Scene rendered incorrectly"); + } }, getPixelColor: function(ray, scene){ @@ -3415,4 +902,3 @@ function renderScene(){ raytracer.renderScene(scene, null, 0); } - diff --git a/js/src/v8/regexp.js b/js/src/v8/regexp.js new file mode 100644 index 000000000000..71b9e6362c47 --- /dev/null +++ b/js/src/v8/regexp.js @@ -0,0 +1,1764 @@ +// Copyright 2010 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. + +// Automatically generated on 2009-01-30. Manually updated on 2010-09-17. + +// This benchmark is generated by loading 50 of the most popular pages +// on the web and logging all regexp operations performed. Each +// operation is given a weight that is calculated from an estimate of +// the popularity of the pages where it occurs and the number of times +// it is executed while loading each page. Furthermore the literal +// letters in the data are encoded using ROT13 in a way that does not +// affect how the regexps match their input. Finally the strings are +// scrambled to exercise the regexp engine on different input strings. + + +var RegExp = new BenchmarkSuite('RegExp', 910985, [ + new Benchmark("RegExp", RegExpRun, RegExpSetup, RegExpTearDown) +]); + +var regExpBenchmark = null; + +function RegExpSetup() { + regExpBenchmark = new RegExpBenchmark(); + RegExpRun(); // run once to get system initialized +} + +function RegExpRun() { + regExpBenchmark.run(); +} + +function RegExpTearDown() { + regExpBenchmark = null; +} + +// Returns an array of n different variants of the input string str. +// The variants are computed by randomly rotating one random +// character. +function computeInputVariants(str, n) { + var variants = [ str ]; + for (var i = 1; i < n; i++) { + var pos = Math.floor(Math.random() * str.length); + var chr = String.fromCharCode((str.charCodeAt(pos) + Math.floor(Math.random() * 128)) % 128); + variants[i] = str.substring(0, pos) + chr + str.substring(pos + 1, str.length); + } + return variants; +} + +function RegExpBenchmark() { + var re0 = /^ba/; + var re1 = /(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/; + var re2 = /^\s*|\s*$/g; + var re3 = /\bQBZPbageby_cynprubyqre\b/; + var re4 = /,/; + var re5 = /\bQBZPbageby_cynprubyqre\b/g; + var re6 = /^[\s\xa0]+|[\s\xa0]+$/g; + var re7 = /(\d*)(\D*)/g; + var re8 = /=/; + var re9 = /(^|\s)lhv\-h(\s|$)/; + var str0 = 'Zbmvyyn/5.0 (Jvaqbjf; H; Jvaqbjf AG 5.1; ra-HF) NccyrJroXvg/528.9 (XUGZY, yvxr Trpxb) Puebzr/2.0.157.0 Fnsnev/528.9'; + var re10 = /\#/g; + var re11 = /\./g; + var re12 = /'/g; + var re13 = /\?[\w\W]*(sevraqvq|punaaryvq|tebhcvq)=([^\&\?#]*)/i; + var str1 = 'Fubpxjnir Synfu 9.0 e115'; + var re14 = /\s+/g; + var re15 = /^\s*(\S*(\s+\S+)*)\s*$/; + var re16 = /(-[a-z])/i; + + var s0 = computeInputVariants('pyvpx', 6511); + var s1 = computeInputVariants('uggc://jjj.snprobbx.pbz/ybtva.cuc', 1844); + var s2 = computeInputVariants('QBZPbageby_cynprubyqre', 739); + var s3 = computeInputVariants('uggc://jjj.snprobbx.pbz/', 598); + var s4 = computeInputVariants('uggc://jjj.snprobbx.pbz/fepu.cuc', 454); + var s5 = computeInputVariants('qqqq, ZZZ q, llll', 352); + var s6 = computeInputVariants('vachggrkg QBZPbageby_cynprubyqre', 312); + var s7 = computeInputVariants('/ZlFcnprUbzrcntr/Vaqrk-FvgrUbzr,10000000', 282); + var s8 = computeInputVariants('vachggrkg', 177); + var s9 = computeInputVariants('528.9', 170); + var s10 = computeInputVariants('528', 170); + var s11 = computeInputVariants('VCPhygher=ra-HF', 156); + var s12 = computeInputVariants('CersreerqPhygher=ra-HF', 156); + var s13 = computeInputVariants('xrlcerff', 144); + var s14 = computeInputVariants('521', 139); + var s15 = computeInputVariants(str0, 139); + var s16 = computeInputVariants('qvi .so_zrah', 137); + var s17 = computeInputVariants('qvi.so_zrah', 137); + var s18 = computeInputVariants('uvqqra_ryrz', 117); + var s19 = computeInputVariants('sevraqfgre_naba=nvq%3Qn6ss9p85n868ro9s059pn854735956o3%26ers%3Q%26df%3Q%26vpgl%3QHF', 95); + var s20 = computeInputVariants('uggc://ubzr.zlfcnpr.pbz/vaqrk.psz', 93); + var s21 = computeInputVariants(str1, 92); + var s22 = computeInputVariants('svefg', 85); + var s23 = computeInputVariants('uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz', 85); + var s24 = computeInputVariants('ynfg', 85); + var s25 = computeInputVariants('qvfcynl', 85); + + function runBlock0() { + for (var i = 0; i < 6511; i++) { + re0.exec(s0[i]); + } + for (var i = 0; i < 1844; i++) { + re1.exec(s1[i]); + } + for (var i = 0; i < 739; i++) { + s2[i].replace(re2, ''); + } + for (var i = 0; i < 598; i++) { + re1.exec(s3[i]); + } + for (var i = 0; i < 454; i++) { + re1.exec(s4[i]); + } + for (var i = 0; i < 352; i++) { + /qqqq|qqq|qq|q|ZZZZ|ZZZ|ZZ|Z|llll|ll|l|uu|u|UU|U|zz|z|ff|f|gg|g|sss|ss|s|mmm|mm|m/g.exec(s5[i]); + } + for (var i = 0; i < 312; i++) { + re3.exec(s6[i]); + } + for (var i = 0; i < 282; i++) { + re4.exec(s7[i]); + } + for (var i = 0; i < 177; i++) { + s8[i].replace(re5, ''); + } + for (var i = 0; i < 170; i++) { + s9[i].replace(re6, ''); + re7.exec(s10[i]); + } + for (var i = 0; i < 156; i++) { + re8.exec(s11[i]); + re8.exec(s12[i]); + } + for (var i = 0; i < 144; i++) { + re0.exec(s13[i]); + } + for (var i = 0; i < 139; i++) { + s14[i].replace(re6, ''); + re7.exec(s14[i]); + re9.exec(''); + /JroXvg\/(\S+)/.exec(s15[i]); + } + for (var i = 0; i < 137; i++) { + s16[i].replace(re10, ''); + s16[i].replace(/\[/g, ''); + s17[i].replace(re11, ''); + } + for (var i = 0; i < 117; i++) { + s18[i].replace(re2, ''); + } + for (var i = 0; i < 95; i++) { + /(?:^|;)\s*sevraqfgre_ynat=([^;]*)/.exec(s19[i]); + } + for (var i = 0; i < 93; i++) { + s20[i].replace(re12, ''); + re13.exec(s20[i]); + } + for (var i = 0; i < 92; i++) { + s21[i].replace(/([a-zA-Z]|\s)+/, ''); + } + for (var i = 0; i < 85; i++) { + s22[i].replace(re14, ''); + s22[i].replace(re15, ''); + s23[i].replace(re12, ''); + s24[i].replace(re14, ''); + s24[i].replace(re15, ''); + re16.exec(s25[i]); + re13.exec(s23[i]); + } + } + var re17 = /(^|[^\\])\"\\\/Qngr\((-?[0-9]+)\)\\\/\"/g; + var str2 = '{"anzr":"","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":gehr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"\xa4","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":gehr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, qq ZZZZ llll UU:zz:ff","YbatQngrCnggrea":"qqqq, qq ZZZZ llll","YbatGvzrCnggrea":"UU:zz:ff","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"ZZ/qq/llll","FubegGvzrCnggrea":"UU:zz","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"llll ZZZZ","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":gehr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; + var str3 = '{"anzr":"ra-HF","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":snyfr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"$","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":snyfr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, ZZZZ qq, llll u:zz:ff gg","YbatQngrCnggrea":"qqqq, ZZZZ qq, llll","YbatGvzrCnggrea":"u:zz:ff gg","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"Z/q/llll","FubegGvzrCnggrea":"u:zz gg","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"ZZZZ, llll","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":snyfr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; + var str4 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str5 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var re18 = /^\s+|\s+$/g; + var str6 = 'uggc://jjj.snprobbx.pbz/vaqrk.cuc'; + var re19 = /(?:^|\s+)ba(?:\s+|$)/; + var re20 = /[+, ]/; + var re21 = /ybnqrq|pbzcyrgr/; + var str7 = ';;jvaqbj.IjPurpxZbhfrCbfvgvbaNQ_VQ=shapgvba(r){vs(!r)ine r=jvaqbj.rirag;ine c=-1;vs(d1)c=d1.EbyybssCnary;ine bo=IjTrgBow("IjCnayNQ_VQ_"+c);vs(bo&&bo.fglyr.ivfvovyvgl=="ivfvoyr"){ine fns=IjFns?8:0;ine pheK=r.pyvragK+IjBOFpe("U")+fns,pheL=r.pyvragL+IjBOFpe("I")+fns;ine y=IjBOEC(NQ_VQ,bo,"Y"),g=IjBOEC(NQ_VQ,bo,"G");ine e=y+d1.Cnaryf[c].Jvqgu,o=g+d1.Cnaryf[c].Urvtug;vs((pheKe)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(d1&&d1.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(d1)d1.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(d1)d1.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;d1.IjTc=d2(n,c){ine nq=d1;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;d1.IjYvzvg0=d2(n,f){ine nq=d1,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;d1.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",d1.rvsg);};;d1.IjNavzSHC=d2(n,c){ine nq=d1;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;d1.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;d1.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;c]/g; + var str15 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=44132r503660'; + var str16 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; AFP_zp_dfctwzs-aowb_80=44132r503660; __hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1; __hgzo=144631658.0.10.1231363638; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str17 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231363621014&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231363621014&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=348699119.1231363624&tn_fvq=1231363624&tn_uvq=895511034&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str18 = 'uggc://jjj.yrobapbva.se/yv'; + var str19 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str20 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + + var s67 = computeInputVariants('e115', 27); + var s68 = computeInputVariants('qvfcynl', 27); + var s69 = computeInputVariants('cbfvgvba', 27); + var s70 = computeInputVariants('uggc://jjj.zlfcnpr.pbz/', 27); + var s71 = computeInputVariants('cntrivrj', 27); + var s72 = computeInputVariants('VC=74.125.75.3', 27); + var s73 = computeInputVariants('ra', 27); + var s74 = computeInputVariants(str10, 27); + var s75 = computeInputVariants(str11, 27); + var s76 = computeInputVariants(str12, 27); + var s77 = computeInputVariants(str17, 27); + var s78 = computeInputVariants(str18, 27); + + function runBlock3() { + for (var i = 0; i < 27; i++) { + s67[i].replace(/[A-Za-z]/g, ''); + } + for (var i = 0; i < 23; i++) { + s68[i].replace(re27, ''); + s69[i].replace(re27, ''); + } + for (var i = 0; i < 22; i++) { + 'unaqyr'.replace(re14, ''); + 'unaqyr'.replace(re15, ''); + 'yvar'.replace(re14, ''); + 'yvar'.replace(re15, ''); + 'cnerag puebzr6 fvatyr1 gno'.replace(re14, ''); + 'cnerag puebzr6 fvatyr1 gno'.replace(re15, ''); + 'fyvqre'.replace(re14, ''); + 'fyvqre'.replace(re15, ''); + re28.exec(''); + } + for (var i = 0; i < 21; i++) { + s70[i].replace(re12, ''); + re13.exec(s70[i]); + } + for (var i = 0; i < 20; i++) { + s71[i].replace(re29, ''); + s71[i].replace(re30, ''); + re19.exec('ynfg'); + re19.exec('ba svefg'); + re8.exec(s72[i]); + } + for (var i = 0; i < 19; i++) { + re31.exec(s73[i]); + } + for (var i = 0; i < 18; i++) { + s74[i].split(re32); + s75[i].split(re32); + s76[i].replace(re33, ''); + re8.exec('144631658.0.10.1231363570'); + re8.exec('144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); + re8.exec(str13); + re8.exec(str14); + re8.exec('__hgzn=144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); + re8.exec('__hgzo=144631658.0.10.1231363570'); + re8.exec('__hgzm=144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(s74[i]); + re34.exec(s75[i]); + } + for (var i = 0; i < 17; i++) { + s15[i].match(/zfvr/gi); + s15[i].match(/bcren/gi); + str15.split(re32); + str16.split(re32); + 'ohggba'.replace(re14, ''); + 'ohggba'.replace(re15, ''); + 'puvyq p1 svefg sylbhg pybfrq'.replace(re14, ''); + 'puvyq p1 svefg sylbhg pybfrq'.replace(re15, ''); + 'pvgvrf'.replace(re14, ''); + 'pvgvrf'.replace(re15, ''); + 'pybfrq'.replace(re14, ''); + 'pybfrq'.replace(re15, ''); + 'qry'.replace(re14, ''); + 'qry'.replace(re15, ''); + 'uqy_zba'.replace(re14, ''); + 'uqy_zba'.replace(re15, ''); + s77[i].replace(re33, ''); + s78[i].replace(/%3P/g, ''); + s78[i].replace(/%3R/g, ''); + s78[i].replace(/%3q/g, ''); + s78[i].replace(re35, ''); + 'yvaxyvfg16'.replace(re14, ''); + 'yvaxyvfg16'.replace(re15, ''); + 'zvahf'.replace(re14, ''); + 'zvahf'.replace(re15, ''); + 'bcra'.replace(re14, ''); + 'bcra'.replace(re15, ''); + 'cnerag puebzr5 fvatyr1 ps NU'.replace(re14, ''); + 'cnerag puebzr5 fvatyr1 ps NU'.replace(re15, ''); + 'cynlre'.replace(re14, ''); + 'cynlre'.replace(re15, ''); + 'cyhf'.replace(re14, ''); + 'cyhf'.replace(re15, ''); + 'cb_uqy'.replace(re14, ''); + 'cb_uqy'.replace(re15, ''); + 'hyJVzt'.replace(re14, ''); + 'hyJVzt'.replace(re15, ''); + re8.exec('144631658.0.10.1231363638'); + re8.exec('144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.965867047679498800.1231363638.1231363638.1231363638.1'); + re8.exec('4413268q3660'); + re8.exec('4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); + re8.exec('SbeprqRkcvengvba=633669321699093060'); + re8.exec('VC=74.125.75.20'); + re8.exec(str19); + re8.exec(str20); + re8.exec('AFP_zp_tfwsbrg-aowb_80=4413268q3660'); + re8.exec('FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); + re8.exec('__hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1'); + re8.exec('__hgzo=144631658.0.10.1231363638'); + re8.exec('__hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(str15); + re34.exec(str16); + } + } + var re36 = /uers|fep|fryrpgrq/; + var re37 = /\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g; + var re38 = /^(\w+|\*)$/; + var str21 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str22 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; __hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1; __hgzo=144631658.0.10.1231367822; __hgzp=144631658; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str23 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367803797&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367803797&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Szrffntvat.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1192552091.1231367807&tn_fvq=1231367807&tn_uvq=1155446857&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str24 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str25 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str26 = 'hy.ynat-fryrpgbe'; + var re39 = /\\/g; + var re40 = / /g; + var re41 = /\/\xc4\/t/; + var re42 = /\/\xd6\/t/; + var re43 = /\/\xdc\/t/; + var re44 = /\/\xdf\/t/; + var re45 = /\/\xe4\/t/; + var re46 = /\/\xf6\/t/; + var re47 = /\/\xfc\/t/; + var re48 = /\W/g; + var re49 = /uers|fep|fglyr/; + var s79 = computeInputVariants(str21, 16); + var s80 = computeInputVariants(str22, 16); + var s81 = computeInputVariants(str23, 16); + var s82 = computeInputVariants(str26, 16); + + function runBlock4() { + for (var i = 0; i < 16; i++) { + ''.replace(/\*/g, ''); + /\bnpgvir\b/.exec('npgvir'); + /sversbk/i.exec(s15[i]); + re36.exec('glcr'); + /zfvr/i.exec(s15[i]); + /bcren/i.exec(s15[i]); + } + for (var i = 0; i < 15; i++) { + s79[i].split(re32); + s80[i].split(re32); + 'uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); + s81[i].replace(re33, ''); + 'yv'.replace(re37, ''); + 'yv'.replace(re18, ''); + re8.exec('144631658.0.10.1231367822'); + re8.exec('144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); + re8.exec(str24); + re8.exec(str25); + re8.exec('__hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); + re8.exec('__hgzo=144631658.0.10.1231367822'); + re8.exec('__hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(s79[i]); + re34.exec(s80[i]); + /\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g.exec(s82[i]); + re13.exec('uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'); + re38.exec('yv'); + } + for (var i = 0; i < 14; i++) { + ''.replace(re18, ''); + '9.0 e115'.replace(/(\s+e|\s+o[0-9]+)/, ''); + 'Funer guvf tnqtrg'.replace(//g, ''); + 'Funer guvf tnqtrg'.replace(re39, ''); + 'uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); + 'grnfre'.replace(re40, ''); + 'grnfre'.replace(re41, ''); + 'grnfre'.replace(re42, ''); + 'grnfre'.replace(re43, ''); + 'grnfre'.replace(re44, ''); + 'grnfre'.replace(re45, ''); + 'grnfre'.replace(re46, ''); + 'grnfre'.replace(re47, ''); + 'grnfre'.replace(re48, ''); + re16.exec('znetva-gbc'); + re16.exec('cbfvgvba'); + re19.exec('gno1'); + re9.exec('qz'); + re9.exec('qg'); + re9.exec('zbqobk'); + re9.exec('zbqobkva'); + re9.exec('zbqgvgyr'); + re13.exec('uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'); + re26.exec('/vt/znvytnqtrg'); + re49.exec('glcr'); + } + } + var re50 = /(?:^|\s+)fryrpgrq(?:\s+|$)/; + var re51 = /\&/g; + var re52 = /\+/g; + var re53 = /\?/g; + var re54 = /\t/g; + var re55 = /(\$\{nqiHey\})|(\$nqiHey\b)/g; + var re56 = /(\$\{cngu\})|(\$cngu\b)/g; + function runBlock5() { + for (var i = 0; i < 13; i++) { + 'purpx'.replace(re14, ''); + 'purpx'.replace(re15, ''); + 'pvgl'.replace(re14, ''); + 'pvgl'.replace(re15, ''); + 'qrpe fyvqrgrkg'.replace(re14, ''); + 'qrpe fyvqrgrkg'.replace(re15, ''); + 'svefg fryrpgrq'.replace(re14, ''); + 'svefg fryrpgrq'.replace(re15, ''); + 'uqy_rag'.replace(re14, ''); + 'uqy_rag'.replace(re15, ''); + 'vape fyvqrgrkg'.replace(re14, ''); + 'vape fyvqrgrkg'.replace(re15, ''); + 'vachggrkg QBZPbageby_cynprubyqre'.replace(re5, ''); + 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re14, ''); + 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re15, ''); + 'cb_guz'.replace(re14, ''); + 'cb_guz'.replace(re15, ''); + 'fhozvg'.replace(re14, ''); + 'fhozvg'.replace(re15, ''); + re50.exec(''); + /NccyrJroXvg\/([^\s]*)/.exec(s15[i]); + /XUGZY/.exec(s15[i]); + } + for (var i = 0; i < 12; i++) { + '${cebg}://${ubfg}${cngu}/${dz}'.replace(/(\$\{cebg\})|(\$cebg\b)/g, ''); + '1'.replace(re40, ''); + '1'.replace(re10, ''); + '1'.replace(re51, ''); + '1'.replace(re52, ''); + '1'.replace(re53, ''); + '1'.replace(re39, ''); + '1'.replace(re54, ''); + '9.0 e115'.replace(/^(.*)\..*$/, ''); + '9.0 e115'.replace(/^.*e(.*)$/, ''); + ''.replace(re55, ''); + ''.replace(re55, ''); + s21[i].replace(/^.*\s+(\S+\s+\S+$)/, ''); + 'tzk%2Subzrcntr%2Sfgneg%2Sqr%2S'.replace(re30, ''); + 'tzk'.replace(re30, ''); + 'uggc://${ubfg}${cngu}/${dz}'.replace(/(\$\{ubfg\})|(\$ubfg\b)/g, ''); + 'uggc://nqpyvrag.hvzfrei.arg${cngu}/${dz}'.replace(re56, ''); + 'uggc://nqpyvrag.hvzfrei.arg/wf.at/${dz}'.replace(/(\$\{dz\})|(\$dz\b)/g, ''); + 'frpgvba'.replace(re29, ''); + 'frpgvba'.replace(re30, ''); + 'fvgr'.replace(re29, ''); + 'fvgr'.replace(re30, ''); + 'fcrpvny'.replace(re29, ''); + 'fcrpvny'.replace(re30, ''); + re36.exec('anzr'); + /e/.exec('9.0 e115'); + } + } + var re57 = /##yv4##/gi; + var re58 = /##yv16##/gi; + var re59 = /##yv19##/gi; + var str27 = '##yv4##Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str28 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str29 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str30 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str31 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. ##N##Yrnea zber##/N##'; + var str32 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. Yrnea zber##/N##'; + var str33 = 'Bar Jvaqbjf Yvir VQ trgf lbh vagb Ubgznvy, Zrffratre, Kobk YVIR \u2014 naq bgure cynprf lbh frr #~#argjbexybtb#~#'; + var re60 = /(?:^|\s+)bss(?:\s+|$)/; + var re61 = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; + var re62 = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; + var str34 = '${1}://${2}${3}${4}${5}'; + var str35 = ' O=6gnyg0g4znrrn&o=3&f=gc; Q=_lyu=K3bQZGSxnT4lZzD3OS9GNmV3ZGLkAQxRpTyxNmRlZmRmAmNkAQLRqTImqNZjOUEgpTjQnJ5xMKtgoN--; SCF=qy'; + var s83 = computeInputVariants(str27, 11); + var s84 = computeInputVariants(str28, 11); + var s85 = computeInputVariants(str29, 11); + var s86 = computeInputVariants(str30, 11); + var s87 = computeInputVariants(str31, 11); + var s88 = computeInputVariants(str32, 11); + var s89 = computeInputVariants(str33, 11); + var s90 = computeInputVariants(str34, 11); + + function runBlock6() { + for (var i = 0; i < 11; i++) { + s83[i].replace(/##yv0##/gi, ''); + s83[i].replace(re57, ''); + s84[i].replace(re58, ''); + s85[i].replace(re59, ''); + s86[i].replace(/##\/o##/gi, ''); + s86[i].replace(/##\/v##/gi, ''); + s86[i].replace(/##\/h##/gi, ''); + s86[i].replace(/##o##/gi, ''); + s86[i].replace(/##oe##/gi, ''); + s86[i].replace(/##v##/gi, ''); + s86[i].replace(/##h##/gi, ''); + s87[i].replace(/##n##/gi, ''); + s88[i].replace(/##\/n##/gi, ''); + s89[i].replace(/#~#argjbexybtb#~#/g, ''); + / Zbovyr\//.exec(s15[i]); + /##yv1##/gi.exec(s83[i]); + /##yv10##/gi.exec(s84[i]); + /##yv11##/gi.exec(s84[i]); + /##yv12##/gi.exec(s84[i]); + /##yv13##/gi.exec(s84[i]); + /##yv14##/gi.exec(s84[i]); + /##yv15##/gi.exec(s84[i]); + re58.exec(s84[i]); + /##yv17##/gi.exec(s85[i]); + /##yv18##/gi.exec(s85[i]); + re59.exec(s85[i]); + /##yv2##/gi.exec(s83[i]); + /##yv20##/gi.exec(s86[i]); + /##yv21##/gi.exec(s86[i]); + /##yv22##/gi.exec(s86[i]); + /##yv23##/gi.exec(s86[i]); + /##yv3##/gi.exec(s83[i]); + re57.exec(s83[i]); + /##yv5##/gi.exec(s84[i]); + /##yv6##/gi.exec(s84[i]); + /##yv7##/gi.exec(s84[i]); + /##yv8##/gi.exec(s84[i]); + /##yv9##/gi.exec(s84[i]); + re8.exec('473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); + re8.exec('SbeprqRkcvengvba=633669325184628362'); + re8.exec('FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); + /AbxvnA[^\/]*/.exec(s15[i]); + } + for (var i = 0; i < 10; i++) { + ' bss'.replace(/(?:^|\s+)bss(?:\s+|$)/g, ''); + s90[i].replace(/(\$\{0\})|(\$0\b)/g, ''); + s90[i].replace(/(\$\{1\})|(\$1\b)/g, ''); + s90[i].replace(/(\$\{pbzcyrgr\})|(\$pbzcyrgr\b)/g, ''); + s90[i].replace(/(\$\{sentzrag\})|(\$sentzrag\b)/g, ''); + s90[i].replace(/(\$\{ubfgcbeg\})|(\$ubfgcbeg\b)/g, ''); + s90[i].replace(re56, ''); + s90[i].replace(/(\$\{cebgbpby\})|(\$cebgbpby\b)/g, ''); + s90[i].replace(/(\$\{dhrel\})|(\$dhrel\b)/g, ''); + 'nqfvmr'.replace(re29, ''); + 'nqfvmr'.replace(re30, ''); + 'uggc://${2}${3}${4}${5}'.replace(/(\$\{2\})|(\$2\b)/g, ''); + 'uggc://wf.hv-cbegny.qr${3}${4}${5}'.replace(/(\$\{3\})|(\$3\b)/g, ''); + 'arjf'.replace(re40, ''); + 'arjf'.replace(re41, ''); + 'arjf'.replace(re42, ''); + 'arjf'.replace(re43, ''); + 'arjf'.replace(re44, ''); + 'arjf'.replace(re45, ''); + 'arjf'.replace(re46, ''); + 'arjf'.replace(re47, ''); + 'arjf'.replace(re48, ''); + / PC=i=(\d+)&oe=(.)/.exec(str35); + re60.exec(' '); + re60.exec(' bss'); + re60.exec(''); + re19.exec(' '); + re19.exec('svefg ba'); + re19.exec('ynfg vtaber'); + re19.exec('ba'); + re9.exec('scnq so '); + re9.exec('zrqvgobk'); + re9.exec('hsgy'); + re9.exec('lhv-h'); + /Fnsnev|Xbadhrebe|XUGZY/gi.exec(s15[i]); + re61.exec('uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); + re62.exec('#Ybtva_rznvy'); + } + } + var re63 = /\{0\}/g; + var str36 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_tfwsbrg-aowb_80=4413268q3660'; + var str37 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; AFP_zp_tfwsbrg-aowb_80=4413268q3660; __hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1; __hgzo=144631658.0.10.1231364074; __hgzp=144631658; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str38 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231364057761&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364057761&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Ssevraqf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1667363813.1231364061&tn_fvq=1231364061&tn_uvq=1917563877&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str39 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str40 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var s91 = computeInputVariants(str36, 9); + var s92 = computeInputVariants(str37, 9); + var s93 = computeInputVariants(str38, 9); + function runBlock7() { + for (var i = 0; i < 9; i++) { + '0'.replace(re40, ''); + '0'.replace(re10, ''); + '0'.replace(re51, ''); + '0'.replace(re52, ''); + '0'.replace(re53, ''); + '0'.replace(re39, ''); + '0'.replace(re54, ''); + 'Lrf'.replace(re40, ''); + 'Lrf'.replace(re10, ''); + 'Lrf'.replace(re51, ''); + 'Lrf'.replace(re52, ''); + 'Lrf'.replace(re53, ''); + 'Lrf'.replace(re39, ''); + 'Lrf'.replace(re54, ''); + } + for (var i = 0; i < 8; i++) { + 'Pybfr {0}'.replace(re63, ''); + 'Bcra {0}'.replace(re63, ''); + s91[i].split(re32); + s92[i].split(re32); + 'puvyq p1 svefg gnournqref'.replace(re14, ''); + 'puvyq p1 svefg gnournqref'.replace(re15, ''); + 'uqy_fcb'.replace(re14, ''); + 'uqy_fcb'.replace(re15, ''); + 'uvag'.replace(re14, ''); + 'uvag'.replace(re15, ''); + s93[i].replace(re33, ''); + 'yvfg'.replace(re14, ''); + 'yvfg'.replace(re15, ''); + 'at_bhgre'.replace(re30, ''); + 'cnerag puebzr5 qbhoyr2 NU'.replace(re14, ''); + 'cnerag puebzr5 qbhoyr2 NU'.replace(re15, ''); + 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re14, ''); + 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re15, ''); + 'cnerag puebzr6 fvatyr1'.replace(re14, ''); + 'cnerag puebzr6 fvatyr1'.replace(re15, ''); + 'cb_qrs'.replace(re14, ''); + 'cb_qrs'.replace(re15, ''); + 'gnopbagrag'.replace(re14, ''); + 'gnopbagrag'.replace(re15, ''); + 'iv_svefg_gvzr'.replace(re30, ''); + /(^|.)(ronl|qri-ehf3.wbg)(|fgberf|zbgbef|yvirnhpgvbaf|jvxv|rkcerff|punggre).(pbz(|.nh|.pa|.ux|.zl|.ft|.oe|.zk)|pb(.hx|.xe|.am)|pn|qr|se|vg|ay|or|ng|pu|vr|va|rf|cy|cu|fr)$/i.exec('cntrf.ronl.pbz'); + re8.exec('144631658.0.10.1231364074'); + re8.exec('144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); + re8.exec('4413241q3660'); + re8.exec('SbeprqRkcvengvba=633669357391353591'); + re8.exec(str39); + re8.exec(str40); + re8.exec('AFP_zp_kkk-gdzogv_80=4413241q3660'); + re8.exec('FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); + re8.exec('__hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); + re8.exec('__hgzo=144631658.0.10.1231364074'); + re8.exec('__hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); + re34.exec(s91[i]); + re34.exec(s92[i]); + } + } + var re64 = /\b[a-z]/g; + var re65 = /^uggc:\/\//; + var re66 = /(?:^|\s+)qvfnoyrq(?:\s+|$)/; + var str41 = 'uggc://cebsvyr.zlfcnpr.pbz/Zbqhyrf/Nccyvpngvbaf/Cntrf/Pnainf.nfck'; + function runBlock8() { + for (var i = 0; i < 7; i++) { + s21[i].match(/\d+/g); + 'nsgre'.replace(re64, ''); + 'orsber'.replace(re64, ''); + 'obggbz'.replace(re64, ''); + 'ohvygva_jrngure.kzy'.replace(re65, ''); + 'ohggba'.replace(re37, ''); + 'ohggba'.replace(re18, ''); + 'qngrgvzr.kzy'.replace(re65, ''); + 'uggc://eff.paa.pbz/eff/paa_gbcfgbevrf.eff'.replace(re65, ''); + 'vachg'.replace(re37, ''); + 'vachg'.replace(re18, ''); + 'vafvqr'.replace(re64, ''); + 'cbvagre'.replace(re27, ''); + 'cbfvgvba'.replace(/[A-Z]/g, ''); + 'gbc'.replace(re27, ''); + 'gbc'.replace(re64, ''); + 'hy'.replace(re37, ''); + 'hy'.replace(re18, ''); + str26.replace(re37, ''); + str26.replace(re18, ''); + 'lbhghor_vtbbtyr/i2/lbhghor.kzy'.replace(re65, ''); + 'm-vaqrk'.replace(re27, ''); + /#([\w-]+)/.exec(str26); + re16.exec('urvtug'); + re16.exec('znetvaGbc'); + re16.exec('jvqgu'); + re19.exec('gno0 svefg ba'); + re19.exec('gno0 ba'); + re19.exec('gno4 ynfg'); + re19.exec('gno4'); + re19.exec('gno5'); + re19.exec('gno6'); + re19.exec('gno7'); + re19.exec('gno8'); + /NqborNVE\/([^\s]*)/.exec(s15[i]); + /NccyrJroXvg\/([^ ]*)/.exec(s15[i]); + /XUGZY/gi.exec(s15[i]); + /^(?:obql|ugzy)$/i.exec('YV'); + re38.exec('ohggba'); + re38.exec('vachg'); + re38.exec('hy'); + re38.exec(str26); + /^(\w+|\*)/.exec(str26); + /znp|jva|yvahk/i.exec('Jva32'); + /eton?\([\d\s,]+\)/.exec('fgngvp'); + } + for (var i = 0; i < 6; i++) { + ''.replace(/\r/g, ''); + '/'.replace(re40, ''); + '/'.replace(re10, ''); + '/'.replace(re51, ''); + '/'.replace(re52, ''); + '/'.replace(re53, ''); + '/'.replace(re39, ''); + '/'.replace(re54, ''); + 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/{0}?[NDO]&{1}&{2}&[NDR]'.replace(re63, ''); + str41.replace(re12, ''); + 'uggc://jjj.snprobbx.pbz/fepu.cuc'.replace(re23, ''); + 'freivpr'.replace(re40, ''); + 'freivpr'.replace(re41, ''); + 'freivpr'.replace(re42, ''); + 'freivpr'.replace(re43, ''); + 'freivpr'.replace(re44, ''); + 'freivpr'.replace(re45, ''); + 'freivpr'.replace(re46, ''); + 'freivpr'.replace(re47, ''); + 'freivpr'.replace(re48, ''); + /((ZFVR\s+([6-9]|\d\d)\.))/.exec(s15[i]); + re66.exec(''); + re50.exec('fryrpgrq'); + re8.exec('8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); + re8.exec('SbeprqRkcvengvba=633669340386893867'); + re8.exec('VC=74.125.75.17'); + re8.exec('FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); + /Xbadhrebe|Fnsnev|XUGZY/.exec(s15[i]); + re13.exec(str41); + re49.exec('unfsbphf'); + } + } + var re67 = /zrah_byq/g; + var str42 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str43 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; __hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1; __hgzo=144631658.0.10.1231364380; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str44 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_vzntrf_wf&qg=1231364373088&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364373088&punaary=svz_zlfcnpr_hfre-ivrj-pbzzragf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Spbzzrag.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1158737789.1231364375&tn_fvq=1231364375&tn_uvq=415520832&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str45 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str46 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var re68 = /^([#.]?)((?:[\w\u0128-\uffff*_-]|\\.)*)/; + var re69 = /\{1\}/g; + var re70 = /\s+/; + var re71 = /(\$\{4\})|(\$4\b)/g; + var re72 = /(\$\{5\})|(\$5\b)/g; + var re73 = /\{2\}/g; + var re74 = /[^+>] [^+>]/; + var re75 = /\bucpyv\s*=\s*([^;]*)/i; + var re76 = /\bucuvqr\s*=\s*([^;]*)/i; + var re77 = /\bucfie\s*=\s*([^;]*)/i; + var re78 = /\bhfucjrn\s*=\s*([^;]*)/i; + var re79 = /\bmvc\s*=\s*([^;]*)/i; + var re80 = /^((?:[\w\u0128-\uffff*_-]|\\.)+)(#)((?:[\w\u0128-\uffff*_-]|\\.)+)/; + var re81 = /^([>+~])\s*(\w*)/i; + var re82 = /^>\s*((?:[\w\u0128-\uffff*_-]|\\.)+)/; + var re83 = /^[\s[]?shapgvba/; + var re84 = /v\/g.tvs#(.*)/i; + var str47 = '#Zbq-Vasb-Vasb-WninFpevcgUvag'; + var str48 = ',n.svryqOgaPnapry'; + var str49 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_kkk-gdzogv_80=4413241q3660'; + var str50 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; AFP_zp_kkk-gdzogv_80=4413241q3660; AFP_zp_kkk-aowb_80=4413235p3660; __hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1; __hgzo=144631658.0.10.1231367708; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str51 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367691141&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367691141&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sjjj.zlfcnpr.pbz%2S&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=320757904.1231367694&tn_fvq=1231367694&tn_uvq=1758792003&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str52 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N38%3N42%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=1024k768&p=24&x=L&oj=994&ou=634&uc=A&{2}&[NDR]'; + var str53 = 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq qbhoyr2 ps'; + var str54 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str55 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str56 = 'ne;ng;nh;or;oe;pn;pu;py;pa;qr;qx;rf;sv;se;to;ux;vq;vr;va;vg;wc;xe;zk;zl;ay;ab;am;cu;cy;cg;eh;fr;ft;gu;ge;gj;mn;'; + var str57 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886&GHVQ=1'; + var str58 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886'; + var str59 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'; + var str60 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF'; + var str61 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/29/4RQP4969777N048NPS4RRR3PO2S7S.wct'; + var str62 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/OQ/63NP9O94NS5OQP1249Q9S1ROP7NS3.wct'; + var str63 = 'zbmvyyn/5.0 (jvaqbjf; h; jvaqbjf ag 5.1; ra-hf) nccyrjroxvg/528.9 (xugzy, yvxr trpxb) puebzr/2.0.157.0 fnsnev/528.9'; + var s94 = computeInputVariants(str42, 5); + var s95 = computeInputVariants(str43, 5); + var s96 = computeInputVariants(str44, 5); + var s97 = computeInputVariants(str47, 5); + var s98 = computeInputVariants(str48, 5); + var s99 = computeInputVariants(str49, 5); + var s100 = computeInputVariants(str50, 5); + var s101 = computeInputVariants(str51, 5); + var s102 = computeInputVariants(str52, 5); + var s103 = computeInputVariants(str53, 5); + + function runBlock9() { + for (var i = 0; i < 5; i++) { + s94[i].split(re32); + s95[i].split(re32); + 'svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); + s96[i].replace(re33, ''); + 'zrah_arj zrah_arj_gbttyr zrah_gbttyr'.replace(re67, ''); + 'zrah_byq zrah_byq_gbttyr zrah_gbttyr'.replace(re67, ''); + re8.exec('102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); + re8.exec('144631658.0.10.1231364380'); + re8.exec('144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); + re8.exec('441326q33660'); + re8.exec('SbeprqRkcvengvba=633669341278771470'); + re8.exec(str45); + re8.exec(str46); + re8.exec('AFP_zp_dfctwzssrwh-aowb_80=441326q33660'); + re8.exec('FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); + re8.exec('__hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); + re8.exec('__hgzo=144631658.0.10.1231364380'); + re8.exec('__hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + } + for (var i = 0; i < 4; i++) { + ' yvfg1'.replace(re14, ''); + ' yvfg1'.replace(re15, ''); + ' yvfg2'.replace(re14, ''); + ' yvfg2'.replace(re15, ''); + ' frneputebhc1'.replace(re14, ''); + ' frneputebhc1'.replace(re15, ''); + s97[i].replace(re68, ''); + s97[i].replace(re18, ''); + ''.replace(/&/g, ''); + ''.replace(re35, ''); + '(..-{0})(\|(\d+)|)'.replace(re63, ''); + s98[i].replace(re18, ''); + '//vzt.jro.qr/vij/FC/${cngu}/${anzr}/${inyhr}?gf=${abj}'.replace(re56, ''); + '//vzt.jro.qr/vij/FC/tzk_uc/${anzr}/${inyhr}?gf=${abj}'.replace(/(\$\{anzr\})|(\$anzr\b)/g, ''); + 'Jvaqbjf Yvir Ubgznvy{1}'.replace(re69, ''); + '{0}{1}'.replace(re63, ''); + '{1}'.replace(re69, ''); + '{1}'.replace(re63, ''); + 'Vzntrf'.replace(re15, ''); + 'ZFA'.replace(re15, ''); + 'Zncf'.replace(re15, ''); + 'Zbq-Vasb-Vasb-WninFpevcgUvag'.replace(re39, ''); + 'Arjf'.replace(re15, ''); + s99[i].split(re32); + s100[i].split(re32); + 'Ivqrb'.replace(re15, ''); + 'Jro'.replace(re15, ''); + 'n'.replace(re39, ''); + 'nwnkFgneg'.split(re70); + 'nwnkFgbc'.split(re70); + 'ovaq'.replace(re14, ''); + 'ovaq'.replace(re15, ''); + 'oevatf lbh zber. Zber fcnpr (5TO), zber frphevgl, fgvyy serr.'.replace(re63, ''); + 'puvyq p1 svefg qrpx'.replace(re14, ''); + 'puvyq p1 svefg qrpx'.replace(re15, ''); + 'puvyq p1 svefg qbhoyr2'.replace(re14, ''); + 'puvyq p1 svefg qbhoyr2'.replace(re15, ''); + 'puvyq p2 ynfg'.replace(re14, ''); + 'puvyq p2 ynfg'.replace(re15, ''); + 'puvyq p2'.replace(re14, ''); + 'puvyq p2'.replace(re15, ''); + 'puvyq p3'.replace(re14, ''); + 'puvyq p3'.replace(re15, ''); + 'puvyq p4 ynfg'.replace(re14, ''); + 'puvyq p4 ynfg'.replace(re15, ''); + 'pbclevtug'.replace(re14, ''); + 'pbclevtug'.replace(re15, ''); + 'qZFAZR_1'.replace(re14, ''); + 'qZFAZR_1'.replace(re15, ''); + 'qbhoyr2 ps'.replace(re14, ''); + 'qbhoyr2 ps'.replace(re15, ''); + 'qbhoyr2'.replace(re14, ''); + 'qbhoyr2'.replace(re15, ''); + 'uqy_arj'.replace(re14, ''); + 'uqy_arj'.replace(re15, ''); + 'uc_fubccvatobk'.replace(re30, ''); + 'ugzy%2Rvq'.replace(re29, ''); + 'ugzy%2Rvq'.replace(re30, ''); + s101[i].replace(re33, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${4}${5}'.replace(re71, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${5}'.replace(re72, ''); + s102[i].replace(re73, ''); + 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); + 'vztZFSG'.replace(re14, ''); + 'vztZFSG'.replace(re15, ''); + 'zfasbbg1 ps'.replace(re14, ''); + 'zfasbbg1 ps'.replace(re15, ''); + s103[i].replace(re14, ''); + s103[i].replace(re15, ''); + 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re14, ''); + 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re15, ''); + 'cevznel'.replace(re14, ''); + 'cevznel'.replace(re15, ''); + 'erpgnatyr'.replace(re30, ''); + 'frpbaqnel'.replace(re14, ''); + 'frpbaqnel'.replace(re15, ''); + 'haybnq'.split(re70); + '{0}{1}1'.replace(re63, ''); + '|{1}1'.replace(re69, ''); + /(..-HF)(\|(\d+)|)/i.exec('xb-xe,ra-va,gu-gu'); + re4.exec('/ZlFcnprNccf/NccPnainf,45000012'); + re8.exec('144631658.0.10.1231367708'); + re8.exec('144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); + re8.exec('4413235p3660'); + re8.exec('441327q73660'); + re8.exec('9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); + re8.exec('SbeprqRkcvengvba=633669350559478880'); + re8.exec(str54); + re8.exec(str55); + re8.exec('AFP_zp_dfctwzs-aowb_80=441327q73660'); + re8.exec('AFP_zp_kkk-aowb_80=4413235p3660'); + re8.exec('FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); + re8.exec('__hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); + re8.exec('__hgzo=144631658.0.10.1231367708'); + re8.exec('__hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(s99[i]); + re34.exec(s100[i]); + /ZFVR\s+5[.]01/.exec(s15[i]); + /HF(?=;)/i.exec(str56); + re74.exec(s97[i]); + re28.exec('svefg npgvir svefgNpgvir'); + re28.exec('ynfg'); + /\bp:(..)/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF'); + re75.exec(str57); + re75.exec(str58); + re76.exec(str57); + re76.exec(str58); + re77.exec(str57); + re77.exec(str58); + /\bhfucce\s*=\s*([^;]*)/i.exec(str59); + re78.exec(str57); + re78.exec(str58); + /\bjci\s*=\s*([^;]*)/i.exec(str59); + re79.exec(str58); + re79.exec(str60); + re79.exec(str59); + /\|p:([a-z]{2})/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'); + re80.exec(s97[i]); + re61.exec('cebgbglcr.wf'); + re68.exec(s97[i]); + re81.exec(s97[i]); + re82.exec(s97[i]); + /^Fubpxjnir Synfu (\d)/.exec(s21[i]); + /^Fubpxjnir Synfu (\d+)/.exec(s21[i]); + re83.exec('[bowrpg tybony]'); + re62.exec(s97[i]); + re84.exec(str61); + re84.exec(str62); + /jroxvg/.exec(str63); + } + } + var re85 = /eaq_zbqobkva/; + var str64 = '1231365729213'; + var str65 = '74.125.75.3-1057165600.29978900'; + var str66 = '74.125.75.3-1057165600.29978900.1231365730214'; + var str67 = 'Frnepu%20Zvpebfbsg.pbz'; + var str68 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str69 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; __hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1; __hgzo=144631658.0.10.1231365779; __hgzp=144631658; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str70 = 'I=3%26THVQ=757q3ss871q44o7o805n8113n5p72q52'; + var str71 = 'I=3&THVQ=757q3ss871q44o7o805n8113n5p72q52'; + var str72 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365765292&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365765292&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sohyyrgvaf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1579793869.1231365768&tn_fvq=1231365768&tn_uvq=2056210897&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str73 = 'frnepu.zvpebfbsg.pbz'; + var str74 = 'frnepu.zvpebfbsg.pbz/'; + var str75 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str76 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + function runBlock10() { + for (var i = 0; i < 3; i++) { + '%3Szxg=ra-HF'.replace(re39, ''); + '-8'.replace(re40, ''); + '-8'.replace(re10, ''); + '-8'.replace(re51, ''); + '-8'.replace(re52, ''); + '-8'.replace(re53, ''); + '-8'.replace(re39, ''); + '-8'.replace(re54, ''); + '1.5'.replace(re40, ''); + '1.5'.replace(re10, ''); + '1.5'.replace(re51, ''); + '1.5'.replace(re52, ''); + '1.5'.replace(re53, ''); + '1.5'.replace(re39, ''); + '1.5'.replace(re54, ''); + '1024k768'.replace(re40, ''); + '1024k768'.replace(re10, ''); + '1024k768'.replace(re51, ''); + '1024k768'.replace(re52, ''); + '1024k768'.replace(re53, ''); + '1024k768'.replace(re39, ''); + '1024k768'.replace(re54, ''); + str64.replace(re40, ''); + str64.replace(re10, ''); + str64.replace(re51, ''); + str64.replace(re52, ''); + str64.replace(re53, ''); + str64.replace(re39, ''); + str64.replace(re54, ''); + '14'.replace(re40, ''); + '14'.replace(re10, ''); + '14'.replace(re51, ''); + '14'.replace(re52, ''); + '14'.replace(re53, ''); + '14'.replace(re39, ''); + '14'.replace(re54, ''); + '24'.replace(re40, ''); + '24'.replace(re10, ''); + '24'.replace(re51, ''); + '24'.replace(re52, ''); + '24'.replace(re53, ''); + '24'.replace(re39, ''); + '24'.replace(re54, ''); + str65.replace(re40, ''); + str65.replace(re10, ''); + str65.replace(re51, ''); + str65.replace(re52, ''); + str65.replace(re53, ''); + str65.replace(re39, ''); + str65.replace(re54, ''); + str66.replace(re40, ''); + str66.replace(re10, ''); + str66.replace(re51, ''); + str66.replace(re52, ''); + str66.replace(re53, ''); + str66.replace(re39, ''); + str66.replace(re54, ''); + '9.0'.replace(re40, ''); + '9.0'.replace(re10, ''); + '9.0'.replace(re51, ''); + '9.0'.replace(re52, ''); + '9.0'.replace(re53, ''); + '9.0'.replace(re39, ''); + '9.0'.replace(re54, ''); + '994k634'.replace(re40, ''); + '994k634'.replace(re10, ''); + '994k634'.replace(re51, ''); + '994k634'.replace(re52, ''); + '994k634'.replace(re53, ''); + '994k634'.replace(re39, ''); + '994k634'.replace(re54, ''); + '?zxg=ra-HF'.replace(re40, ''); + '?zxg=ra-HF'.replace(re10, ''); + '?zxg=ra-HF'.replace(re51, ''); + '?zxg=ra-HF'.replace(re52, ''); + '?zxg=ra-HF'.replace(re53, ''); + '?zxg=ra-HF'.replace(re54, ''); + 'PAA.pbz'.replace(re25, ''); + 'PAA.pbz'.replace(re12, ''); + 'PAA.pbz'.replace(re39, ''); + 'Qngr & Gvzr'.replace(re25, ''); + 'Qngr & Gvzr'.replace(re12, ''); + 'Qngr & Gvzr'.replace(re39, ''); + 'Frnepu Zvpebfbsg.pbz'.replace(re40, ''); + 'Frnepu Zvpebfbsg.pbz'.replace(re54, ''); + str67.replace(re10, ''); + str67.replace(re51, ''); + str67.replace(re52, ''); + str67.replace(re53, ''); + str67.replace(re39, ''); + str68.split(re32); + str69.split(re32); + str70.replace(re52, ''); + str70.replace(re53, ''); + str70.replace(re39, ''); + str71.replace(re40, ''); + str71.replace(re10, ''); + str71.replace(re51, ''); + str71.replace(re54, ''); + 'Jrngure'.replace(re25, ''); + 'Jrngure'.replace(re12, ''); + 'Jrngure'.replace(re39, ''); + 'LbhGhor'.replace(re25, ''); + 'LbhGhor'.replace(re12, ''); + 'LbhGhor'.replace(re39, ''); + str72.replace(re33, ''); + 'erzbgr_vsenzr_1'.replace(/^erzbgr_vsenzr_/, ''); + str73.replace(re40, ''); + str73.replace(re10, ''); + str73.replace(re51, ''); + str73.replace(re52, ''); + str73.replace(re53, ''); + str73.replace(re39, ''); + str73.replace(re54, ''); + str74.replace(re40, ''); + str74.replace(re10, ''); + str74.replace(re51, ''); + str74.replace(re52, ''); + str74.replace(re53, ''); + str74.replace(re39, ''); + str74.replace(re54, ''); + 'lhv-h'.replace(/\-/g, ''); + re9.exec('p'); + re9.exec('qz p'); + re9.exec('zbqynory'); + re9.exec('lhv-h svefg'); + re8.exec('144631658.0.10.1231365779'); + re8.exec('144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); + re8.exec(str75); + re8.exec(str76); + re8.exec('__hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); + re8.exec('__hgzo=144631658.0.10.1231365779'); + re8.exec('__hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(str68); + re34.exec(str69); + /^$/.exec(''); + re31.exec('qr'); + /^znk\d+$/.exec(''); + /^zva\d+$/.exec(''); + /^erfgber$/.exec(''); + re85.exec('zbqobkva zbqobk_abcnqqvat '); + re85.exec('zbqgvgyr'); + re85.exec('eaq_zbqobkva '); + re85.exec('eaq_zbqgvgyr '); + /frpgvba\d+_pbagragf/.exec('obggbz_ani'); + } + } + var re86 = /;\s*/; + var re87 = /(\$\{inyhr\})|(\$inyhr\b)/g; + var re88 = /(\$\{abj\})|(\$abj\b)/g; + var re89 = /\s+$/; + var re90 = /^\s+/; + var re91 = /(\\\"|\x00-|\x1f|\x7f-|\x9f|\u00ad|\u0600-|\u0604|\u070f|\u17b4|\u17b5|\u200c-|\u200f|\u2028-|\u202f|\u2060-|\u206f|\ufeff|\ufff0-|\uffff)/g; + var re92 = /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/; + var re93 = /^([:.#]*)((?:[\w\u0128-\uffff*_-]|\\.)+)/; + var re94 = /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/; + var str77 = '#fubhgobk .pybfr'; + var str78 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzssrwh-aowb_80=441326q33660'; + var str79 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; AFP_zp_dfctwzssrwh-aowb_80=441326q33660; __hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1; __hgzo=144631658.0.10.1231365869; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str80 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=441327q73660'; + var str81 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; AFP_zp_dfctwzs-aowb_80=441327q73660; __hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1; __hgzo=144631658.0.10.1231367054; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str82 = '[glcr=fhozvg]'; + var str83 = 'n.svryqOga,n.svryqOgaPnapry'; + var str84 = 'n.svryqOgaPnapry'; + var str85 = 'oyvpxchaxg'; + var str86 = 'qvi.bow-nppbeqvba qg'; + var str87 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_nccf_wf&qg=1231367052227&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367052227&punaary=svz_zlfcnpr_nccf-pnainf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2SZbqhyrf%2SNccyvpngvbaf%2SCntrf%2SPnainf.nfck&nq_glcr=grkg&rvq=6083027&rn=0&sez=1&tn_ivq=716357910.1231367056&tn_fvq=1231367056&tn_uvq=1387206491&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str88 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365851658&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365851658&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyrrqvg.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1979828129.1231365855&tn_fvq=1231365855&tn_uvq=2085229649&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; + var str89 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N12%3N47%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=0k0&p=43835816&x=A&oj=994&ou=634&uc=A&{2}&[NDR]'; + var str90 = 'zrgn[anzr=nwnkHey]'; + var str91 = 'anpuevpugra'; + var str92 = 'b oS={\'oT\':1.1};x $8n(B){z(B!=o9)};x $S(B){O(!$8n(B))z A;O(B.4L)z\'T\';b S=7t B;O(S==\'2P\'&&B.p4){23(B.7f){12 1:z\'T\';12 3:z/\S/.2g(B.8M)?\'ox\':\'oh\'}}O(S==\'2P\'||S==\'x\'){23(B.nE){12 2V:z\'1O\';12 7I:z\'5a\';12 18:z\'4B\'}O(7t B.I==\'4F\'){O(B.3u)z\'pG\';O(B.8e)z\'1p\'}}z S};x $2p(){b 4E={};Z(b v=0;v<1p.I;v++){Z(b X 1o 1p[v]){b nc=1p[v][X];b 6E=4E[X];O(6E&&$S(nc)==\'2P\'&&$S(6E)==\'2P\')4E[X]=$2p(6E,nc);17 4E[X]=nc}}z 4E};b $E=7p.E=x(){b 1d=1p;O(!1d[1])1d=[p,1d[0]];Z(b X 1o 1d[1])1d[0][X]=1d[1][X];z 1d[0]};b $4D=7p.pJ=x(){Z(b v=0,y=1p.I;v-1:p.3F(2R)>-1},nX:x(){z p.3y(/([.*+?^${}()|[\]\/\\])/t,\'\\$1\')}});2V.E({5V:x(1O){O(p.I<3)z A;O(p.I==4&&p[3]==0&&!1O)z\'p5\';b 3P=[];Z(b v=0;v<3;v++){b 52=(p[v]-0).4h(16);3P.1x((52.I==1)?\'0\'+52:52)}z 1O?3P:\'#\'+3P.2u(\'\')},5U:x(1O){O(p.I!=3)z A;b 1i=[];Z(b v=0;v<3;v++){1i.1x(5K((p[v].I==1)?p[v]+p[v]:p[v],16))}z 1O?1i:\'1i(\'+1i.2u(\',\')+\')\'}});7F.E({3n:x(P){b J=p;P=$2p({\'L\':J,\'V\':A,\'1p\':1S,\'2x\':A,\'4s\':A,\'6W\':A},P);O($2O(P.1p)&&$S(P.1p)!=\'1O\')P.1p=[P.1p];z x(V){b 1d;O(P.V){V=V||H.V;1d=[(P.V===1r)?V:Y P.V(V)];O(P.1p)1d.E(P.1p)}17 1d=P.1p||1p;b 3C=x(){z J.3H($5S(P'; + var str93 = 'hagreunyghat'; + var str94 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str95 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; + var str96 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str97 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str98 = 'shapgvba (){Cuk.Nccyvpngvba.Frghc.Pber();Cuk.Nccyvpngvba.Frghc.Nwnk();Cuk.Nccyvpngvba.Frghc.Synfu();Cuk.Nccyvpngvba.Frghc.Zbqhyrf()}'; + function runBlock11() { + for (var i = 0; i < 2; i++) { + ' .pybfr'.replace(re18, ''); + ' n.svryqOgaPnapry'.replace(re18, ''); + ' qg'.replace(re18, ''); + str77.replace(re68, ''); + str77.replace(re18, ''); + ''.replace(re39, ''); + ''.replace(/^/, ''); + ''.split(re86); + '*'.replace(re39, ''); + '*'.replace(re68, ''); + '*'.replace(re18, ''); + '.pybfr'.replace(re68, ''); + '.pybfr'.replace(re18, ''); + '//vzt.jro.qr/vij/FC/tzk_uc/fperra/${inyhr}?gf=${abj}'.replace(re87, ''); + '//vzt.jro.qr/vij/FC/tzk_uc/fperra/1024?gf=${abj}'.replace(re88, ''); + '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/${inyhr}?gf=${abj}'.replace(re87, ''); + '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/992/608?gf=${abj}'.replace(re88, ''); + '300k120'.replace(re30, ''); + '300k250'.replace(re30, ''); + '310k120'.replace(re30, ''); + '310k170'.replace(re30, ''); + '310k250'.replace(re30, ''); + '9.0 e115'.replace(/^.*\.(.*)\s.*$/, ''); + 'Nppbeqvba'.replace(re2, ''); + 'Nxghryy\x0a'.replace(re89, ''); + 'Nxghryy\x0a'.replace(re90, ''); + 'Nccyvpngvba'.replace(re2, ''); + 'Oyvpxchaxg\x0a'.replace(re89, ''); + 'Oyvpxchaxg\x0a'.replace(re90, ''); + 'Svanamra\x0a'.replace(re89, ''); + 'Svanamra\x0a'.replace(re90, ''); + 'Tnzrf\x0a'.replace(re89, ''); + 'Tnzrf\x0a'.replace(re90, ''); + 'Ubebfxbc\x0a'.replace(re89, ''); + 'Ubebfxbc\x0a'.replace(re90, ''); + 'Xvab\x0a'.replace(re89, ''); + 'Xvab\x0a'.replace(re90, ''); + 'Zbqhyrf'.replace(re2, ''); + 'Zhfvx\x0a'.replace(re89, ''); + 'Zhfvx\x0a'.replace(re90, ''); + 'Anpuevpugra\x0a'.replace(re89, ''); + 'Anpuevpugra\x0a'.replace(re90, ''); + 'Cuk'.replace(re2, ''); + 'ErdhrfgSvavfu'.split(re70); + 'ErdhrfgSvavfu.NWNK.Cuk'.split(re70); + 'Ebhgr\x0a'.replace(re89, ''); + 'Ebhgr\x0a'.replace(re90, ''); + str78.split(re32); + str79.split(re32); + str80.split(re32); + str81.split(re32); + 'Fcbeg\x0a'.replace(re89, ''); + 'Fcbeg\x0a'.replace(re90, ''); + 'GI-Fcbg\x0a'.replace(re89, ''); + 'GI-Fcbg\x0a'.replace(re90, ''); + 'Gbhe\x0a'.replace(re89, ''); + 'Gbhe\x0a'.replace(re90, ''); + 'Hagreunyghat\x0a'.replace(re89, ''); + 'Hagreunyghat\x0a'.replace(re90, ''); + 'Ivqrb\x0a'.replace(re89, ''); + 'Ivqrb\x0a'.replace(re90, ''); + 'Jrggre\x0a'.replace(re89, ''); + 'Jrggre\x0a'.replace(re90, ''); + str82.replace(re68, ''); + str82.replace(re18, ''); + str83.replace(re68, ''); + str83.replace(re18, ''); + str84.replace(re68, ''); + str84.replace(re18, ''); + 'nqiFreivprObk'.replace(re30, ''); + 'nqiFubccvatObk'.replace(re30, ''); + 'nwnk'.replace(re39, ''); + 'nxghryy'.replace(re40, ''); + 'nxghryy'.replace(re41, ''); + 'nxghryy'.replace(re42, ''); + 'nxghryy'.replace(re43, ''); + 'nxghryy'.replace(re44, ''); + 'nxghryy'.replace(re45, ''); + 'nxghryy'.replace(re46, ''); + 'nxghryy'.replace(re47, ''); + 'nxghryy'.replace(re48, ''); + str85.replace(re40, ''); + str85.replace(re41, ''); + str85.replace(re42, ''); + str85.replace(re43, ''); + str85.replace(re44, ''); + str85.replace(re45, ''); + str85.replace(re46, ''); + str85.replace(re47, ''); + str85.replace(re48, ''); + 'pngrtbel'.replace(re29, ''); + 'pngrtbel'.replace(re30, ''); + 'pybfr'.replace(re39, ''); + 'qvi'.replace(re39, ''); + str86.replace(re68, ''); + str86.replace(re18, ''); + 'qg'.replace(re39, ''); + 'qg'.replace(re68, ''); + 'qg'.replace(re18, ''); + 'rzorq'.replace(re39, ''); + 'rzorq'.replace(re68, ''); + 'rzorq'.replace(re18, ''); + 'svryqOga'.replace(re39, ''); + 'svryqOgaPnapry'.replace(re39, ''); + 'svz_zlfcnpr_nccf-pnainf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); + 'svanamra'.replace(re40, ''); + 'svanamra'.replace(re41, ''); + 'svanamra'.replace(re42, ''); + 'svanamra'.replace(re43, ''); + 'svanamra'.replace(re44, ''); + 'svanamra'.replace(re45, ''); + 'svanamra'.replace(re46, ''); + 'svanamra'.replace(re47, ''); + 'svanamra'.replace(re48, ''); + 'sbphf'.split(re70); + 'sbphf.gno sbphfva.gno'.split(re70); + 'sbphfva'.split(re70); + 'sbez'.replace(re39, ''); + 'sbez.nwnk'.replace(re68, ''); + 'sbez.nwnk'.replace(re18, ''); + 'tnzrf'.replace(re40, ''); + 'tnzrf'.replace(re41, ''); + 'tnzrf'.replace(re42, ''); + 'tnzrf'.replace(re43, ''); + 'tnzrf'.replace(re44, ''); + 'tnzrf'.replace(re45, ''); + 'tnzrf'.replace(re46, ''); + 'tnzrf'.replace(re47, ''); + 'tnzrf'.replace(re48, ''); + 'ubzrcntr'.replace(re30, ''); + 'ubebfxbc'.replace(re40, ''); + 'ubebfxbc'.replace(re41, ''); + 'ubebfxbc'.replace(re42, ''); + 'ubebfxbc'.replace(re43, ''); + 'ubebfxbc'.replace(re44, ''); + 'ubebfxbc'.replace(re45, ''); + 'ubebfxbc'.replace(re46, ''); + 'ubebfxbc'.replace(re47, ''); + 'ubebfxbc'.replace(re48, ''); + 'uc_cebzbobk_ugzy%2Puc_cebzbobk_vzt'.replace(re30, ''); + 'uc_erpgnatyr'.replace(re30, ''); + str87.replace(re33, ''); + str88.replace(re33, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${4}${5}'.replace(re71, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${5}'.replace(re72, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${4}${5}'.replace(re71, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${5}'.replace(re72, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${4}${5}'.replace(re71, ''); + 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${5}'.replace(re72, ''); + str89.replace(re73, ''); + 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); + str6.replace(re23, ''); + 'xvab'.replace(re40, ''); + 'xvab'.replace(re41, ''); + 'xvab'.replace(re42, ''); + 'xvab'.replace(re43, ''); + 'xvab'.replace(re44, ''); + 'xvab'.replace(re45, ''); + 'xvab'.replace(re46, ''); + 'xvab'.replace(re47, ''); + 'xvab'.replace(re48, ''); + 'ybnq'.split(re70); + 'zrqvnzbqgno lhv-anifrg lhv-anifrg-gbc'.replace(re18, ''); + 'zrgn'.replace(re39, ''); + str90.replace(re68, ''); + str90.replace(re18, ''); + 'zbhfrzbir'.split(re70); + 'zbhfrzbir.gno'.split(re70); + str63.replace(/^.*jroxvg\/(\d+(\.\d+)?).*$/, ''); + 'zhfvx'.replace(re40, ''); + 'zhfvx'.replace(re41, ''); + 'zhfvx'.replace(re42, ''); + 'zhfvx'.replace(re43, ''); + 'zhfvx'.replace(re44, ''); + 'zhfvx'.replace(re45, ''); + 'zhfvx'.replace(re46, ''); + 'zhfvx'.replace(re47, ''); + 'zhfvx'.replace(re48, ''); + 'zlfcnpr_nccf_pnainf'.replace(re52, ''); + str91.replace(re40, ''); + str91.replace(re41, ''); + str91.replace(re42, ''); + str91.replace(re43, ''); + str91.replace(re44, ''); + str91.replace(re45, ''); + str91.replace(re46, ''); + str91.replace(re47, ''); + str91.replace(re48, ''); + 'anzr'.replace(re39, ''); + str92.replace(/\b\w+\b/g, ''); + 'bow-nppbeqvba'.replace(re39, ''); + 'bowrpg'.replace(re39, ''); + 'bowrpg'.replace(re68, ''); + 'bowrpg'.replace(re18, ''); + 'cnenzf%2Rfglyrf'.replace(re29, ''); + 'cnenzf%2Rfglyrf'.replace(re30, ''); + 'cbchc'.replace(re30, ''); + 'ebhgr'.replace(re40, ''); + 'ebhgr'.replace(re41, ''); + 'ebhgr'.replace(re42, ''); + 'ebhgr'.replace(re43, ''); + 'ebhgr'.replace(re44, ''); + 'ebhgr'.replace(re45, ''); + 'ebhgr'.replace(re46, ''); + 'ebhgr'.replace(re47, ''); + 'ebhgr'.replace(re48, ''); + 'freivprobk_uc'.replace(re30, ''); + 'fubccvatobk_uc'.replace(re30, ''); + 'fubhgobk'.replace(re39, ''); + 'fcbeg'.replace(re40, ''); + 'fcbeg'.replace(re41, ''); + 'fcbeg'.replace(re42, ''); + 'fcbeg'.replace(re43, ''); + 'fcbeg'.replace(re44, ''); + 'fcbeg'.replace(re45, ''); + 'fcbeg'.replace(re46, ''); + 'fcbeg'.replace(re47, ''); + 'fcbeg'.replace(re48, ''); + 'gbhe'.replace(re40, ''); + 'gbhe'.replace(re41, ''); + 'gbhe'.replace(re42, ''); + 'gbhe'.replace(re43, ''); + 'gbhe'.replace(re44, ''); + 'gbhe'.replace(re45, ''); + 'gbhe'.replace(re46, ''); + 'gbhe'.replace(re47, ''); + 'gbhe'.replace(re48, ''); + 'gi-fcbg'.replace(re40, ''); + 'gi-fcbg'.replace(re41, ''); + 'gi-fcbg'.replace(re42, ''); + 'gi-fcbg'.replace(re43, ''); + 'gi-fcbg'.replace(re44, ''); + 'gi-fcbg'.replace(re45, ''); + 'gi-fcbg'.replace(re46, ''); + 'gi-fcbg'.replace(re47, ''); + 'gi-fcbg'.replace(re48, ''); + 'glcr'.replace(re39, ''); + 'haqrsvarq'.replace(/\//g, ''); + str93.replace(re40, ''); + str93.replace(re41, ''); + str93.replace(re42, ''); + str93.replace(re43, ''); + str93.replace(re44, ''); + str93.replace(re45, ''); + str93.replace(re46, ''); + str93.replace(re47, ''); + str93.replace(re48, ''); + 'ivqrb'.replace(re40, ''); + 'ivqrb'.replace(re41, ''); + 'ivqrb'.replace(re42, ''); + 'ivqrb'.replace(re43, ''); + 'ivqrb'.replace(re44, ''); + 'ivqrb'.replace(re45, ''); + 'ivqrb'.replace(re46, ''); + 'ivqrb'.replace(re47, ''); + 'ivqrb'.replace(re48, ''); + 'ivfvgf=1'.split(re86); + 'jrggre'.replace(re40, ''); + 'jrggre'.replace(re41, ''); + 'jrggre'.replace(re42, ''); + 'jrggre'.replace(re43, ''); + 'jrggre'.replace(re44, ''); + 'jrggre'.replace(re45, ''); + 'jrggre'.replace(re46, ''); + 'jrggre'.replace(re47, ''); + 'jrggre'.replace(re48, ''); + /#[a-z0-9]+$/i.exec('uggc://jjj.fpuhryreim.arg/Qrsnhyg'); + re66.exec('fryrpgrq'); + /(?:^|\s+)lhv-ani(?:\s+|$)/.exec('sff lhv-ani'); + /(?:^|\s+)lhv-anifrg(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); + /(?:^|\s+)lhv-anifrg-gbc(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); + re91.exec('GnoThvq'); + re91.exec('thvq'); + /(pbzcngvoyr|jroxvg)/.exec(str63); + /.+(?:ei|vg|en|vr)[\/: ]([\d.]+)/.exec(str63); + re8.exec('144631658.0.10.1231365869'); + re8.exec('144631658.0.10.1231367054'); + re8.exec('144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); + re8.exec('144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); + re8.exec(str94); + re8.exec(str95); + re8.exec(str96); + re8.exec(str97); + re8.exec('__hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); + re8.exec('__hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); + re8.exec('__hgzo=144631658.0.10.1231365869'); + re8.exec('__hgzo=144631658.0.10.1231367054'); + re8.exec('__hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec('__hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re34.exec(str78); + re34.exec(str79); + re34.exec(str81); + re74.exec(str77); + re74.exec('*'); + re74.exec(str82); + re74.exec(str83); + re74.exec(str86); + re74.exec('rzorq'); + re74.exec('sbez.nwnk'); + re74.exec(str90); + re74.exec('bowrpg'); + /\/onfr.wf(\?.+)?$/.exec('/uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); + re28.exec('uvag ynfgUvag ynfg'); + re75.exec(''); + re76.exec(''); + re77.exec(''); + re78.exec(''); + re80.exec(str77); + re80.exec('*'); + re80.exec('.pybfr'); + re80.exec(str82); + re80.exec(str83); + re80.exec(str84); + re80.exec(str86); + re80.exec('qg'); + re80.exec('rzorq'); + re80.exec('sbez.nwnk'); + re80.exec(str90); + re80.exec('bowrpg'); + re61.exec('qlaYvo.wf'); + re61.exec('rssrpgYvo.wf'); + re61.exec('uggc://jjj.tzk.arg/qr/?fgnghf=uvajrvf'); + re92.exec(' .pybfr'); + re92.exec(' n.svryqOgaPnapry'); + re92.exec(' qg'); + re92.exec(str48); + re92.exec('.nwnk'); + re92.exec('.svryqOga,n.svryqOgaPnapry'); + re92.exec('.svryqOgaPnapry'); + re92.exec('.bow-nppbeqvba qg'); + re68.exec(str77); + re68.exec('*'); + re68.exec('.pybfr'); + re68.exec(str82); + re68.exec(str83); + re68.exec(str84); + re68.exec(str86); + re68.exec('qg'); + re68.exec('rzorq'); + re68.exec('sbez.nwnk'); + re68.exec(str90); + re68.exec('bowrpg'); + re93.exec(' .pybfr'); + re93.exec(' n.svryqOgaPnapry'); + re93.exec(' qg'); + re93.exec(str48); + re93.exec('.nwnk'); + re93.exec('.svryqOga,n.svryqOgaPnapry'); + re93.exec('.svryqOgaPnapry'); + re93.exec('.bow-nppbeqvba qg'); + re81.exec(str77); + re81.exec('*'); + re81.exec(str48); + re81.exec('.pybfr'); + re81.exec(str82); + re81.exec(str83); + re81.exec(str84); + re81.exec(str86); + re81.exec('qg'); + re81.exec('rzorq'); + re81.exec('sbez.nwnk'); + re81.exec(str90); + re81.exec('bowrpg'); + re94.exec(' .pybfr'); + re94.exec(' n.svryqOgaPnapry'); + re94.exec(' qg'); + re94.exec(str48); + re94.exec('.nwnk'); + re94.exec('.svryqOga,n.svryqOgaPnapry'); + re94.exec('.svryqOgaPnapry'); + re94.exec('.bow-nppbeqvba qg'); + re94.exec('[anzr=nwnkHey]'); + re94.exec(str82); + re31.exec('rf'); + re31.exec('wn'); + re82.exec(str77); + re82.exec('*'); + re82.exec(str48); + re82.exec('.pybfr'); + re82.exec(str82); + re82.exec(str83); + re82.exec(str84); + re82.exec(str86); + re82.exec('qg'); + re82.exec('rzorq'); + re82.exec('sbez.nwnk'); + re82.exec(str90); + re82.exec('bowrpg'); + re83.exec(str98); + re83.exec('shapgvba sbphf() { [angvir pbqr] }'); + re62.exec('#Ybtva'); + re62.exec('#Ybtva_cnffjbeq'); + re62.exec(str77); + re62.exec('#fubhgobkWf'); + re62.exec('#fubhgobkWfReebe'); + re62.exec('#fubhgobkWfFhpprff'); + re62.exec('*'); + re62.exec(str82); + re62.exec(str83); + re62.exec(str86); + re62.exec('rzorq'); + re62.exec('sbez.nwnk'); + re62.exec(str90); + re62.exec('bowrpg'); + re49.exec('pbagrag'); + re24.exec(str6); + /xbadhrebe/.exec(str63); + /znp/.exec('jva32'); + /zbmvyyn/.exec(str63); + /zfvr/.exec(str63); + /ag\s5\.1/.exec(str63); + /bcren/.exec(str63); + /fnsnev/.exec(str63); + /jva/.exec('jva32'); + /jvaqbjf/.exec(str63); + } + } + + function run() { + for (var i = 0; i < 5; i++) { + runBlock0(); + runBlock1(); + runBlock2(); + runBlock3(); + runBlock4(); + runBlock5(); + runBlock6(); + runBlock7(); + runBlock8(); + runBlock9(); + runBlock10(); + runBlock11(); + } + } + + this.run = run; +} diff --git a/js/src/v8/richards.js b/js/src/v8/richards.js index 8cced90bd097..054928db16f8 100644 --- a/js/src/v8/richards.js +++ b/js/src/v8/richards.js @@ -1,4 +1,4 @@ -// Copyright 2007 Google Inc. All rights reserved. +// Copyright 2006-2008 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: @@ -30,12 +30,12 @@ // benchmark from: // // http://www.cl.cam.ac.uk/~mr10/Bench.html -// +// // The benchmark was originally implemented in BCPL by // Martin Richards. -var Richards = new BenchmarkSuite('Richards', 34886, [ +var Richards = new BenchmarkSuite('Richards', 35302, [ new Benchmark("Richards", runRichards) ]); @@ -73,7 +73,7 @@ function runRichards() { var msg = "Error during execution: queueCount = " + scheduler.queueCount + ", holdCount = " + scheduler.holdCount + "."; - print(msg); + throw new Error(msg); } } diff --git a/js/src/v8/run-crypto.js b/js/src/v8/run-crypto.js index 009b109214cb..da4b1434cd78 100644 --- a/js/src/v8/run-crypto.js +++ b/js/src/v8/run-crypto.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -29,16 +29,27 @@ load('base.js'); load('crypto.js'); +var success = true; + function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/run-deltablue.js b/js/src/v8/run-deltablue.js index e8d2a07ff210..324b2c90f1dd 100644 --- a/js/src/v8/run-deltablue.js +++ b/js/src/v8/run-deltablue.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -29,16 +29,27 @@ load('base.js'); load('deltablue.js'); +var success = true; + function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/run-earley-boyer.js b/js/src/v8/run-earley-boyer.js index ff519522da9b..d0ea06cf67d0 100644 --- a/js/src/v8/run-earley-boyer.js +++ b/js/src/v8/run-earley-boyer.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -29,16 +29,27 @@ load('base.js'); load('earley-boyer.js'); +var success = true; + function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/run-raytrace.js b/js/src/v8/run-raytrace.js index 7af95c8517a6..fd82c7ea781e 100644 --- a/js/src/v8/run-raytrace.js +++ b/js/src/v8/run-raytrace.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -29,16 +29,27 @@ load('base.js'); load('raytrace.js'); +var success = true; + function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/run-regexp.js b/js/src/v8/run-regexp.js new file mode 100644 index 000000000000..140487fa02f0 --- /dev/null +++ b/js/src/v8/run-regexp.js @@ -0,0 +1,55 @@ +// Copyright 2008 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. + + +load('base.js'); +load('regexp.js'); + +var success = true; + +function PrintResult(name, result) { + print(name + ': ' + result); +} + + +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + +function PrintScore(score) { + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } +} + + +BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, + NotifyScore: PrintScore }); diff --git a/js/src/v8/run-richards.js b/js/src/v8/run-richards.js index 1dfbcb2db031..d89fb6f8eef7 100644 --- a/js/src/v8/run-richards.js +++ b/js/src/v8/run-richards.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -29,16 +29,27 @@ load('base.js'); load('richards.js'); +var success = true; + function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/run-splay.js b/js/src/v8/run-splay.js new file mode 100644 index 000000000000..7def749f4981 --- /dev/null +++ b/js/src/v8/run-splay.js @@ -0,0 +1,55 @@ +// Copyright 2008 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. + + +load('base.js'); +load('splay.js'); + +var success = true; + +function PrintResult(name, result) { + print(name + ': ' + result); +} + + +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + +function PrintScore(score) { + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } +} + + +BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, + NotifyScore: PrintScore }); diff --git a/js/src/v8/run.js b/js/src/v8/run.js index 8302535d411b..da95fb498f73 100644 --- a/js/src/v8/run.js +++ b/js/src/v8/run.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 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: @@ -32,18 +32,30 @@ load('deltablue.js'); load('crypto.js'); load('raytrace.js'); load('earley-boyer.js'); +load('regexp.js'); +load('splay.js'); +var success = true; function PrintResult(name, result) { print(name + ': ' + result); } +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + function PrintScore(score) { - print('----'); - print('Score: ' + score); + if (success) { + print('----'); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); + } } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, NotifyScore: PrintScore }); diff --git a/js/src/v8/splay.js b/js/src/v8/splay.js new file mode 100644 index 000000000000..6b4f56d32138 --- /dev/null +++ b/js/src/v8/splay.js @@ -0,0 +1,394 @@ +// Copyright 2009 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 benchmark is based on a JavaScript log processing module used +// by the V8 profiler to generate execution time profiles for runs of +// JavaScript applications, and it effectively measures how fast the +// JavaScript engine is at allocating nodes and reclaiming the memory +// used for old nodes. Because of the way splay trees work, the engine +// also has to deal with a lot of changes to the large tree object +// graph. + +var Splay = new BenchmarkSuite('Splay', 81491, [ + new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown) +]); + + +// Configuration. +var kSplayTreeSize = 8000; +var kSplayTreeModifications = 80; +var kSplayTreePayloadDepth = 5; + +var splayTree = null; + + +function GeneratePayloadTree(depth, tag) { + if (depth == 0) { + return { + array : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], + string : 'String for key ' + tag + ' in leaf node' + }; + } else { + return { + left: GeneratePayloadTree(depth - 1, tag), + right: GeneratePayloadTree(depth - 1, tag) + }; + } +} + + +function GenerateKey() { + // The benchmark framework guarantees that Math.random is + // deterministic; see base.js. + return Math.random(); +} + + +function InsertNewNode() { + // Insert new node with a unique key. + var key; + do { + key = GenerateKey(); + } while (splayTree.find(key) != null); + var payload = GeneratePayloadTree(kSplayTreePayloadDepth, String(key)); + splayTree.insert(key, payload); + return key; +} + + + +function SplaySetup() { + splayTree = new SplayTree(); + for (var i = 0; i < kSplayTreeSize; i++) InsertNewNode(); +} + + +function SplayTearDown() { + // Allow the garbage collector to reclaim the memory + // used by the splay tree no matter how we exit the + // tear down function. + var keys = splayTree.exportKeys(); + splayTree = null; + + // Verify that the splay tree has the right size. + var length = keys.length; + if (length != kSplayTreeSize) { + throw new Error("Splay tree has wrong size"); + } + + // Verify that the splay tree has sorted, unique keys. + for (var i = 0; i < length - 1; i++) { + if (keys[i] >= keys[i + 1]) { + throw new Error("Splay tree not sorted"); + } + } +} + + +function SplayRun() { + // Replace a few nodes in the splay tree. + for (var i = 0; i < kSplayTreeModifications; i++) { + var key = InsertNewNode(); + var greatest = splayTree.findGreatestLessThan(key); + if (greatest == null) splayTree.remove(key); + else splayTree.remove(greatest.key); + } +} + + +/** + * Constructs a Splay tree. A splay tree is a self-balancing binary + * search tree with the additional property that recently accessed + * elements are quick to access again. It performs basic operations + * such as insertion, look-up and removal in O(log(n)) amortized time. + * + * @constructor + */ +function SplayTree() { +}; + + +/** + * Pointer to the root node of the tree. + * + * @type {SplayTree.Node} + * @private + */ +SplayTree.prototype.root_ = null; + + +/** + * @return {boolean} Whether the tree is empty. + */ +SplayTree.prototype.isEmpty = function() { + return !this.root_; +}; + + +/** + * Inserts a node into the tree with the specified key and value if + * the tree does not already contain a node with the specified key. If + * the value is inserted, it becomes the root of the tree. + * + * @param {number} key Key to insert into the tree. + * @param {*} value Value to insert into the tree. + */ +SplayTree.prototype.insert = function(key, value) { + if (this.isEmpty()) { + this.root_ = new SplayTree.Node(key, value); + return; + } + // Splay on the key to move the last node on the search path for + // the key to the root of the tree. + this.splay_(key); + if (this.root_.key == key) { + return; + } + var node = new SplayTree.Node(key, value); + if (key > this.root_.key) { + node.left = this.root_; + node.right = this.root_.right; + this.root_.right = null; + } else { + node.right = this.root_; + node.left = this.root_.left; + this.root_.left = null; + } + this.root_ = node; +}; + + +/** + * Removes a node with the specified key from the tree if the tree + * contains a node with this key. The removed node is returned. If the + * key is not found, an exception is thrown. + * + * @param {number} key Key to find and remove from the tree. + * @return {SplayTree.Node} The removed node. + */ +SplayTree.prototype.remove = function(key) { + if (this.isEmpty()) { + throw Error('Key not found: ' + key); + } + this.splay_(key); + if (this.root_.key != key) { + throw Error('Key not found: ' + key); + } + var removed = this.root_; + if (!this.root_.left) { + this.root_ = this.root_.right; + } else { + var right = this.root_.right; + this.root_ = this.root_.left; + // Splay to make sure that the new root has an empty right child. + this.splay_(key); + // Insert the original right child as the right child of the new + // root. + this.root_.right = right; + } + return removed; +}; + + +/** + * Returns the node having the specified key or null if the tree doesn't contain + * a node with the specified key. + * + * @param {number} key Key to find in the tree. + * @return {SplayTree.Node} Node having the specified key. + */ +SplayTree.prototype.find = function(key) { + if (this.isEmpty()) { + return null; + } + this.splay_(key); + return this.root_.key == key ? this.root_ : null; +}; + + +/** + * @return {SplayTree.Node} Node having the maximum key value. + */ +SplayTree.prototype.findMax = function(opt_startNode) { + if (this.isEmpty()) { + return null; + } + var current = opt_startNode || this.root_; + while (current.right) { + current = current.right; + } + return current; +}; + + +/** + * @return {SplayTree.Node} Node having the maximum key value that + * is less than the specified key value. + */ +SplayTree.prototype.findGreatestLessThan = function(key) { + if (this.isEmpty()) { + return null; + } + // Splay on the key to move the node with the given key or the last + // node on the search path to the top of the tree. + this.splay_(key); + // Now the result is either the root node or the greatest node in + // the left subtree. + if (this.root_.key < key) { + return this.root_; + } else if (this.root_.left) { + return this.findMax(this.root_.left); + } else { + return null; + } +}; + + +/** + * @return {Array<*>} An array containing all the keys of tree's nodes. + */ +SplayTree.prototype.exportKeys = function() { + var result = []; + if (!this.isEmpty()) { + this.root_.traverse_(function(node) { result.push(node.key); }); + } + return result; +}; + + +/** + * Perform the splay operation for the given key. Moves the node with + * the given key to the top of the tree. If no node has the given + * key, the last node on the search path is moved to the top of the + * tree. This is the simplified top-down splaying algorithm from: + * "Self-adjusting Binary Search Trees" by Sleator and Tarjan + * + * @param {number} key Key to splay the tree on. + * @private + */ +SplayTree.prototype.splay_ = function(key) { + if (this.isEmpty()) { + return; + } + // Create a dummy node. The use of the dummy node is a bit + // counter-intuitive: The right child of the dummy node will hold + // the L tree of the algorithm. The left child of the dummy node + // will hold the R tree of the algorithm. Using a dummy node, left + // and right will always be nodes and we avoid special cases. + var dummy, left, right; + dummy = left = right = new SplayTree.Node(null, null); + var current = this.root_; + while (true) { + if (key < current.key) { + if (!current.left) { + break; + } + if (key < current.left.key) { + // Rotate right. + var tmp = current.left; + current.left = tmp.right; + tmp.right = current; + current = tmp; + if (!current.left) { + break; + } + } + // Link right. + right.left = current; + right = current; + current = current.left; + } else if (key > current.key) { + if (!current.right) { + break; + } + if (key > current.right.key) { + // Rotate left. + var tmp = current.right; + current.right = tmp.left; + tmp.left = current; + current = tmp; + if (!current.right) { + break; + } + } + // Link left. + left.right = current; + left = current; + current = current.right; + } else { + break; + } + } + // Assemble. + left.right = current.left; + right.left = current.right; + current.left = dummy.right; + current.right = dummy.left; + this.root_ = current; +}; + + +/** + * Constructs a Splay tree node. + * + * @param {number} key Key. + * @param {*} value Value. + */ +SplayTree.Node = function(key, value) { + this.key = key; + this.value = value; +}; + + +/** + * @type {SplayTree.Node} + */ +SplayTree.Node.prototype.left = null; + + +/** + * @type {SplayTree.Node} + */ +SplayTree.Node.prototype.right = null; + + +/** + * Performs an ordered traversal of the subtree starting at + * this SplayTree.Node. + * + * @param {function(SplayTree.Node)} f Visitor function. + * @private + */ +SplayTree.Node.prototype.traverse_ = function(f) { + var current = this; + while (current) { + var left = current.left; + if (left) left.traverse_(f); + f(current); + current = current.right; + } +}; diff --git a/js/src/vprof/vprof.cpp b/js/src/vprof/vprof.cpp index 0145868b6520..4fd71be44eaf 100644 --- a/js/src/vprof/vprof.cpp +++ b/js/src/vprof/vprof.cpp @@ -93,7 +93,7 @@ static long glock = LOCK_IS_FREE; #define Lock(lock) while (_InterlockedCompareExchange(lock, LOCK_IS_TAKEN, LOCK_IS_FREE) == LOCK_IS_TAKEN){}; #define Unlock(lock) _InterlockedCompareExchange(lock, LOCK_IS_FREE, LOCK_IS_TAKEN); -#if defined(WIN32) +#if defined(WIN32) && !defined(UNDER_CE) static void vprof_printf(const char* format, ...) { va_list args; diff --git a/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/js/src/xpconnect/loader/mozJSComponentLoader.cpp index 934b99da0b91..63194488e8b5 100644 --- a/js/src/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/src/xpconnect/loader/mozJSComponentLoader.cpp @@ -1132,7 +1132,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile, return NS_ERROR_FILE_NOT_FOUND; } - script = JS_CompileFileHandleForPrincipalsVersion( + scriptObj = JS_CompileFileHandleForPrincipalsVersion( cx, global, nativePath.get(), fileHandle, jsPrincipals, JSVERSION_LATEST); /* JS will close the filehandle after compilation is complete. */ diff --git a/js/src/xpconnect/shell/xpcshell.cpp b/js/src/xpconnect/shell/xpcshell.cpp index d3f586fbf28b..cebe512de4a7 100644 --- a/js/src/xpconnect/shell/xpcshell.cpp +++ b/js/src/xpconnect/shell/xpcshell.cpp @@ -1094,7 +1094,7 @@ ProcessFile(JSContext *cx, JSObject *obj, const char *filename, FILE *file, } bufp += strlen(bufp); lineno++; - } while (!JS_BufferIsCompilableUnit(cx, obj, buffer, strlen(buffer))); + } while (!JS_BufferIsCompilableUnit(cx, JS_FALSE, obj, buffer, strlen(buffer))); DoBeginRequest(cx); /* Clear any pending exception from previous failed compiles. */ diff --git a/js/src/yarr/yarr/RegexCompiler.cpp b/js/src/yarr/yarr/RegexCompiler.cpp index 46b3e91e230c..9b60cbd4a78b 100644 --- a/js/src/yarr/yarr/RegexCompiler.cpp +++ b/js/src/yarr/yarr/RegexCompiler.cpp @@ -34,6 +34,12 @@ namespace JSC { namespace Yarr { #include "RegExpJitTables.h" +#if WTF_CPU_SPARC +#define BASE_FRAME_SIZE 24 +#else +#define BASE_FRAME_SIZE 0 +#endif + class CharacterClassConstructor { public: CharacterClassConstructor(bool isCaseInsensitive = false) @@ -592,7 +598,7 @@ public: void setupOffsets() { - setupDisjunctionOffsets(m_pattern.m_body, 0, 0); + setupDisjunctionOffsets(m_pattern.m_body, BASE_FRAME_SIZE, 0); } // This optimization identifies sets of parentheses that we will never need to backtrack. diff --git a/js/src/yarr/yarr/RegexJIT.cpp b/js/src/yarr/yarr/RegexJIT.cpp index c43d2a9494ff..1571c35b7125 100644 --- a/js/src/yarr/yarr/RegexJIT.cpp +++ b/js/src/yarr/yarr/RegexJIT.cpp @@ -62,6 +62,16 @@ class RegexGenerator : private MacroAssembler { static const RegisterID regT1 = MIPSRegisters::t5; static const RegisterID returnRegister = MIPSRegisters::v0; +#elif WTF_CPU_SPARC + static const RegisterID input = SparcRegisters::i0; + static const RegisterID index = SparcRegisters::i1; + static const RegisterID length = SparcRegisters::i2; + static const RegisterID output = SparcRegisters::i3; + + static const RegisterID regT0 = SparcRegisters::i4; + static const RegisterID regT1 = SparcRegisters::i5; + + static const RegisterID returnRegister = SparcRegisters::i0; #elif WTF_CPU_X86 static const RegisterID input = X86Registers::eax; static const RegisterID index = X86Registers::edx; @@ -564,8 +574,13 @@ class RegexGenerator : private MacroAssembler { void generatePatternCharacterPair(TermGenerationState& state) { const RegisterID character = regT0; +#if WTF_CPU_BIG_ENDIAN + UChar ch2 = state.term().patternCharacter; + UChar ch1 = state.lookaheadTerm().patternCharacter; +#else UChar ch1 = state.term().patternCharacter; UChar ch2 = state.lookaheadTerm().patternCharacter; +#endif int mask = 0; int chPair = ch1 | (ch2 << 16); @@ -1449,6 +1464,10 @@ class RegexGenerator : private MacroAssembler { push(ARMRegisters::r8); // scratch register #endif move(ARMRegisters::r3, output); +#elif WTF_CPU_SPARC + save(Imm32(-m_pattern.m_body->m_callFrameSize * sizeof(void*))); + // set m_callFrameSize to 0 avoid and stack movement later. + m_pattern.m_body->m_callFrameSize = 0; #elif WTF_CPU_MIPS // Do nothing. #endif @@ -1471,6 +1490,9 @@ class RegexGenerator : private MacroAssembler { pop(ARMRegisters::r6); pop(ARMRegisters::r5); pop(ARMRegisters::r4); +#elif WTF_CPU_SPARC + ret_and_restore(); + return; #elif WTF_CPU_MIPS // Do nothing #endif