Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (100515 => 100516)
--- trunk/Source/_javascript_Core/ChangeLog 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-11-16 23:37:15 UTC (rev 100516)
@@ -1,3 +1,20 @@
+2011-11-16 Geoffrey Garen <gga...@apple.com>
+
+ Rolled back in r100375 and r100385 with 32-bit build fixed.
+
+ * dfg/DFGOperations.cpp:
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArgList.cpp:
+ (JSC::ArgList::getSlice):
+ * runtime/ArgList.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::finishCreation):
+ * runtime/JSArray.h:
+ (JSC::JSArray::create):
+ * runtime/JSGlobalObject.h:
+ (JSC::constructArray):
+
2011-11-16 Filip Pizlo <fpi...@apple.com>
DFG global variable CSE mishandles the cross-global-object inlining corner case
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (100515 => 100516)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2011-11-16 23:37:15 UTC (rev 100516)
@@ -773,14 +773,12 @@
EncodedJSValue DFG_OPERATION operationNewArray(ExecState* exec, void* start, size_t size)
{
- ArgList argList(static_cast<Register*>(start), size);
- return JSValue::encode(constructArray(exec, argList));
+ return JSValue::encode(constructArray(exec, static_cast<JSValue*>(start), size));
}
EncodedJSValue DFG_OPERATION operationNewArrayBuffer(ExecState* exec, size_t start, size_t size)
{
- ArgList argList(exec->codeBlock()->constantBuffer(start), size);
- return JSValue::encode(constructArray(exec, argList));
+ return JSValue::encode(constructArray(exec, exec->codeBlock()->constantBuffer(start), size));
}
EncodedJSValue DFG_OPERATION operationNewRegexp(ExecState* exec, void* regexpPtr)
Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (100515 => 100516)
--- trunk/Source/_javascript_Core/jit/JITStubs.cpp 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp 2011-11-16 23:37:15 UTC (rev 100516)
@@ -2432,16 +2432,14 @@
{
STUB_INIT_STACK_FRAME(stackFrame);
- ArgList argList(&stackFrame.callFrame->registers()[stackFrame.args[0].int32()], stackFrame.args[1].int32());
- return constructArray(stackFrame.callFrame, argList);
+ return constructArray(stackFrame.callFrame, reinterpret_cast<JSValue*>(&stackFrame.callFrame->registers()[stackFrame.args[0].int32()]), stackFrame.args[1].int32());
}
DEFINE_STUB_FUNCTION(JSObject*, op_new_array_buffer)
{
STUB_INIT_STACK_FRAME(stackFrame);
- ArgList argList(stackFrame.callFrame->codeBlock()->constantBuffer(stackFrame.args[0].int32()), stackFrame.args[1].int32());
- return constructArray(stackFrame.callFrame, argList);
+ return constructArray(stackFrame.callFrame, stackFrame.callFrame->codeBlock()->constantBuffer(stackFrame.args[0].int32()), stackFrame.args[1].int32());
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve)
Modified: trunk/Source/_javascript_Core/runtime/ArgList.cpp (100515 => 100516)
--- trunk/Source/_javascript_Core/runtime/ArgList.cpp 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/runtime/ArgList.cpp 2011-11-16 23:37:15 UTC (rev 100516)
@@ -33,10 +33,12 @@
void ArgList::getSlice(int startIndex, ArgList& result) const
{
if (startIndex <= 0 || static_cast<unsigned>(startIndex) >= m_argCount) {
- result = ArgList(m_args, 0);
+ result = ArgList();
return;
}
- result = ArgList(m_args + startIndex, m_argCount - startIndex);
+
+ result.m_args = m_args + startIndex;
+ result.m_argCount = m_argCount - startIndex;
}
void MarkedArgumentBuffer::markLists(HeapRootVisitor& heapRootVisitor, ListSet& markSet)
Modified: trunk/Source/_javascript_Core/runtime/ArgList.h (100515 => 100516)
--- trunk/Source/_javascript_Core/runtime/ArgList.h 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/runtime/ArgList.h 2011-11-16 23:37:15 UTC (rev 100516)
@@ -191,19 +191,6 @@
{
}
- ArgList(JSValue* args, unsigned argCount)
- : m_args(args)
- , m_argCount(argCount)
- {
- }
-
- ArgList(Register* args, int argCount)
- : m_args(reinterpret_cast<JSValue*>(args))
- , m_argCount(argCount)
- {
- ASSERT(argCount >= 0);
- }
-
ArgList(const MarkedArgumentBuffer& args)
: m_args(reinterpret_cast<JSValue*>(const_cast<Register*>(args.begin())))
, m_argCount(args.size())
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (100515 => 100516)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2011-11-16 23:37:15 UTC (rev 100516)
@@ -236,6 +236,46 @@
Heap::heap(this)->reportExtraMemoryCost(storageSize(initialStorage));
}
+void JSArray::finishCreation(JSGlobalData& globalData, const JSValue* values, size_t length)
+{
+ Base::finishCreation(globalData);
+ ASSERT(inherits(&s_info));
+
+ unsigned initialCapacity = length;
+ unsigned initialStorage;
+
+ // If the ArgList is empty, allocate space for 3 entries. This value empirically
+ // works well for benchmarks.
+ if (!initialCapacity)
+ initialStorage = 3;
+ else
+ initialStorage = initialCapacity;
+
+ m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialStorage)));
+ m_storage->m_allocBase = m_storage;
+ m_indexBias = 0;
+ m_storage->m_length = initialCapacity;
+ m_vectorLength = initialStorage;
+ m_storage->m_numValuesInVector = initialCapacity;
+ m_storage->m_sparseValueMap = 0;
+ m_storage->subclassData = 0;
+ m_storage->reportedMapCapacity = 0;
+#if CHECK_ARRAY_CONSISTENCY
+ m_storage->m_inCompactInitialization = false;
+#endif
+
+ size_t i = 0;
+ WriteBarrier<Unknown>* vector = m_storage->m_vector;
+ for ( ; i != length; ++i)
+ vector[i].set(globalData, this, values[i]);
+ for (; i < initialStorage; i++)
+ vector[i].clear();
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(initialStorage));
+}
+
JSArray::~JSArray()
{
ASSERT(vptr() == JSGlobalData::jsArrayVPtr);
Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (100515 => 100516)
--- trunk/Source/_javascript_Core/runtime/JSArray.h 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h 2011-11-16 23:37:15 UTC (rev 100516)
@@ -66,6 +66,7 @@
void finishCreation(JSGlobalData&);
void finishCreation(JSGlobalData&, unsigned initialLength, ArrayCreationMode);
void finishCreation(JSGlobalData&, const ArgList&);
+ void finishCreation(JSGlobalData&, const JSValue*, size_t length);
public:
typedef JSNonFinalObject Base;
@@ -94,6 +95,13 @@
return array;
}
+ static JSArray* create(JSGlobalData& globalData, Structure* structure, const JSValue* values, size_t length)
+ {
+ JSArray* array = new (allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure);
+ array->finishCreation(globalData, values, length);
+ return array;
+ }
+
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (100515 => 100516)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-11-16 23:33:18 UTC (rev 100515)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-11-16 23:37:15 UTC (rev 100516)
@@ -473,6 +473,11 @@
return constructArray(exec, exec->lexicalGlobalObject(), values);
}
+ inline JSArray* constructArray(ExecState* exec, const JSValue* values, size_t length)
+ {
+ return JSArray::create(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure(), values, length);
+ }
+
class DynamicGlobalObjectScope {
WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);
public: