| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
| 8 #include "src/crankshaft/hydrogen.h" | 8 #include "src/crankshaft/hydrogen.h" |
| 9 #include "src/crankshaft/lithium.h" | 9 #include "src/crankshaft/lithium.h" |
| 10 #include "src/field-index.h" | 10 #include "src/field-index.h" |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 if (state.op() == Token::ADD && | 1461 if (state.op() == Token::ADD && |
| 1462 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && | 1462 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && |
| 1463 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { | 1463 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { |
| 1464 // For the generic add stub a fast case for string addition is performance | 1464 // For the generic add stub a fast case for string addition is performance |
| 1465 // critical. | 1465 // critical. |
| 1466 if (left_type->Maybe(Type::String())) { | 1466 if (left_type->Maybe(Type::String())) { |
| 1467 IfBuilder if_leftisstring(this); | 1467 IfBuilder if_leftisstring(this); |
| 1468 if_leftisstring.If<HIsStringAndBranch>(left); | 1468 if_leftisstring.If<HIsStringAndBranch>(left); |
| 1469 if_leftisstring.Then(); | 1469 if_leftisstring.Then(); |
| 1470 { | 1470 { |
| 1471 Push(BuildBinaryOperation( | 1471 Push(BuildBinaryOperation(state.op(), left, right, Type::String(), |
| 1472 state.op(), left, right, Type::String(), right_type, result_type, | 1472 right_type, result_type, |
| 1473 state.fixed_right_arg(), allocation_mode, state.strength())); | 1473 state.fixed_right_arg(), allocation_mode)); |
| 1474 } | 1474 } |
| 1475 if_leftisstring.Else(); | 1475 if_leftisstring.Else(); |
| 1476 { | 1476 { |
| 1477 Push(BuildBinaryOperation( | 1477 Push(BuildBinaryOperation(state.op(), left, right, left_type, |
| 1478 state.op(), left, right, left_type, right_type, result_type, | 1478 right_type, result_type, |
| 1479 state.fixed_right_arg(), allocation_mode, state.strength())); | 1479 state.fixed_right_arg(), allocation_mode)); |
| 1480 } | 1480 } |
| 1481 if_leftisstring.End(); | 1481 if_leftisstring.End(); |
| 1482 result = Pop(); | 1482 result = Pop(); |
| 1483 } else { | 1483 } else { |
| 1484 IfBuilder if_rightisstring(this); | 1484 IfBuilder if_rightisstring(this); |
| 1485 if_rightisstring.If<HIsStringAndBranch>(right); | 1485 if_rightisstring.If<HIsStringAndBranch>(right); |
| 1486 if_rightisstring.Then(); | 1486 if_rightisstring.Then(); |
| 1487 { | 1487 { |
| 1488 Push(BuildBinaryOperation( | 1488 Push(BuildBinaryOperation(state.op(), left, right, left_type, |
| 1489 state.op(), left, right, left_type, Type::String(), result_type, | 1489 Type::String(), result_type, |
| 1490 state.fixed_right_arg(), allocation_mode, state.strength())); | 1490 state.fixed_right_arg(), allocation_mode)); |
| 1491 } | 1491 } |
| 1492 if_rightisstring.Else(); | 1492 if_rightisstring.Else(); |
| 1493 { | 1493 { |
| 1494 Push(BuildBinaryOperation( | 1494 Push(BuildBinaryOperation(state.op(), left, right, left_type, |
| 1495 state.op(), left, right, left_type, right_type, result_type, | 1495 right_type, result_type, |
| 1496 state.fixed_right_arg(), allocation_mode, state.strength())); | 1496 state.fixed_right_arg(), allocation_mode)); |
| 1497 } | 1497 } |
| 1498 if_rightisstring.End(); | 1498 if_rightisstring.End(); |
| 1499 result = Pop(); | 1499 result = Pop(); |
| 1500 } | 1500 } |
| 1501 } else { | 1501 } else { |
| 1502 result = BuildBinaryOperation( | 1502 result = BuildBinaryOperation(state.op(), left, right, left_type, |
| 1503 state.op(), left, right, left_type, right_type, result_type, | 1503 right_type, result_type, |
| 1504 state.fixed_right_arg(), allocation_mode, state.strength()); | 1504 state.fixed_right_arg(), allocation_mode); |
| 1505 } | 1505 } |
| 1506 | 1506 |
| 1507 // If we encounter a generic argument, the number conversion is | 1507 // If we encounter a generic argument, the number conversion is |
| 1508 // observable, thus we cannot afford to bail out after the fact. | 1508 // observable, thus we cannot afford to bail out after the fact. |
| 1509 if (!state.HasSideEffects()) { | 1509 if (!state.HasSideEffects()) { |
| 1510 result = EnforceNumberType(result, result_type); | 1510 result = EnforceNumberType(result, result_type); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 return result; | 1513 return result; |
| 1514 } | 1514 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1528 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); | 1528 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); |
| 1529 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); | 1529 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); |
| 1530 | 1530 |
| 1531 Type* left_type = state.GetLeftType(); | 1531 Type* left_type = state.GetLeftType(); |
| 1532 Type* right_type = state.GetRightType(); | 1532 Type* right_type = state.GetRightType(); |
| 1533 Type* result_type = state.GetResultType(); | 1533 Type* result_type = state.GetResultType(); |
| 1534 HAllocationMode allocation_mode(allocation_site); | 1534 HAllocationMode allocation_mode(allocation_site); |
| 1535 | 1535 |
| 1536 return BuildBinaryOperation(state.op(), left, right, left_type, right_type, | 1536 return BuildBinaryOperation(state.op(), left, right, left_type, right_type, |
| 1537 result_type, state.fixed_right_arg(), | 1537 result_type, state.fixed_right_arg(), |
| 1538 allocation_mode, state.strength()); | 1538 allocation_mode); |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 | 1541 |
| 1542 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() { | 1542 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() { |
| 1543 return DoGenerateCode(this); | 1543 return DoGenerateCode(this); |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 | 1546 |
| 1547 HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) { | 1547 HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) { |
| 1548 if (!convert) return BuildCheckString(input); | 1548 if (!convert) return BuildCheckString(input); |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 return Pop(); | 2428 return Pop(); |
| 2429 } | 2429 } |
| 2430 | 2430 |
| 2431 | 2431 |
| 2432 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2432 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
| 2433 return DoGenerateCode(this); | 2433 return DoGenerateCode(this); |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 } // namespace internal | 2436 } // namespace internal |
| 2437 } // namespace v8 | 2437 } // namespace v8 |
| OLD | NEW |