| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 | 811 |
| 812 | 812 |
| 813 void DeferredInlineBinaryOperation::Generate() { | 813 void DeferredInlineBinaryOperation::Generate() { |
| 814 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); | 814 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); |
| 815 stub.GenerateCall(masm_, left_, right_); | 815 stub.GenerateCall(masm_, left_, right_); |
| 816 if (!dst_.is(eax)) __ mov(dst_, eax); | 816 if (!dst_.is(eax)) __ mov(dst_, eax); |
| 817 } | 817 } |
| 818 | 818 |
| 819 | 819 |
| 820 void CodeGenerator::GenericBinaryOperation(Token::Value op, | 820 void CodeGenerator::GenericBinaryOperation(Token::Value op, |
| 821 SmiAnalysis* type, | 821 StaticType* type, |
| 822 OverwriteMode overwrite_mode) { | 822 OverwriteMode overwrite_mode) { |
| 823 Comment cmnt(masm_, "[ BinaryOperation"); | 823 Comment cmnt(masm_, "[ BinaryOperation"); |
| 824 Comment cmnt_token(masm_, Token::String(op)); | 824 Comment cmnt_token(masm_, Token::String(op)); |
| 825 | 825 |
| 826 if (op == Token::COMMA) { | 826 if (op == Token::COMMA) { |
| 827 // Simply discard left value. | 827 // Simply discard left value. |
| 828 frame_->Nip(1); | 828 frame_->Nip(1); |
| 829 return; | 829 return; |
| 830 } | 830 } |
| 831 | 831 |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 __ add(Operand(dst_), Immediate(value_)); | 1492 __ add(Operand(dst_), Immediate(value_)); |
| 1493 GenericBinaryOpStub igostub(Token::SUB, overwrite_mode_, NO_SMI_CODE_IN_STUB); | 1493 GenericBinaryOpStub igostub(Token::SUB, overwrite_mode_, NO_SMI_CODE_IN_STUB); |
| 1494 igostub.GenerateCall(masm_, dst_, value_); | 1494 igostub.GenerateCall(masm_, dst_, value_); |
| 1495 if (!dst_.is(eax)) __ mov(dst_, eax); | 1495 if (!dst_.is(eax)) __ mov(dst_, eax); |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 | 1498 |
| 1499 void CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, | 1499 void CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, |
| 1500 Result* operand, | 1500 Result* operand, |
| 1501 Handle<Object> value, | 1501 Handle<Object> value, |
| 1502 SmiAnalysis* type, | 1502 StaticType* type, |
| 1503 bool reversed, | 1503 bool reversed, |
| 1504 OverwriteMode overwrite_mode) { | 1504 OverwriteMode overwrite_mode) { |
| 1505 // NOTE: This is an attempt to inline (a bit) more of the code for | 1505 // NOTE: This is an attempt to inline (a bit) more of the code for |
| 1506 // some possible smi operations (like + and -) when (at least) one | 1506 // some possible smi operations (like + and -) when (at least) one |
| 1507 // of the operands is a constant smi. | 1507 // of the operands is a constant smi. |
| 1508 // Consumes the argument "operand". | 1508 // Consumes the argument "operand". |
| 1509 | 1509 |
| 1510 // TODO(199): Optimize some special cases of operations involving a | 1510 // TODO(199): Optimize some special cases of operations involving a |
| 1511 // smi literal (multiply by 2, shift by 0, etc.). | 1511 // smi literal (multiply by 2, shift by 0, etc.). |
| 1512 if (IsUnsafeSmi(value)) { | 1512 if (IsUnsafeSmi(value)) { |
| (...skipping 4926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6439 break; | 6439 break; |
| 6440 } | 6440 } |
| 6441 | 6441 |
| 6442 case KEYED: { | 6442 case KEYED: { |
| 6443 Comment cmnt(masm, "[ Store to keyed Property"); | 6443 Comment cmnt(masm, "[ Store to keyed Property"); |
| 6444 | 6444 |
| 6445 // Generate inlined version of the keyed store if the code is in | 6445 // Generate inlined version of the keyed store if the code is in |
| 6446 // a loop and the key is likely to be a smi. | 6446 // a loop and the key is likely to be a smi. |
| 6447 Property* property = expression()->AsProperty(); | 6447 Property* property = expression()->AsProperty(); |
| 6448 ASSERT(property != NULL); | 6448 ASSERT(property != NULL); |
| 6449 SmiAnalysis* key_smi_analysis = property->key()->type(); | 6449 StaticType* key_smi_analysis = property->key()->type(); |
| 6450 | 6450 |
| 6451 if (cgen_->loop_nesting() > 0 && key_smi_analysis->IsLikelySmi()) { | 6451 if (cgen_->loop_nesting() > 0 && key_smi_analysis->IsLikelySmi()) { |
| 6452 Comment cmnt(masm, "[ Inlined store to keyed Property"); | 6452 Comment cmnt(masm, "[ Inlined store to keyed Property"); |
| 6453 | 6453 |
| 6454 // Get the receiver, key and value into registers. | 6454 // Get the receiver, key and value into registers. |
| 6455 Result value = cgen_->frame()->Pop(); | 6455 Result value = cgen_->frame()->Pop(); |
| 6456 Result key = cgen_->frame()->Pop(); | 6456 Result key = cgen_->frame()->Pop(); |
| 6457 Result receiver = cgen_->frame()->Pop(); | 6457 Result receiver = cgen_->frame()->Pop(); |
| 6458 | 6458 |
| 6459 Result tmp = cgen_->allocator_->Allocate(); | 6459 Result tmp = cgen_->allocator_->Allocate(); |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8511 __ add(Operand(dest), Immediate(2)); | 8511 __ add(Operand(dest), Immediate(2)); |
| 8512 } | 8512 } |
| 8513 __ sub(Operand(count), Immediate(1)); | 8513 __ sub(Operand(count), Immediate(1)); |
| 8514 __ j(not_zero, &loop); | 8514 __ j(not_zero, &loop); |
| 8515 } | 8515 } |
| 8516 | 8516 |
| 8517 | 8517 |
| 8518 #undef __ | 8518 #undef __ |
| 8519 | 8519 |
| 8520 } } // namespace v8::internal | 8520 } } // namespace v8::internal |
| OLD | NEW |