#include "Operations.h"
#include "Error.h"
+#include "JSCInlines.h"
#include "JSObject.h"
#include "JSString.h"
-#include <math.h>
-#include <stdio.h>
#include <wtf/MathExtras.h>
namespace JSC {
return vm.smallStrings.numberString();
if (v.isString())
return vm.smallStrings.stringString();
+ if (v.isSymbol())
+ return vm.smallStrings.symbolString();
if (v.isObject()) {
+ JSObject* object = asObject(v);
// Return "undefined" for objects that should be treated
// as null when doing comparisons.
- if (asObject(v)->structure()->masqueradesAsUndefined(globalObject))
+ if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return vm.smallStrings.undefinedString();
- CallData callData;
- JSObject* object = asObject(v);
- if (object->methodTable()->getCallData(object, callData) != CallTypeNone)
+ if (object->type() == JSFunctionType)
return vm.smallStrings.functionString();
+ if (object->inlineTypeFlags() & TypeOfShouldCallGetCallData) {
+ CallData callData;
+ JSObject* object = asObject(v);
+ if (object->methodTable(vm)->getCallData(object, callData) != CallTypeNone)
+ return vm.smallStrings.functionString();
+ }
}
return vm.smallStrings.objectString();
}
return jsTypeStringForValue(callFrame->vm(), callFrame->lexicalGlobalObject(), v);
}
-bool jsIsObjectType(CallFrame* callFrame, JSValue v)
+bool jsIsObjectTypeOrNull(CallFrame* callFrame, JSValue v)
{
if (!v.isCell())
return v.isNull();
- JSType type = v.asCell()->structure()->typeInfo().type();
- if (type == StringType)
+ JSType type = v.asCell()->type();
+ if (type == StringType || type == SymbolType)
return false;
if (type >= ObjectType) {
- if (asObject(v)->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject()))
+ if (asObject(v)->structure(callFrame->vm())->masqueradesAsUndefined(callFrame->lexicalGlobalObject()))
return false;
CallData callData;
JSObject* object = asObject(v);
- if (object->methodTable()->getCallData(object, callData) != CallTypeNone)
+ if (object->methodTable(callFrame->vm())->getCallData(object, callData) != CallTypeNone)
return false;
}
return true;