OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3348 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 3348 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
3349 Expression* target = expr->target(); | 3349 Expression* target = expr->target(); |
3350 VariableProxy* proxy = target->AsVariableProxy(); | 3350 VariableProxy* proxy = target->AsVariableProxy(); |
3351 Variable* var = proxy->AsVariable(); | 3351 Variable* var = proxy->AsVariable(); |
3352 Property* prop = target->AsProperty(); | 3352 Property* prop = target->AsProperty(); |
3353 ASSERT(var == NULL || prop == NULL); | 3353 ASSERT(var == NULL || prop == NULL); |
3354 | 3354 |
3355 // We have a second position recorded in the FullCodeGenerator to have | 3355 // We have a second position recorded in the FullCodeGenerator to have |
3356 // type feedback for the binary operation. | 3356 // type feedback for the binary operation. |
3357 BinaryOperation* operation = expr->binary_operation(); | 3357 BinaryOperation* operation = expr->binary_operation(); |
3358 operation->RecordTypeFeedback(oracle()); | |
3359 | 3358 |
3360 if (var != NULL) { | 3359 if (var != NULL) { |
3361 if (!var->is_global() && !var->IsStackAllocated()) { | 3360 if (!var->is_global() && !var->IsStackAllocated()) { |
3362 BAILOUT("non-stack/non-global in compound assignment"); | 3361 BAILOUT("non-stack/non-global in compound assignment"); |
3363 } | 3362 } |
3364 | 3363 |
3365 VISIT_FOR_VALUE(operation); | 3364 VISIT_FOR_VALUE(operation); |
3366 | 3365 |
3367 if (var->is_global()) { | 3366 if (var->is_global()) { |
3368 HandleGlobalVariableAssignment(var, | 3367 HandleGlobalVariableAssignment(var, |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4707 break; | 4706 break; |
4708 case Token::SHR: | 4707 case Token::SHR: |
4709 instr = new HShr(left, right); | 4708 instr = new HShr(left, right); |
4710 break; | 4709 break; |
4711 case Token::SHL: | 4710 case Token::SHL: |
4712 instr = new HShl(left, right); | 4711 instr = new HShl(left, right); |
4713 break; | 4712 break; |
4714 default: | 4713 default: |
4715 UNREACHABLE(); | 4714 UNREACHABLE(); |
4716 } | 4715 } |
4717 TypeInfo info = oracle()->BinaryType(expr, TypeFeedbackOracle::RESULT); | 4716 TypeInfo info = oracle()->BinaryType(expr); |
4718 // If we hit an uninitialized binary op stub we will get type info | 4717 // If we hit an uninitialized binary op stub we will get type info |
4719 // for a smi operation. If one of the operands is a constant string | 4718 // for a smi operation. If one of the operands is a constant string |
4720 // do not generate code assuming it is a smi operation. | 4719 // do not generate code assuming it is a smi operation. |
4721 if (info.IsSmi() && | 4720 if (info.IsSmi() && |
4722 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || | 4721 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
4723 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { | 4722 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { |
4724 return instr; | 4723 return instr; |
4725 } | 4724 } |
4726 if (FLAG_trace_representation) { | 4725 if (FLAG_trace_representation) { |
4727 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); | 4726 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 return; | 4851 return; |
4853 } | 4852 } |
4854 | 4853 |
4855 VISIT_FOR_VALUE(expr->left()); | 4854 VISIT_FOR_VALUE(expr->left()); |
4856 VISIT_FOR_VALUE(expr->right()); | 4855 VISIT_FOR_VALUE(expr->right()); |
4857 | 4856 |
4858 HValue* right = Pop(); | 4857 HValue* right = Pop(); |
4859 HValue* left = Pop(); | 4858 HValue* left = Pop(); |
4860 Token::Value op = expr->op(); | 4859 Token::Value op = expr->op(); |
4861 | 4860 |
4862 TypeInfo info = oracle()->CompareType(expr, TypeFeedbackOracle::RESULT); | 4861 TypeInfo info = oracle()->CompareType(expr); |
4863 HInstruction* instr = NULL; | 4862 HInstruction* instr = NULL; |
4864 if (op == Token::INSTANCEOF) { | 4863 if (op == Token::INSTANCEOF) { |
4865 instr = new HInstanceOf(left, right); | 4864 instr = new HInstanceOf(left, right); |
4866 } else if (op == Token::IN) { | 4865 } else if (op == Token::IN) { |
4867 BAILOUT("Unsupported comparison: in"); | 4866 BAILOUT("Unsupported comparison: in"); |
4868 } else if (info.IsNonPrimitive()) { | 4867 } else if (info.IsNonPrimitive()) { |
4869 switch (op) { | 4868 switch (op) { |
4870 case Token::EQ: | 4869 case Token::EQ: |
4871 case Token::EQ_STRICT: { | 4870 case Token::EQ_STRICT: { |
4872 AddInstruction(new HCheckNonSmi(left)); | 4871 AddInstruction(new HCheckNonSmi(left)); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 } | 5693 } |
5695 | 5694 |
5696 #ifdef DEBUG | 5695 #ifdef DEBUG |
5697 if (graph_ != NULL) graph_->Verify(); | 5696 if (graph_ != NULL) graph_->Verify(); |
5698 if (chunk_ != NULL) chunk_->Verify(); | 5697 if (chunk_ != NULL) chunk_->Verify(); |
5699 if (allocator_ != NULL) allocator_->Verify(); | 5698 if (allocator_ != NULL) allocator_->Verify(); |
5700 #endif | 5699 #endif |
5701 } | 5700 } |
5702 | 5701 |
5703 } } // namespace v8::internal | 5702 } } // namespace v8::internal |
OLD | NEW |