| 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 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3359 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 3359 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
| 3360 Expression* target = expr->target(); | 3360 Expression* target = expr->target(); |
| 3361 VariableProxy* proxy = target->AsVariableProxy(); | 3361 VariableProxy* proxy = target->AsVariableProxy(); |
| 3362 Variable* var = proxy->AsVariable(); | 3362 Variable* var = proxy->AsVariable(); |
| 3363 Property* prop = target->AsProperty(); | 3363 Property* prop = target->AsProperty(); |
| 3364 ASSERT(var == NULL || prop == NULL); | 3364 ASSERT(var == NULL || prop == NULL); |
| 3365 | 3365 |
| 3366 // We have a second position recorded in the FullCodeGenerator to have | 3366 // We have a second position recorded in the FullCodeGenerator to have |
| 3367 // type feedback for the binary operation. | 3367 // type feedback for the binary operation. |
| 3368 BinaryOperation* operation = expr->binary_operation(); | 3368 BinaryOperation* operation = expr->binary_operation(); |
| 3369 operation->RecordTypeFeedback(oracle()); |
| 3369 | 3370 |
| 3370 if (var != NULL) { | 3371 if (var != NULL) { |
| 3371 if (!var->is_global() && !var->IsStackAllocated()) { | 3372 if (!var->is_global() && !var->IsStackAllocated()) { |
| 3372 BAILOUT("non-stack/non-global in compound assignment"); | 3373 BAILOUT("non-stack/non-global in compound assignment"); |
| 3373 } | 3374 } |
| 3374 | 3375 |
| 3375 VISIT_FOR_VALUE(operation); | 3376 VISIT_FOR_VALUE(operation); |
| 3376 | 3377 |
| 3377 if (var->is_global()) { | 3378 if (var->is_global()) { |
| 3378 HandleGlobalVariableAssignment(var, | 3379 HandleGlobalVariableAssignment(var, |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4723 break; | 4724 break; |
| 4724 case Token::SHR: | 4725 case Token::SHR: |
| 4725 instr = new HShr(left, right); | 4726 instr = new HShr(left, right); |
| 4726 break; | 4727 break; |
| 4727 case Token::SHL: | 4728 case Token::SHL: |
| 4728 instr = new HShl(left, right); | 4729 instr = new HShl(left, right); |
| 4729 break; | 4730 break; |
| 4730 default: | 4731 default: |
| 4731 UNREACHABLE(); | 4732 UNREACHABLE(); |
| 4732 } | 4733 } |
| 4733 TypeInfo info = oracle()->BinaryType(expr); | 4734 TypeInfo info = oracle()->BinaryType(expr, TypeFeedbackOracle::RESULT); |
| 4734 // If we hit an uninitialized binary op stub we will get type info | 4735 // If we hit an uninitialized binary op stub we will get type info |
| 4735 // for a smi operation. If one of the operands is a constant string | 4736 // for a smi operation. If one of the operands is a constant string |
| 4736 // do not generate code assuming it is a smi operation. | 4737 // do not generate code assuming it is a smi operation. |
| 4737 if (info.IsSmi() && | 4738 if (info.IsSmi() && |
| 4738 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || | 4739 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
| 4739 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { | 4740 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { |
| 4740 return instr; | 4741 return instr; |
| 4741 } | 4742 } |
| 4742 if (FLAG_trace_representation) { | 4743 if (FLAG_trace_representation) { |
| 4743 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); | 4744 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4868 return; | 4869 return; |
| 4869 } | 4870 } |
| 4870 | 4871 |
| 4871 VISIT_FOR_VALUE(expr->left()); | 4872 VISIT_FOR_VALUE(expr->left()); |
| 4872 VISIT_FOR_VALUE(expr->right()); | 4873 VISIT_FOR_VALUE(expr->right()); |
| 4873 | 4874 |
| 4874 HValue* right = Pop(); | 4875 HValue* right = Pop(); |
| 4875 HValue* left = Pop(); | 4876 HValue* left = Pop(); |
| 4876 Token::Value op = expr->op(); | 4877 Token::Value op = expr->op(); |
| 4877 | 4878 |
| 4878 TypeInfo info = oracle()->CompareType(expr); | 4879 TypeInfo info = oracle()->CompareType(expr, TypeFeedbackOracle::RESULT); |
| 4879 HInstruction* instr = NULL; | 4880 HInstruction* instr = NULL; |
| 4880 if (op == Token::INSTANCEOF) { | 4881 if (op == Token::INSTANCEOF) { |
| 4881 // Check to see if the rhs of the instanceof is a global function not | 4882 // Check to see if the rhs of the instanceof is a global function not |
| 4882 // residing in new space. If it is we assume that the function will stay the | 4883 // residing in new space. If it is we assume that the function will stay the |
| 4883 // same. | 4884 // same. |
| 4884 Handle<JSFunction> target = Handle<JSFunction>::null(); | 4885 Handle<JSFunction> target = Handle<JSFunction>::null(); |
| 4885 Variable* var = expr->right()->AsVariableProxy()->AsVariable(); | 4886 Variable* var = expr->right()->AsVariableProxy()->AsVariable(); |
| 4886 bool global_function = (var != NULL) && var->is_global() && !var->is_this(); | 4887 bool global_function = (var != NULL) && var->is_global() && !var->is_this(); |
| 4887 CompilationInfo* info = graph()->info(); | 4888 CompilationInfo* info = graph()->info(); |
| 4888 if (global_function && | 4889 if (global_function && |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5775 } | 5776 } |
| 5776 | 5777 |
| 5777 #ifdef DEBUG | 5778 #ifdef DEBUG |
| 5778 if (graph_ != NULL) graph_->Verify(); | 5779 if (graph_ != NULL) graph_->Verify(); |
| 5779 if (chunk_ != NULL) chunk_->Verify(); | 5780 if (chunk_ != NULL) chunk_->Verify(); |
| 5780 if (allocator_ != NULL) allocator_->Verify(); | 5781 if (allocator_ != NULL) allocator_->Verify(); |
| 5781 #endif | 5782 #endif |
| 5782 } | 5783 } |
| 5783 | 5784 |
| 5784 } } // namespace v8::internal | 5785 } } // namespace v8::internal |
| OLD | NEW |