Commit acea358b authored by ggaren@apple.com's avatar ggaren@apple.com

JavaScriptCore:

2009-05-02  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Sam Weinig.

        Simplified null-ish JSValues.
        
        Replaced calls to noValue() with calls to JSValue() (which is what
        noValue() returned). Removed noValue().
        
        Replaced almost all uses of jsImpossibleValue() with uses of JSValue().
        Its one remaining use is for construction of hash table deleted values.
        For that specific task, I made a new, private constructor with a special
        tag. Removed jsImpossibleValue().
        
        Removed "JSValue()" initialiazers, since default construction happens...
        by default.

        * API/JSCallbackObjectFunctions.h:
        (JSC::::call):
        * bytecompiler/BytecodeGenerator.cpp:
        (JSC::BytecodeGenerator::emitLoad):
        * bytecompiler/BytecodeGenerator.h:
        * debugger/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::evaluate):
        * debugger/DebuggerCallFrame.h:
        (JSC::DebuggerCallFrame::DebuggerCallFrame):
        * interpreter/CallFrame.h:
        (JSC::ExecState::clearException):
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::privateExecute):
        (JSC::Interpreter::retrieveLastCaller):
        * interpreter/Register.h:
        (JSC::Register::Register):
        * jit/JITCall.cpp:
        (JSC::JIT::unlinkCall):
        (JSC::JIT::compileOpCallInitializeCallFrame):
        (JSC::JIT::compileOpCall):
        * jit/JITStubs.cpp:
        (JSC::JITStubs::cti_op_call_eval):
        (JSC::JITStubs::cti_vm_throw):
        * profiler/Profiler.cpp:
        (JSC::Profiler::willExecute):
        (JSC::Profiler::didExecute):
        * runtime/ArrayPrototype.cpp:
        (JSC::getProperty):
        * runtime/Completion.cpp:
        (JSC::evaluate):
        * runtime/Completion.h:
        (JSC::Completion::Completion):
        * runtime/GetterSetter.cpp:
        (JSC::GetterSetter::getPrimitiveNumber):
        * runtime/JSArray.cpp:
        (JSC::JSArray::putSlowCase):
        (JSC::JSArray::deleteProperty):
        (JSC::JSArray::increaseVectorLength):
        (JSC::JSArray::setLength):
        (JSC::JSArray::pop):
        (JSC::JSArray::sort):
        (JSC::JSArray::compactForSorting):
        * runtime/JSCell.cpp:
        (JSC::JSCell::getJSNumber):
        * runtime/JSCell.h:
        (JSC::JSValue::getJSNumber):
        * runtime/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData):
        * runtime/JSImmediate.h:
        (JSC::JSImmediate::fromNumberOutsideIntegerRange):
        (JSC::JSImmediate::from):
        * runtime/JSNumberCell.cpp:
        (JSC::jsNumberCell):
        * runtime/JSObject.cpp:
        (JSC::callDefaultValueFunction):
        * runtime/JSObject.h:
        (JSC::JSObject::getDirect):
        * runtime/JSPropertyNameIterator.cpp:
        (JSC::JSPropertyNameIterator::toPrimitive):
        * runtime/JSPropertyNameIterator.h:
        (JSC::JSPropertyNameIterator::next):
        * runtime/JSValue.h:
        (JSC::JSValue::):
        (JSC::JSValueHashTraits::constructDeletedValue):
        (JSC::JSValueHashTraits::isDeletedValue):
        (JSC::JSValue::JSValue):
        * runtime/JSWrapperObject.h:
        (JSC::JSWrapperObject::JSWrapperObject):
        * runtime/Operations.h:
        (JSC::resolveBase):
        * runtime/PropertySlot.h:
        (JSC::PropertySlot::clearBase):
        (JSC::PropertySlot::clearValue):

WebCore:

2009-05-02  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Sam Weinig.

        Simplified null-ish JSValues.
        
        Replaced calls to noValue() with calls to JSValue() (which is what
        noValue() returned). Removed noValue().
        
        Removed "JSValue()" initialiazers, since default construction happens...
        by default.

        * bindings/js/JSDOMBinding.cpp:
        (WebCore::setDOMException):
        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::open):
        (WebCore::JSDOMWindow::showModalDialog):
        * bindings/js/JSEventListener.cpp:
        (WebCore::JSEventListener::handleEvent):
        * bindings/js/JSJavaScriptCallFrameCustom.cpp:
        (WebCore::JSJavaScriptCallFrame::evaluate):
        * bindings/js/JSSQLResultSetRowListCustom.cpp:
        (WebCore::JSSQLResultSetRowList::item):
        * bindings/js/ScriptController.cpp:
        (WebCore::ScriptController::evaluate):
        * bindings/js/ScriptValue.h:
        (WebCore::ScriptValue::ScriptValue):
        (WebCore::ScriptValue::hasNoValue):
        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::evaluate):
        * bridge/jni/jni_instance.cpp:
        (JavaInstance::invokeMethod):
        * bridge/jni/jni_runtime.cpp:
        (JavaField::dispatchValueFromInstance):
        (JavaField::dispatchSetValueToInstance):
        * bridge/runtime.h:
        (JSC::Bindings::Instance::invokeConstruct):

WebKit/mac:

2009-05-02  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Sam Weinig.

        Simplified null-ish JSValues.
        
        Replaced calls to noValue() with calls to JSValue() (which is what
        noValue() returned). Removed noValue().
        
        Removed "JSValue()" initialiazers, since default construction happens...
        by default.

        * WebView/WebScriptDebugDelegate.mm:
        (-[WebScriptCallFrame evaluateWebScript:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 74a2cd2f
......@@ -347,7 +347,7 @@ JSValue JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject,
}
ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
return noValue();
return JSValue();
}
template <class Base>
......
2009-05-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Simplified null-ish JSValues.
Replaced calls to noValue() with calls to JSValue() (which is what
noValue() returned). Removed noValue().
Replaced almost all uses of jsImpossibleValue() with uses of JSValue().
Its one remaining use is for construction of hash table deleted values.
For that specific task, I made a new, private constructor with a special
tag. Removed jsImpossibleValue().
Removed "JSValue()" initialiazers, since default construction happens...
by default.
* API/JSCallbackObjectFunctions.h:
(JSC::::call):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitLoad):
* bytecompiler/BytecodeGenerator.h:
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* debugger/DebuggerCallFrame.h:
(JSC::DebuggerCallFrame::DebuggerCallFrame):
* interpreter/CallFrame.h:
(JSC::ExecState::clearException):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
(JSC::Interpreter::retrieveLastCaller):
* interpreter/Register.h:
(JSC::Register::Register):
* jit/JITCall.cpp:
(JSC::JIT::unlinkCall):
(JSC::JIT::compileOpCallInitializeCallFrame):
(JSC::JIT::compileOpCall):
* jit/JITStubs.cpp:
(JSC::JITStubs::cti_op_call_eval):
(JSC::JITStubs::cti_vm_throw):
* profiler/Profiler.cpp:
(JSC::Profiler::willExecute):
(JSC::Profiler::didExecute):
* runtime/ArrayPrototype.cpp:
(JSC::getProperty):
* runtime/Completion.cpp:
(JSC::evaluate):
* runtime/Completion.h:
(JSC::Completion::Completion):
* runtime/GetterSetter.cpp:
(JSC::GetterSetter::getPrimitiveNumber):
* runtime/JSArray.cpp:
(JSC::JSArray::putSlowCase):
(JSC::JSArray::deleteProperty):
(JSC::JSArray::increaseVectorLength):
(JSC::JSArray::setLength):
(JSC::JSArray::pop):
(JSC::JSArray::sort):
(JSC::JSArray::compactForSorting):
* runtime/JSCell.cpp:
(JSC::JSCell::getJSNumber):
* runtime/JSCell.h:
(JSC::JSValue::getJSNumber):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSImmediate.h:
(JSC::JSImmediate::fromNumberOutsideIntegerRange):
(JSC::JSImmediate::from):
* runtime/JSNumberCell.cpp:
(JSC::jsNumberCell):
* runtime/JSObject.cpp:
(JSC::callDefaultValueFunction):
* runtime/JSObject.h:
(JSC::JSObject::getDirect):
* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::toPrimitive):
* runtime/JSPropertyNameIterator.h:
(JSC::JSPropertyNameIterator::next):
* runtime/JSValue.h:
(JSC::JSValue::):
(JSC::JSValueHashTraits::constructDeletedValue):
(JSC::JSValueHashTraits::isDeletedValue):
(JSC::JSValue::JSValue):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::JSWrapperObject):
* runtime/Operations.h:
(JSC::resolveBase):
* runtime/PropertySlot.h:
(JSC::PropertySlot::clearBase):
(JSC::PropertySlot::clearValue):
2009-05-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Cameron Zwarich.
......@@ -911,7 +911,7 @@ RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, double number)
// Later we can do the extra work to handle that like the other cases.
if (number == HashTraits<double>::emptyValue() || HashTraits<double>::isDeletedValue(number))
return emitLoad(dst, jsNumber(globalData(), number));
JSValue& valueInMap = m_numberMap.add(number, noValue()).first->second;
JSValue& valueInMap = m_numberMap.add(number, JSValue()).first->second;
if (!valueInMap)
valueInMap = jsNumber(globalData(), number);
return emitLoad(dst, valueInMap);
......
......@@ -350,11 +350,6 @@ namespace JSC {
PassRefPtr<Label> emitComplexJumpScopes(Label* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
struct JSValueHashTraits : HashTraits<EncodedJSValue> {
static void constructDeletedValue(EncodedJSValue& slot) { slot = JSValue::encode(jsImpossibleValue()); }
static bool isDeletedValue(EncodedJSValue value) { return value == JSValue::encode(jsImpossibleValue()); }
};
typedef HashMap<EncodedJSValue, unsigned, PtrHash<EncodedJSValue>, JSValueHashTraits> JSValueMap;
struct IdentifierMapIndexHashTraits {
......
......@@ -66,7 +66,7 @@ JSObject* DebuggerCallFrame::thisObject() const
JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const
{
if (!m_callFrame->codeBlock())
return noValue();
return JSValue();
int errLine;
UString errMsg;
......
......@@ -39,7 +39,6 @@ namespace JSC {
DebuggerCallFrame(CallFrame* callFrame)
: m_callFrame(callFrame)
, m_exception(noValue())
{
}
......
......@@ -74,7 +74,7 @@ namespace JSC {
// But they're used in many places in legacy code, so they're not going away any time soon.
void setException(JSValue exception) { globalData().exception = exception; }
void clearException() { globalData().exception = noValue(); }
void clearException() { globalData().exception = JSValue(); }
JSValue exception() const { return globalData().exception; }
JSValue* exceptionSlot() { return &globalData().exception; }
bool hadException() const { return globalData().exception; }
......
......@@ -1094,7 +1094,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#undef ADD_OPCODE_ID
ASSERT(m_opcodeIDTable.size() == numOpcodeIDs);
#endif // HAVE(COMPUTED_GOTO)
return noValue();
return JSValue();
}
#if ENABLE(JIT)
......@@ -1103,7 +1103,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#endif
JSGlobalData* globalData = &callFrame->globalData();
JSValue exceptionValue = noValue();
JSValue exceptionValue;
HandlerInfo* handler = 0;
Instruction* vPC = callFrame->codeBlock()->instructions().begin();
......@@ -1112,7 +1112,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#define CHECK_FOR_EXCEPTION() \
do { \
if (UNLIKELY(globalData->exception != noValue())) { \
if (UNLIKELY(globalData->exception != JSValue())) { \
exceptionValue = globalData->exception; \
goto vm_throw; \
} \
......@@ -3567,7 +3567,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT(!globalData->exception);
int ex = (++vPC)->u.operand;
callFrame[ex] = exceptionValue;
exceptionValue = noValue();
exceptionValue = JSValue();
++vPC;
NEXT_INSTRUCTION();
......@@ -3756,7 +3756,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
NEXT_INSTRUCTION();
}
vm_throw: {
globalData->exception = noValue();
globalData->exception = JSValue();
if (!tickCount) {
// The exceptionValue is a lie! (GCC produces bad code for reasons I
// cannot fathom if we don't assign to the exceptionValue before branching)
......@@ -3824,7 +3824,7 @@ JSValue Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* func
void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const
{
function = noValue();
function = JSValue();
lineNumber = -1;
sourceURL = UString();
......
......@@ -105,7 +105,7 @@ namespace JSC {
ALWAYS_INLINE Register::Register()
{
#ifndef NDEBUG
u.value = JSValue::encode(noValue());
u.value = JSValue::encode(JSValue());
#endif
}
......
......@@ -49,7 +49,7 @@ void JIT::unlinkCall(CallLinkInfo* callLinkInfo)
// When the JSFunction is deleted the pointer embedded in the instruction stream will no longer be valid
// (and, if a new JSFunction happened to be constructed at the same location, we could get a false positive
// match). Reset the check so it no longer matches.
callLinkInfo->hotPathBegin.repatch(JSValue::encode(jsImpossibleValue()));
callLinkInfo->hotPathBegin.repatch(JSValue::encode(JSValue()));
}
//void JIT::linkCall(JSFunction* , CodeBlock* , JITCode , CallLinkInfo* callLinkInfo, int )
......@@ -75,7 +75,7 @@ void JIT::compileOpCallInitializeCallFrame()
loadPtr(Address(regT2, FIELD_OFFSET(JSFunction, m_scopeChain) + FIELD_OFFSET(ScopeChain, m_node)), regT1); // newScopeChain
storePtr(ImmPtr(JSValue::encode(noValue())), Address(callFrameRegister, RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register))));
storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register))));
storePtr(regT2, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
}
......@@ -144,7 +144,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
compileOpCallEvalSetupArgs(instruction);
emitCTICall(JITStubs::cti_op_call_eval);
wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsImpossibleValue())));
wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue())));
}
emitGetVirtualRegister(callee, regT2);
......@@ -212,14 +212,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
compileOpCallEvalSetupArgs(instruction);
emitCTICall(JITStubs::cti_op_call_eval);
wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsImpossibleValue())));
wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue())));
}
// This plants a check for a cached JSFunction value, so we can plant a fast link to the callee.
// This deliberately leaves the callee in ecx, used when setting up the stack frame below
emitGetVirtualRegister(callee, regT2);
DataLabelPtr addressOfLinkedFunctionCheck;
Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT2, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(jsImpossibleValue())));
Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT2, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue())));
addSlowCase(jumpToSlow);
ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
......@@ -240,7 +240,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// Fast version of stack frame initialization, directly relative to edi.
// Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
storePtr(ImmPtr(JSValue::encode(noValue())), Address(callFrameRegister, (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register))));
storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register))));
storePtr(regT2, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
loadPtr(Address(regT2, FIELD_OFFSET(JSFunction, m_scopeChain) + FIELD_OFFSET(ScopeChain, m_node)), regT1); // newScopeChain
store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
......
......@@ -298,17 +298,17 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
#define CHECK_FOR_EXCEPTION() \
do { \
if (UNLIKELY(ARG_globalData->exception != noValue())) \
if (UNLIKELY(ARG_globalData->exception != JSValue())) \
VM_THROW_EXCEPTION(); \
} while (0)
#define CHECK_FOR_EXCEPTION_AT_END() \
do { \
if (UNLIKELY(ARG_globalData->exception != noValue())) \
if (UNLIKELY(ARG_globalData->exception != JSValue())) \
VM_THROW_EXCEPTION_AT_END(); \
} while (0)
#define CHECK_FOR_EXCEPTION_VOID() \
do { \
if (UNLIKELY(ARG_globalData->exception != noValue())) { \
if (UNLIKELY(ARG_globalData->exception != JSValue())) { \
VM_THROW_EXCEPTION_AT_END(); \
return; \
} \
......@@ -1894,16 +1894,16 @@ EncodedJSValue JITStubs::cti_op_call_eval(STUB_ARGS)
JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject();
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
JSValue exceptionValue = noValue();
JSValue exceptionValue;
JSValue result = interpreter->callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
if (UNLIKELY(exceptionValue != noValue())) {
if (UNLIKELY(exceptionValue != JSValue())) {
ARG_globalData->exception = exceptionValue;
VM_THROW_EXCEPTION_AT_END();
}
return JSValue::encode(result);
}
return JSValue::encode(jsImpossibleValue());
return JSValue::encode(JSValue());
}
EncodedJSValue JITStubs::cti_op_throw(STUB_ARGS)
......@@ -2258,7 +2258,7 @@ EncodedJSValue JITStubs::cti_vm_throw(STUB_ARGS)
JSValue exceptionValue = globalData->exception;
ASSERT(exceptionValue);
globalData->exception = noValue();
globalData->exception = JSValue();
HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex, false);
......
......@@ -114,7 +114,7 @@ void Profiler::willExecute(ExecState* exec, const UString& sourceURL, int starti
{
ASSERT(!m_currentProfiles.isEmpty());
CallIdentifier callIdentifier = createCallIdentifier(&exec->globalData(), noValue(), sourceURL, startingLineNumber);
CallIdentifier callIdentifier = createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber);
dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, exec->lexicalGlobalObject()->profileGroup());
}
......@@ -130,7 +130,7 @@ void Profiler::didExecute(ExecState* exec, const UString& sourceURL, int startin
{
ASSERT(!m_currentProfiles.isEmpty());
dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), noValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
}
CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue function, const UString& defaultSourceURL, int defaultLineNumber)
......
......@@ -131,7 +131,7 @@ static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index)
{
PropertySlot slot(obj);
if (!obj->getPropertySlot(exec, index, slot))
return noValue();
return JSValue();
return slot.getValue(exec, index);
}
......
......@@ -63,7 +63,7 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s
JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSValue exception = noValue();
JSValue exception;
JSValue result = exec->interpreter()->execute(programNode.get(), exec, scopeChain.node(), thisObj, &exception);
if (exception) {
......
......@@ -39,7 +39,7 @@ namespace JSC {
*/
class Completion {
public:
Completion(ComplType type = Normal, JSValue value = noValue())
Completion(ComplType type = Normal, JSValue value = JSValue())
: m_type(type)
, m_value(value)
{
......@@ -56,7 +56,7 @@ namespace JSC {
};
Completion checkSyntax(ExecState*, const SourceCode&);
Completion evaluate(ExecState*, ScopeChain&, const SourceCode&, JSValue thisValue = noValue());
Completion evaluate(ExecState*, ScopeChain&, const SourceCode&, JSValue thisValue = JSValue());
} // namespace JSC
......
......@@ -48,7 +48,7 @@ bool GetterSetter::getPrimitiveNumber(ExecState*, double& number, JSValue& value
{
ASSERT_NOT_REACHED();
number = 0;
value = noValue();
value = JSValue();
return true;
}
......
......@@ -355,12 +355,12 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
if (newNumValuesInVector == storage->m_numValuesInVector + 1) {
for (unsigned j = vectorLength; j < newVectorLength; ++j)
storage->m_vector[j] = noValue();
storage->m_vector[j] = JSValue();
if (i > MIN_SPARSE_ARRAY_INDEX)
map->remove(i);
} else {
for (unsigned j = vectorLength; j < max(vectorLength, MIN_SPARSE_ARRAY_INDEX); ++j)
storage->m_vector[j] = noValue();
storage->m_vector[j] = JSValue();
for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
storage->m_vector[j] = map->take(j);
}
......@@ -400,7 +400,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
checkConsistency();
return false;
}
valueSlot = noValue();
valueSlot = JSValue();
--storage->m_numValuesInVector;
if (m_fastAccessCutoff > i)
m_fastAccessCutoff = i;
......@@ -470,7 +470,7 @@ bool JSArray::increaseVectorLength(unsigned newLength)
storage->m_vectorLength = newVectorLength;
for (unsigned i = vectorLength; i < newVectorLength; ++i)
storage->m_vector[i] = noValue();
storage->m_vector[i] = JSValue();
m_storage = storage;
return true;
......@@ -492,7 +492,7 @@ void JSArray::setLength(unsigned newLength)
for (unsigned i = newLength; i < usedVectorLength; ++i) {
JSValue& valueSlot = storage->m_vector[i];
bool hadValue = valueSlot;
valueSlot = noValue();
valueSlot = JSValue();
storage->m_numValuesInVector -= hadValue;
}
......@@ -531,13 +531,13 @@ JSValue JSArray::pop()
JSValue& valueSlot = m_storage->m_vector[length];
result = valueSlot;
ASSERT(result);
valueSlot = noValue();
valueSlot = JSValue();
--m_storage->m_numValuesInVector;
m_fastAccessCutoff = length;
} else if (length < m_storage->m_vectorLength) {
JSValue& valueSlot = m_storage->m_vector[length];
result = valueSlot;
valueSlot = noValue();
valueSlot = JSValue();
if (result)
--m_storage->m_numValuesInVector;
else
......@@ -906,7 +906,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
// Ensure that unused values in the vector are zeroed out.
for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
m_storage->m_vector[i] = noValue();
m_storage->m_vector[i] = JSValue();
m_fastAccessCutoff = newUsedVectorLength;
m_storage->m_numValuesInVector = newUsedVectorLength;
......@@ -986,7 +986,7 @@ unsigned JSArray::compactForSorting()
for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
storage->m_vector[i] = jsUndefined();
for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
storage->m_vector[i] = noValue();
storage->m_vector[i] = JSValue();
m_fastAccessCutoff = newUsedVectorLength;
storage->m_numValuesInVector = newUsedVectorLength;
......
......@@ -199,7 +199,7 @@ const ClassInfo* JSCell::classInfo() const
JSValue JSCell::getJSNumber()
{
return noValue();
return JSValue();
}
bool JSCell::isGetterSetter() const
......
......@@ -292,7 +292,7 @@ namespace JSC {
inline JSValue JSValue::getJSNumber()
{
return JSImmediate::isNumber(asValue()) ? asValue() : JSImmediate::isImmediate(asValue()) ? noValue() : asCell()->getJSNumber();
return JSImmediate::isNumber(asValue()) ? asValue() : JSImmediate::isImmediate(asValue()) ? JSValue() : asCell()->getJSNumber();
}
} // namespace JSC
......
......@@ -132,7 +132,6 @@ JSGlobalData::JSGlobalData(bool isShared, const VPtrSet& vptrSet)
, jitStubs(this)
#endif
, heap(this)
, exception(noValue())
, initializingLazyNumericCompareFunction(false)
, newParserObjects(0)
, parserObjectExtraRefCounts(0)
......
......@@ -283,8 +283,6 @@ namespace JSC {
static JSValue zeroImmediate();
static JSValue oneImmediate();
static JSValue impossibleValue();
static JSObject* prototype(JSValue, ExecState*);
private:
......@@ -376,9 +374,6 @@ namespace JSC {
ALWAYS_INLINE JSValue JSImmediate::zeroImmediate() { return makeInt(0); }
ALWAYS_INLINE JSValue JSImmediate::oneImmediate() { return makeInt(1); }
// This value is impossible because 0x4 is not a valid pointer but a tag of 0 would indicate non-immediate
ALWAYS_INLINE JSValue JSImmediate::impossibleValue() { return makeValue(0x4); }
#if USE(ALTERNATE_JSIMMEDIATE)
inline bool doubleToBoolean(double value)
{
......@@ -416,7 +411,7 @@ namespace JSC {
template<typename T>
inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T)
{
return noValue();
return JSValue();
}
#endif
......@@ -478,7 +473,7 @@ namespace JSC {
ALWAYS_INLINE JSValue JSImmediate::from(long long i)
{
if ((i < minImmediateInt) | (i > maxImmediateInt))
return noValue();
return JSValue();
return makeInt(static_cast<intptr_t>(i));
}
......@@ -552,11 +547,6 @@ namespace JSC {
int32_t toInt32SlowCase(double, bool& ok);
uint32_t toUInt32SlowCase(double, bool& ok);
inline JSValue::JSValue(ImpossibleValueTag)
{
*this = JSImmediate::impossibleValue();
}
inline JSValue::JSValue(JSNullTag)
{
*this = JSImmediate::nullImmediate();
......
......@@ -118,7 +118,7 @@ JSValue jsNumberCell(JSGlobalData* globalData, double d)
JSValue jsNumberCell(ExecState*, double)
{
ASSERT_NOT_REACHED();
return noValue();
return JSValue();
}
#endif
......
......@@ -244,7 +244,7 @@ static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSO
if (exec->hadException())
return exec->exception();
if (result.isObject())
return noValue();
return JSValue();
return result;
}
......
......@@ -125,7 +125,7 @@ namespace JSC {
JSValue getDirect(const Identifier& propertyName) const
{
size_t offset = m_structure->get(propertyName);
return offset != WTF::notFound ? m_propertyStorage[offset] : noValue();
return offset != WTF::notFound ? m_propertyStorage[offset] : JSValue();
}
JSValue* getDirectLocation(const Identifier& propertyName)
......
......@@ -40,7 +40,7 @@ JSPropertyNameIterator::~JSPropertyNameIterator()
JSValue JSPropertyNameIterator::toPrimitive(ExecState*, PreferredPrimitiveType) const
{
ASSERT_NOT_REACHED();
return noValue();
return JSValue();
}
bool JSPropertyNameIterator::getPrimitiveNumber(ExecState*, double&, JSValue&)
......
......@@ -97,7 +97,7 @@ inline JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, J
inline JSValue JSPropertyNameIterator::next(ExecState* exec)
{
if (m_position == m_end)
return noValue();
return JSValue();
if (m_data->cachedStructure() == m_object->structure() && m_data->cachedPrototypeChain() == m_object->structure()->prototypeChain(exec))
return jsOwnedString(exec, (*m_position++).ustring());
......@@ -108,7 +108,7 @@ inline JSValue JSPropertyNameIterator::next(ExecState* exec)
m_position++;
} while (m_position != m_end);
return noValue();
return JSValue();
}
} // namespace JSC
......
......@@ -28,6 +28,7 @@
#include "CallData.h"
#include "ConstructData.h"
#include <wtf/HashTraits.h>
#include <wtf/AlwaysInline.h>
namespace JSC {
......@@ -51,6 +52,7 @@ namespace JSC {
class JSValue {
friend class JSImmediate;
friend struct JSValueHashTraits;
static JSValue makeImmediate(intptr_t value)
{
......@@ -63,7 +65,6 @@ namespace JSC {
}
public:
enum ImpossibleValueTag { ImpossibleValue };
enum JSNullTag { JSNull };
enum JSUndefinedTag { JSUndefined };
enum JSTrueTag { JSTrue };
......@@ -73,7 +74,6 @@ namespace JSC {
static JSValue decode(EncodedJSValue ptr);
JSValue();
JSValue(ImpossibleValueTag);
JSValue(JSNullTag);
JSValue(JSUndefinedTag);
JSValue(JSTrueTag);
......@@ -200,12 +200,15 @@ namespace JSC {
static bool strictEqualSlowCase(JSValue v1, JSValue v2);
static bool strictEqualSlowCaseInline(JSValue v1, JSValue v2);
JSValue getJSNumber(); // noValue() if this is not a JSNumber or number object
JSValue getJSNumber(); // JSValue() if this is not a JSNumber or number object
bool isCell() const;
JSCell* asCell() const;
private:
enum HashTableDeletedValueTag { HashTableDeletedValue };
JSValue(HashTableDeletedValueTag);
inline const JSValue asValue() const { return *this; }
bool isDoubleNumber() const;
......@@ -214,17 +217,12 @@ namespace JSC {
JSCell* m_ptr;
};
// Stand-alone helper functions.
inline JSValue noValue()
{
return JSValue();
}
inline JSValue jsImpossibleValue()
{
return JSValue(JSValue::ImpossibleValue);
}
struct JSValueHashTraits : HashTraits<EncodedJSValue> {
static void constructDeletedValue(EncodedJSValue& slot) { slot = JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
static bool isDeletedValue(EncodedJSValue value) { return value == JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
};
// Stand-alone helper functions.
inline JSValue jsNull()