Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (192507 => 192508)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-11-17 03:51:03 UTC (rev 192507)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-11-17 06:20:21 UTC (rev 192508)
@@ -2511,7 +2511,7 @@
LValue arguments = lowCell(m_node->child1());
speculate(
ExoticObjectMode, noValue(), nullptr,
- m_out.notZero8(m_out.load8(arguments, m_heaps.ScopedArguments_overrodeThings)));
+ m_out.notZero32(m_out.load8ZeroExt32(arguments, m_heaps.ScopedArguments_overrodeThings)));
setInt32(m_out.load32NonNegative(arguments, m_heaps.ScopedArguments_totalLength));
return;
}
@@ -2751,10 +2751,10 @@
LValue result;
switch (elementSize(type)) {
case 1:
- result = m_out.load8(pointer);
+ result = isSigned(type) ? m_out.load8SignExt32(pointer) : m_out.load8ZeroExt32(pointer);
break;
case 2:
- result = m_out.load16(pointer);
+ result = isSigned(type) ? m_out.load16SignExt32(pointer) : m_out.load16ZeroExt32(pointer);
break;
case 4:
result = m_out.load32(pointer);
@@ -2763,20 +2763,11 @@
DFG_CRASH(m_graph, m_node, "Bad element size");
}
- if (elementSize(type) < 4) {
- if (isSigned(type))
- result = m_out.signExt(result, m_out.int32);
- else
- result = m_out.zeroExt(result, m_out.int32);
+ if (elementSize(type) < 4 || isSigned(type)) {
setInt32(result);
return;
}
-
- if (isSigned(type)) {
- setInt32(result);
- return;
- }
-
+
if (m_node->shouldSpeculateInt32()) {
speculate(
Overflow, noValue(), 0, m_out.lessThan(result, m_out.int32Zero));
@@ -3998,20 +3989,18 @@
m_out.appendTo(is8Bit, is16Bit);
- ValueFromBlock char8Bit = m_out.anchor(m_out.zeroExt(
- m_out.load8(m_out.baseIndex(
+ ValueFromBlock char8Bit = m_out.anchor(
+ m_out.load8ZeroExt32(m_out.baseIndex(
m_heaps.characters8, storage, m_out.zeroExtPtr(index),
- provenValue(m_node->child2()))),
- m_out.int32));
+ provenValue(m_node->child2()))));
m_out.jump(bitsContinuation);
m_out.appendTo(is16Bit, bigCharacter);
- ValueFromBlock char16Bit = m_out.anchor(m_out.zeroExt(
- m_out.load16(m_out.baseIndex(
+ ValueFromBlock char16Bit = m_out.anchor(
+ m_out.load16ZeroExt32(m_out.baseIndex(
m_heaps.characters16, storage, m_out.zeroExtPtr(index),
- provenValue(m_node->child2()))),
- m_out.int32));
+ provenValue(m_node->child2()))));
m_out.branch(
m_out.aboveOrEqual(char16Bit.value(), m_out.constInt32(0x100)),
rarely(bigCharacter), usually(bitsContinuation));
@@ -4096,20 +4085,18 @@
LBasicBlock lastNext = m_out.appendTo(is8Bit, is16Bit);
- ValueFromBlock char8Bit = m_out.anchor(m_out.zeroExt(
- m_out.load8(m_out.baseIndex(
+ ValueFromBlock char8Bit = m_out.anchor(
+ m_out.load8ZeroExt32(m_out.baseIndex(
m_heaps.characters8, storage, m_out.zeroExtPtr(index),
- provenValue(m_node->child2()))),
- m_out.int32));
+ provenValue(m_node->child2()))));
m_out.jump(continuation);
m_out.appendTo(is16Bit, continuation);
- ValueFromBlock char16Bit = m_out.anchor(m_out.zeroExt(
- m_out.load16(m_out.baseIndex(
+ ValueFromBlock char16Bit = m_out.anchor(
+ m_out.load16ZeroExt32(m_out.baseIndex(
m_heaps.characters16, storage, m_out.zeroExtPtr(index),
- provenValue(m_node->child2()))),
- m_out.int32));
+ provenValue(m_node->child2()))));
m_out.jump(continuation);
m_out.appendTo(continuation, lastNext);
@@ -4309,9 +4296,9 @@
LBasicBlock isNotInvalidated = FTL_NEW_BLOCK(m_out, ("NotifyWrite not invalidated case"));
LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("NotifyWrite continuation"));
- LValue state = m_out.load8(m_out.absolute(set->addressOfState()));
+ LValue state = m_out.load8ZeroExt32(m_out.absolute(set->addressOfState()));
m_out.branch(
- m_out.equal(state, m_out.constInt8(IsInvalidated)),
+ m_out.equal(state, m_out.constInt32(IsInvalidated)),
usually(continuation), rarely(isNotInvalidated));
LBasicBlock lastNext = m_out.appendTo(isNotInvalidated, continuation);
@@ -4944,16 +4931,15 @@
Vector<ValueFromBlock, 2> characters;
m_out.appendTo(is8Bit, is16Bit);
- characters.append(m_out.anchor(
- m_out.zeroExt(m_out.load8(characterData, m_heaps.characters8[0]), m_out.int16)));
+ characters.append(m_out.anchor(m_out.load8ZeroExt32(characterData, m_heaps.characters8[0])));
m_out.jump(continuation);
m_out.appendTo(is16Bit, continuation);
- characters.append(m_out.anchor(m_out.load16(characterData, m_heaps.characters16[0])));
+ characters.append(m_out.anchor(m_out.load16ZeroExt32(characterData, m_heaps.characters16[0])));
m_out.jump(continuation);
m_out.appendTo(continuation, lastNext);
- buildSwitch(data, m_out.int16, m_out.phi(m_out.int16, characters));
+ buildSwitch(data, m_out.int32, m_out.phi(m_out.int32, characters));
return;
}
@@ -5281,9 +5267,9 @@
{
speculate(
Uncountable, noValue(), 0,
- m_out.testIsZero8(
- m_out.load8(lowCell(m_node->child1()), m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(ImplementsDefaultHasInstance)));
+ m_out.testIsZero32(
+ m_out.load8ZeroExt32(lowCell(m_node->child1()), m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(ImplementsDefaultHasInstance)));
}
void compileInstanceOf()
@@ -5776,8 +5762,8 @@
LBasicBlock timerDidFire = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer timer did fire"));
LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer continuation"));
- LValue state = m_out.load8(m_out.absolute(vm().watchdog->timerDidFireAddress()));
- m_out.branch(m_out.equal(state, m_out.constInt8(0)),
+ LValue state = m_out.load8ZeroExt32(m_out.absolute(vm().watchdog->timerDidFireAddress()));
+ m_out.branch(m_out.isZero32(state),
usually(continuation), rarely(timerDidFire));
LBasicBlock lastNext = m_out.appendTo(timerDidFire, continuation);
@@ -6453,9 +6439,9 @@
FTL_TYPE_CHECK(jsValueValue(cell), edge, filter, isNotObject(cell));
speculate(
BadType, jsValueValue(cell), edge.node(),
- m_out.testNonZero8(
- m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(MasqueradesAsUndefined)));
+ m_out.testNonZero32(
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(MasqueradesAsUndefined)));
}
void nonSpeculativeCompare(LIntPredicate intCondition, S_JITOperation_EJJ helperFunction)
@@ -6803,9 +6789,9 @@
results.append(m_out.anchor(m_out.booleanTrue));
m_out.branch(
- m_out.testIsZero8(
- m_out.load8(value, m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(MasqueradesAsUndefined)),
+ m_out.testIsZero32(
+ m_out.load8ZeroExt32(value, m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(MasqueradesAsUndefined)),
usually(continuation), rarely(masqueradesCase));
m_out.appendTo(masqueradesCase);
@@ -6901,9 +6887,9 @@
results.append(m_out.anchor(m_out.booleanFalse));
m_out.branch(
- m_out.testNonZero8(
- m_out.load8(value, m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(MasqueradesAsUndefined)),
+ m_out.testNonZero32(
+ m_out.load8ZeroExt32(value, m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(MasqueradesAsUndefined)),
rarely(masqueradesCase), usually(continuation));
m_out.appendTo(masqueradesCase, primitiveCase);
@@ -7157,8 +7143,8 @@
for (unsigned i = numChecked; i < commonChars; ++i) {
m_out.check(
m_out.notEqual(
- m_out.load8(buffer, m_heaps.characters8[i]),
- m_out.constInt8(cases[begin].string->at(i))),
+ m_out.load8ZeroExt32(buffer, m_heaps.characters8[i]),
+ m_out.constInt32(static_cast<uint16_t>(cases[begin].string->at(i)))),
unsure(fallThrough));
}
@@ -7195,7 +7181,7 @@
DFG_ASSERT(m_graph, m_node, end >= begin + 2);
- LValue uncheckedChar = m_out.load8(buffer, m_heaps.characters8[commonChars]);
+ LValue uncheckedChar = m_out.load8ZeroExt32(buffer, m_heaps.characters8[commonChars]);
Vector<CharacterCase> characterCases;
CharacterCase currentCase(cases[begin].string->at(commonChars), begin, begin + 1);
@@ -7219,7 +7205,7 @@
if (i)
DFG_ASSERT(m_graph, m_node, characterCases[i - 1].character < characterCases[i].character);
switchCases.append(SwitchCase(
- m_out.constInt8(characterCases[i].character), characterBlocks[i], Weight()));
+ m_out.constInt32(characterCases[i].character), characterBlocks[i], Weight()));
}
m_out.switchInstruction(uncheckedChar, switchCases, fallThrough, Weight());
@@ -8313,8 +8299,8 @@
if (LValue proven = isProvenValue(type & SpecCell, SpecObject))
return proven;
return m_out.aboveOrEqual(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(ObjectType));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(ObjectType));
}
LValue isNotObject(LValue cell, SpeculatedType type = SpecFullTop)
@@ -8322,8 +8308,8 @@
if (LValue proven = isProvenValue(type & SpecCell, ~SpecObject))
return proven;
return m_out.below(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(ObjectType));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(ObjectType));
}
LValue isNotString(LValue cell, SpeculatedType type = SpecFullTop)
@@ -8359,7 +8345,7 @@
case Array::Int32:
case Array::Double:
case Array::Contiguous: {
- LValue indexingType = m_out.load8(cell, m_heaps.JSCell_indexingType);
+ LValue indexingType = m_out.load8ZeroExt32(cell, m_heaps.JSCell_indexingType);
switch (arrayMode.arrayClass()) {
case Array::OriginalArray:
@@ -8368,19 +8354,19 @@
case Array::Array:
return m_out.equal(
- m_out.bitAnd(indexingType, m_out.constInt8(IsArray | IndexingShapeMask)),
- m_out.constInt8(IsArray | arrayMode.shapeMask()));
+ m_out.bitAnd(indexingType, m_out.constInt32(IsArray | IndexingShapeMask)),
+ m_out.constInt32(IsArray | arrayMode.shapeMask()));
case Array::NonArray:
case Array::OriginalNonArray:
return m_out.equal(
- m_out.bitAnd(indexingType, m_out.constInt8(IsArray | IndexingShapeMask)),
- m_out.constInt8(arrayMode.shapeMask()));
+ m_out.bitAnd(indexingType, m_out.constInt32(IsArray | IndexingShapeMask)),
+ m_out.constInt32(arrayMode.shapeMask()));
case Array::PossiblyArray:
return m_out.equal(
- m_out.bitAnd(indexingType, m_out.constInt8(IndexingShapeMask)),
- m_out.constInt8(arrayMode.shapeMask()));
+ m_out.bitAnd(indexingType, m_out.constInt32(IndexingShapeMask)),
+ m_out.constInt32(arrayMode.shapeMask()));
}
DFG_CRASH(m_graph, m_node, "Corrupt array class");
@@ -8388,18 +8374,18 @@
case Array::DirectArguments:
return m_out.equal(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(DirectArgumentsType));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(DirectArgumentsType));
case Array::ScopedArguments:
return m_out.equal(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(ScopedArgumentsType));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(ScopedArgumentsType));
default:
return m_out.equal(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(typeForTypedArrayType(arrayMode.typedArrayType())));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(typeForTypedArrayType(arrayMode.typedArrayType())));
}
}
@@ -8420,16 +8406,16 @@
{
if (!(type & SpecObjectOther))
return m_out.booleanFalse;
- return m_out.testNonZero8(
- m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
+ return m_out.testNonZero32(
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
}
LValue isType(LValue cell, JSType type)
{
return m_out.equal(
- m_out.load8(cell, m_heaps.JSCell_typeInfoType),
- m_out.constInt8(type));
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+ m_out.constInt32(type));
}
LValue isNotType(LValue cell, JSType type)
@@ -8594,9 +8580,9 @@
speculate(
BadType, jsValueValue(cell), edge.node(),
- m_out.testNonZero8(
- m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
- m_out.constInt8(MasqueradesAsUndefined)));
+ m_out.testNonZero32(
+ m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+ m_out.constInt32(MasqueradesAsUndefined)));
}
void speculateNumber(Edge edge)
@@ -8713,7 +8699,7 @@
LValue loadCellState(LValue base)
{
- return m_out.load8(base, m_heaps.JSCell_cellState);
+ return m_out.load8ZeroExt32(base, m_heaps.JSCell_cellState);
}
void emitStoreBarrier(LValue base)
@@ -8722,7 +8708,7 @@
LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("Store barrier continuation"));
m_out.branch(
- m_out.notZero8(loadCellState(base)), usually(continuation), rarely(slowPath));
+ m_out.notZero32(loadCellState(base)), usually(continuation), rarely(slowPath));
LBasicBlock lastNext = m_out.appendTo(slowPath, continuation);
Modified: trunk/Source/_javascript_Core/ftl/FTLOutput.h (192507 => 192508)
--- trunk/Source/_javascript_Core/ftl/FTLOutput.h 2015-11-17 03:51:03 UTC (rev 192507)
+++ trunk/Source/_javascript_Core/ftl/FTLOutput.h 2015-11-17 06:20:21 UTC (rev 192508)
@@ -89,7 +89,6 @@
LValue param(unsigned index) { return getParam(m_function, index); }
LValue constBool(bool value) { return constInt(boolean, value); }
- LValue constInt8(int8_t value) { return constInt(int8, value); }
LValue constInt32(int32_t value) { return constInt(int32, value); }
template<typename T>
LValue constIntPtr(T* value) { return constInt(intPtr, bitwise_cast<intptr_t>(value)); }
@@ -242,20 +241,20 @@
LValue load(TypedPointer, LType refType);
void store(LValue, TypedPointer, LType refType);
-
- LValue load8(TypedPointer pointer) { return load(pointer, ref8); }
- LValue load16(TypedPointer pointer) { return load(pointer, ref16); }
+
+ LValue load8SignExt32(TypedPointer);
+ LValue load8ZeroExt32(TypedPointer);
+ LValue load16SignExt32(TypedPointer);
+ LValue load16ZeroExt32(TypedPointer);
LValue load32(TypedPointer pointer) { return load(pointer, ref32); }
LValue load64(TypedPointer pointer) { return load(pointer, ref64); }
LValue loadPtr(TypedPointer pointer) { return load(pointer, refPtr); }
LValue loadFloat(TypedPointer pointer) { return load(pointer, refFloat); }
LValue loadDouble(TypedPointer pointer) { return load(pointer, refDouble); }
- void store8(LValue value, TypedPointer pointer) { store(value, pointer, ref8); }
void store16(LValue value, TypedPointer pointer) { store(value, pointer, ref16); }
void store32(LValue value, TypedPointer pointer) { store(value, pointer, ref32); }
void store64(LValue value, TypedPointer pointer) { store(value, pointer, ref64); }
void storePtr(LValue value, TypedPointer pointer) { store(value, pointer, refPtr); }
- void storeFloat(LValue value, TypedPointer pointer) { store(value, pointer, refFloat); }
void storeDouble(LValue value, TypedPointer pointer) { store(value, pointer, refDouble); }
LValue addPtr(LValue value, ptrdiff_t immediate = 0)
@@ -294,14 +293,15 @@
{
return TypedPointer(m_heaps->absolute[address], constIntPtr(address));
}
-
- LValue load8(LValue base, const AbstractField& field) { return load8(address(base, field)); }
- LValue load16(LValue base, const AbstractField& field) { return load16(address(base, field)); }
+
+ LValue load8SignExt32(LValue base, const AbstractField& field) { return load8SignExt32(address(base, field)); }
+ LValue load8ZeroExt32(LValue base, const AbstractField& field) { return load8ZeroExt32(address(base, field)); }
+ LValue load16SignExt32(LValue base, const AbstractField& field) { return load16SignExt32(address(base, field)); }
+ LValue load16ZeroExt32(LValue base, const AbstractField& field) { return load16ZeroExt32(address(base, field)); }
LValue load32(LValue base, const AbstractField& field) { return load32(address(base, field)); }
LValue load64(LValue base, const AbstractField& field) { return load64(address(base, field)); }
LValue loadPtr(LValue base, const AbstractField& field) { return loadPtr(address(base, field)); }
LValue loadDouble(LValue base, const AbstractField& field) { return loadDouble(address(base, field)); }
- void store8(LValue value, LValue base, const AbstractField& field) { store8(value, address(base, field)); }
void store32(LValue value, LValue base, const AbstractField& field) { store32(value, address(base, field)); }
void store64(LValue value, LValue base, const AbstractField& field) { store64(value, address(base, field)); }
void storePtr(LValue value, LValue base, const AbstractField& field) { storePtr(value, address(base, field)); }
@@ -347,8 +347,6 @@
LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGT, left, right); }
LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGE, left, right); }
- LValue isZero8(LValue value) { return equal(value, int8Zero); }
- LValue notZero8(LValue value) { return notEqual(value, int8Zero); }
LValue isZero32(LValue value) { return equal(value, int32Zero); }
LValue notZero32(LValue value) { return notEqual(value, int32Zero); }
LValue isZero64(LValue value) { return equal(value, int64Zero); }
@@ -356,8 +354,6 @@
LValue isNull(LValue value) { return equal(value, intPtrZero); }
LValue notNull(LValue value) { return notEqual(value, intPtrZero); }
- LValue testIsZero8(LValue value, LValue mask) { return isZero8(bitAnd(value, mask)); }
- LValue testNonZero8(LValue value, LValue mask) { return notZero8(bitAnd(value, mask)); }
LValue testIsZero32(LValue value, LValue mask) { return isZero32(bitAnd(value, mask)); }
LValue testNonZero32(LValue value, LValue mask) { return notZero32(bitAnd(value, mask)); }
LValue testIsZero64(LValue value, LValue mask) { return isZero64(bitAnd(value, mask)); }
@@ -443,6 +439,30 @@
LBasicBlock m_nextBlock;
};
+inline LValue Output::load8SignExt32(TypedPointer pointer)
+{
+ LValue value8 = load(pointer, ref8);
+ return signExt(value8, int32);
+}
+
+inline LValue Output::load8ZeroExt32(TypedPointer pointer)
+{
+ LValue value8 = load(pointer, ref8);
+ return zeroExt(value8, int32);
+}
+
+inline LValue Output::load16SignExt32(TypedPointer pointer)
+{
+ LValue value16 = load(pointer, ref16);
+ return signExt(value16, int32);
+}
+
+inline LValue Output::load16ZeroExt32(TypedPointer pointer)
+{
+ LValue value16 = load(pointer, ref16);
+ return zeroExt(value16, int32);
+}
+
#define FTL_NEW_BLOCK(output, nameArguments) \
(LIKELY(!verboseCompilationEnabled()) \
? (output).newBlock() \