OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 5109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5120 | 5120 |
5121 | 5121 |
5122 void DeferredInlineBinaryOperation::Generate() { | 5122 void DeferredInlineBinaryOperation::Generate() { |
5123 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); | 5123 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); |
5124 stub.GenerateCall(masm_, left_, right_); | 5124 stub.GenerateCall(masm_, left_, right_); |
5125 if (!dst_.is(rax)) __ movq(dst_, rax); | 5125 if (!dst_.is(rax)) __ movq(dst_, rax); |
5126 } | 5126 } |
5127 | 5127 |
5128 | 5128 |
5129 void CodeGenerator::GenericBinaryOperation(Token::Value op, | 5129 void CodeGenerator::GenericBinaryOperation(Token::Value op, |
5130 SmiAnalysis* type, | 5130 StaticType* type, |
5131 OverwriteMode overwrite_mode) { | 5131 OverwriteMode overwrite_mode) { |
5132 Comment cmnt(masm_, "[ BinaryOperation"); | 5132 Comment cmnt(masm_, "[ BinaryOperation"); |
5133 Comment cmnt_token(masm_, Token::String(op)); | 5133 Comment cmnt_token(masm_, Token::String(op)); |
5134 | 5134 |
5135 if (op == Token::COMMA) { | 5135 if (op == Token::COMMA) { |
5136 // Simply discard left value. | 5136 // Simply discard left value. |
5137 frame_->Nip(1); | 5137 frame_->Nip(1); |
5138 return; | 5138 return; |
5139 } | 5139 } |
5140 | 5140 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5309 overwrite_mode_, | 5309 overwrite_mode_, |
5310 (op_ == Token::MOD) ? NO_GENERIC_BINARY_FLAGS : NO_SMI_CODE_IN_STUB); | 5310 (op_ == Token::MOD) ? NO_GENERIC_BINARY_FLAGS : NO_SMI_CODE_IN_STUB); |
5311 stub.GenerateCall(masm_, src_, value_); | 5311 stub.GenerateCall(masm_, src_, value_); |
5312 if (!dst_.is(rax)) __ movq(dst_, rax); | 5312 if (!dst_.is(rax)) __ movq(dst_, rax); |
5313 } | 5313 } |
5314 | 5314 |
5315 | 5315 |
5316 void CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, | 5316 void CodeGenerator::ConstantSmiBinaryOperation(Token::Value op, |
5317 Result* operand, | 5317 Result* operand, |
5318 Handle<Object> value, | 5318 Handle<Object> value, |
5319 SmiAnalysis* type, | 5319 StaticType* type, |
5320 bool reversed, | 5320 bool reversed, |
5321 OverwriteMode overwrite_mode) { | 5321 OverwriteMode overwrite_mode) { |
5322 // NOTE: This is an attempt to inline (a bit) more of the code for | 5322 // NOTE: This is an attempt to inline (a bit) more of the code for |
5323 // some possible smi operations (like + and -) when (at least) one | 5323 // some possible smi operations (like + and -) when (at least) one |
5324 // of the operands is a constant smi. | 5324 // of the operands is a constant smi. |
5325 // Consumes the argument "operand". | 5325 // Consumes the argument "operand". |
5326 | 5326 |
5327 // TODO(199): Optimize some special cases of operations involving a | 5327 // TODO(199): Optimize some special cases of operations involving a |
5328 // smi literal (multiply by 2, shift by 0, etc.). | 5328 // smi literal (multiply by 2, shift by 0, etc.). |
5329 if (IsUnsafeSmi(value)) { | 5329 if (IsUnsafeSmi(value)) { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6092 break; | 6092 break; |
6093 } | 6093 } |
6094 | 6094 |
6095 case KEYED: { | 6095 case KEYED: { |
6096 Comment cmnt(masm, "[ Store to keyed Property"); | 6096 Comment cmnt(masm, "[ Store to keyed Property"); |
6097 | 6097 |
6098 // Generate inlined version of the keyed store if the code is in | 6098 // Generate inlined version of the keyed store if the code is in |
6099 // a loop and the key is likely to be a smi. | 6099 // a loop and the key is likely to be a smi. |
6100 Property* property = expression()->AsProperty(); | 6100 Property* property = expression()->AsProperty(); |
6101 ASSERT(property != NULL); | 6101 ASSERT(property != NULL); |
6102 SmiAnalysis* key_smi_analysis = property->key()->type(); | 6102 StaticType* key_smi_analysis = property->key()->type(); |
6103 | 6103 |
6104 if (cgen_->loop_nesting() > 0 && key_smi_analysis->IsLikelySmi()) { | 6104 if (cgen_->loop_nesting() > 0 && key_smi_analysis->IsLikelySmi()) { |
6105 Comment cmnt(masm, "[ Inlined store to keyed Property"); | 6105 Comment cmnt(masm, "[ Inlined store to keyed Property"); |
6106 | 6106 |
6107 // Get the receiver, key and value into registers. | 6107 // Get the receiver, key and value into registers. |
6108 Result value = cgen_->frame()->Pop(); | 6108 Result value = cgen_->frame()->Pop(); |
6109 Result key = cgen_->frame()->Pop(); | 6109 Result key = cgen_->frame()->Pop(); |
6110 Result receiver = cgen_->frame()->Pop(); | 6110 Result receiver = cgen_->frame()->Pop(); |
6111 | 6111 |
6112 Result tmp = cgen_->allocator_->Allocate(); | 6112 Result tmp = cgen_->allocator_->Allocate(); |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8207 masm.GetCode(&desc); | 8207 masm.GetCode(&desc); |
8208 // Call the function from C++. | 8208 // Call the function from C++. |
8209 return FUNCTION_CAST<ModuloFunction>(buffer); | 8209 return FUNCTION_CAST<ModuloFunction>(buffer); |
8210 } | 8210 } |
8211 | 8211 |
8212 #endif | 8212 #endif |
8213 | 8213 |
8214 #undef __ | 8214 #undef __ |
8215 | 8215 |
8216 } } // namespace v8::internal | 8216 } } // namespace v8::internal |
OLD | NEW |