summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r--Source/JavaScriptCore/runtime/DateConstructor.cpp4
-rw-r--r--Source/JavaScriptCore/runtime/DateConversion.cpp4
-rw-r--r--Source/JavaScriptCore/runtime/DatePrototype.cpp20
-rw-r--r--Source/JavaScriptCore/runtime/JSArray.h4
-rw-r--r--Source/JavaScriptCore/runtime/JSDateMath.cpp4
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalData.h3
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalThis.cpp2
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.cpp66
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.h24
-rw-r--r--Source/JavaScriptCore/runtime/PropertyNameArray.h5
-rw-r--r--Source/JavaScriptCore/runtime/PropertyOffset.h2
-rw-r--r--Source/JavaScriptCore/runtime/Structure.h61
12 files changed, 111 insertions, 88 deletions
diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp
index 0325080f6..5984bbf97 100644
--- a/Source/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp
@@ -136,7 +136,7 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
else {
GregorianDateTime t;
int year = JSC::toInt32(doubleArguments[0]);
- t.setYear((year >= 0 && year <= 99) ? year : year - 1900);
+ t.setYear((year >= 0 && year <= 99) ? (year + 1900) : year);
t.setMonth(JSC::toInt32(doubleArguments[1]));
t.setMonthDay((numArgs >= 3) ? JSC::toInt32(doubleArguments[2]) : 1);
t.setHour(JSC::toInt32(doubleArguments[3]));
@@ -214,7 +214,7 @@ static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec)
GregorianDateTime t;
int year = JSC::toInt32(doubleArguments[0]);
- t.setYear((year >= 0 && year <= 99) ? year : year - 1900);
+ t.setYear((year >= 0 && year <= 99) ? (year + 1900) : year);
t.setMonth(JSC::toInt32(doubleArguments[1]));
t.setMonthDay((n >= 3) ? JSC::toInt32(doubleArguments[2]) : 1);
t.setHour(JSC::toInt32(doubleArguments[3]));
diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
index e8714c14c..706ffe9a2 100644
--- a/Source/JavaScriptCore/runtime/DateConversion.cpp
+++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
@@ -59,14 +59,14 @@ void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
snprintf(buffer, DateConversionBufferSize, "%s %s %02d %04d",
weekdayName[(t.weekDay() + 6) % 7],
- monthName[t.month()], t.monthDay(), t.year() + 1900);
+ monthName[t.month()], t.monthDay(), t.year());
}
void formatDateUTCVariant(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
snprintf(buffer, DateConversionBufferSize, "%s, %02d %s %04d",
weekdayName[(t.weekDay() + 6) % 7],
- t.monthDay(), monthName[t.month()], t.year() + 1900);
+ t.monthDay(), monthName[t.month()], t.year());
}
void formatTime(const GregorianDateTime &t, DateConversionBuffer& buffer)
diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp
index aa65acd05..7cbab0497 100644
--- a/Source/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp
@@ -222,7 +222,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L
#if OS(WINDOWS)
SYSTEMTIME systemTime;
memset(&systemTime, 0, sizeof(systemTime));
- systemTime.wYear = gdt.year() + 1900;
+ systemTime.wYear = gdt.year();
systemTime.wMonth = gdt.month() + 1;
systemTime.wDay = gdt.monthDay();
systemTime.wDayOfWeek = gdt.weekDay();
@@ -265,7 +265,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L
// Offset year if needed
struct tm localTM = gdt;
- int year = gdt.year() + 1900;
+ int year = gdt.year();
bool yearNeedsOffset = year < 1900 || year > 2038;
if (yearNeedsOffset)
localTM.tm_year = equivalentYearForDST(year) - 1900;
@@ -412,7 +412,7 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, int maxArgs, double *ms
if (maxArgs >= 3 && idx < numArgs) {
double years = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(years);
- t->setYear(toInt32(years - 1900));
+ t->setYear(toInt32(years));
}
// months
if (maxArgs >= 2 && idx < numArgs && ok) {
@@ -567,10 +567,10 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
int ms = static_cast<int>(fmod(thisDateObj->internalNumber(), msPerSecond));
if (ms < 0)
ms += msPerSecond;
- if (gregorianDateTime->year() > 8099 || gregorianDateTime->year() < -1900)
- snprintf(buffer, sizeof(buffer) - 1, "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms);
+ if (gregorianDateTime->year() > 9999 || gregorianDateTime->year() < 0)
+ snprintf(buffer, sizeof(buffer) - 1, "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms);
else
- snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms);
+ snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms);
buffer[sizeof(buffer) - 1] = 0;
return JSValue::encode(jsNontrivialString(exec, buffer));
}
@@ -657,7 +657,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return JSValue::encode(jsNaN());
- return JSValue::encode(jsNumber(1900 + gregorianDateTime->year()));
+ return JSValue::encode(jsNumber(gregorianDateTime->year()));
}
EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
@@ -671,7 +671,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return JSValue::encode(jsNaN());
- return JSValue::encode(jsNumber(1900 + gregorianDateTime->year()));
+ return JSValue::encode(jsNumber(gregorianDateTime->year()));
}
EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
@@ -1116,7 +1116,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
return JSValue::encode(result);
}
- gregorianDateTime.setYear(toInt32((year > 99 || year < 0) ? year - 1900 : year));
+ gregorianDateTime.setYear(toInt32((year >= 0 && year <= 99) ? (year + 1900) : year));
JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
thisDateObj->setInternalValue(exec->globalData(), result);
return JSValue::encode(result);
@@ -1135,7 +1135,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
return JSValue::encode(jsNaN());
// NOTE: IE returns the full year even in getYear.
- return JSValue::encode(jsNumber(gregorianDateTime->year()));
+ return JSValue::encode(jsNumber(gregorianDateTime->year() - 1900));
}
EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h
index 52c591324..c0b9916d1 100644
--- a/Source/JavaScriptCore/runtime/JSArray.h
+++ b/Source/JavaScriptCore/runtime/JSArray.h
@@ -287,9 +287,6 @@ namespace JSC {
static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- JS_EXPORT_PRIVATE void* subclassData() const;
- JS_EXPORT_PRIVATE void setSubclassData(void*);
-
private:
static size_t storageSize(unsigned vectorLength);
bool isLengthWritable()
@@ -304,7 +301,6 @@ namespace JSC {
void allocateSparseMap(JSGlobalData&);
void deallocateSparseMap();
- bool getOwnPropertySlotSlowCase(ExecState*, unsigned propertyName, PropertySlot&);
void putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
JS_EXPORT_PRIVATE bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp
index a7840938c..fcf1c4345 100644
--- a/Source/JavaScriptCore/runtime/JSDateMath.cpp
+++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp
@@ -203,7 +203,7 @@ double getUTCOffset(ExecState* exec)
double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC)
{
- double day = dateToDaysFrom1970(t.year() + 1900, t.month(), t.monthDay());
+ double day = dateToDaysFrom1970(t.year(), t.month(), t.monthDay());
double ms = timeToMS(t.hour(), t.minute(), t.second(), milliSeconds);
double result = (day * WTF::msPerDay) + ms;
@@ -235,7 +235,7 @@ void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, Gregori
tm.setYearDay(dayInYear(ms, year));
tm.setMonthDay(dayInMonthFromDayInYear(tm.yearDay(), isLeapYear(year)));
tm.setMonth(monthFromDayInYear(tm.yearDay(), isLeapYear(year)));
- tm.setYear(year - 1900);
+ tm.setYear(year);
tm.setIsDST(dstOff != 0.0);
tm.setUtcOffset(static_cast<long>((dstOff + utcOff) / WTF::msPerSecond));
}
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h
index 59a672f67..4604737d2 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalData.h
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.h
@@ -39,6 +39,7 @@
#include "JSValue.h"
#include "LLIntData.h"
#include "NumericStrings.h"
+#include "PrivateName.h"
#include "SmallStrings.h"
#include "Strong.h"
#include "Terminator.h"
@@ -293,6 +294,8 @@ namespace JSC {
bool canUseRegExpJIT() { return m_canUseAssembler; }
#endif
+ PrivateName m_inheritorIDKey;
+
OwnPtr<ParserArena> parserArena;
OwnPtr<Keywords> keywords;
Interpreter* interpreter;
diff --git a/Source/JavaScriptCore/runtime/JSGlobalThis.cpp b/Source/JavaScriptCore/runtime/JSGlobalThis.cpp
index abd31ac14..b2bbae5d7 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalThis.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalThis.cpp
@@ -53,7 +53,7 @@ void JSGlobalThis::setUnwrappedObject(JSGlobalData& globalData, JSGlobalObject*
ASSERT_ARG(globalObject, globalObject);
m_unwrappedObject.set(globalData, this, globalObject);
setPrototype(globalData, globalObject->prototype());
- resetInheritorID();
+ resetInheritorID(globalData);
}
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
index a84597f8b..c40c625e1 100644
--- a/Source/JavaScriptCore/runtime/JSObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -38,6 +38,7 @@
#include "Operations.h"
#include "PropertyDescriptor.h"
#include "PropertyNameArray.h"
+#include "SlotVisitorInlineMethods.h"
#include <math.h>
#include <wtf/Assertions.h>
@@ -85,6 +86,31 @@ static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* class
}
}
+ALWAYS_INLINE void JSObject::visitOutOfLineStorage(SlotVisitor& visitor, PropertyStorage storage, size_t storageSize)
+{
+ ASSERT(storage);
+ ASSERT(storageSize);
+
+ size_t capacity = structure()->outOfLineCapacity();
+ ASSERT(capacity);
+ size_t capacityInBytes = capacity * sizeof(WriteBarrierBase<Unknown>);
+ PropertyStorage baseOfStorage = storage - capacity - 1;
+ if (visitor.checkIfShouldCopyAndPinOtherwise(baseOfStorage, capacityInBytes)) {
+ PropertyStorage newBaseOfStorage = static_cast<PropertyStorage>(visitor.allocateNewSpace(capacityInBytes));
+ PropertyStorage currentTarget = newBaseOfStorage + capacity;
+ PropertyStorage newStorage = currentTarget + 1;
+ PropertyStorage currentSource = storage - 1;
+ for (size_t count = storageSize; count--;) {
+ JSValue value = (--currentSource)->get();
+ ASSERT(value);
+ visitor.appendUnbarrieredValue(&value);
+ (--currentTarget)->setWithoutWriteBarrier(value);
+ }
+ m_outOfLineStorage.set(newStorage, StorageBarrier::Unchecked);
+ } else
+ visitor.appendValues(storage - storageSize - 1, storageSize);
+}
+
void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSObject* thisObject = jsCast<JSObject*>(cell);
@@ -97,18 +123,8 @@ void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
JSCell::visitChildren(thisObject, visitor);
PropertyStorage storage = thisObject->outOfLineStorage();
- if (storage) {
- size_t storageSize = thisObject->structure()->outOfLineSizeForKnownNonFinalObject();
- size_t capacity = thisObject->structure()->outOfLineCapacity();
- // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers.
- void* temp = storage - capacity - 1;
- visitor.copyAndAppend(&temp, capacity * sizeof(WriteBarrierBase<Unknown>), (storage - storageSize - 1)->slot(), storageSize);
- storage = static_cast<PropertyStorage>(temp) + capacity + 1;
- thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked);
- }
-
- if (thisObject->m_inheritorID)
- visitor.append(&thisObject->m_inheritorID);
+ if (storage)
+ thisObject->visitOutOfLineStorage(visitor, storage, thisObject->structure()->outOfLineSizeForKnownNonFinalObject());
#if !ASSERT_DISABLED
visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
@@ -127,18 +143,8 @@ void JSFinalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
JSCell::visitChildren(thisObject, visitor);
PropertyStorage storage = thisObject->outOfLineStorage();
- if (storage) {
- size_t storageSize = thisObject->structure()->outOfLineSizeForKnownFinalObject();
- size_t capacity = thisObject->structure()->outOfLineCapacity();
- // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers.
- void* temp = storage - capacity - 1;
- visitor.copyAndAppend(&temp, thisObject->structure()->outOfLineCapacity() * sizeof(WriteBarrierBase<Unknown>), (storage - storageSize - 1)->slot(), storageSize);
- storage = static_cast<PropertyStorage>(temp) + capacity + 1;
- thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked);
- }
-
- if (thisObject->m_inheritorID)
- visitor.append(&thisObject->m_inheritorID);
+ if (storage)
+ thisObject->visitOutOfLineStorage(visitor, storage, thisObject->structure()->outOfLineSizeForKnownFinalObject());
size_t storageSize = thisObject->structure()->inlineSizeForKnownFinalObject();
visitor.appendValues(thisObject->inlineStorage(), storageSize);
@@ -580,15 +586,21 @@ NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarr
Structure* JSObject::createInheritorID(JSGlobalData& globalData)
{
+ ASSERT(!getDirectLocation(globalData, globalData.m_inheritorIDKey));
+
JSGlobalObject* globalObject;
if (isGlobalThis())
globalObject = static_cast<JSGlobalThis*>(this)->unwrappedObject();
else
globalObject = structure()->globalObject();
ASSERT(globalObject);
- m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, globalObject, this));
- ASSERT(m_inheritorID->isEmpty());
- return m_inheritorID.get();
+
+ Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject, this);
+ ASSERT(inheritorID->isEmpty());
+
+ PutPropertySlot slot;
+ putDirectInternal<PutModeDefineOwnProperty>(globalData, globalData.m_inheritorIDKey, inheritorID, DontEnum, slot, 0);
+ return inheritorID;
}
PropertyStorage JSObject::growOutOfLineStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize)
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
index cc43440ab..82da5eef9 100644
--- a/Source/JavaScriptCore/runtime/JSObject.h
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -272,7 +272,6 @@ namespace JSC {
JS_EXPORT_PRIVATE PropertyStorage growOutOfLineStorage(JSGlobalData&, size_t oldSize, size_t newSize);
void setOutOfLineStorage(JSGlobalData&, PropertyStorage, Structure*);
- bool reallocateStorageIfNecessary(JSGlobalData&, unsigned oldCapacity, Structure*);
void setStructureAndReallocateStorageIfNecessary(JSGlobalData&, unsigned oldCapacity, Structure*);
void setStructureAndReallocateStorageIfNecessary(JSGlobalData&, Structure*);
@@ -295,7 +294,6 @@ namespace JSC {
static size_t offsetOfInlineStorage();
static size_t offsetOfOutOfLineStorage();
- static size_t offsetOfInheritorID();
static JS_EXPORTDATA const ClassInfo s_info;
@@ -322,10 +320,12 @@ namespace JSC {
// To create derived types you likely want JSNonFinalObject, below.
JSObject(JSGlobalData&, Structure*);
- void resetInheritorID()
+ void resetInheritorID(JSGlobalData& globalData)
{
- m_inheritorID.clear();
+ removeDirect(globalData, globalData.m_inheritorIDKey);
}
+
+ void visitOutOfLineStorage(SlotVisitor&, PropertyStorage, size_t storageSize);
private:
friend class LLIntOffsetsExtractor;
@@ -348,7 +348,9 @@ namespace JSC {
Structure* createInheritorID(JSGlobalData&);
StorageBarrier m_outOfLineStorage;
- WriteBarrier<Structure> m_inheritorID;
+#if USE(JSVALUE32_64)
+ void* m_padding;
+#endif
};
@@ -461,11 +463,6 @@ inline size_t JSObject::offsetOfOutOfLineStorage()
return OBJECT_OFFSETOF(JSObject, m_outOfLineStorage);
}
-inline size_t JSObject::offsetOfInheritorID()
-{
- return OBJECT_OFFSETOF(JSObject, m_inheritorID);
-}
-
inline bool JSObject::isGlobalObject() const
{
return structure()->typeInfo().type() == GlobalObjectType;
@@ -564,9 +561,10 @@ inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype)
inline Structure* JSObject::inheritorID(JSGlobalData& globalData)
{
- if (m_inheritorID) {
- ASSERT(m_inheritorID->isEmpty());
- return m_inheritorID.get();
+ if (WriteBarrierBase<Unknown>* location = getDirectLocation(globalData, globalData.m_inheritorIDKey)) {
+ Structure* inheritorID = jsCast<Structure*>(location->get());
+ ASSERT(inheritorID->isEmpty());
+ return inheritorID;
}
return createInheritorID(globalData);
}
diff --git a/Source/JavaScriptCore/runtime/PropertyNameArray.h b/Source/JavaScriptCore/runtime/PropertyNameArray.h
index dabda945b..89b1af00b 100644
--- a/Source/JavaScriptCore/runtime/PropertyNameArray.h
+++ b/Source/JavaScriptCore/runtime/PropertyNameArray.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008, 2012 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -55,14 +55,12 @@ namespace JSC {
PropertyNameArray(JSGlobalData* globalData)
: m_data(PropertyNameArrayData::create())
, m_globalData(globalData)
- , m_shouldCache(true)
{
}
PropertyNameArray(ExecState* exec)
: m_data(PropertyNameArrayData::create())
, m_globalData(&exec->globalData())
- , m_shouldCache(true)
{
}
@@ -91,7 +89,6 @@ namespace JSC {
RefPtr<PropertyNameArrayData> m_data;
IdentifierSet m_set;
JSGlobalData* m_globalData;
- bool m_shouldCache;
};
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/PropertyOffset.h b/Source/JavaScriptCore/runtime/PropertyOffset.h
index 3883d910f..511c5e334 100644
--- a/Source/JavaScriptCore/runtime/PropertyOffset.h
+++ b/Source/JavaScriptCore/runtime/PropertyOffset.h
@@ -36,7 +36,7 @@ namespace JSC {
#if USE(JSVALUE32_64)
#define INLINE_STORAGE_CAPACITY 6
#else
-#define INLINE_STORAGE_CAPACITY 4
+#define INLINE_STORAGE_CAPACITY 5
#endif
typedef int PropertyOffset;
diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h
index 712ea6bb5..8e41781e2 100644
--- a/Source/JavaScriptCore/runtime/Structure.h
+++ b/Source/JavaScriptCore/runtime/Structure.h
@@ -68,14 +68,7 @@ namespace JSC {
typedef JSCell Base;
- static Structure* create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo)
- {
- ASSERT(globalData.structureStructure);
- ASSERT(classInfo);
- Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo);
- structure->finishCreation(globalData);
- return structure;
- }
+ static Structure* create(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*);
protected:
void finishCreation(JSGlobalData& globalData)
@@ -330,13 +323,7 @@ namespace JSC {
return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::typeOffset();
}
- static Structure* createStructure(JSGlobalData& globalData)
- {
- ASSERT(!globalData.structureStructure);
- Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData);
- structure->finishCreation(globalData, CreatingEarlyCell);
- return structure;
- }
+ static Structure* createStructure(JSGlobalData&);
bool transitionWatchpointSetHasBeenInvalidated() const
{
@@ -368,13 +355,7 @@ namespace JSC {
Structure(JSGlobalData&);
Structure(JSGlobalData&, const Structure*);
- static Structure* create(JSGlobalData& globalData, const Structure* structure)
- {
- ASSERT(globalData.structureStructure);
- Structure* newStructure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, structure);
- newStructure->finishCreation(globalData);
- return newStructure;
- }
+ static Structure* create(JSGlobalData&, const Structure*);
typedef enum {
NoneDictionaryKind = 0,
@@ -461,6 +442,42 @@ namespace JSC {
unsigned m_staticFunctionReified;
};
+ template <> inline void* allocateCell<Structure>(Heap& heap)
+ {
+#if ENABLE(GC_VALIDATION)
+ ASSERT(!heap.globalData()->isInitializingObject());
+ heap.globalData()->setInitializingObjectClass(&Structure::s_info);
+#endif
+ JSCell* result = static_cast<JSCell*>(heap.allocateStructure());
+ result->clearStructure();
+ return result;
+ }
+
+ inline Structure* Structure::create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo)
+ {
+ ASSERT(globalData.structureStructure);
+ ASSERT(classInfo);
+ Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo);
+ structure->finishCreation(globalData);
+ return structure;
+ }
+
+ inline Structure* Structure::createStructure(JSGlobalData& globalData)
+ {
+ ASSERT(!globalData.structureStructure);
+ Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData);
+ structure->finishCreation(globalData, CreatingEarlyCell);
+ return structure;
+ }
+
+ inline Structure* Structure::create(JSGlobalData& globalData, const Structure* structure)
+ {
+ ASSERT(globalData.structureStructure);
+ Structure* newStructure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, structure);
+ newStructure->finishCreation(globalData);
+ return newStructure;
+ }
+
inline PropertyOffset Structure::get(JSGlobalData& globalData, PropertyName propertyName)
{
ASSERT(structure()->classInfo() == &s_info);