Changeset 160294 in webkit for trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
- Timestamp:
- Dec 8, 2013, 5:06:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r160292 r160294 2397 2397 } 2398 2398 2399 if (m_node->isBinaryUseKind(UntypedUse)) { 2400 nonSpeculativeCompare(LLVMIntEQ, operationCompareEq); 2401 return; 2402 } 2403 2399 2404 RELEASE_ASSERT_NOT_REACHED(); 2400 2405 } … … 2465 2470 void compileCompareLess() 2466 2471 { 2467 if (m_node->isBinaryUseKind(Int32Use)) { 2468 setBoolean( 2469 m_out.lessThan(lowInt32(m_node->child1()), lowInt32(m_node->child2()))); 2470 return; 2471 } 2472 2473 if (m_node->isBinaryUseKind(MachineIntUse)) { 2474 Int52Kind kind; 2475 LValue left = lowWhicheverInt52(m_node->child1(), kind); 2476 LValue right = lowInt52(m_node->child2(), kind); 2477 setBoolean(m_out.lessThan(left, right)); 2478 return; 2479 } 2480 2481 if (m_node->isBinaryUseKind(NumberUse)) { 2482 setBoolean( 2483 m_out.doubleLessThan(lowDouble(m_node->child1()), lowDouble(m_node->child2()))); 2484 return; 2485 } 2486 2487 RELEASE_ASSERT_NOT_REACHED(); 2472 compare(LLVMIntSLT, LLVMRealOLT, operationCompareLess); 2488 2473 } 2489 2474 2490 2475 void compileCompareLessEq() 2491 2476 { 2492 if (m_node->isBinaryUseKind(Int32Use)) { 2493 setBoolean( 2494 m_out.lessThanOrEqual(lowInt32(m_node->child1()), lowInt32(m_node->child2()))); 2495 return; 2496 } 2497 2498 if (m_node->isBinaryUseKind(MachineIntUse)) { 2499 Int52Kind kind; 2500 LValue left = lowWhicheverInt52(m_node->child1(), kind); 2501 LValue right = lowInt52(m_node->child2(), kind); 2502 setBoolean(m_out.lessThanOrEqual(left, right)); 2503 return; 2504 } 2505 2506 if (m_node->isBinaryUseKind(NumberUse)) { 2507 setBoolean( 2508 m_out.doubleLessThanOrEqual( 2509 lowDouble(m_node->child1()), lowDouble(m_node->child2()))); 2510 return; 2511 } 2512 2513 RELEASE_ASSERT_NOT_REACHED(); 2477 compare(LLVMIntSLE, LLVMRealOLE, operationCompareLessEq); 2514 2478 } 2515 2479 2516 2480 void compileCompareGreater() 2517 2481 { 2518 if (m_node->isBinaryUseKind(Int32Use)) { 2519 setBoolean( 2520 m_out.greaterThan(lowInt32(m_node->child1()), lowInt32(m_node->child2()))); 2521 return; 2522 } 2523 2524 if (m_node->isBinaryUseKind(MachineIntUse)) { 2525 Int52Kind kind; 2526 LValue left = lowWhicheverInt52(m_node->child1(), kind); 2527 LValue right = lowInt52(m_node->child2(), kind); 2528 setBoolean(m_out.greaterThan(left, right)); 2529 return; 2530 } 2531 2532 if (m_node->isBinaryUseKind(NumberUse)) { 2533 setBoolean( 2534 m_out.doubleGreaterThan( 2535 lowDouble(m_node->child1()), lowDouble(m_node->child2()))); 2536 return; 2537 } 2538 2539 RELEASE_ASSERT_NOT_REACHED(); 2482 compare(LLVMIntSGT, LLVMRealOGT, operationCompareGreater); 2540 2483 } 2541 2484 2542 2485 void compileCompareGreaterEq() 2543 2486 { 2544 if (m_node->isBinaryUseKind(Int32Use)) { 2545 setBoolean( 2546 m_out.greaterThanOrEqual( 2547 lowInt32(m_node->child1()), lowInt32(m_node->child2()))); 2548 return; 2549 } 2550 2551 if (m_node->isBinaryUseKind(MachineIntUse)) { 2552 Int52Kind kind; 2553 LValue left = lowWhicheverInt52(m_node->child1(), kind); 2554 LValue right = lowInt52(m_node->child2(), kind); 2555 setBoolean(m_out.greaterThanOrEqual(left, right)); 2556 return; 2557 } 2558 2559 if (m_node->isBinaryUseKind(NumberUse)) { 2560 setBoolean( 2561 m_out.doubleGreaterThanOrEqual( 2562 lowDouble(m_node->child1()), lowDouble(m_node->child2()))); 2563 return; 2564 } 2565 2566 RELEASE_ASSERT_NOT_REACHED(); 2487 compare(LLVMIntSGE, LLVMRealOGE, operationCompareGreaterEq); 2567 2488 } 2568 2489 … … 2799 2720 heap, storage, m_out.zeroExt(index, m_out.intPtr), 2800 2721 m_state.forNode(edge).m_value); 2722 } 2723 2724 void compare( 2725 LIntPredicate intCondition, LRealPredicate realCondition, 2726 S_JITOperation_EJJ helperFunction) 2727 { 2728 if (m_node->isBinaryUseKind(Int32Use)) { 2729 LValue left = lowInt32(m_node->child1()); 2730 LValue right = lowInt32(m_node->child2()); 2731 setBoolean(m_out.icmp(intCondition, left, right)); 2732 return; 2733 } 2734 2735 if (m_node->isBinaryUseKind(MachineIntUse)) { 2736 Int52Kind kind; 2737 LValue left = lowWhicheverInt52(m_node->child1(), kind); 2738 LValue right = lowInt52(m_node->child2(), kind); 2739 setBoolean(m_out.icmp(intCondition, left, right)); 2740 return; 2741 } 2742 2743 if (m_node->isBinaryUseKind(NumberUse)) { 2744 LValue left = lowDouble(m_node->child1()); 2745 LValue right = lowDouble(m_node->child2()); 2746 setBoolean(m_out.fcmp(realCondition, left, right)); 2747 return; 2748 } 2749 2750 if (m_node->isBinaryUseKind(UntypedUse)) { 2751 nonSpeculativeCompare(intCondition, helperFunction); 2752 return; 2753 } 2754 2755 RELEASE_ASSERT_NOT_REACHED(); 2756 } 2757 2758 void nonSpeculativeCompare(LIntPredicate intCondition, S_JITOperation_EJJ helperFunction) 2759 { 2760 LValue left = lowJSValue(m_node->child1()); 2761 LValue right = lowJSValue(m_node->child2()); 2762 2763 LBasicBlock leftIsInt = FTL_NEW_BLOCK(m_out, ("CompareEq untyped left is int")); 2764 LBasicBlock fastPath = FTL_NEW_BLOCK(m_out, ("CompareEq untyped fast path")); 2765 LBasicBlock slowPath = FTL_NEW_BLOCK(m_out, ("CompareEq untyped slow path")); 2766 LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CompareEq untyped continuation")); 2767 2768 m_out.branch(isNotInt32(left), slowPath, leftIsInt); 2769 2770 LBasicBlock lastNext = m_out.appendTo(leftIsInt, fastPath); 2771 m_out.branch(isNotInt32(right), slowPath, fastPath); 2772 2773 m_out.appendTo(fastPath, slowPath); 2774 ValueFromBlock fastResult = m_out.anchor( 2775 m_out.icmp(intCondition, unboxInt32(left), unboxInt32(right))); 2776 m_out.jump(continuation); 2777 2778 m_out.appendTo(slowPath, continuation); 2779 ValueFromBlock slowResult = m_out.anchor(m_out.notNull(vmCall( 2780 m_out.operation(helperFunction), m_callFrame, left, right))); 2781 m_out.jump(continuation); 2782 2783 m_out.appendTo(continuation, lastNext); 2784 setBoolean(m_out.phi(m_out.boolean, fastResult, slowResult)); 2801 2785 } 2802 2786
Note:
See TracChangeset
for help on using the changeset viewer.