Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 return ToRegister(op->index()); | 575 return ToRegister(op->index()); |
| 576 } | 576 } |
| 577 | 577 |
| 578 | 578 |
| 579 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { | 579 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { |
| 580 ASSERT(op->IsDoubleRegister()); | 580 ASSERT(op->IsDoubleRegister()); |
| 581 return ToDoubleRegister(op->index()); | 581 return ToDoubleRegister(op->index()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 | 584 |
| 585 int LCodeGen::ToInteger32(LConstantOperand* op) const { | 585 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { |
| 586 HConstant* constant = chunk_->LookupConstant(op); | 586 return ToRepresentation(op, Representation::Integer32()); |
| 587 return constant->Integer32Value(); | |
| 588 } | 587 } |
| 589 | 588 |
| 590 | 589 |
| 590 int32_t LCodeGen::ToRepresentation(LConstantOperand* op, | |
| 591 const Representation& r) const { | |
| 592 HConstant* constant = chunk_->LookupConstant(op); | |
|
danno
2013/06/06 12:32:13
why do you need to pass in the representation? Can
| |
| 593 int32_t value = constant->Integer32Value(); | |
| 594 if (r.IsInteger32()) return value; | |
| 595 ASSERT(r.IsSmiOrTagged()); | |
| 596 return reinterpret_cast<int32_t>(Smi::FromInt(value)); | |
| 597 } | |
| 598 | |
| 599 | |
| 591 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 600 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
| 592 HConstant* constant = chunk_->LookupConstant(op); | 601 HConstant* constant = chunk_->LookupConstant(op); |
| 593 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 602 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
| 594 return constant->handle(); | 603 return constant->handle(); |
| 595 } | 604 } |
| 596 | 605 |
| 597 | 606 |
| 598 double LCodeGen::ToDouble(LConstantOperand* op) const { | 607 double LCodeGen::ToDouble(LConstantOperand* op) const { |
| 599 HConstant* constant = chunk_->LookupConstant(op); | 608 HConstant* constant = chunk_->LookupConstant(op); |
| 600 ASSERT(constant->HasDoubleValue()); | 609 ASSERT(constant->HasDoubleValue()); |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1544 LOperand* right = instr->right(); | 1553 LOperand* right = instr->right(); |
| 1545 | 1554 |
| 1546 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1555 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1547 __ mov(ToRegister(instr->temp()), left); | 1556 __ mov(ToRegister(instr->temp()), left); |
| 1548 } | 1557 } |
| 1549 | 1558 |
| 1550 if (right->IsConstantOperand()) { | 1559 if (right->IsConstantOperand()) { |
| 1551 // Try strength reductions on the multiplication. | 1560 // Try strength reductions on the multiplication. |
| 1552 // All replacement instructions are at most as long as the imul | 1561 // All replacement instructions are at most as long as the imul |
| 1553 // and have better latency. | 1562 // and have better latency. |
| 1554 int constant = ToInteger32(LConstantOperand::cast(right)); | 1563 int constant = ToRepresentation( |
| 1564 LConstantOperand::cast(right), | |
| 1565 instr->hydrogen()->BetterRightOperand()->representation()); | |
| 1555 if (constant == -1) { | 1566 if (constant == -1) { |
| 1556 __ neg(left); | 1567 __ neg(left); |
| 1557 } else if (constant == 0) { | 1568 } else if (constant == 0) { |
| 1558 __ xor_(left, Operand(left)); | 1569 __ xor_(left, Operand(left)); |
| 1559 } else if (constant == 2) { | 1570 } else if (constant == 2) { |
| 1560 __ add(left, Operand(left)); | 1571 __ add(left, Operand(left)); |
| 1561 } else if (!instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1572 } else if (!instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1562 // If we know that the multiplication can't overflow, it's safe to | 1573 // If we know that the multiplication can't overflow, it's safe to |
| 1563 // use instructions that don't set the overflow flag for the | 1574 // use instructions that don't set the overflow flag for the |
| 1564 // multiplication. | 1575 // multiplication. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1609 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1599 DeoptimizeIf(overflow, instr->environment()); | 1610 DeoptimizeIf(overflow, instr->environment()); |
| 1600 } | 1611 } |
| 1601 | 1612 |
| 1602 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1613 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1603 // Bail out if the result is supposed to be negative zero. | 1614 // Bail out if the result is supposed to be negative zero. |
| 1604 Label done; | 1615 Label done; |
| 1605 __ test(left, Operand(left)); | 1616 __ test(left, Operand(left)); |
| 1606 __ j(not_zero, &done, Label::kNear); | 1617 __ j(not_zero, &done, Label::kNear); |
| 1607 if (right->IsConstantOperand()) { | 1618 if (right->IsConstantOperand()) { |
| 1608 if (ToInteger32(LConstantOperand::cast(right)) < 0) { | 1619 Representation r = |
| 1620 instr->hydrogen()->BetterRightOperand()->representation(); | |
| 1621 if (ToRepresentation(LConstantOperand::cast(right), r) < 0) { | |
| 1609 DeoptimizeIf(no_condition, instr->environment()); | 1622 DeoptimizeIf(no_condition, instr->environment()); |
| 1610 } else if (ToInteger32(LConstantOperand::cast(right)) == 0) { | 1623 } else if (ToRepresentation(LConstantOperand::cast(right), r) == 0) { |
| 1611 __ cmp(ToRegister(instr->temp()), Immediate(0)); | 1624 __ cmp(ToRegister(instr->temp()), Immediate(0)); |
| 1612 DeoptimizeIf(less, instr->environment()); | 1625 DeoptimizeIf(less, instr->environment()); |
| 1613 } | 1626 } |
| 1614 } else { | 1627 } else { |
| 1615 // Test the non-zero operand for negative sign. | 1628 // Test the non-zero operand for negative sign. |
| 1616 __ or_(ToRegister(instr->temp()), ToOperand(right)); | 1629 __ or_(ToRegister(instr->temp()), ToOperand(right)); |
| 1617 DeoptimizeIf(sign, instr->environment()); | 1630 DeoptimizeIf(sign, instr->environment()); |
| 1618 } | 1631 } |
| 1619 __ bind(&done); | 1632 __ bind(&done); |
| 1620 } | 1633 } |
| 1621 } | 1634 } |
| 1622 | 1635 |
| 1623 | 1636 |
| 1624 void LCodeGen::DoBitI(LBitI* instr) { | 1637 void LCodeGen::DoBitI(LBitI* instr) { |
| 1625 LOperand* left = instr->left(); | 1638 LOperand* left = instr->left(); |
| 1626 LOperand* right = instr->right(); | 1639 LOperand* right = instr->right(); |
| 1627 ASSERT(left->Equals(instr->result())); | 1640 ASSERT(left->Equals(instr->result())); |
| 1628 ASSERT(left->IsRegister()); | 1641 ASSERT(left->IsRegister()); |
| 1629 | 1642 |
| 1630 if (right->IsConstantOperand()) { | 1643 if (right->IsConstantOperand()) { |
| 1631 int right_operand = ToInteger32(LConstantOperand::cast(right)); | 1644 int right_operand = ToRepresentation(LConstantOperand::cast(right), |
| 1645 instr->hydrogen()->representation()); | |
| 1632 switch (instr->op()) { | 1646 switch (instr->op()) { |
| 1633 case Token::BIT_AND: | 1647 case Token::BIT_AND: |
| 1634 __ and_(ToRegister(left), right_operand); | 1648 __ and_(ToRegister(left), right_operand); |
| 1635 break; | 1649 break; |
| 1636 case Token::BIT_OR: | 1650 case Token::BIT_OR: |
| 1637 __ or_(ToRegister(left), right_operand); | 1651 __ or_(ToRegister(left), right_operand); |
| 1638 break; | 1652 break; |
| 1639 case Token::BIT_XOR: | 1653 case Token::BIT_XOR: |
| 1640 __ xor_(ToRegister(left), right_operand); | 1654 __ xor_(ToRegister(left), right_operand); |
| 1641 break; | 1655 break; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1732 } | 1746 } |
| 1733 } | 1747 } |
| 1734 | 1748 |
| 1735 | 1749 |
| 1736 void LCodeGen::DoSubI(LSubI* instr) { | 1750 void LCodeGen::DoSubI(LSubI* instr) { |
| 1737 LOperand* left = instr->left(); | 1751 LOperand* left = instr->left(); |
| 1738 LOperand* right = instr->right(); | 1752 LOperand* right = instr->right(); |
| 1739 ASSERT(left->Equals(instr->result())); | 1753 ASSERT(left->Equals(instr->result())); |
| 1740 | 1754 |
| 1741 if (right->IsConstantOperand()) { | 1755 if (right->IsConstantOperand()) { |
| 1742 __ sub(ToOperand(left), ToInteger32Immediate(right)); | 1756 __ sub(ToOperand(left), |
| 1757 ToImmediate(right, instr->hydrogen()->representation())); | |
| 1743 } else { | 1758 } else { |
| 1744 __ sub(ToRegister(left), ToOperand(right)); | 1759 __ sub(ToRegister(left), ToOperand(right)); |
| 1745 } | 1760 } |
| 1746 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1761 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1747 DeoptimizeIf(overflow, instr->environment()); | 1762 DeoptimizeIf(overflow, instr->environment()); |
| 1748 } | 1763 } |
| 1749 } | 1764 } |
| 1750 | 1765 |
| 1751 | 1766 |
| 1752 void LCodeGen::DoConstantI(LConstantI* instr) { | 1767 void LCodeGen::DoConstantI(LConstantI* instr) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1951 } | 1966 } |
| 1952 } | 1967 } |
| 1953 | 1968 |
| 1954 | 1969 |
| 1955 void LCodeGen::DoAddI(LAddI* instr) { | 1970 void LCodeGen::DoAddI(LAddI* instr) { |
| 1956 LOperand* left = instr->left(); | 1971 LOperand* left = instr->left(); |
| 1957 LOperand* right = instr->right(); | 1972 LOperand* right = instr->right(); |
| 1958 | 1973 |
| 1959 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { | 1974 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { |
| 1960 if (right->IsConstantOperand()) { | 1975 if (right->IsConstantOperand()) { |
| 1961 int32_t offset = ToInteger32(LConstantOperand::cast(right)); | 1976 int32_t offset = ToRepresentation(LConstantOperand::cast(right), |
| 1977 instr->hydrogen()->representation()); | |
| 1962 __ lea(ToRegister(instr->result()), MemOperand(ToRegister(left), offset)); | 1978 __ lea(ToRegister(instr->result()), MemOperand(ToRegister(left), offset)); |
| 1963 } else { | 1979 } else { |
| 1964 Operand address(ToRegister(left), ToRegister(right), times_1, 0); | 1980 Operand address(ToRegister(left), ToRegister(right), times_1, 0); |
| 1965 __ lea(ToRegister(instr->result()), address); | 1981 __ lea(ToRegister(instr->result()), address); |
| 1966 } | 1982 } |
| 1967 } else { | 1983 } else { |
| 1968 if (right->IsConstantOperand()) { | 1984 if (right->IsConstantOperand()) { |
| 1969 __ add(ToOperand(left), ToInteger32Immediate(right)); | 1985 __ add(ToOperand(left), |
| 1986 ToImmediate(right, instr->hydrogen()->representation())); | |
| 1970 } else { | 1987 } else { |
| 1971 __ add(ToRegister(left), ToOperand(right)); | 1988 __ add(ToRegister(left), ToOperand(right)); |
| 1972 } | 1989 } |
| 1973 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1990 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1974 DeoptimizeIf(overflow, instr->environment()); | 1991 DeoptimizeIf(overflow, instr->environment()); |
| 1975 } | 1992 } |
| 1976 } | 1993 } |
| 1977 } | 1994 } |
| 1978 | 1995 |
| 1979 | 1996 |
| 1980 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1997 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { |
| 1981 CpuFeatureScope scope(masm(), SSE2); | 1998 CpuFeatureScope scope(masm(), SSE2); |
| 1982 LOperand* left = instr->left(); | 1999 LOperand* left = instr->left(); |
| 1983 LOperand* right = instr->right(); | 2000 LOperand* right = instr->right(); |
| 1984 ASSERT(left->Equals(instr->result())); | 2001 ASSERT(left->Equals(instr->result())); |
| 1985 HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 2002 HMathMinMax::Operation operation = instr->hydrogen()->operation(); |
| 1986 if (instr->hydrogen()->representation().IsInteger32()) { | 2003 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { |
| 1987 Label return_left; | 2004 Label return_left; |
| 1988 Condition condition = (operation == HMathMinMax::kMathMin) | 2005 Condition condition = (operation == HMathMinMax::kMathMin) |
| 1989 ? less_equal | 2006 ? less_equal |
| 1990 : greater_equal; | 2007 : greater_equal; |
| 1991 if (right->IsConstantOperand()) { | 2008 if (right->IsConstantOperand()) { |
| 1992 Operand left_op = ToOperand(left); | 2009 Operand left_op = ToOperand(left); |
| 1993 Immediate right_imm = ToInteger32Immediate(right); | 2010 Immediate immediate = ToImmediate(LConstantOperand::cast(instr->right()), |
| 1994 __ cmp(left_op, right_imm); | 2011 instr->hydrogen()->representation()); |
| 2012 __ cmp(left_op, immediate); | |
| 1995 __ j(condition, &return_left, Label::kNear); | 2013 __ j(condition, &return_left, Label::kNear); |
| 1996 __ mov(left_op, right_imm); | 2014 __ mov(left_op, immediate); |
| 1997 } else { | 2015 } else { |
| 1998 Register left_reg = ToRegister(left); | 2016 Register left_reg = ToRegister(left); |
| 1999 Operand right_op = ToOperand(right); | 2017 Operand right_op = ToOperand(right); |
| 2000 __ cmp(left_reg, right_op); | 2018 __ cmp(left_reg, right_op); |
| 2001 __ j(condition, &return_left, Label::kNear); | 2019 __ j(condition, &return_left, Label::kNear); |
| 2002 __ mov(left_reg, right_op); | 2020 __ mov(left_reg, right_op); |
| 2003 } | 2021 } |
| 2004 __ bind(&return_left); | 2022 __ bind(&return_left); |
| 2005 } else { | 2023 } else { |
| 2006 ASSERT(instr->hydrogen()->representation().IsDouble()); | 2024 ASSERT(instr->hydrogen()->representation().IsDouble()); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2312 EmitGoto(next_block); | 2330 EmitGoto(next_block); |
| 2313 } else { | 2331 } else { |
| 2314 if (instr->is_double()) { | 2332 if (instr->is_double()) { |
| 2315 CpuFeatureScope scope(masm(), SSE2); | 2333 CpuFeatureScope scope(masm(), SSE2); |
| 2316 // Don't base result on EFLAGS when a NaN is involved. Instead | 2334 // Don't base result on EFLAGS when a NaN is involved. Instead |
| 2317 // jump to the false block. | 2335 // jump to the false block. |
| 2318 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); | 2336 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); |
| 2319 __ j(parity_even, chunk_->GetAssemblyLabel(false_block)); | 2337 __ j(parity_even, chunk_->GetAssemblyLabel(false_block)); |
| 2320 } else { | 2338 } else { |
| 2321 if (right->IsConstantOperand()) { | 2339 if (right->IsConstantOperand()) { |
| 2322 int32_t const_value = ToInteger32(LConstantOperand::cast(right)); | 2340 __ cmp(ToOperand(left), |
| 2323 if (instr->hydrogen_value()->representation().IsSmi()) { | 2341 ToImmediate(right, instr->hydrogen()->representation())); |
| 2324 __ cmp(ToOperand(left), Immediate(Smi::FromInt(const_value))); | |
| 2325 } else { | |
| 2326 __ cmp(ToOperand(left), Immediate(const_value)); | |
| 2327 } | |
| 2328 } else if (left->IsConstantOperand()) { | 2342 } else if (left->IsConstantOperand()) { |
| 2329 int32_t const_value = ToInteger32(LConstantOperand::cast(left)); | 2343 __ cmp(ToOperand(right), |
| 2330 if (instr->hydrogen_value()->representation().IsSmi()) { | 2344 ToImmediate(left, instr->hydrogen()->representation())); |
| 2331 __ cmp(ToOperand(right), Immediate(Smi::FromInt(const_value))); | |
| 2332 } else { | |
| 2333 __ cmp(ToOperand(right), Immediate(const_value)); | |
| 2334 } | |
| 2335 // We transposed the operands. Reverse the condition. | 2345 // We transposed the operands. Reverse the condition. |
| 2336 cc = ReverseCondition(cc); | 2346 cc = ReverseCondition(cc); |
| 2337 } else { | 2347 } else { |
| 2338 __ cmp(ToRegister(left), ToOperand(right)); | 2348 __ cmp(ToRegister(left), ToOperand(right)); |
| 2339 } | 2349 } |
| 2340 } | 2350 } |
| 2341 EmitBranch(true_block, false_block, cc); | 2351 EmitBranch(true_block, false_block, cc); |
| 2342 } | 2352 } |
| 2343 } | 2353 } |
| 2344 | 2354 |
| (...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4378 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4388 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
| 4379 : isolate()->builtins()->StoreIC_Initialize(); | 4389 : isolate()->builtins()->StoreIC_Initialize(); |
| 4380 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4390 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4381 } | 4391 } |
| 4382 | 4392 |
| 4383 | 4393 |
| 4384 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4394 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4385 if (instr->hydrogen()->skip_check()) return; | 4395 if (instr->hydrogen()->skip_check()) return; |
| 4386 | 4396 |
| 4387 if (instr->index()->IsConstantOperand()) { | 4397 if (instr->index()->IsConstantOperand()) { |
| 4388 int constant_index = | 4398 Immediate immediate = |
| 4389 ToInteger32(LConstantOperand::cast(instr->index())); | 4399 ToImmediate(LConstantOperand::cast(instr->index()), |
| 4390 if (instr->hydrogen()->length()->representation().IsSmi()) { | 4400 instr->hydrogen()->length()->representation()); |
| 4391 __ cmp(ToOperand(instr->length()), | 4401 __ cmp(ToOperand(instr->length()), immediate); |
| 4392 Immediate(Smi::FromInt(constant_index))); | |
| 4393 } else { | |
| 4394 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); | |
| 4395 } | |
| 4396 DeoptimizeIf(below_equal, instr->environment()); | 4402 DeoptimizeIf(below_equal, instr->environment()); |
| 4397 } else { | 4403 } else { |
| 4398 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | 4404 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); |
| 4399 DeoptimizeIf(above_equal, instr->environment()); | 4405 DeoptimizeIf(above_equal, instr->environment()); |
| 4400 } | 4406 } |
| 4401 } | 4407 } |
| 4402 | 4408 |
| 4403 | 4409 |
| 4404 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4410 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
| 4405 ElementsKind elements_kind = instr->elements_kind(); | 4411 ElementsKind elements_kind = instr->elements_kind(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4548 instr->elements(), | 4554 instr->elements(), |
| 4549 instr->key(), | 4555 instr->key(), |
| 4550 instr->hydrogen()->key()->representation(), | 4556 instr->hydrogen()->key()->representation(), |
| 4551 FAST_ELEMENTS, | 4557 FAST_ELEMENTS, |
| 4552 FixedArray::kHeaderSize - kHeapObjectTag, | 4558 FixedArray::kHeaderSize - kHeapObjectTag, |
| 4553 instr->additional_index()); | 4559 instr->additional_index()); |
| 4554 if (instr->value()->IsRegister()) { | 4560 if (instr->value()->IsRegister()) { |
| 4555 __ mov(operand, ToRegister(instr->value())); | 4561 __ mov(operand, ToRegister(instr->value())); |
| 4556 } else { | 4562 } else { |
| 4557 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4563 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4558 if (IsInteger32(operand_value)) { | 4564 if (IsSmi(operand_value)) { |
| 4559 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); | 4565 Immediate immediate = ToImmediate(operand_value, Representation::Smi()); |
| 4560 __ mov(operand, Immediate(smi_value)); | 4566 __ mov(operand, immediate); |
| 4561 } else { | 4567 } else { |
| 4568 ASSERT(!IsInteger32(operand_value)); | |
| 4562 Handle<Object> handle_value = ToHandle(operand_value); | 4569 Handle<Object> handle_value = ToHandle(operand_value); |
| 4563 __ mov(operand, handle_value); | 4570 __ mov(operand, handle_value); |
| 4564 } | 4571 } |
| 4565 } | 4572 } |
| 4566 | 4573 |
| 4567 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4574 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 4568 ASSERT(instr->value()->IsRegister()); | 4575 ASSERT(instr->value()->IsRegister()); |
| 4569 Register value = ToRegister(instr->value()); | 4576 Register value = ToRegister(instr->value()); |
| 4570 ASSERT(!instr->key()->IsConstantOperand()); | 4577 ASSERT(!instr->key()->IsConstantOperand()); |
| 4571 HType type = instr->hydrogen()->value()->type(); | 4578 HType type = instr->hydrogen()->value()->type(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4714 // result register contain a valid pointer because it is already | 4721 // result register contain a valid pointer because it is already |
| 4715 // contained in the register pointer map. | 4722 // contained in the register pointer map. |
| 4716 __ Set(result, Immediate(0)); | 4723 __ Set(result, Immediate(0)); |
| 4717 | 4724 |
| 4718 PushSafepointRegistersScope scope(this); | 4725 PushSafepointRegistersScope scope(this); |
| 4719 __ push(string); | 4726 __ push(string); |
| 4720 // Push the index as a smi. This is safe because of the checks in | 4727 // Push the index as a smi. This is safe because of the checks in |
| 4721 // DoStringCharCodeAt above. | 4728 // DoStringCharCodeAt above. |
| 4722 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 4729 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 4723 if (instr->index()->IsConstantOperand()) { | 4730 if (instr->index()->IsConstantOperand()) { |
| 4724 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 4731 Immediate immediate = ToImmediate(LConstantOperand::cast(instr->index()), |
| 4725 __ push(Immediate(Smi::FromInt(const_index))); | 4732 Representation::Smi()); |
| 4733 __ push(immediate); | |
| 4726 } else { | 4734 } else { |
| 4727 Register index = ToRegister(instr->index()); | 4735 Register index = ToRegister(instr->index()); |
| 4728 __ SmiTag(index); | 4736 __ SmiTag(index); |
| 4729 __ push(index); | 4737 __ push(index); |
| 4730 } | 4738 } |
| 4731 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, | 4739 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, |
| 4732 instr, instr->context()); | 4740 instr, instr->context()); |
| 4733 __ AssertSmi(eax); | 4741 __ AssertSmi(eax); |
| 4734 __ SmiUntag(eax); | 4742 __ SmiUntag(eax); |
| 4735 __ StoreToSafepointRegisterSlot(result, eax); | 4743 __ StoreToSafepointRegisterSlot(result, eax); |
| (...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6511 FixedArray::kHeaderSize - kPointerSize)); | 6519 FixedArray::kHeaderSize - kPointerSize)); |
| 6512 __ bind(&done); | 6520 __ bind(&done); |
| 6513 } | 6521 } |
| 6514 | 6522 |
| 6515 | 6523 |
| 6516 #undef __ | 6524 #undef __ |
| 6517 | 6525 |
| 6518 } } // namespace v8::internal | 6526 } } // namespace v8::internal |
| 6519 | 6527 |
| 6520 #endif // V8_TARGET_ARCH_IA32 | 6528 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |