Commit 540d71a6 authored by ggaren@apple.com's avatar ggaren@apple.com

Merged nitro-extreme branch into trunk.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0eb529f4
......@@ -26,7 +26,7 @@
#ifndef APICast_h
#define APICast_h
#include "JSNumberCell.h"
#include "JSAPIValueWrapper.h"
#include "JSValue.h"
#include <wtf/Platform.h>
#include <wtf/UnusedParam.h>
......@@ -58,18 +58,18 @@ inline JSC::ExecState* toJS(JSGlobalContextRef c)
return reinterpret_cast<JSC::ExecState*>(c);
}
inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v)
inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v)
{
JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
#if USE(ALTERNATE_JSIMMEDIATE)
UNUSED_PARAM(exec);
#if USE(JSVALUE32_64)
JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v));
if (!jsCell)
return JSC::JSValue();
if (jsCell->isAPIValueWrapper())
return static_cast<JSC::JSAPIValueWrapper*>(jsCell)->value();
return jsCell;
#else
if (jsValue && jsValue.isNumber()) {
ASSERT(jsValue.isAPIMangledNumber());
return JSC::jsNumber(exec, jsValue.uncheckedGetNumber());
}
return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
#endif
return jsValue;
}
inline JSC::JSObject* toJS(JSObjectRef o)
......@@ -89,15 +89,16 @@ inline JSC::JSGlobalData* toJS(JSContextGroupRef g)
inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v)
{
#if USE(ALTERNATE_JSIMMEDIATE)
UNUSED_PARAM(exec);
#if USE(JSVALUE32_64)
if (!v)
return 0;
if (!v.isCell())
return reinterpret_cast<JSValueRef>(asCell(JSC::jsAPIValueWrapper(exec, v)));
return reinterpret_cast<JSValueRef>(asCell(v));
#else
if (v && v.isNumber()) {
ASSERT(!v.isAPIMangledNumber());
return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber())));
}
#endif
UNUSED_PARAM(exec);
return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v));
#endif
}
inline JSObjectRef toRef(JSC::JSObject* o)
......
......@@ -318,11 +318,12 @@ bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
JSValueRef valueRef = toRef(exec, value);
JSValueRef exception = 0;
bool result;
{
JSLock::DropAllLocks dropAllLocks(exec);
result = hasInstance(execRef, thisRef, toRef(exec, value), &exception);
result = hasInstance(execRef, thisRef, valueRef, &exception);
}
exec->setException(toJS(exec, exception));
return result;
......@@ -428,11 +429,13 @@ double JSCallbackObject<Base>::toNumber(ExecState* exec) const
JSLock::DropAllLocks dropAllLocks(exec);
value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
}
exec->setException(toJS(exec, exception));
if (value) {
double dValue;
return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
if (exception) {
exec->setException(toJS(exec, exception));
return 0;
}
double dValue;
return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
}
return Base::toNumber(exec);
......@@ -452,11 +455,11 @@ UString JSCallbackObject<Base>::toString(ExecState* exec) const
JSLock::DropAllLocks dropAllLocks(exec);
value = convertToType(ctx, thisRef, kJSTypeString, &exception);
}
exec->setException(toJS(exec, exception));
if (value)
return toJS(exec, value).getString();
if (exception)
if (exception) {
exec->setException(toJS(exec, exception));
return "";
}
return toJS(exec, value).getString();
}
return Base::toString(exec);
......
......@@ -383,8 +383,12 @@ static JSValueRef EvilExceptionObject_convertToType(JSContextRef context, JSObje
if (!function)
return NULL;
JSValueRef value = JSObjectCallAsFunction(context, function, object, 0, NULL, exception);
if (!value)
return (JSValueRef)JSStringCreateWithUTF8CString("convertToType failed");
if (!value) {
JSStringRef errorString = JSStringCreateWithUTF8CString("convertToType failed");
JSValueRef errorStringRef = JSValueMakeString(context, errorString);
JSStringRelease(errorString);
return errorStringRef;
}
return value;
}
......
......@@ -34,6 +34,7 @@
#include "runtime/JSStaticScopeObject.cpp"
#include "runtime/JSFunction.cpp"
#include "runtime/Arguments.cpp"
#include "runtime/JSAPIValueWrapper.cpp"
#include "runtime/JSGlobalObjectFunctions.cpp"
#include "runtime/PrototypeFunction.cpp"
#include "runtime/GlobalEvalFunction.cpp"
......
This diff is collapsed.
......@@ -102,11 +102,6 @@ __ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
__ZN3JSC11JSImmediate12nonInlineNaNEv
__ZN3JSC11JSImmediate12toThisObjectENS_7JSValueEPNS_9ExecStateE
__ZN3JSC11JSImmediate8toObjectENS_7JSValueEPNS_9ExecStateE
__ZN3JSC11JSImmediate8toStringENS_7JSValueE
__ZN3JSC11JSImmediate9prototypeENS_7JSValueEPNS_9ExecStateE
__ZN3JSC11ParserArena5resetEv
__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
__ZN3JSC12DateInstance4infoE
......@@ -127,6 +122,7 @@ __ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15Pu
__ZN3JSC12StringObject4infoE
__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEERKNS_7UStringE
__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
__ZN3JSC12nonInlineNaNEv
__ZN3JSC13SamplingFlags4stopEv
__ZN3JSC13SamplingFlags5startEv
__ZN3JSC13SamplingFlags7s_flagsE
......@@ -162,7 +158,6 @@ __ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEi
__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectES6_RKNS_7ArgListEE
__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
__ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE
__ZN3JSC18jsAPIMangledNumberEPNS_9ExecStateEd
__ZN3JSC19constructEmptyArrayEPNS_9ExecStateE
__ZN3JSC19initializeThreadingEv
__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
......@@ -172,7 +167,6 @@ __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_
__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
__ZN3JSC4Heap11objectCountEv
__ZN3JSC4Heap14allocateNumberEm
__ZN3JSC4Heap14primaryHeapEndEv
__ZN3JSC4Heap15recordExtraCostEm
__ZN3JSC4Heap16primaryHeapBeginEv
......@@ -217,12 +211,14 @@ __ZN3JSC7Profile10restoreAllEv
__ZN3JSC7Profile5focusEPKNS_11ProfileNodeE
__ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE
__ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE
__ZN3JSC7UString3Rep12sharedBufferEv
__ZN3JSC7UString3Rep11computeHashEPKci
__ZN3JSC7UString3Rep11computeHashEPKti
__ZN3JSC7UString3Rep12sharedBufferEv
__ZN3JSC7UString3Rep14createFromUTF8EPKc
__ZN3JSC7UString3Rep14nullBaseStringE
__ZN3JSC7UString3Rep6createEPtiN3WTF10PassRefPtrINS3_21CrossThreadRefCountedINS3_16OwnFastMallocPtrItEEEEEE
__ZN3JSC7UString3Rep7destroyEv
__ZN3JSC7UString4fromEd
__ZN3JSC7UString4fromEi
__ZN3JSC7UString4fromEj
__ZN3JSC7UString4fromEl
......@@ -279,7 +275,6 @@ __ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13Construc
__ZN3JSCeqERKNS_7UStringEPKc
__ZN3JSCgtERKNS_7UStringES2_
__ZN3JSCltERKNS_7UStringES2_
__ZN3JSC7UString3Rep14createFromUTF8EPKc
__ZN3WTF10fastCallocEmm
__ZN3WTF10fastMallocEm
__ZN3WTF11currentTimeEv
......@@ -290,7 +285,6 @@ __ZN3WTF12detachThreadEj
__ZN3WTF12isMainThreadEv
__ZN3WTF12randomNumberEv
__ZN3WTF13currentThreadEv
__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc
__ZN3WTF13tryFastCallocEmm
__ZN3WTF15ThreadCondition4waitERNS_5MutexE
__ZN3WTF15ThreadCondition6signalEv
......@@ -312,6 +306,7 @@ __ZN3WTF23waitForThreadCompletionEjPPv
__ZN3WTF27releaseFastMallocFreeMemoryEv
__ZN3WTF28setMainThreadCallbacksPausedEb
__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc
__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
__ZN3WTF5Mutex4lockEv
__ZN3WTF5Mutex6unlockEv
......@@ -344,13 +339,14 @@ __ZNK3JSC4Heap10statisticsEv
__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
__ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE
__ZNK3JSC6JSCell14isGetterSetterEv
__ZNK3JSC6JSCell17getTruncatedInt32ERi
__ZNK3JSC6JSCell18getTruncatedUInt32ERj
__ZNK3JSC6JSCell9classInfoEv
__ZNK3JSC6JSCell9getStringERNS_7UStringE
__ZNK3JSC6JSCell9getStringEv
__ZNK3JSC6JSCell9getUInt32ERj
__ZNK3JSC7ArgList8getSliceEiRS0_
__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
__ZNK3JSC7UString10UTF8StringEb
__ZNK3JSC7UString14toStrictUInt32EPb
......@@ -377,6 +373,7 @@ __ZTVN3JSC14JSGlobalObjectE
__ZTVN3JSC15JSWrapperObjectE
__ZTVN3JSC16InternalFunctionE
__ZTVN3JSC16JSVariableObjectE
__ZTVN3JSC17JSAPIValueWrapperE
__ZTVN3JSC8JSObjectE
__ZTVN3JSC8JSStringE
_jscore_fastmalloc_introspection
......
......@@ -707,6 +707,14 @@
RelativePath="..\..\runtime\JSActivation.h"
>
</File>
<File
RelativePath="..\..\runtime\JSAPIValueWrapper.cpp"
>
</File>
<File
RelativePath="..\..\runtime\JSAPIValueWrapper.h"
>
</File>
<File
RelativePath="..\..\runtime\JSArray.cpp"
>
......
......@@ -119,6 +119,7 @@
7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E4EE7080EBB7963005934AA /* StructureChain.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */; };
7EFF00640EC05A9A00AA7C93 /* NodeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EFF00630EC05A9A00AA7C93 /* NodeInfo.h */; };
840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
860161E30F3A83C100F84710 /* AbstractMacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */; };
860161E40F3A83C100F84710 /* MacroAssemblerX86.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */; };
860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; };
......@@ -769,6 +770,8 @@
BC02E9B60E1842FA000F9297 /* JSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSString.cpp; sourceTree = "<group>"; };
BC02E9B80E184545000F9297 /* GetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetterSetter.cpp; sourceTree = "<group>"; };
BC02E9B90E184580000F9297 /* JSNumberCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNumberCell.cpp; sourceTree = "<group>"; };
BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAPIValueWrapper.cpp; path = ../runtime/JSAPIValueWrapper.cpp; sourceTree = "<group>"; };
BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAPIValueWrapper.h; path = ../runtime/JSAPIValueWrapper.h; sourceTree = "<group>"; };
BC1166000E1997B1008066DD /* DateInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateInstance.cpp; sourceTree = "<group>"; };
BC1166010E1997B1008066DD /* DateInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstance.h; sourceTree = "<group>"; };
BC11667A0E199C05008066DD /* InternalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunction.h; sourceTree = "<group>"; };
......@@ -1078,6 +1081,8 @@
1482B78A0A4305AB00517CFC /* APICast.h */,
1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */,
1CAA8B4B0D32C39A0041BCFF /* JavaScriptCore.h */,
BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */,
BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */,
1421359A0A677F4F00A8195E /* JSBase.cpp */,
142711380A460BBB0080EEEA /* JSBase.h */,
140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */,
......@@ -1722,6 +1727,7 @@
960626960FB8EC02009798AB /* JITStubCall.h in Headers */,
14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */,
BC18C4160E16F5CD00B34460 /* JSActivation.h in Headers */,
840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */,
BC18C4170E16F5CD00B34460 /* JSArray.h in Headers */,
BC18C4180E16F5CD00B34460 /* JSBase.h in Headers */,
140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */,
......
......@@ -378,6 +378,8 @@ public:
friend class LinkBuffer;
public:
typedef Vector<Jump, 16> JumpVector;
void link(AbstractMacroAssembler<AssemblerType>* masm)
{
size_t size = m_jumps.size();
......@@ -408,9 +410,11 @@ public:
{
return !m_jumps.size();
}
const JumpVector& jumps() { return m_jumps; }
private:
Vector<Jump, 16> m_jumps;
JumpVector m_jumps;
};
......
......@@ -51,6 +51,8 @@ public:
using MacroAssemblerX86Common::store32;
using MacroAssemblerX86Common::branch32;
using MacroAssemblerX86Common::call;
using MacroAssemblerX86Common::loadDouble;
using MacroAssemblerX86Common::convertInt32ToDouble;
void add32(Imm32 imm, RegisterID src, RegisterID dest)
{
......@@ -87,6 +89,17 @@ public:
m_assembler.movl_mr(address, dest);
}
void loadDouble(void* address, FPRegisterID dest)
{
ASSERT(isSSE2Present());
m_assembler.movsd_mr(address, dest);
}
void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
{
m_assembler.cvtsi2sd_mr(src.m_ptr, dest);
}
void store32(Imm32 imm, void* address)
{
m_assembler.movl_i32m(imm.m_value, address);
......
......@@ -57,6 +57,7 @@ public:
enum DoubleCondition {
DoubleEqual = X86Assembler::ConditionE,
DoubleNotEqual = X86Assembler::ConditionNE,
DoubleGreaterThan = X86Assembler::ConditionA,
DoubleGreaterThanOrEqual = X86Assembler::ConditionAE,
DoubleLessThan = X86Assembler::ConditionB,
......@@ -91,6 +92,11 @@ public:
{
m_assembler.addl_mr(src.offset, src.base, dest);
}
void add32(RegisterID src, Address dest)
{
m_assembler.addl_rm(src, dest.offset, dest.base);
}
void and32(RegisterID src, RegisterID dest)
{
......@@ -102,6 +108,16 @@ public:
m_assembler.andl_ir(imm.m_value, dest);
}
void and32(RegisterID src, Address dest)
{
m_assembler.andl_rm(src, dest.offset, dest.base);
}
void and32(Address src, RegisterID dest)
{
m_assembler.andl_mr(src.offset, src.base, dest);
}
void and32(Imm32 imm, Address address)
{
m_assembler.andl_im(imm.m_value, address.offset, address.base);
......@@ -138,16 +154,36 @@ public:
{
m_assembler.imull_rr(src, dest);
}
void mul32(Address src, RegisterID dest)
{
m_assembler.imull_mr(src.offset, src.base, dest);
}
void mul32(Imm32 imm, RegisterID src, RegisterID dest)
{
m_assembler.imull_i32r(src, imm.m_value, dest);
}
void neg32(RegisterID srcDest)
{
m_assembler.negl_r(srcDest);
}
void neg32(Address srcDest)
{
m_assembler.negl_m(srcDest.offset, srcDest.base);
}
void not32(RegisterID srcDest)
{
m_assembler.notl_r(srcDest);
}
void not32(Address srcDest)
{
m_assembler.notl_m(srcDest.offset, srcDest.base);
}
void or32(RegisterID src, RegisterID dest)
{
......@@ -159,6 +195,16 @@ public:
m_assembler.orl_ir(imm.m_value, dest);
}
void or32(RegisterID src, Address dest)
{
m_assembler.orl_rm(src, dest.offset, dest.base);
}
void or32(Address src, RegisterID dest)
{
m_assembler.orl_mr(src.offset, src.base, dest);
}
void or32(Imm32 imm, Address address)
{
m_assembler.orl_im(imm.m_value, address.offset, address.base);
......@@ -211,14 +257,35 @@ public:
m_assembler.subl_mr(src.offset, src.base, dest);
}
void sub32(RegisterID src, Address dest)
{
m_assembler.subl_rm(src, dest.offset, dest.base);
}
void xor32(RegisterID src, RegisterID dest)
{
m_assembler.xorl_rr(src, dest);
}
void xor32(Imm32 imm, RegisterID srcDest)
void xor32(Imm32 imm, Address dest)
{
m_assembler.xorl_ir(imm.m_value, srcDest);
m_assembler.xorl_im(imm.m_value, dest.offset, dest.base);
}
void xor32(Imm32 imm, RegisterID dest)
{
m_assembler.xorl_ir(imm.m_value, dest);
}
void xor32(RegisterID src, Address dest)
{
m_assembler.xorl_rm(src, dest.offset, dest.base);
}
void xor32(Address src, RegisterID dest)
{
m_assembler.xorl_mr(src.offset, src.base, dest);
}
......@@ -300,6 +367,18 @@ public:
m_assembler.addsd_mr(src.offset, src.base, dest);
}
void divDouble(FPRegisterID src, FPRegisterID dest)
{
ASSERT(isSSE2Present());
m_assembler.divsd_rr(src, dest);
}
void divDouble(Address src, FPRegisterID dest)
{
ASSERT(isSSE2Present());
m_assembler.divsd_mr(src.offset, src.base, dest);
}
void subDouble(FPRegisterID src, FPRegisterID dest)
{
ASSERT(isSSE2Present());
......@@ -330,6 +409,11 @@ public:
m_assembler.cvtsi2sd_rr(src, dest);
}
void convertInt32ToDouble(Address src, FPRegisterID dest)
{
m_assembler.cvtsi2sd_mr(src.offset, src.base, dest);
}
Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
{
ASSERT(isSSE2Present());
......@@ -337,6 +421,12 @@ public:
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchDouble(DoubleCondition cond, FPRegisterID left, Address right)
{
m_assembler.ucomisd_mr(right.offset, right.base, left);
return Jump(m_assembler.jCC(x86Condition(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
......@@ -348,6 +438,12 @@ public:
return branch32(Equal, dest, Imm32(0x80000000));
}
void zeroDouble(FPRegisterID srcDest)
{
ASSERT(isSSE2Present());
m_assembler.xorpd_rr(srcDest, srcDest);
}
// Stack manipulation operations:
//
......@@ -397,7 +493,8 @@ public:
{
// Note: on 64-bit this is is a full register move; perhaps it would be
// useful to have separate move32 & movePtr, with move32 zero extending?
m_assembler.movq_rr(src, dest);
if (src != dest)
m_assembler.movq_rr(src, dest);
}
void move(ImmPtr imm, RegisterID dest)
......@@ -605,12 +702,40 @@ public:
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchAdd32(Condition cond, Imm32 src, Address dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
add32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchAdd32(Condition cond, RegisterID src, Address dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
add32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchAdd32(Condition cond, Address src, RegisterID dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
add32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
{
ASSERT(cond == Overflow);
mul32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchMul32(Condition cond, Address src, RegisterID dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
mul32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest)
{
......@@ -632,7 +757,35 @@ public:
sub32(imm, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchSub32(Condition cond, Imm32 imm, Address dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
sub32(imm, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchSub32(Condition cond, RegisterID src, Address dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
sub32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchSub32(Condition cond, Address src, RegisterID dest)
{
ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
sub32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
Jump branchOr32(Condition cond, RegisterID src, RegisterID dest)
{
ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
or32(src, dest);
return Jump(m_assembler.jCC(x86Condition(cond)));
}
// Miscellaneous operations:
......@@ -661,6 +814,27 @@ public:
m_assembler.ret();
}
void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
{
m_assembler.cmpl_rr(right, left);