|
Lines 505-534
private:
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec1
|
| 505 |
flush(m_inlineStackTop); |
505 |
flush(m_inlineStackTop); |
| 506 |
} |
506 |
} |
| 507 |
|
507 |
|
| 508 |
// Get an operand, and perform a ToInt32/ToNumber conversion on it. |
|
|
| 509 |
Node* getToInt32(int operand) |
| 510 |
{ |
| 511 |
return toInt32(get(VirtualRegister(operand))); |
| 512 |
} |
| 513 |
|
| 514 |
// Perform an ES5 ToInt32 operation - returns a node of type NodeResultInt32. |
| 515 |
Node* toInt32(Node* node) |
| 516 |
{ |
| 517 |
if (node->hasInt32Result()) |
| 518 |
return node; |
| 519 |
|
| 520 |
// Check for numeric constants boxed as JSValues. |
| 521 |
if (canFold(node)) { |
| 522 |
JSValue v = valueOfJSConstant(node); |
| 523 |
if (v.isInt32()) |
| 524 |
return getJSConstant(node->constantNumber()); |
| 525 |
if (v.isNumber()) |
| 526 |
return getJSConstantForValue(JSValue(JSC::toInt32(v.asNumber()))); |
| 527 |
} |
| 528 |
|
| 529 |
return addToGraph(ValueToInt32, node); |
| 530 |
} |
| 531 |
|
| 532 |
// NOTE: Only use this to construct constants that arise from non-speculative |
508 |
// NOTE: Only use this to construct constants that arise from non-speculative |
| 533 |
// constant folding. I.e. creating constants using this if we had constant |
509 |
// constant folding. I.e. creating constants using this if we had constant |
| 534 |
// field inference would be a bad idea, since the bytecode parser's folding |
510 |
// field inference would be a bad idea, since the bytecode parser's folding |
|
Lines 1577-1585
bool ByteCodeParser::handleIntrinsic(int
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec2
|
| 1577 |
if (argumentCountIncludingThis != 2) |
1553 |
if (argumentCountIncludingThis != 2) |
| 1578 |
return false; |
1554 |
return false; |
| 1579 |
|
1555 |
|
| 1580 |
int thisOperand = virtualRegisterForArgument(0, registerOffset).offset(); |
1556 |
VirtualRegister thisOperand = virtualRegisterForArgument(0, registerOffset); |
| 1581 |
int indexOperand = virtualRegisterForArgument(1, registerOffset).offset(); |
1557 |
VirtualRegister indexOperand = virtualRegisterForArgument(1, registerOffset); |
| 1582 |
Node* charCode = addToGraph(StringCharCodeAt, OpInfo(ArrayMode(Array::String).asWord()), get(VirtualRegister(thisOperand)), getToInt32(indexOperand)); |
1558 |
Node* charCode = addToGraph(StringCharCodeAt, OpInfo(ArrayMode(Array::String).asWord()), get(VirtualRegister(thisOperand)), get(indexOperand)); |
| 1583 |
|
1559 |
|
| 1584 |
set(VirtualRegister(resultOperand), charCode); |
1560 |
set(VirtualRegister(resultOperand), charCode); |
| 1585 |
return true; |
1561 |
return true; |
|
Lines 1589-1597
bool ByteCodeParser::handleIntrinsic(int
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec3
|
| 1589 |
if (argumentCountIncludingThis != 2) |
1565 |
if (argumentCountIncludingThis != 2) |
| 1590 |
return false; |
1566 |
return false; |
| 1591 |
|
1567 |
|
| 1592 |
int thisOperand = virtualRegisterForArgument(0, registerOffset).offset(); |
1568 |
VirtualRegister thisOperand = virtualRegisterForArgument(0, registerOffset); |
| 1593 |
int indexOperand = virtualRegisterForArgument(1, registerOffset).offset(); |
1569 |
VirtualRegister indexOperand = virtualRegisterForArgument(1, registerOffset); |
| 1594 |
Node* charCode = addToGraph(StringCharAt, OpInfo(ArrayMode(Array::String).asWord()), get(VirtualRegister(thisOperand)), getToInt32(indexOperand)); |
1570 |
Node* charCode = addToGraph(StringCharAt, OpInfo(ArrayMode(Array::String).asWord()), get(VirtualRegister(thisOperand)), get(indexOperand)); |
| 1595 |
|
1571 |
|
| 1596 |
set(VirtualRegister(resultOperand), charCode); |
1572 |
set(VirtualRegister(resultOperand), charCode); |
| 1597 |
return true; |
1573 |
return true; |
|
Lines 1600-1607
bool ByteCodeParser::handleIntrinsic(int
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec4
|
| 1600 |
if (argumentCountIncludingThis != 2) |
1576 |
if (argumentCountIncludingThis != 2) |
| 1601 |
return false; |
1577 |
return false; |
| 1602 |
|
1578 |
|
| 1603 |
int indexOperand = virtualRegisterForArgument(1, registerOffset).offset(); |
1579 |
VirtualRegister indexOperand = virtualRegisterForArgument(1, registerOffset); |
| 1604 |
Node* charCode = addToGraph(StringFromCharCode, getToInt32(indexOperand)); |
1580 |
Node* charCode = addToGraph(StringFromCharCode, get(indexOperand)); |
| 1605 |
|
1581 |
|
| 1606 |
set(VirtualRegister(resultOperand), charCode); |
1582 |
set(VirtualRegister(resultOperand), charCode); |
| 1607 |
|
1583 |
|
|
Lines 1631-1640
bool ByteCodeParser::handleIntrinsic(int
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec5
|
| 1631 |
case IMulIntrinsic: { |
1607 |
case IMulIntrinsic: { |
| 1632 |
if (argumentCountIncludingThis != 3) |
1608 |
if (argumentCountIncludingThis != 3) |
| 1633 |
return false; |
1609 |
return false; |
| 1634 |
int leftOperand = virtualRegisterForArgument(1, registerOffset).offset(); |
1610 |
VirtualRegister leftOperand = virtualRegisterForArgument(1, registerOffset); |
| 1635 |
int rightOperand = virtualRegisterForArgument(2, registerOffset).offset(); |
1611 |
VirtualRegister rightOperand = virtualRegisterForArgument(2, registerOffset); |
| 1636 |
Node* left = getToInt32(leftOperand); |
1612 |
Node* left = get(leftOperand); |
| 1637 |
Node* right = getToInt32(rightOperand); |
1613 |
Node* right = get(rightOperand); |
| 1638 |
set(VirtualRegister(resultOperand), addToGraph(ArithIMul, left, right)); |
1614 |
set(VirtualRegister(resultOperand), addToGraph(ArithIMul, left, right)); |
| 1639 |
return true; |
1615 |
return true; |
| 1640 |
} |
1616 |
} |
|
Lines 2053-2097
bool ByteCodeParser::parseBlock(unsigned
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec6
|
| 2053 |
// === Bitwise operations === |
2029 |
// === Bitwise operations === |
| 2054 |
|
2030 |
|
| 2055 |
case op_bitand: { |
2031 |
case op_bitand: { |
| 2056 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2032 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2057 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2033 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2058 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitAnd, op1, op2)); |
2034 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitAnd, op1, op2)); |
| 2059 |
NEXT_OPCODE(op_bitand); |
2035 |
NEXT_OPCODE(op_bitand); |
| 2060 |
} |
2036 |
} |
| 2061 |
|
2037 |
|
| 2062 |
case op_bitor: { |
2038 |
case op_bitor: { |
| 2063 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2039 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2064 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2040 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2065 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitOr, op1, op2)); |
2041 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitOr, op1, op2)); |
| 2066 |
NEXT_OPCODE(op_bitor); |
2042 |
NEXT_OPCODE(op_bitor); |
| 2067 |
} |
2043 |
} |
| 2068 |
|
2044 |
|
| 2069 |
case op_bitxor: { |
2045 |
case op_bitxor: { |
| 2070 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2046 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2071 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2047 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2072 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitXor, op1, op2)); |
2048 |
set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitXor, op1, op2)); |
| 2073 |
NEXT_OPCODE(op_bitxor); |
2049 |
NEXT_OPCODE(op_bitxor); |
| 2074 |
} |
2050 |
} |
| 2075 |
|
2051 |
|
| 2076 |
case op_rshift: { |
2052 |
case op_rshift: { |
| 2077 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2053 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2078 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2054 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2079 |
set(VirtualRegister(currentInstruction[1].u.operand), |
2055 |
set(VirtualRegister(currentInstruction[1].u.operand), |
| 2080 |
addToGraph(BitRShift, op1, op2)); |
2056 |
addToGraph(BitRShift, op1, op2)); |
| 2081 |
NEXT_OPCODE(op_rshift); |
2057 |
NEXT_OPCODE(op_rshift); |
| 2082 |
} |
2058 |
} |
| 2083 |
|
2059 |
|
| 2084 |
case op_lshift: { |
2060 |
case op_lshift: { |
| 2085 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2061 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2086 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2062 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2087 |
set(VirtualRegister(currentInstruction[1].u.operand), |
2063 |
set(VirtualRegister(currentInstruction[1].u.operand), |
| 2088 |
addToGraph(BitLShift, op1, op2)); |
2064 |
addToGraph(BitLShift, op1, op2)); |
| 2089 |
NEXT_OPCODE(op_lshift); |
2065 |
NEXT_OPCODE(op_lshift); |
| 2090 |
} |
2066 |
} |
| 2091 |
|
2067 |
|
| 2092 |
case op_urshift: { |
2068 |
case op_urshift: { |
| 2093 |
Node* op1 = getToInt32(currentInstruction[2].u.operand); |
2069 |
Node* op1 = get(VirtualRegister(currentInstruction[2].u.operand)); |
| 2094 |
Node* op2 = getToInt32(currentInstruction[3].u.operand); |
2070 |
Node* op2 = get(VirtualRegister(currentInstruction[3].u.operand)); |
| 2095 |
set(VirtualRegister(currentInstruction[1].u.operand), |
2071 |
set(VirtualRegister(currentInstruction[1].u.operand), |
| 2096 |
addToGraph(BitURShift, op1, op2)); |
2072 |
addToGraph(BitURShift, op1, op2)); |
| 2097 |
NEXT_OPCODE(op_urshift); |
2073 |
NEXT_OPCODE(op_urshift); |
|
Lines 2099-2105
bool ByteCodeParser::parseBlock(unsigned
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp_sec7
|
| 2099 |
|
2075 |
|
| 2100 |
case op_unsigned: { |
2076 |
case op_unsigned: { |
| 2101 |
set(VirtualRegister(currentInstruction[1].u.operand), |
2077 |
set(VirtualRegister(currentInstruction[1].u.operand), |
| 2102 |
makeSafe(addToGraph(UInt32ToNumber, getToInt32(currentInstruction[2].u.operand)))); |
2078 |
makeSafe(addToGraph(UInt32ToNumber, get(VirtualRegister(currentInstruction[2].u.operand))))); |
| 2103 |
NEXT_OPCODE(op_unsigned); |
2079 |
NEXT_OPCODE(op_unsigned); |
| 2104 |
} |
2080 |
} |
| 2105 |
|
2081 |
|