mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[JAEGER] House cleaning... re-org.
--HG-- rename : js/src/methodjit/CodeGen_NaN32.cpp => js/src/methodjit/nunbox/CodeGenerator.cpp rename : js/src/methodjit/CodeGenerator.h => js/src/methodjit/nunbox/CodeGenerator.h rename : js/src/methodjit/FastOps.cpp => js/src/methodjit/nunbox/FastOps.cpp rename : js/src/methodjit/FrameEntry.h => js/src/methodjit/nunbox/FrameEntry.h rename : js/src/methodjit/FrameState.cpp => js/src/methodjit/nunbox/FrameState.cpp rename : js/src/methodjit/FrameState.h => js/src/methodjit/nunbox/FrameState.h
This commit is contained in:
parent
935d205ba8
commit
88963dc176
@ -288,7 +288,8 @@ VPATH += $(srcdir)/assembler \
|
||||
$(srcdir)/assembler/wtf \
|
||||
$(srcdir)/assembler/jit \
|
||||
$(srcdir)/assembler/assembler \
|
||||
$(srcdir)/methodjit
|
||||
$(srcdir)/methodjit \
|
||||
$(srcdir)/methodjit/nunbox
|
||||
|
||||
CPPSRCS += Assertions.cpp \
|
||||
ExecutableAllocatorPosix.cpp \
|
||||
@ -301,11 +302,10 @@ CPPSRCS += Assertions.cpp \
|
||||
Logging.cpp \
|
||||
Stubs.cpp \
|
||||
Compiler.cpp \
|
||||
CodeGen_NaN32.cpp \
|
||||
CodeGenerator.cpp \
|
||||
FrameState.cpp \
|
||||
FastOps.cpp \
|
||||
$(NULL)
|
||||
# CodeGenerator.cpp \
|
||||
# PICStubCompiler.cpp \
|
||||
|
||||
ifeq (86, $(findstring 86,$(TARGET_CPU)))
|
||||
|
@ -2580,18 +2580,21 @@ i?86-*)
|
||||
NANOJIT_ARCH=i386
|
||||
ENABLE_METHODJIT=1
|
||||
AC_DEFINE(JS_CPU_X86)
|
||||
AC_DEFINE(JS_32BIT)
|
||||
;;
|
||||
x86_64*-*)
|
||||
ENABLE_TRACEJIT=1
|
||||
NANOJIT_ARCH=X64
|
||||
ENABLE_METHODJIT=1
|
||||
AC_DEFINE(JS_CPU_X64)
|
||||
AC_DEFINE(JS_64BIT)
|
||||
;;
|
||||
arm*-*)
|
||||
ENABLE_TRACEJIT=1
|
||||
NANOJIT_ARCH=ARM
|
||||
ENABLE_METHODJIT=1
|
||||
AC_DEFINE(JS_CPU_ARM)
|
||||
AC_DEFINE(JS_32BIT)
|
||||
;;
|
||||
sparc*-*)
|
||||
ENABLE_TRACEJIT=1
|
||||
|
49
js/src/methodjit/CodeGenIncludes.h
Normal file
49
js/src/methodjit/CodeGenIncludes.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- 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
|
||||
* Brendan Eich <brendan@mozilla.org>
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Anderson <danderson@mozilla.com>
|
||||
* Julian Seward <jseward@acm.org>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#if !defined jsjaeger_codegenincs_h__ && defined JS_METHODJIT
|
||||
#define jsjaeger_codegenincs_h__
|
||||
|
||||
#include "nunbox/FrameState.h"
|
||||
#include "nunbox/FrameEntry.h"
|
||||
#include "nunbox/CodeGenerator.h"
|
||||
|
||||
#endif
|
||||
|
@ -1,133 +0,0 @@
|
||||
/* -*- 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
|
||||
* Brendan Eich <brendan@mozilla.org>
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Anderson <danderson@mozilla.com>
|
||||
* David Mandelin <dmandelin@mozilla.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
#define __STDC_LIMIT_MACROS
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsnum.h"
|
||||
#include "CodeGenerator.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::mjit;
|
||||
|
||||
CodeGenerator::CodeGenerator(MacroAssembler &masm, FrameState &frame)
|
||||
: masm(masm), frame(frame)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenerator::storeJsval(const Value &v, Address address)
|
||||
{
|
||||
const jsval jv = Jsvalify(v);
|
||||
masm.store32(Imm32(jv.mask), Address(address.base, address.offset + offsetof(jsval, mask)));
|
||||
if (v.isNullOrUndefined())
|
||||
return;
|
||||
#ifdef JS_CPU_X64
|
||||
masm.storePtr(ImmPtr(jv.data.ptr), Address(address.base, address.offset + offsetof(jsval, data)));
|
||||
#elif defined(JS_CPU_ARM) || defined(JS_CPU_X86)
|
||||
if (v.isDouble()) {
|
||||
jsdpun u;
|
||||
u.d = jv.data.dbl;
|
||||
masm.store32(Imm32(u.s.hi), Address(address.base,
|
||||
address.offset + offsetof(jsval, data)));
|
||||
masm.store32(Imm32(u.s.lo), Address(address.base,
|
||||
address.offset + offsetof(jsval, data) + 4));
|
||||
} else {
|
||||
masm.storePtr(ImmPtr(jv.data.ptr), Address(address.base, address.offset + offsetof(jsval, data)));
|
||||
}
|
||||
#else
|
||||
# error "Unknown architecture"
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenerator::storeValue(FrameEntry *fe, Address address, bool popped)
|
||||
{
|
||||
if (fe->isConstant()) {
|
||||
storeJsval(Valueify(fe->getConstant()), address);
|
||||
return;
|
||||
}
|
||||
|
||||
Address feAddr = frame.addressOf(fe);
|
||||
|
||||
/* Copy the payload - :TODO: something better */
|
||||
#ifdef JS_32BIT
|
||||
RegisterID tempReg = frame.allocReg();
|
||||
masm.loadPtr(Address(feAddr.base, feAddr.offset + offsetof(jsval, data)), tempReg);
|
||||
masm.storePtr(tempReg, Address(address.base, address.offset + offsetof(jsval, data)));
|
||||
masm.loadPtr(Address(feAddr.base, feAddr.offset + offsetof(jsval, data) + 4), tempReg);
|
||||
masm.storePtr(tempReg, Address(address.base, address.offset + offsetof(jsval, data) + 4));
|
||||
frame.freeReg(tempReg);
|
||||
#else
|
||||
# error "IMPLEMENT ME"
|
||||
#endif
|
||||
|
||||
/* Copy the type. */
|
||||
if (fe->isTypeConstant()) {
|
||||
masm.store32(Imm32(fe->getTypeTag()),
|
||||
Address(address.base,
|
||||
address.offset + offsetof(jsval, mask)));
|
||||
} else {
|
||||
RegisterID reg = frame.tempRegForType(fe);
|
||||
masm.store32(reg, Address(address.base, address.offset + offsetof(jsval, mask)));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenerator::pushValueOntoFrame(Address address)
|
||||
{
|
||||
RegisterID tempReg = frame.allocReg();
|
||||
|
||||
Address tos = frame.topOfStack();
|
||||
|
||||
#ifdef JS_CPU_X64
|
||||
masm.loadPtr(Address(address.base, address.offset + offsetof(jsval, data)), tempReg);
|
||||
masm.storePtr(tempReg, Address(tos.base, tos.offset + offsetof(jsval, data)));
|
||||
#elif defined(JS_CPU_ARM) || defined(JS_CPU_X86)
|
||||
masm.load32(Address(address.base, address.offset + offsetof(jsval, data)), tempReg);
|
||||
masm.store32(tempReg, Address(tos.base, tos.offset + offsetof(jsval, data)));
|
||||
masm.load32(Address(address.base, address.offset + offsetof(jsval, data) + 4), tempReg);
|
||||
masm.store32(tempReg, Address(tos.base, tos.offset + offsetof(jsval, data) + 4));
|
||||
#endif
|
||||
masm.load32(Address(address.base, address.offset + offsetof(jsval, mask)), tempReg);
|
||||
|
||||
frame.pushUnknownType(tempReg);
|
||||
}
|
||||
|
@ -61,9 +61,9 @@ NotCheckedSSE2;
|
||||
#endif
|
||||
|
||||
mjit::Compiler::Compiler(JSContext *cx, JSScript *script, JSFunction *fun, JSObject *scopeChain)
|
||||
: CompilerBase(cx), cx(cx), script(script), scopeChain(scopeChain),
|
||||
globalObj(scopeChain->getGlobal()), fun(fun), analysis(cx, script), jumpMap(NULL),
|
||||
frame(cx, script, masm), cg(masm, frame), branchPatches(ContextAllocPolicy(cx))
|
||||
: cx(cx), script(script), scopeChain(scopeChain), globalObj(scopeChain->getGlobal()), fun(fun),
|
||||
analysis(cx, script), jumpMap(NULL), frame(cx, script, masm), cg(masm, frame),
|
||||
branchPatches(ContextAllocPolicy(cx))
|
||||
{
|
||||
}
|
||||
|
||||
@ -304,6 +304,13 @@ mjit::Compiler::labelOf(jsbytecode *pc)
|
||||
return jumpMap[offs];
|
||||
}
|
||||
|
||||
JSC::ExecutablePool *
|
||||
mjit::Compiler::getExecPool(size_t size)
|
||||
{
|
||||
ThreadData *jaegerData = &JS_METHODJIT_DATA(cx);
|
||||
return jaegerData->execPool->poolForSize(size);
|
||||
}
|
||||
|
||||
uint32
|
||||
mjit::Compiler::fullAtomIndex(jsbytecode *pc)
|
||||
{
|
||||
|
@ -45,14 +45,12 @@
|
||||
#include "BytecodeAnalyzer.h"
|
||||
#include "MethodJIT.h"
|
||||
#include "assembler/assembler/MacroAssembler.h"
|
||||
#include "FrameState.h"
|
||||
#include "CodeGenerator.h"
|
||||
#include "CompilerBase.h"
|
||||
#include "CodeGenIncludes.h"
|
||||
|
||||
namespace js {
|
||||
namespace mjit {
|
||||
|
||||
class Compiler : public CompilerBase
|
||||
class Compiler
|
||||
{
|
||||
typedef JSC::MacroAssembler::Label Label;
|
||||
typedef JSC::MacroAssembler::ImmPtr ImmPtr;
|
||||
@ -103,6 +101,7 @@ class Compiler : public CompilerBase
|
||||
const Label &labelOf(jsbytecode *pc);
|
||||
uint32 fullAtomIndex(jsbytecode *pc);
|
||||
void jumpInScript(Jump j, jsbytecode *pc);
|
||||
JSC::ExecutablePool *getExecPool(size_t size);
|
||||
|
||||
/* Opcode handlers. */
|
||||
void jsop_bindname(uint32 index);
|
||||
|
@ -49,11 +49,7 @@
|
||||
# error "Oh no, you should define a platform so this compiles."
|
||||
#endif
|
||||
|
||||
#if defined JS_CPU_X64
|
||||
# define JS_64BIT
|
||||
#elif defined(JS_CPU_ARM) || defined(JS_CPU_X86)
|
||||
# define JS_32BIT
|
||||
#else
|
||||
#if !defined(JS_32BIT) && !defined(JS_64BIT)
|
||||
# error "This processor is UNKNOWN."
|
||||
#endif
|
||||
|
||||
|
@ -42,11 +42,9 @@
|
||||
|
||||
#include "jscntxt.h"
|
||||
#include "jstl.h"
|
||||
#include "BytecodeAnalyzer.h"
|
||||
#include "MethodJIT.h"
|
||||
#include "FrameState.h"
|
||||
#include "methodjit/MethodJIT.h"
|
||||
#include "methodjit/nunbox/FrameState.h"
|
||||
#include "assembler/assembler/MacroAssembler.h"
|
||||
#include "CodeGenerator.h"
|
||||
|
||||
namespace js {
|
||||
namespace mjit {
|
@ -37,8 +37,8 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "MethodJIT.h"
|
||||
#include "Compiler.h"
|
||||
#include "methodjit/MethodJIT.h"
|
||||
#include "methodjit/Compiler.h"
|
||||
|
||||
#include "jsautooplen.h"
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define jsjaeger_valueinfo_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "MachineRegs.h"
|
||||
#include "methodjit/MachineRegs.h"
|
||||
#include "assembler/assembler/MacroAssembler.h"
|
||||
|
||||
namespace js {
|
@ -41,9 +41,9 @@
|
||||
#define jsjaeger_framestate_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "MachineRegs.h"
|
||||
#include "methodjit/MachineRegs.h"
|
||||
#include "assembler/assembler/MacroAssembler.h"
|
||||
#include "FrameEntry.h"
|
||||
#include "methodjit/nunbox/FrameEntry.h"
|
||||
|
||||
namespace js {
|
||||
namespace mjit {
|
Loading…
Reference in New Issue
Block a user