mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-01 03:19:56 +00:00
Implement ** exponentiation operator.
Parser and Baseline JIT.
This commit is contained in:
@@ -5871,7 +5871,8 @@ static const JSOp ParseNodeKindToJSOp[] = {
|
||||
JSOP_SUB,
|
||||
JSOP_MUL,
|
||||
JSOP_DIV,
|
||||
JSOP_MOD
|
||||
JSOP_MOD,
|
||||
JSOP_POW
|
||||
};
|
||||
|
||||
static inline JSOp
|
||||
@@ -5918,7 +5919,8 @@ static const int PrecedenceTable[] = {
|
||||
9, /* PNK_SUB */
|
||||
10, /* PNK_STAR */
|
||||
10, /* PNK_DIV */
|
||||
10 /* PNK_MOD */
|
||||
10, /* PNK_MOD */
|
||||
11 /* PNK_POW */
|
||||
};
|
||||
|
||||
static const int PRECEDENCE_CLASSES = 10;
|
||||
@@ -5940,8 +5942,8 @@ template <typename ParseHandler>
|
||||
MOZ_ALWAYS_INLINE typename ParseHandler::Node
|
||||
Parser<ParseHandler>::orExpr1(InvokedPrediction invoked)
|
||||
{
|
||||
// Shift-reduce parser for the left-associative binary operator part of
|
||||
// the JS syntax.
|
||||
// Shift-reduce parser for the binary operator part of the JS expression
|
||||
// syntax.
|
||||
|
||||
// Conceptually there's just one stack, a stack of pairs (lhs, op).
|
||||
// It's implemented using two separate arrays, though.
|
||||
@@ -5975,10 +5977,9 @@ Parser<ParseHandler>::orExpr1(InvokedPrediction invoked)
|
||||
// stack, reduce. This combines nodes on the stack until we form the
|
||||
// actual lhs of pnk.
|
||||
//
|
||||
// The >= in this condition works because all the operators in question
|
||||
// are left-associative; if any were not, the case where two operators
|
||||
// have equal precedence would need to be handled specially, and the
|
||||
// stack would need to be a Vector.
|
||||
// The >= in this condition works because it is appendOrCreateList's
|
||||
// job to decide if the operator in question is left- or
|
||||
// right-associative, and build the corresponding tree.
|
||||
while (depth > 0 && Precedence(kindStack[depth - 1]) >= Precedence(pnk)) {
|
||||
depth--;
|
||||
ParseNodeKind combiningPnk = kindStack[depth];
|
||||
@@ -6176,6 +6177,7 @@ Parser<ParseHandler>::assignExpr(InvokedPrediction invoked)
|
||||
case TOK_MULASSIGN: kind = PNK_MULASSIGN; op = JSOP_MUL; break;
|
||||
case TOK_DIVASSIGN: kind = PNK_DIVASSIGN; op = JSOP_DIV; break;
|
||||
case TOK_MODASSIGN: kind = PNK_MODASSIGN; op = JSOP_MOD; break;
|
||||
case TOK_POWASSIGN: kind = PNK_POWASSIGN; op = JSOP_POW; break;
|
||||
|
||||
case TOK_ARROW: {
|
||||
tokenStream.seek(start);
|
||||
|
||||
Reference in New Issue
Block a user