2015-10-06 22:29:27 +00:00
|
|
|
/*
|
2016-05-10 02:01:28 +00:00
|
|
|
* Copyright (C) 2015-2016 Apple Inc. All rights reserved.
|
2015-10-06 22:29:27 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
|
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2016-09-28 17:08:17 +00:00
|
|
|
#pragma once
|
2015-10-06 22:29:27 +00:00
|
|
|
|
2015-10-29 01:18:49 +00:00
|
|
|
#if ENABLE(JIT)
|
|
|
|
|
2015-10-06 22:29:27 +00:00
|
|
|
#include "CCallHelpers.h"
|
2016-08-01 18:48:14 +00:00
|
|
|
#include "JITMathICInlineResult.h"
|
2015-12-01 00:07:39 +00:00
|
|
|
#include "SnippetOperand.h"
|
2015-10-06 22:29:27 +00:00
|
|
|
|
|
|
|
namespace JSC {
|
2015-10-28 18:36:02 +00:00
|
|
|
|
2016-08-01 18:48:14 +00:00
|
|
|
struct MathICGenerationState;
|
|
|
|
|
2015-10-06 22:29:27 +00:00
|
|
|
class JITSubGenerator {
|
|
|
|
public:
|
2016-08-01 18:48:14 +00:00
|
|
|
JITSubGenerator() { }
|
|
|
|
|
2015-12-01 00:07:39 +00:00
|
|
|
JITSubGenerator(SnippetOperand leftOperand, SnippetOperand rightOperand,
|
|
|
|
JSValueRegs result, JSValueRegs left, JSValueRegs right,
|
2021-08-21 00:54:50 +00:00
|
|
|
FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR)
|
2015-12-01 00:07:39 +00:00
|
|
|
: m_leftOperand(leftOperand)
|
|
|
|
, m_rightOperand(rightOperand)
|
|
|
|
, m_result(result)
|
2015-10-06 22:29:27 +00:00
|
|
|
, m_left(left)
|
|
|
|
, m_right(right)
|
|
|
|
, m_leftFPR(leftFPR)
|
|
|
|
, m_rightFPR(rightFPR)
|
|
|
|
, m_scratchGPR(scratchGPR)
|
|
|
|
{ }
|
|
|
|
|
2019-11-13 20:07:29 +00:00
|
|
|
JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const BinaryArithProfile*);
|
|
|
|
bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile*, bool shouldEmitProfiling);
|
2015-10-06 22:29:27 +00:00
|
|
|
|
2016-09-02 19:49:09 +00:00
|
|
|
static bool isLeftOperandValidConstant(SnippetOperand) { return false; }
|
|
|
|
static bool isRightOperandValidConstant(SnippetOperand) { return false; }
|
|
|
|
|
2015-10-06 22:29:27 +00:00
|
|
|
private:
|
2015-12-01 00:07:39 +00:00
|
|
|
SnippetOperand m_leftOperand;
|
|
|
|
SnippetOperand m_rightOperand;
|
2015-10-06 22:29:27 +00:00
|
|
|
JSValueRegs m_result;
|
|
|
|
JSValueRegs m_left;
|
|
|
|
JSValueRegs m_right;
|
|
|
|
FPRReg m_leftFPR;
|
|
|
|
FPRReg m_rightFPR;
|
|
|
|
GPRReg m_scratchGPR;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace JSC
|
|
|
|
|
2015-10-29 01:18:49 +00:00
|
|
|
#endif // ENABLE(JIT)
|