From 6882a04fb36642862b11efe514251d32070c3d65 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Thu, 25 Aug 2016 19:20:41 +0300 Subject: Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443) Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev --- Source/JavaScriptCore/runtime/Operations.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'Source/JavaScriptCore/runtime/Operations.cpp') diff --git a/Source/JavaScriptCore/runtime/Operations.cpp b/Source/JavaScriptCore/runtime/Operations.cpp index d6cc0ff57..5732cfd0c 100644 --- a/Source/JavaScriptCore/runtime/Operations.cpp +++ b/Source/JavaScriptCore/runtime/Operations.cpp @@ -23,10 +23,9 @@ #include "Operations.h" #include "Error.h" +#include "JSCInlines.h" #include "JSObject.h" #include "JSString.h" -#include -#include #include namespace JSC { @@ -66,15 +65,22 @@ JSValue jsTypeStringForValue(VM& vm, JSGlobalObject* globalObject, JSValue v) 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(); } @@ -84,20 +90,20 @@ JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v) 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; -- cgit v1.2.1