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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; | 311 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; |
312 } | 312 } |
313 return code; | 313 return code; |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 template <> | 317 template <> |
318 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { | 318 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { |
319 info()->MarkAsSavesCallerDoubles(); | 319 info()->MarkAsSavesCallerDoubles(); |
320 HValue* number = GetParameter(NumberToStringStub::kNumber); | 320 HValue* number = GetParameter(NumberToStringStub::kNumber); |
321 return BuildNumberToString(number, Type::Number(zone())); | 321 return BuildNumberToString(number, Type::Number()); |
322 } | 322 } |
323 | 323 |
324 | 324 |
325 Handle<Code> NumberToStringStub::GenerateCode() { | 325 Handle<Code> NumberToStringStub::GenerateCode() { |
326 return DoGenerateCode(this); | 326 return DoGenerateCode(this); |
327 } | 327 } |
328 | 328 |
329 | 329 |
330 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47). | 330 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47). |
331 template <> | 331 template <> |
(...skipping 1129 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(state.op(), left, right, Type::String(zone()), | 1471 Push(BuildBinaryOperation( |
1472 right_type, result_type, | 1472 state.op(), left, right, Type::String(), right_type, result_type, |
1473 state.fixed_right_arg(), allocation_mode, | 1473 state.fixed_right_arg(), allocation_mode, state.strength())); |
1474 state.strength())); | |
1475 } | 1474 } |
1476 if_leftisstring.Else(); | 1475 if_leftisstring.Else(); |
1477 { | 1476 { |
1478 Push(BuildBinaryOperation( | 1477 Push(BuildBinaryOperation( |
1479 state.op(), left, right, left_type, right_type, result_type, | 1478 state.op(), left, right, left_type, right_type, result_type, |
1480 state.fixed_right_arg(), allocation_mode, state.strength())); | 1479 state.fixed_right_arg(), allocation_mode, state.strength())); |
1481 } | 1480 } |
1482 if_leftisstring.End(); | 1481 if_leftisstring.End(); |
1483 result = Pop(); | 1482 result = Pop(); |
1484 } else { | 1483 } else { |
1485 IfBuilder if_rightisstring(this); | 1484 IfBuilder if_rightisstring(this); |
1486 if_rightisstring.If<HIsStringAndBranch>(right); | 1485 if_rightisstring.If<HIsStringAndBranch>(right); |
1487 if_rightisstring.Then(); | 1486 if_rightisstring.Then(); |
1488 { | 1487 { |
1489 Push(BuildBinaryOperation(state.op(), left, right, left_type, | 1488 Push(BuildBinaryOperation( |
1490 Type::String(zone()), result_type, | 1489 state.op(), left, right, left_type, Type::String(), result_type, |
1491 state.fixed_right_arg(), allocation_mode, | 1490 state.fixed_right_arg(), allocation_mode, state.strength())); |
1492 state.strength())); | |
1493 } | 1491 } |
1494 if_rightisstring.Else(); | 1492 if_rightisstring.Else(); |
1495 { | 1493 { |
1496 Push(BuildBinaryOperation( | 1494 Push(BuildBinaryOperation( |
1497 state.op(), left, right, left_type, right_type, result_type, | 1495 state.op(), left, right, left_type, right_type, result_type, |
1498 state.fixed_right_arg(), allocation_mode, state.strength())); | 1496 state.fixed_right_arg(), allocation_mode, state.strength())); |
1499 } | 1497 } |
1500 if_rightisstring.End(); | 1498 if_rightisstring.End(); |
1501 result = Pop(); | 1499 result = Pop(); |
1502 } | 1500 } |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 return Pop(); | 2428 return Pop(); |
2431 } | 2429 } |
2432 | 2430 |
2433 | 2431 |
2434 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2432 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2435 return DoGenerateCode(this); | 2433 return DoGenerateCode(this); |
2436 } | 2434 } |
2437 | 2435 |
2438 } // namespace internal | 2436 } // namespace internal |
2439 } // namespace v8 | 2437 } // namespace v8 |
OLD | NEW |