| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3383 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 3383 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
| 3384 Expression* target = expr->target(); | 3384 Expression* target = expr->target(); |
| 3385 VariableProxy* proxy = target->AsVariableProxy(); | 3385 VariableProxy* proxy = target->AsVariableProxy(); |
| 3386 Variable* var = proxy->AsVariable(); | 3386 Variable* var = proxy->AsVariable(); |
| 3387 Property* prop = target->AsProperty(); | 3387 Property* prop = target->AsProperty(); |
| 3388 ASSERT(var == NULL || prop == NULL); | 3388 ASSERT(var == NULL || prop == NULL); |
| 3389 | 3389 |
| 3390 // We have a second position recorded in the FullCodeGenerator to have | 3390 // We have a second position recorded in the FullCodeGenerator to have |
| 3391 // type feedback for the binary operation. | 3391 // type feedback for the binary operation. |
| 3392 BinaryOperation* operation = expr->binary_operation(); | 3392 BinaryOperation* operation = expr->binary_operation(); |
| 3393 operation->RecordTypeFeedback(oracle()); | |
| 3394 | 3393 |
| 3395 if (var != NULL) { | 3394 if (var != NULL) { |
| 3396 if (!var->is_global() && !var->IsStackAllocated()) { | 3395 if (!var->is_global() && !var->IsStackAllocated()) { |
| 3397 BAILOUT("non-stack/non-global in compound assignment"); | 3396 BAILOUT("non-stack/non-global in compound assignment"); |
| 3398 } | 3397 } |
| 3399 | 3398 |
| 3400 VISIT_FOR_VALUE(operation); | 3399 VISIT_FOR_VALUE(operation); |
| 3401 | 3400 |
| 3402 if (var->is_global()) { | 3401 if (var->is_global()) { |
| 3403 HandleGlobalVariableAssignment(var, | 3402 HandleGlobalVariableAssignment(var, |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4807 break; | 4806 break; |
| 4808 case Token::SHR: | 4807 case Token::SHR: |
| 4809 instr = new HShr(left, right); | 4808 instr = new HShr(left, right); |
| 4810 break; | 4809 break; |
| 4811 case Token::SHL: | 4810 case Token::SHL: |
| 4812 instr = new HShl(left, right); | 4811 instr = new HShl(left, right); |
| 4813 break; | 4812 break; |
| 4814 default: | 4813 default: |
| 4815 UNREACHABLE(); | 4814 UNREACHABLE(); |
| 4816 } | 4815 } |
| 4817 TypeInfo info = oracle()->BinaryType(expr, TypeFeedbackOracle::RESULT); | 4816 TypeInfo info = oracle()->BinaryType(expr); |
| 4818 // If we hit an uninitialized binary op stub we will get type info | 4817 // If we hit an uninitialized binary op stub we will get type info |
| 4819 // for a smi operation. If one of the operands is a constant string | 4818 // for a smi operation. If one of the operands is a constant string |
| 4820 // do not generate code assuming it is a smi operation. | 4819 // do not generate code assuming it is a smi operation. |
| 4821 if (info.IsSmi() && | 4820 if (info.IsSmi() && |
| 4822 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || | 4821 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
| 4823 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { | 4822 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { |
| 4824 return instr; | 4823 return instr; |
| 4825 } | 4824 } |
| 4826 if (FLAG_trace_representation) { | 4825 if (FLAG_trace_representation) { |
| 4827 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); | 4826 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4958 return; | 4957 return; |
| 4959 } | 4958 } |
| 4960 | 4959 |
| 4961 VISIT_FOR_VALUE(expr->left()); | 4960 VISIT_FOR_VALUE(expr->left()); |
| 4962 VISIT_FOR_VALUE(expr->right()); | 4961 VISIT_FOR_VALUE(expr->right()); |
| 4963 | 4962 |
| 4964 HValue* right = Pop(); | 4963 HValue* right = Pop(); |
| 4965 HValue* left = Pop(); | 4964 HValue* left = Pop(); |
| 4966 Token::Value op = expr->op(); | 4965 Token::Value op = expr->op(); |
| 4967 | 4966 |
| 4968 TypeInfo info = oracle()->CompareType(expr, TypeFeedbackOracle::RESULT); | 4967 TypeInfo info = oracle()->CompareType(expr); |
| 4969 HInstruction* instr = NULL; | 4968 HInstruction* instr = NULL; |
| 4970 if (op == Token::INSTANCEOF) { | 4969 if (op == Token::INSTANCEOF) { |
| 4971 // Check to see if the rhs of the instanceof is a global function not | 4970 // Check to see if the rhs of the instanceof is a global function not |
| 4972 // residing in new space. If it is we assume that the function will stay the | 4971 // residing in new space. If it is we assume that the function will stay the |
| 4973 // same. | 4972 // same. |
| 4974 Handle<JSFunction> target = Handle<JSFunction>::null(); | 4973 Handle<JSFunction> target = Handle<JSFunction>::null(); |
| 4975 Variable* var = expr->right()->AsVariableProxy()->AsVariable(); | 4974 Variable* var = expr->right()->AsVariableProxy()->AsVariable(); |
| 4976 bool global_function = (var != NULL) && var->is_global() && !var->is_this(); | 4975 bool global_function = (var != NULL) && var->is_global() && !var->is_this(); |
| 4977 CompilationInfo* info = graph()->info(); | 4976 CompilationInfo* info = graph()->info(); |
| 4978 if (global_function && | 4977 if (global_function && |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5879 } | 5878 } |
| 5880 } | 5879 } |
| 5881 | 5880 |
| 5882 #ifdef DEBUG | 5881 #ifdef DEBUG |
| 5883 if (graph_ != NULL) graph_->Verify(); | 5882 if (graph_ != NULL) graph_->Verify(); |
| 5884 if (allocator_ != NULL) allocator_->Verify(); | 5883 if (allocator_ != NULL) allocator_->Verify(); |
| 5885 #endif | 5884 #endif |
| 5886 } | 5885 } |
| 5887 | 5886 |
| 5888 } } // namespace v8::internal | 5887 } } // namespace v8::internal |
| OLD | NEW |