Changeset 194369 in webkit
- Timestamp:
- Dec 22, 2015, 12:04:56 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
-
JavaScriptCore/API/JSCallbackConstructor.h (modified) (1 diff)
-
JavaScriptCore/API/JSCallbackObject.h (modified) (1 diff)
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/jit/JITOpcodes.cpp (modified) (1 diff)
-
JavaScriptCore/jit/JITOpcodes32_64.cpp (modified) (1 diff)
-
JavaScriptCore/llint/LLIntData.cpp (modified) (6 diffs)
-
JavaScriptCore/llint/LowLevelInterpreter.asm (modified) (1 diff)
-
JavaScriptCore/runtime/InternalFunction.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSBoundFunction.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSCallee.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSTypeInfo.h (modified) (3 diffs)
-
JavaScriptCore/runtime/NumberConstructor.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/js/JSDOMBinding.h (modified) (1 diff)
-
WebCore/bindings/scripts/CodeGeneratorJS.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h
r182747 r194369 35 35 public: 36 36 typedef JSDestructibleObject Base; 37 static const unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance ;37 static const unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance; 38 38 39 39 static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback) -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r194248 r194369 128 128 public: 129 129 typedef Parent Base; 130 static const unsigned StructureFlags = Base::StructureFlags | ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | ImplementsHasInstance | Overrides HasInstanceFlag | OverridesGetPropertyNames | TypeOfShouldCallGetCallData;130 static const unsigned StructureFlags = Base::StructureFlags | ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | ImplementsHasInstance | OverridesGetPropertyNames | TypeOfShouldCallGetCallData; 131 131 132 132 ~JSCallbackObject(); -
trunk/Source/JavaScriptCore/ChangeLog
r194368 r194369 1 2015-12-22 Keith Miller <keith_miller@apple.com> 2 3 Remove OverridesHasInstance from TypeInfoFlags 4 https://bugs.webkit.org/show_bug.cgi?id=152005 5 6 Reviewed by Saam Barati. 7 8 Currently, we have three TypeInfo flags associated with instanceof behavior, 9 ImplementsHasInstance, ImplementDefaultHasInstance, and OverridesHasInstance. This patch 10 removes the third and moves the first to the out of line flags. In theory, we should only 11 need one flag but removing ImplementsHasInstance is more involved and should be done in a 12 separate patch. 13 14 * API/JSCallbackConstructor.h: 15 * API/JSCallbackObject.h: 16 * jit/JITOpcodes.cpp: 17 (JSC::JIT::emit_op_overrides_has_instance): 18 * jit/JITOpcodes32_64.cpp: 19 (JSC::JIT::emit_op_overrides_has_instance): 20 * llint/LLIntData.cpp: 21 (JSC::LLInt::Data::performAssertions): 22 * llint/LowLevelInterpreter.asm: 23 * runtime/InternalFunction.h: 24 * runtime/JSBoundFunction.h: 25 * runtime/JSCallee.h: 26 * runtime/JSTypeInfo.h: 27 (JSC::TypeInfo::implementsHasInstance): 28 (JSC::TypeInfo::TypeInfo): Deleted. 29 (JSC::TypeInfo::overridesHasInstance): Deleted. 30 * runtime/NumberConstructor.h: 31 1 32 2015-12-22 Filip Pizlo <fpizlo@apple.com> 2 33 -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r194248 r194369 119 119 emitGetVirtualRegister(constructor, regT0); 120 120 121 // Check that constructor 'Implements HasInstance' i.e. the object is a C-API useror a bound function.121 // Check that constructor 'ImplementsDefaultHasInstance' i.e. the object is not a C-API user nor a bound function. 122 122 test8(Zero, Address(regT0, JSCell::typeInfoFlagsOffset()), TrustedImm32(ImplementsDefaultHasInstance), regT0); 123 123 emitTagBool(regT0); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r194248 r194369 198 198 emitLoadPayload(constructor, regT0); 199 199 200 // Check that constructor 'Implements HasInstance' i.e. the object is a C-API useror a bound function.200 // Check that constructor 'ImplementsDefaultHasInstance' i.e. the object is not a C-API user nor a bound function. 201 201 test8(Zero, Address(regT0, JSCell::typeInfoFlagsOffset()), TrustedImm32(ImplementsDefaultHasInstance), regT0); 202 202 Jump done = jump(); -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r194248 r194369 37 37 #include "WriteBarrier.h" 38 38 39 #define STATIC_ASSERT(cond) static_assert(cond, "LLInt assumes " #cond) 40 39 41 namespace JSC { namespace LLInt { 40 42 … … 73 75 // prepared to change LowLevelInterpreter.asm as well!! 74 76 75 #ifndef NDEBUG76 77 #if USE(JSVALUE64) 77 78 const ptrdiff_t PtrSize = 8; … … 82 83 #endif 83 84 const ptrdiff_t SlotSize = 8; 84 #endif 85 86 ASSERT(sizeof(void*) == PtrSize); 87 ASSERT(sizeof(Register) == SlotSize); 88 ASSERT(JSStack::CallFrameHeaderSize == CallFrameHeaderSlots); 85 86 STATIC_ASSERT(sizeof(void*) == PtrSize); 87 STATIC_ASSERT(sizeof(Register) == SlotSize); 88 STATIC_ASSERT(JSStack::CallFrameHeaderSize == CallFrameHeaderSlots); 89 89 90 90 ASSERT(!CallFrame::callerFrameOffset()); 91 ASSERT(JSStack::CallerFrameAndPCSize == (PtrSize * 2) / SlotSize);91 STATIC_ASSERT(JSStack::CallerFrameAndPCSize == (PtrSize * 2) / SlotSize); 92 92 ASSERT(CallFrame::returnPCOffset() == CallFrame::callerFrameOffset() + PtrSize); 93 93 ASSERT(JSStack::CodeBlock * sizeof(Register) == CallFrame::returnPCOffset() + PtrSize); 94 ASSERT(JSStack::Callee * sizeof(Register) == JSStack::CodeBlock * sizeof(Register) + SlotSize);95 ASSERT(JSStack::ArgumentCount * sizeof(Register) == JSStack::Callee * sizeof(Register) + SlotSize);96 ASSERT(JSStack::ThisArgument * sizeof(Register) == JSStack::ArgumentCount * sizeof(Register) + SlotSize);97 ASSERT(JSStack::CallFrameHeaderSize == JSStack::ThisArgument);94 STATIC_ASSERT(JSStack::Callee * sizeof(Register) == JSStack::CodeBlock * sizeof(Register) + SlotSize); 95 STATIC_ASSERT(JSStack::ArgumentCount * sizeof(Register) == JSStack::Callee * sizeof(Register) + SlotSize); 96 STATIC_ASSERT(JSStack::ThisArgument * sizeof(Register) == JSStack::ArgumentCount * sizeof(Register) + SlotSize); 97 STATIC_ASSERT(JSStack::CallFrameHeaderSize == JSStack::ThisArgument); 98 98 99 99 ASSERT(CallFrame::argumentOffsetIncludingThis(0) == JSStack::ThisArgument); … … 107 107 #endif 108 108 #if USE(JSVALUE32_64) 109 ASSERT(JSValue::Int32Tag == static_cast<unsigned>(-1));110 ASSERT(JSValue::BooleanTag == static_cast<unsigned>(-2));111 ASSERT(JSValue::NullTag == static_cast<unsigned>(-3));112 ASSERT(JSValue::UndefinedTag == static_cast<unsigned>(-4));113 ASSERT(JSValue::CellTag == static_cast<unsigned>(-5));114 ASSERT(JSValue::EmptyValueTag == static_cast<unsigned>(-6));115 ASSERT(JSValue::DeletedValueTag == static_cast<unsigned>(-7));116 ASSERT(JSValue::LowestTag == static_cast<unsigned>(-7));109 STATIC_ASSERT(JSValue::Int32Tag == static_cast<unsigned>(-1)); 110 STATIC_ASSERT(JSValue::BooleanTag == static_cast<unsigned>(-2)); 111 STATIC_ASSERT(JSValue::NullTag == static_cast<unsigned>(-3)); 112 STATIC_ASSERT(JSValue::UndefinedTag == static_cast<unsigned>(-4)); 113 STATIC_ASSERT(JSValue::CellTag == static_cast<unsigned>(-5)); 114 STATIC_ASSERT(JSValue::EmptyValueTag == static_cast<unsigned>(-6)); 115 STATIC_ASSERT(JSValue::DeletedValueTag == static_cast<unsigned>(-7)); 116 STATIC_ASSERT(JSValue::LowestTag == static_cast<unsigned>(-7)); 117 117 #else 118 ASSERT(TagBitTypeOther == 0x2);119 ASSERT(TagBitBool == 0x4);120 ASSERT(TagBitUndefined == 0x8);121 ASSERT(ValueEmpty == 0x0);122 ASSERT(ValueFalse == (TagBitTypeOther | TagBitBool));123 ASSERT(ValueTrue == (TagBitTypeOther | TagBitBool | 1));124 ASSERT(ValueUndefined == (TagBitTypeOther | TagBitUndefined));125 ASSERT(ValueNull == TagBitTypeOther);118 STATIC_ASSERT(TagBitTypeOther == 0x2); 119 STATIC_ASSERT(TagBitBool == 0x4); 120 STATIC_ASSERT(TagBitUndefined == 0x8); 121 STATIC_ASSERT(ValueEmpty == 0x0); 122 STATIC_ASSERT(ValueFalse == (TagBitTypeOther | TagBitBool)); 123 STATIC_ASSERT(ValueTrue == (TagBitTypeOther | TagBitBool | 1)); 124 STATIC_ASSERT(ValueUndefined == (TagBitTypeOther | TagBitUndefined)); 125 STATIC_ASSERT(ValueNull == TagBitTypeOther); 126 126 #endif 127 127 #if (CPU(X86_64) && !OS(WINDOWS)) || CPU(ARM64) || !ENABLE(JIT) 128 ASSERT(!maxFrameExtentForSlowPathCall);128 STATIC_ASSERT(!maxFrameExtentForSlowPathCall); 129 129 #elif CPU(ARM) || CPU(SH4) 130 ASSERT(maxFrameExtentForSlowPathCall == 24);130 STATIC_ASSERT(maxFrameExtentForSlowPathCall == 24); 131 131 #elif CPU(X86) || CPU(MIPS) 132 ASSERT(maxFrameExtentForSlowPathCall == 40);132 STATIC_ASSERT(maxFrameExtentForSlowPathCall == 40); 133 133 #elif CPU(X86_64) && OS(WINDOWS) 134 ASSERT(maxFrameExtentForSlowPathCall == 64);134 STATIC_ASSERT(maxFrameExtentForSlowPathCall == 64); 135 135 #endif 136 136 … … 143 143 #endif 144 144 145 ASSERT(StringType == 6); 146 ASSERT(SymbolType == 7); 147 ASSERT(ObjectType == 21); 148 ASSERT(FinalObjectType == 22); 149 ASSERT(MasqueradesAsUndefined == 1); 150 ASSERT(ImplementsHasInstance == 2); 151 ASSERT(ImplementsDefaultHasInstance == 8); 152 ASSERT(FirstConstantRegisterIndex == 0x40000000); 153 ASSERT(GlobalCode == 0); 154 ASSERT(EvalCode == 1); 155 ASSERT(FunctionCode == 2); 156 ASSERT(ModuleCode == 3); 145 STATIC_ASSERT(StringType == 6); 146 STATIC_ASSERT(SymbolType == 7); 147 STATIC_ASSERT(ObjectType == 21); 148 STATIC_ASSERT(FinalObjectType == 22); 149 STATIC_ASSERT(MasqueradesAsUndefined == 1); 150 STATIC_ASSERT(ImplementsDefaultHasInstance == 2); 151 STATIC_ASSERT(FirstConstantRegisterIndex == 0x40000000); 152 STATIC_ASSERT(GlobalCode == 0); 153 STATIC_ASSERT(EvalCode == 1); 154 STATIC_ASSERT(FunctionCode == 2); 155 STATIC_ASSERT(ModuleCode == 3); 157 156 158 157 ASSERT(!(reinterpret_cast<ptrdiff_t>((reinterpret_cast<WriteBarrier<JSCell>*>(0x4000)->slot())) - 0x4000)); … … 186 185 static_assert(InitializationMode::Initialization == 0, "LLInt assumes that InitializationMode::Initialization is 0"); 187 186 188 ASSERT(GetPutInfo::typeBits == 0x3ff);189 ASSERT(GetPutInfo::initializationShift == 10);190 ASSERT(GetPutInfo::initializationBits == 0xffc00);191 192 ASSERT(MarkedBlock::blockMask == ~static_cast<decltype(MarkedBlock::blockMask)>(0x3fff));187 STATIC_ASSERT(GetPutInfo::typeBits == 0x3ff); 188 STATIC_ASSERT(GetPutInfo::initializationShift == 10); 189 STATIC_ASSERT(GetPutInfo::initializationBits == 0xffc00); 190 191 STATIC_ASSERT(MarkedBlock::blockMask == ~static_cast<decltype(MarkedBlock::blockMask)>(0x3fff)); 193 192 194 193 // FIXME: make these assertions less horrible. -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r193766 r194369 334 334 # Type flags constants. 335 335 const MasqueradesAsUndefined = 1 336 const ImplementsHasInstance = 2 337 const ImplementsDefaultHasInstance = 8 336 const ImplementsDefaultHasInstance = 2 338 337 339 338 # Bytecode operand constants. -
trunk/Source/JavaScriptCore/runtime/InternalFunction.h
r183575 r194369 35 35 public: 36 36 typedef JSDestructibleObject Base; 37 static const unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | TypeOfShouldCallGetCallData;37 static const unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance | TypeOfShouldCallGetCallData; 38 38 39 39 DECLARE_EXPORT_INFO; -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.h
r194248 r194369 39 39 public: 40 40 typedef JSFunction Base; 41 const static unsigned StructureFlags = OverridesHasInstanceFlag |Base::StructureFlags;41 const static unsigned StructureFlags = ~ImplementsDefaultHasInstance & Base::StructureFlags; 42 42 43 43 static JSBoundFunction* create(VM&, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&); -
trunk/Source/JavaScriptCore/runtime/JSCallee.h
r182899 r194369 47 47 public: 48 48 typedef JSNonFinalObject Base; 49 const static unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance ;49 const static unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance; 50 50 51 51 static JSCallee* create(VM& vm, JSGlobalObject* globalObject, JSScope* scope) -
trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h
r194248 r194369 38 38 39 39 static const unsigned MasqueradesAsUndefined = 1; // WebCore uses MasqueradesAsUndefined to make document.all undetectable. 40 static const unsigned ImplementsHasInstance = 1 << 1; 41 static const unsigned OverridesHasInstanceFlag = 1 << 2; // FIXME: This is only trivially used by the runtime and should be removed: https://bugs.webkit.org/show_bug.cgi?id=152005 42 static const unsigned ImplementsDefaultHasInstance = 1 << 3; 43 static const unsigned TypeOfShouldCallGetCallData = 1 << 4; // Need this flag if you override getCallData() and you want typeof to use this to determine if it should say "function". Currently we always set this flag when we override getCallData(). 44 static const unsigned OverridesGetOwnPropertySlot = 1 << 5; 45 static const unsigned InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero = 1 << 6; 46 static const unsigned StructureIsImmortal = 1 << 7; 40 static const unsigned ImplementsDefaultHasInstance = 1 << 1; 41 static const unsigned TypeOfShouldCallGetCallData = 1 << 2; // Need this flag if you override getCallData() and you want typeof to use this to determine if it should say "function". Currently we always set this flag when we override getCallData(). 42 static const unsigned OverridesGetOwnPropertySlot = 1 << 3; 43 static const unsigned InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero = 1 << 4; 44 static const unsigned StructureIsImmortal = 1 << 5; 45 // There are two free bits at the end of the InlineTypeFlags. 47 46 48 static const unsigned OverridesGetPropertyNames = 1 << 8; 49 static const unsigned ProhibitsPropertyCaching = 1 << 9; 50 static const unsigned GetOwnPropertySlotIsImpure = 1 << 10; 51 static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 11; 52 static const unsigned IsEnvironmentRecord = 1 << 12; 53 static const unsigned GetOwnPropertySlotIsImpureForPropertyAbsence = 1 << 13; 47 static const unsigned ImplementsHasInstance = 1 << 8; 48 static const unsigned OverridesGetPropertyNames = 1 << 9; 49 static const unsigned ProhibitsPropertyCaching = 1 << 10; 50 static const unsigned GetOwnPropertySlotIsImpure = 1 << 11; 51 static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 12; 52 static const unsigned IsEnvironmentRecord = 1 << 13; 53 static const unsigned GetOwnPropertySlotIsImpureForPropertyAbsence = 1 << 14; 54 54 55 55 class TypeInfo { … … 68 68 , m_flags2(outOfLineTypeFlags) 69 69 { 70 // No object that doesn't ImplementsHasInstance should override it!71 ASSERT((m_flags & (ImplementsHasInstance | OverridesHasInstanceFlag)) != OverridesHasInstanceFlag);72 // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance)73 if ((m_flags & (ImplementsHasInstance | OverridesHasInstanceFlag)) == ImplementsHasInstance)74 m_flags |= ImplementsDefaultHasInstance;75 70 } 76 71 … … 83 78 unsigned flags() const { return (static_cast<unsigned>(m_flags2) << 8) | static_cast<unsigned>(m_flags); } 84 79 bool masqueradesAsUndefined() const { return isSetOnFlags1(MasqueradesAsUndefined); } 85 bool implementsHasInstance() const { return isSetOnFlags1(ImplementsHasInstance); } 86 bool overridesHasInstance() const { return isSetOnFlags1(OverridesHasInstanceFlag); } 80 bool implementsHasInstance() const { return isSetOnFlags2(ImplementsHasInstance); } 87 81 bool implementsDefaultHasInstance() const { return isSetOnFlags1(ImplementsDefaultHasInstance); } 88 82 bool typeOfShouldCallGetCallData() const { return isSetOnFlags1(TypeOfShouldCallGetCallData); } -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.h
r182747 r194369 31 31 public: 32 32 typedef InternalFunction Base; 33 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | ImplementsHasInstance ;33 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | ImplementsHasInstance | ImplementsDefaultHasInstance; 34 34 35 35 static NumberConstructor* create(VM& vm, Structure* structure, NumberPrototype* numberPrototype) -
trunk/Source/WebCore/ChangeLog
r194367 r194369 1 2015-12-22 Keith Miller <keith_miller@apple.com> 2 3 Remove OverridesHasInstance from TypeInfoFlags 4 https://bugs.webkit.org/show_bug.cgi?id=152005 5 6 Reviewed by Saam Barati. 7 8 Currently, we have three TypeInfo flags associated with instanceof behavior, 9 ImplementsHasInstance, ImplementDefaultHasInstance, and OverridesHasInstance. This patch 10 removes the third and moves the first to the out of line flags. In theory, we should only 11 need one flag but removing ImplementsHasInstance is more involved and should be done in a 12 separate patch. 13 14 * bindings/js/JSDOMBinding.h: 15 * bindings/scripts/CodeGeneratorJS.pm: 16 (GenerateHeader): 17 1 18 2015-12-22 Brent Fulgham <bfulgham@apple.com> 2 19 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r193364 r194369 101 101 public: 102 102 typedef JSDOMObject Base; 103 static const unsigned StructureFlags = Base::StructureFlags | JSC::ImplementsHasInstance ;103 static const unsigned StructureFlags = Base::StructureFlags | JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance; 104 104 105 105 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r194100 r194369 1046 1046 # Structure ID 1047 1047 if ($interfaceName eq "DOMWindow") { 1048 $structureFlags{"JSC::ImplementsHasInstance "} = 1;1048 $structureFlags{"JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance"} = 1; 1049 1049 } 1050 1050 push(@headerContent, " static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n");
Note:
See TracChangeset
for help on using the changeset viewer.