mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge.
This commit is contained in:
commit
222a958b75
@ -125,6 +125,12 @@ CPPSRCS = \
|
||||
jsxdrapi.cpp \
|
||||
jsxml.cpp \
|
||||
prmjtime.cpp \
|
||||
nanojit/Assembler.cpp \
|
||||
nanojit/Fragmento.cpp \
|
||||
nanojit/LIR.cpp \
|
||||
nanojit/RegAlloc.cpp \
|
||||
nanojit/avmplus.cpp \
|
||||
jsbuiltins.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef HAVE_DTRACE
|
||||
@ -182,8 +188,29 @@ EXPORTS = \
|
||||
jsutil.h \
|
||||
jsxdrapi.h \
|
||||
jsxml.h \
|
||||
nanojit/Assembler.h \
|
||||
nanojit/LIR.h \
|
||||
nanojit/avmplus.h \
|
||||
nanojit/vm_fops.h \
|
||||
nanojit/Fragmento.h \
|
||||
nanojit/Native.h \
|
||||
nanojit/RegAlloc.h \
|
||||
nanojit/nanojit.h \
|
||||
builtins.tbl \
|
||||
$(NULL)
|
||||
|
||||
ifdef DEBUG
|
||||
EXPORTS += nanojit/TraceTreeDrawer.h
|
||||
CPPSRCS += nanojit/TraceTreeDrawer.cpp nanojit/Tests.cpp
|
||||
endif
|
||||
|
||||
DEFINES += -DFEATURE_NANOJIT
|
||||
ifeq (86,$(findstring 86,$(OS_TEST)))
|
||||
DEFINES += -DAVMPLUS_IA32
|
||||
CPPSRCS += nanojit/Nativei386.cpp
|
||||
EXPORTS += nanojit/Nativei386.h
|
||||
endif
|
||||
|
||||
ifdef HAVE_DTRACE
|
||||
EXPORTS += \
|
||||
jsdtracef.h \
|
||||
@ -264,6 +291,10 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# our build system doesn't handle subdir srcs very gracefully today
|
||||
export::
|
||||
mkdir -p nanojit
|
||||
|
||||
DEFINES += -DEXPORT_JS_API
|
||||
|
||||
INCLUDES += -I$(srcdir)
|
||||
|
@ -55,6 +55,9 @@ include config.mk
|
||||
#NS_USE_NATIVE = 1
|
||||
|
||||
DEFINES += -DJS_TRACER
|
||||
ifndef NANOJIT_ARCH
|
||||
$(error NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, can't build with JIT) #'
|
||||
endif
|
||||
|
||||
ifdef NARCISSUS
|
||||
DEFINES += -DNARCISSUS
|
||||
@ -81,7 +84,7 @@ ifdef JS_HAS_FILE_OBJECT
|
||||
DEFINES += -DJS_HAS_FILE_OBJECT
|
||||
endif
|
||||
|
||||
DEFINES += -DFEATURE_NANOJIT -DAVMPLUS_IA32 -DTRACEMONKEY
|
||||
DEFINES += -DFEATURE_NANOJIT
|
||||
|
||||
#
|
||||
# XCFLAGS may be set in the environment or on the gmake command line
|
||||
@ -186,13 +189,11 @@ JS_HFILES = \
|
||||
jsxml.h \
|
||||
nanojit/Assembler.h \
|
||||
nanojit/LIR.h \
|
||||
nanojit/NativeARM.h \
|
||||
nanojit/Nativei386.h \
|
||||
nanojit/Native$(NANOJIT_ARCH).h \
|
||||
nanojit/avmplus.h \
|
||||
nanojit/vm_fops.h \
|
||||
nanojit/Fragmento.h \
|
||||
nanojit/Native.h \
|
||||
nanojit/NativeThumb.h \
|
||||
nanojit/RegAlloc.h \
|
||||
nanojit/nanojit.h \
|
||||
nanojit/TraceTreeDrawer.h \
|
||||
@ -268,13 +269,15 @@ JS_CPPFILES = \
|
||||
nanojit/Assembler.cpp \
|
||||
nanojit/Fragmento.cpp \
|
||||
nanojit/LIR.cpp \
|
||||
nanojit/Nativei386.cpp \
|
||||
nanojit/Native$(NANOJIT_ARCH).cpp \
|
||||
nanojit/RegAlloc.cpp \
|
||||
nanojit/avmplus.cpp \
|
||||
nanojit/Tests.cpp \
|
||||
nanojit/TraceTreeDrawer.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef DEBUG
|
||||
JS_CPPFILES += nanojit/TraceTreeDrawer.cpp
|
||||
endif
|
||||
|
||||
ifdef JS_LIVECONNECT
|
||||
DIRS += liveconnect
|
||||
endif
|
||||
|
@ -184,9 +184,9 @@ endif
|
||||
|
||||
# Name of the binary code directories
|
||||
ifdef BUILD_IDG
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJD
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG)$(XOBJDIR_TAG).OBJD
|
||||
else
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG)$(XOBJDIR_TAG).OBJ
|
||||
endif
|
||||
VPATH = $(OBJDIR)
|
||||
|
||||
|
@ -60,6 +60,8 @@ CPU_ARCH = $(shell uname -m)
|
||||
ifeq (86,$(findstring 86,$(CPU_ARCH)))
|
||||
CPU_ARCH = x86
|
||||
OS_CFLAGS+= -DX86_LINUX
|
||||
OS_CFLAGS += -DAVMPLUS_IA32
|
||||
NANOJIT_ARCH = i386
|
||||
endif
|
||||
GFX_ARCH = x
|
||||
|
||||
|
@ -58,6 +58,8 @@ ifneq (x86_64,$(CPU_ARCH))
|
||||
ifeq (86,$(findstring 86,$(CPU_ARCH)))
|
||||
CPU_ARCH = x86
|
||||
OS_CFLAGS+= -DX86_LINUX
|
||||
OS_CFLAGS += -DAVMPLUS_IA32
|
||||
NANOJIT_ARCH = i386
|
||||
|
||||
ifeq (gcc, $(CC))
|
||||
# if using gcc on x86, check version for opt bug
|
||||
|
@ -39,13 +39,13 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "nanojit/avmplus.h"
|
||||
#include "nanojit/nanojit.h"
|
||||
#include "jstracer.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsgc.h"
|
||||
#include "jscntxt.h"
|
||||
#include "nanojit/avmplus.h"
|
||||
#include "nanojit/nanojit.h"
|
||||
#include "jstracer.h"
|
||||
|
||||
using namespace nanojit;
|
||||
|
||||
|
132
js/src/jslock.h
132
js/src/jslock.h
@ -39,8 +39,6 @@
|
||||
#ifndef jslock_h__
|
||||
#define jslock_h__
|
||||
|
||||
#include "jspubtd.h" /* for jsword, JSRuntime, etc. */
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
#include "jstypes.h"
|
||||
@ -49,9 +47,8 @@
|
||||
#include "prcvar.h"
|
||||
#include "prthread.h"
|
||||
|
||||
#ifdef JS_DEBUG_TITLE_LOCKS
|
||||
#include "jsprvtd.h" /* for JSScope, etc. */
|
||||
#endif
|
||||
#include "jspubtd.h" /* for JSRuntime, etc. */
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
@ -97,7 +94,7 @@ struct JSTitle {
|
||||
const char *file[4]; /* file where lock was (re-)taken */
|
||||
unsigned int line[4]; /* line where lock was (re-)taken */
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Title structures must be immediately preceded by JSObjectMap structures for
|
||||
@ -116,111 +113,6 @@ struct JSTitle {
|
||||
#define JS_ATOMIC_INCREMENT(p) PR_AtomicIncrement((PRInt32 *)(p))
|
||||
#define JS_ATOMIC_DECREMENT(p) PR_AtomicDecrement((PRInt32 *)(p))
|
||||
#define JS_ATOMIC_ADD(p,v) PR_AtomicAdd((PRInt32 *)(p), (PRInt32)(v))
|
||||
#define JS_ATOMIC_SET(p,v) PR_AtomicSet((PRInt32 *)(p), (PRInt32)(v))
|
||||
|
||||
/*
|
||||
* Compare-And-Swap (CAS) inline function, ifdef'ed for different platforms.
|
||||
*/
|
||||
|
||||
/* Exclude Alpha NT. */
|
||||
#if defined(_WIN32) && defined(_M_IX86)
|
||||
#pragma warning( disable : 4035 )
|
||||
JS_BEGIN_EXTERN_C
|
||||
extern long __cdecl
|
||||
_InterlockedCompareExchange(long *volatile dest, long exchange, long comp);
|
||||
JS_END_EXTERN_C
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwapHelper(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
_InterlockedCompareExchange(w, nv, ov);
|
||||
__asm {
|
||||
sete al
|
||||
}
|
||||
}
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
return (js_CompareAndSwapHelper(w, ov, nv) & 1);
|
||||
}
|
||||
|
||||
#elif defined(XP_MACOSX) || defined(DARWIN)
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
/* Details on these functions available in the manpage for atomic */
|
||||
#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
|
||||
return OSAtomicCompareAndSwap64Barrier(ov, nv, (int64_t*) w);
|
||||
#else
|
||||
return OSAtomicCompareAndSwap32Barrier(ov, nv, (int32_t*) w);
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"lock\n"
|
||||
"cmpxchgl %2, (%1)\n"
|
||||
"sete %%al\n"
|
||||
"andl $1, %%eax\n"
|
||||
: "=a" (res)
|
||||
: "r" (w), "r" (nv), "a" (ov)
|
||||
: "cc", "memory");
|
||||
return (int)res;
|
||||
}
|
||||
|
||||
#elif defined(SOLARIS) && defined(sparc) && defined(ULTRA_SPARC)
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
unsigned int res;
|
||||
JS_ASSERT(ov != nv);
|
||||
asm volatile ("\
|
||||
stbar\n\
|
||||
cas [%1],%2,%3\n\
|
||||
cmp %2,%3\n\
|
||||
be,a 1f\n\
|
||||
mov 1,%0\n\
|
||||
mov 0,%0\n\
|
||||
1:"
|
||||
: "=r" (res)
|
||||
: "r" (w), "r" (ov), "r" (nv));
|
||||
return (int)res;
|
||||
#else /* !__GNUC__ */
|
||||
extern int compare_and_swap(jsword*, jsword, jsword);
|
||||
JS_ASSERT(ov != nv);
|
||||
return compare_and_swap(w, ov, nv);
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(AIX)
|
||||
|
||||
#include <sys/atomic_op.h>
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
return !_check_lock((atomic_p)w, ov, nv);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "Your platform lacks a compare-and-swap instruction."
|
||||
|
||||
#endif /* arch-tests */
|
||||
|
||||
#define js_CurrentThreadId() (jsword)PR_GetCurrentThread()
|
||||
#define JS_NEW_LOCK() PR_NewLock()
|
||||
@ -356,27 +248,9 @@ extern void js_Unlock(JSThinLock *tl, jsword me);
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
static inline int32
|
||||
js_AtomicAdd(int32* p, int32 v)
|
||||
{
|
||||
int32 r = *p;
|
||||
*p = v;
|
||||
return r;
|
||||
}
|
||||
|
||||
#define JS_ATOMIC_INCREMENT(p) (++*(p))
|
||||
#define JS_ATOMIC_DECREMENT(p) (--*(p))
|
||||
#define JS_ATOMIC_ADD(p,v) (*(p) += (v))
|
||||
#define JS_ATOMIC_SET(p,v) (js_AtomicAdd((int32*)p, (int32)v))
|
||||
|
||||
static inline int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
if (*w != ov)
|
||||
return 0;
|
||||
*w = nv;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define JS_CurrentThreadId() 0
|
||||
#define JS_NEW_LOCK() NULL
|
||||
@ -426,7 +300,7 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
|
||||
#define JS_LOCK(P,CX) JS_LOCK0(P, CX_THINLOCK_ID(CX))
|
||||
#define JS_UNLOCK(P,CX) JS_UNLOCK0(P, CX_THINLOCK_ID(CX))
|
||||
|
||||
|
||||
#ifndef SET_OBJ_INFO
|
||||
#define SET_OBJ_INFO(obj,f,l) ((void)0)
|
||||
#endif
|
||||
|
@ -1004,17 +1004,18 @@ js_LoopEdge(JSContext* cx)
|
||||
{
|
||||
JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
if (GET_SCOPE(varobj)->title.owner_cx != cx) {
|
||||
#ifdef DEBUG
|
||||
printf("Global object not owned by this context.\n");
|
||||
#endif
|
||||
return false; /* we stay away from shared global objects */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* is the recorder currently active? */
|
||||
if (tm->recorder) {
|
||||
#ifdef JS_THREADSAFE
|
||||
/* XXX should this test not be earlier, to avoid even recording? */
|
||||
if (OBJ_SCOPE(tm->recorder->getGlobalFrame()->varobj)->title.ownercx != cx) {
|
||||
#ifdef DEBUG
|
||||
printf("Global object not owned by this context.\n");
|
||||
#endif
|
||||
return false; /* we stay away from shared global objects */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tm->recorder->loopEdge())
|
||||
return true; /* keep recording */
|
||||
js_DeleteRecorder(cx);
|
||||
|
@ -71,7 +71,7 @@ class Tracker {
|
||||
struct Page {
|
||||
struct Page* next;
|
||||
jsuword base;
|
||||
T map[0];
|
||||
T map[1];
|
||||
};
|
||||
struct Page* pagelist;
|
||||
|
||||
@ -91,7 +91,7 @@ struct VMFragmentInfo {
|
||||
unsigned entryNativeFrameSlots;
|
||||
unsigned maxNativeFrameSlots;
|
||||
size_t nativeStackBase;
|
||||
uint8 typeMap[0];
|
||||
uint8 typeMap[1];
|
||||
};
|
||||
|
||||
extern struct nanojit::CallInfo builtins[];
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "jstypes.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -57,10 +58,19 @@
|
||||
#define AvmAssertMsg(x, y)
|
||||
#define AvmDebugLog(x) printf x
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
* Can we just take a moment to think about what it means that MSVC doesn't have stdint.h in 2008?
|
||||
* Thanks for your time.
|
||||
*/
|
||||
typedef JSUint8 uint8_t;
|
||||
typedef JSUint16 uint16_t;
|
||||
typedef JSUint32 uint32_t;
|
||||
typedef JSUint64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user