X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..40a37d088818fc2fbeba2ef850dbcaaf294befbf:/dfg/DFGJITCompiler.cpp?ds=sidebyside diff --git a/dfg/DFGJITCompiler.cpp b/dfg/DFGJITCompiler.cpp index 9e946d2..c54746e 100644 --- a/dfg/DFGJITCompiler.cpp +++ b/dfg/DFGJITCompiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2013, 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,425 +28,437 @@ #if ENABLE(DFG_JIT) +#include "ArityCheckFailReturnThunks.h" #include "CodeBlock.h" -#include "DFGJITCodeGenerator.h" -#include "DFGNonSpeculativeJIT.h" +#include "DFGFailedFinalizer.h" +#include "DFGInlineCacheWrapperInlines.h" +#include "DFGJITCode.h" +#include "DFGJITFinalizer.h" +#include "DFGOSRExitCompiler.h" #include "DFGOperations.h" #include "DFGRegisterBank.h" +#include "DFGSlowPathGenerator.h" #include "DFGSpeculativeJIT.h" -#include "JSGlobalData.h" +#include "DFGThunks.h" +#include "JSCJSValueInlines.h" #include "LinkBuffer.h" +#include "MaxFrameExtentForSlowPathCall.h" +#include "JSCInlines.h" +#include "VM.h" namespace JSC { namespace DFG { -// This method used to fill a numeric value to a FPR when linking speculative -> non-speculative. -void JITCompiler::fillNumericToDouble(NodeIndex nodeIndex, FPRReg fpr, GPRReg temporary) +JITCompiler::JITCompiler(Graph& dfg) + : CCallHelpers(&dfg.m_vm, dfg.m_codeBlock) + , m_graph(dfg) + , m_jitCode(adoptRef(new JITCode())) + , m_blockHeads(dfg.numBlocks()) { - Node& node = graph()[nodeIndex]; - - if (node.isConstant()) { - ASSERT(node.op == DoubleConstant); - move(MacroAssembler::ImmPtr(reinterpret_cast(reinterpretDoubleToIntptr(valueOfDoubleConstant(nodeIndex)))), temporary); - movePtrToDouble(temporary, fpr); - } else { - loadPtr(addressFor(node.virtualRegister()), temporary); - Jump isInteger = branchPtr(MacroAssembler::AboveOrEqual, temporary, GPRInfo::tagTypeNumberRegister); - jitAssertIsJSDouble(temporary); - addPtr(GPRInfo::tagTypeNumberRegister, temporary); - movePtrToDouble(temporary, fpr); - Jump hasUnboxedDouble = jump(); - isInteger.link(this); - convertInt32ToDouble(temporary, fpr); - hasUnboxedDouble.link(this); - } + if (shouldShowDisassembly() || m_graph.m_vm.m_perBytecodeProfiler) + m_disassembler = adoptPtr(new Disassembler(dfg)); } -// This method used to fill an integer value to a GPR when linking speculative -> non-speculative. -void JITCompiler::fillInt32ToInteger(NodeIndex nodeIndex, GPRReg gpr) +JITCompiler::~JITCompiler() { - Node& node = graph()[nodeIndex]; - - if (node.isConstant()) { - ASSERT(node.op == Int32Constant); - move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr); - } else { -#if DFG_JIT_ASSERT - // Redundant load, just so we can check the tag! - loadPtr(addressFor(node.virtualRegister()), gpr); - jitAssertIsJSInt32(gpr); -#endif - load32(addressFor(node.virtualRegister()), gpr); - } } -// This method used to fill a JSValue to a GPR when linking speculative -> non-speculative. -void JITCompiler::fillToJS(NodeIndex nodeIndex, GPRReg gpr) +void JITCompiler::linkOSRExits() { - Node& node = graph()[nodeIndex]; - - if (node.isConstant()) { - if (isInt32Constant(nodeIndex)) { - JSValue jsValue = jsNumber(valueOfInt32Constant(nodeIndex)); - move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr); - } else if (isDoubleConstant(nodeIndex)) { - JSValue jsValue(JSValue::EncodeAsDouble, valueOfDoubleConstant(nodeIndex)); - move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr); - } else { - ASSERT(isJSConstant(nodeIndex)); - JSValue jsValue = valueOfJSConstant(nodeIndex); - move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr); + ASSERT(m_jitCode->osrExit.size() == m_exitCompilationInfo.size()); + if (m_graph.compilation()) { + for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) { + OSRExitCompilationInfo& info = m_exitCompilationInfo[i]; + Vector