Changeset 209678 in webkit for trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
- Timestamp:
- Dec 10, 2016, 5:14:37 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
r209653 r209678 29 29 30 30 #include "JIT.h" 31 #include "JITEntryPoints.h"32 31 #include "JITInlines.h" 33 32 #include "JSInterfaceJIT.h" … … 39 38 public: 40 39 static const int ThisArgument = -1; 41 enum ArgLocation { OnStack, InRegisters }; 42 43 SpecializedThunkJIT(VM* vm, int expectedArgCount, AssemblyHelpers::SpillRegisterType spillType = AssemblyHelpers::SpillExactly, ArgLocation argLocation = OnStack) 40 SpecializedThunkJIT(VM* vm, int expectedArgCount) 44 41 : JSInterfaceJIT(vm) 45 42 { 46 #if !NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS 47 UNUSED_PARAM(spillType); 48 UNUSED_PARAM(argLocation); 49 #else 50 if (argLocation == InRegisters) { 51 m_stackArgumentsEntry = label(); 52 fillArgumentRegistersFromFrameBeforePrologue(); 53 m_registerArgumentsEntry = label(); 54 emitFunctionPrologue(); 55 emitSaveThenMaterializeTagRegisters(); 56 // Check that we have the expected number of arguments 57 m_failures.append(branch32(NotEqual, argumentRegisterForArgumentCount(), TrustedImm32(expectedArgCount + 1))); 58 } else { 59 spillArgumentRegistersToFrameBeforePrologue(expectedArgCount + 1, spillType); 60 m_stackArgumentsEntry = label(); 61 #endif 62 emitFunctionPrologue(); 63 emitSaveThenMaterializeTagRegisters(); 64 // Check that we have the expected number of arguments 65 m_failures.append(branch32(NotEqual, payloadFor(CallFrameSlot::argumentCount), TrustedImm32(expectedArgCount + 1))); 66 #if NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS 67 } 68 #endif 43 emitFunctionPrologue(); 44 emitSaveThenMaterializeTagRegisters(); 45 // Check that we have the expected number of arguments 46 m_failures.append(branch32(NotEqual, payloadFor(CallFrameSlot::argumentCount), TrustedImm32(expectedArgCount + 1))); 69 47 } 70 48 … … 72 50 : JSInterfaceJIT(vm) 73 51 { 74 #if USE(JSVALUE64)75 spillArgumentRegistersToFrameBeforePrologue();76 m_stackArgumentsEntry = Label();77 #endif78 52 emitFunctionPrologue(); 79 53 emitSaveThenMaterializeTagRegisters(); … … 121 95 m_failures.append(conversionFailed); 122 96 } 123 124 void checkJSStringArgument(VM& vm, RegisterID argument)125 {126 m_failures.append(emitJumpIfNotJSCell(argument));127 m_failures.append(branchStructure(NotEqual,128 Address(argument, JSCell::structureIDOffset()),129 vm.stringStructure.get()));130 }131 97 132 98 void appendFailure(const Jump& failure) … … 134 100 m_failures.append(failure); 135 101 } 136 137 void linkFailureHere()138 {139 m_failures.link(this);140 m_failures.clear();141 }142 143 102 #if USE(JSVALUE64) 144 103 void returnJSValue(RegisterID src) … … 206 165 } 207 166 208 JITEntryPointsWithRef finalize(MacroAssemblerCodePtr fallback, const char* thunkKind)167 MacroAssemblerCodeRef finalize(MacroAssemblerCodePtr fallback, const char* thunkKind) 209 168 { 210 169 LinkBuffer patchBuffer(*m_vm, *this, GLOBAL_THUNK_ID); … … 212 171 for (unsigned i = 0; i < m_calls.size(); i++) 213 172 patchBuffer.link(m_calls[i].first, m_calls[i].second); 214 215 MacroAssemblerCodePtr stackEntry; 216 if (m_stackArgumentsEntry.isSet()) 217 stackEntry = patchBuffer.locationOf(m_stackArgumentsEntry); 218 MacroAssemblerCodePtr registerEntry; 219 if (m_registerArgumentsEntry.isSet()) 220 registerEntry = patchBuffer.locationOf(m_registerArgumentsEntry); 221 222 MacroAssemblerCodeRef entry = FINALIZE_CODE(patchBuffer, ("Specialized thunk for %s", thunkKind)); 223 224 if (m_stackArgumentsEntry.isSet()) { 225 if (m_registerArgumentsEntry.isSet()) 226 return JITEntryPointsWithRef(entry, registerEntry, registerEntry, registerEntry, stackEntry, stackEntry); 227 return JITEntryPointsWithRef(entry, entry.code(), entry.code(), entry.code(), stackEntry, stackEntry); 228 } 229 230 return JITEntryPointsWithRef(entry, entry.code(), entry.code()); 173 return FINALIZE_CODE(patchBuffer, ("Specialized thunk for %s", thunkKind)); 231 174 } 232 175 … … 265 208 266 209 MacroAssembler::JumpList m_failures; 267 MacroAssembler::Label m_registerArgumentsEntry;268 MacroAssembler::Label m_stackArgumentsEntry;269 210 Vector<std::pair<Call, FunctionPtr>> m_calls; 270 211 };
Note:
See TracChangeset
for help on using the changeset viewer.