diff options
Diffstat (limited to 'Source/JavaScriptCore/jit')
-rw-r--r-- | Source/JavaScriptCore/jit/ExecutableAllocator.h | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp | 14 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JIT.cpp | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JIT.h | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JITInlineMethods.h | 3 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JITOpcodes.cpp | 22 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JITOpcodes32_64.cpp | 24 | ||||
-rw-r--r-- | Source/JavaScriptCore/jit/JITStubs.cpp | 11 |
8 files changed, 24 insertions, 53 deletions
diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.h b/Source/JavaScriptCore/jit/ExecutableAllocator.h index 1ddf011cb..c1edc9752 100644 --- a/Source/JavaScriptCore/jit/ExecutableAllocator.h +++ b/Source/JavaScriptCore/jit/ExecutableAllocator.h @@ -30,6 +30,7 @@ #include <limits> #include <wtf/Assertions.h> #include <wtf/MetaAllocatorHandle.h> +#include <wtf/MetaAllocator.h> #include <wtf/PageAllocation.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp index b4422c3df..884248b20 100644 --- a/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp +++ b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp @@ -78,12 +78,26 @@ protected: virtual void notifyNeedPage(void* page) { +#if OS(DARWIN) + UNUSED_PARAM(page); +#else m_reservation.commit(page, pageSize()); +#endif } virtual void notifyPageIsFree(void* page) { +#if OS(DARWIN) + for (;;) { + int result = madvise(page, pageSize(), MADV_FREE); + if (!result) + return; + ASSERT(result == -1); + ASSERT(errno == EAGAIN); + } +#else m_reservation.decommit(page, pageSize()); +#endif } private: diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp index 01b1260c9..abc79d34b 100644 --- a/Source/JavaScriptCore/jit/JIT.cpp +++ b/Source/JavaScriptCore/jit/JIT.cpp @@ -242,7 +242,6 @@ void JIT::privateCompileMainPass() DEFINE_OP(op_call_varargs) DEFINE_OP(op_catch) DEFINE_OP(op_construct) - DEFINE_OP(op_get_callee) DEFINE_OP(op_create_this) DEFINE_OP(op_convert_this) DEFINE_OP(op_init_lazy_reg) diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h index af5076fb5..6dc0137d9 100644 --- a/Source/JavaScriptCore/jit/JIT.h +++ b/Source/JavaScriptCore/jit/JIT.h @@ -582,7 +582,6 @@ namespace JSC { void emit_op_call_put_result(Instruction*); void emit_op_catch(Instruction*); void emit_op_construct(Instruction*); - void emit_op_get_callee(Instruction*); void emit_op_create_this(Instruction*); void emit_op_convert_this(Instruction*); void emit_op_create_arguments(Instruction*); diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h index cd33821f2..40985ac90 100644 --- a/Source/JavaScriptCore/jit/JITInlineMethods.h +++ b/Source/JavaScriptCore/jit/JITInlineMethods.h @@ -448,6 +448,9 @@ inline void JIT::emitAllocateJSFunction(FunctionExecutable* executable, Register // store the function's executable member storePtr(TrustedImmPtr(executable), Address(result, JSFunction::offsetOfExecutable())); + // clear the function's inheritorID + storePtr(TrustedImmPtr(0), Address(result, JSFunction::offsetOfCachedInheritorID())); + // store the function's name ASSERT(executable->nameValue()); int functionNameOffset = sizeof(JSValue) * m_codeBlock->globalObject()->functionNameOffset(); diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp index d68f4109d..f43e98c45 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp @@ -1263,42 +1263,24 @@ void JIT::emit_op_convert_this(Instruction* currentInstruction) addSlowCase(branchPtr(Equal, Address(regT0, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info))); } -void JIT::emit_op_get_callee(Instruction* currentInstruction) -{ - unsigned result = currentInstruction[1].u.operand; - emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0); - emitPutVirtualRegister(result); -} - void JIT::emit_op_create_this(Instruction* currentInstruction) { - emitGetVirtualRegister(currentInstruction[2].u.operand, regT2); - emitJumpSlowCaseIfNotJSCell(regT2, currentInstruction[2].u.operand); - loadPtr(Address(regT2, JSCell::structureOffset()), regT1); - addSlowCase(emitJumpIfNotObject(regT1)); - - // now we know that the prototype is an object, but we don't know if it's got an - // inheritor ID - - loadPtr(Address(regT2, JSObject::offsetOfInheritorID()), regT2); + emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0); + loadPtr(Address(regT0, JSFunction::offsetOfCachedInheritorID()), regT2); addSlowCase(branchTestPtr(Zero, regT2)); // now regT2 contains the inheritorID, which is the structure that the newly // allocated object will have. emitAllocateJSFinalObject(regT2, regT0, regT1); - emitPutVirtualRegister(currentInstruction[1].u.operand); } void JIT::emitSlow_op_create_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) { - linkSlowCaseIfNotJSCell(iter, currentInstruction[2].u.operand); // not a cell - linkSlowCase(iter); // not an object linkSlowCase(iter); // doesn't have an inheritor ID linkSlowCase(iter); // allocation failed JITStubCall stubCall(this, cti_op_create_this); - stubCall.addArgument(currentInstruction[2].u.operand, regT1); stubCall.call(currentInstruction[1].u.operand); } diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp index 76e11e48c..c9f8922fa 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp @@ -1523,44 +1523,24 @@ void JIT::emit_op_init_lazy_reg(Instruction* currentInstruction) emitStore(dst, JSValue()); } -void JIT::emit_op_get_callee(Instruction* currentInstruction) -{ - int dst = currentInstruction[1].u.operand; - emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0); - emitStoreCell(dst, regT0); -} - void JIT::emit_op_create_this(Instruction* currentInstruction) { - emitLoad(currentInstruction[2].u.operand, regT1, regT0); - emitJumpSlowCaseIfNotJSCell(currentInstruction[2].u.operand, regT1); - loadPtr(Address(regT0, JSCell::structureOffset()), regT1); - addSlowCase(emitJumpIfNotObject(regT1)); - - // now we know that the prototype is an object, but we don't know if it's got an - // inheritor ID - - loadPtr(Address(regT0, JSObject::offsetOfInheritorID()), regT2); + emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0); + loadPtr(Address(regT0, JSFunction::offsetOfCachedInheritorID()), regT2); addSlowCase(branchTestPtr(Zero, regT2)); // now regT2 contains the inheritorID, which is the structure that the newly // allocated object will have. emitAllocateJSFinalObject(regT2, regT0, regT1); - emitStoreCell(currentInstruction[1].u.operand, regT0); } void JIT::emitSlow_op_create_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) { - linkSlowCaseIfNotJSCell(iter, currentInstruction[2].u.operand); // not a cell - linkSlowCase(iter); // not an object linkSlowCase(iter); // doesn't have an inheritor ID linkSlowCase(iter); // allocation failed - unsigned protoRegister = currentInstruction[2].u.operand; - emitLoad(protoRegister, regT1, regT0); JITStubCall stubCall(this, cti_op_create_this); - stubCall.addArgument(regT1, regT0); stubCall.call(currentInstruction[1].u.operand); } diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index d81e68aae..73f4892ac 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -1286,12 +1286,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_this) ASSERT(constructor->methodTable()->getConstructData(constructor, constructData) == ConstructTypeJS); #endif - Structure* structure; - JSValue proto = stackFrame.args[0].jsValue(); - if (proto.isObject()) - structure = asObject(proto)->inheritorID(*stackFrame.globalData); - else - structure = constructor->scope()->globalObject->emptyObjectStructure(); + Structure* structure = constructor->cachedInheritorID(callFrame); JSValue result = constructEmptyObject(callFrame, structure); return JSValue::encode(result); @@ -1497,9 +1492,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_put_by_id_transition_realloc) ASSERT(baseValue.isObject()); JSObject* base = asObject(baseValue); - JSGlobalData& globalData = *stackFrame.globalData; - PropertyStorage newStorage = base->growPropertyStorage(globalData, oldSize, newSize); - base->setPropertyStorage(globalData, newStorage, newStructure); + base->allocatePropertyStorage(*stackFrame.globalData, oldSize, newSize); return base; } |