OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5369 } | 5369 } |
5370 return BuildLoadNamedField(checked_string, HObjectAccess::ForStringLength()); | 5370 return BuildLoadNamedField(checked_string, HObjectAccess::ForStringLength()); |
5371 } | 5371 } |
5372 | 5372 |
5373 | 5373 |
5374 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric( | 5374 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric( |
5375 HValue* object, | 5375 HValue* object, |
5376 Handle<String> name, | 5376 Handle<String> name, |
5377 Property* expr) { | 5377 Property* expr) { |
5378 if (expr->IsUninitialized()) { | 5378 if (expr->IsUninitialized()) { |
5379 Add<HDeoptimize>("Insufficient feedback for generic named load", | 5379 Add<HDeoptimize>("Insufficient type feedback for generic named load", |
5380 Deoptimizer::SOFT); | 5380 Deoptimizer::SOFT); |
5381 } | 5381 } |
5382 HValue* context = environment()->context(); | 5382 HValue* context = environment()->context(); |
5383 return new(zone()) HLoadNamedGeneric(context, object, name); | 5383 return new(zone()) HLoadNamedGeneric(context, object, name); |
5384 } | 5384 } |
5385 | 5385 |
5386 | 5386 |
5387 HInstruction* HOptimizedGraphBuilder::BuildCallGetter( | 5387 HInstruction* HOptimizedGraphBuilder::BuildCallGetter( |
5388 HValue* object, | 5388 HValue* object, |
5389 Handle<Map> map, | 5389 Handle<Map> map, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5683 if (!is_store) { | 5683 if (!is_store) { |
5684 Push(access); | 5684 Push(access); |
5685 } | 5685 } |
5686 NoObservableSideEffectsScope scope(this); | 5686 NoObservableSideEffectsScope scope(this); |
5687 current_block()->GotoNoSimulate(join); | 5687 current_block()->GotoNoSimulate(join); |
5688 set_current_block(other_map); | 5688 set_current_block(other_map); |
5689 } | 5689 } |
5690 | 5690 |
5691 // Deopt if none of the cases matched. | 5691 // Deopt if none of the cases matched. |
5692 NoObservableSideEffectsScope scope(this); | 5692 NoObservableSideEffectsScope scope(this); |
5693 FinishExitWithHardDeoptimization("Unknown type in polymorphic element access", | 5693 FinishExitWithHardDeoptimization("Unknown map in polymorphic element access", |
5694 join); | 5694 join); |
5695 set_current_block(join); | 5695 set_current_block(join); |
5696 return is_store ? NULL : Pop(); | 5696 return is_store ? NULL : Pop(); |
5697 } | 5697 } |
5698 | 5698 |
5699 | 5699 |
5700 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( | 5700 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
5701 HValue* obj, | 5701 HValue* obj, |
5702 HValue* key, | 5702 HValue* key, |
5703 HValue* val, | 5703 HValue* val, |
(...skipping 16 matching lines...) Expand all Loading... |
5720 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); | 5720 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); |
5721 } | 5721 } |
5722 } else if (expr->GetReceiverTypes() != NULL && | 5722 } else if (expr->GetReceiverTypes() != NULL && |
5723 !expr->GetReceiverTypes()->is_empty()) { | 5723 !expr->GetReceiverTypes()->is_empty()) { |
5724 return HandlePolymorphicElementAccess( | 5724 return HandlePolymorphicElementAccess( |
5725 obj, key, val, expr, ast_id, position, is_store, | 5725 obj, key, val, expr, ast_id, position, is_store, |
5726 expr->GetStoreMode(), has_side_effects); | 5726 expr->GetStoreMode(), has_side_effects); |
5727 } else { | 5727 } else { |
5728 if (is_store) { | 5728 if (is_store) { |
5729 if (expr->IsAssignment() && expr->AsAssignment()->IsUninitialized()) { | 5729 if (expr->IsAssignment() && expr->AsAssignment()->IsUninitialized()) { |
5730 Add<HDeoptimize>("Insufficient feedback for keyed store", | 5730 Add<HDeoptimize>("Insufficient type feedback for keyed store", |
5731 Deoptimizer::SOFT); | 5731 Deoptimizer::SOFT); |
5732 } | 5732 } |
5733 instr = BuildStoreKeyedGeneric(obj, key, val); | 5733 instr = BuildStoreKeyedGeneric(obj, key, val); |
5734 } else { | 5734 } else { |
5735 if (expr->AsProperty()->IsUninitialized()) { | 5735 if (expr->AsProperty()->IsUninitialized()) { |
5736 Add<HDeoptimize>("Insufficient feedback for keyed load", | 5736 Add<HDeoptimize>("Insufficient type feedback for keyed load", |
5737 Deoptimizer::SOFT); | 5737 Deoptimizer::SOFT); |
5738 } | 5738 } |
5739 instr = BuildLoadKeyedGeneric(obj, key); | 5739 instr = BuildLoadKeyedGeneric(obj, key); |
5740 } | 5740 } |
5741 AddInstruction(instr); | 5741 AddInstruction(instr); |
5742 } | 5742 } |
5743 if (position != RelocInfo::kNoPosition) instr->set_position(position); | 5743 if (position != RelocInfo::kNoPosition) instr->set_position(position); |
5744 *has_side_effects = instr->HasObservableSideEffects(); | 5744 *has_side_effects = instr->HasObservableSideEffects(); |
5745 return instr; | 5745 return instr; |
5746 } | 5746 } |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7738 | 7738 |
7739 if (expr->op() != Token::ADD || | 7739 if (expr->op() != Token::ADD || |
7740 (left->type().IsNonString() && right->type().IsNonString())) { | 7740 (left->type().IsNonString() && right->type().IsNonString())) { |
7741 // For addition we can only truncate the arguments to number if we can | 7741 // For addition we can only truncate the arguments to number if we can |
7742 // prove that we will not end up in string concatenation mode. | 7742 // prove that we will not end up in string concatenation mode. |
7743 left = TruncateToNumber(left, &left_type); | 7743 left = TruncateToNumber(left, &left_type); |
7744 right = TruncateToNumber(right, &right_type); | 7744 right = TruncateToNumber(right, &right_type); |
7745 } | 7745 } |
7746 | 7746 |
7747 if (left_type->Is(Type::None())) { | 7747 if (left_type->Is(Type::None())) { |
7748 Add<HDeoptimize>("Insufficient type feedback for left side", | 7748 Add<HDeoptimize>("Insufficient type feedback for LHS of binary operation", |
7749 Deoptimizer::SOFT); | 7749 Deoptimizer::SOFT); |
7750 // TODO(rossberg): we should be able to get rid of non-continuous defaults. | 7750 // TODO(rossberg): we should be able to get rid of non-continuous defaults. |
7751 left_type = handle(Type::Any(), isolate()); | 7751 left_type = handle(Type::Any(), isolate()); |
7752 } | 7752 } |
7753 if (right_type->Is(Type::None())) { | 7753 if (right_type->Is(Type::None())) { |
7754 Add<HDeoptimize>("Insufficient type feedback for right side", | 7754 Add<HDeoptimize>("Insufficient type feedback for RHS of binary operation", |
7755 Deoptimizer::SOFT); | 7755 Deoptimizer::SOFT); |
7756 right_type = handle(Type::Any(), isolate()); | 7756 right_type = handle(Type::Any(), isolate()); |
7757 } | 7757 } |
7758 HInstruction* instr = NULL; | 7758 HInstruction* instr = NULL; |
7759 switch (expr->op()) { | 7759 switch (expr->op()) { |
7760 case Token::ADD: | 7760 case Token::ADD: |
7761 if (left_type->Is(Type::String()) && right_type->Is(Type::String())) { | 7761 if (left_type->Is(Type::String()) && right_type->Is(Type::String())) { |
7762 BuildCheckHeapObject(left); | 7762 BuildCheckHeapObject(left); |
7763 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); | 7763 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); |
7764 BuildCheckHeapObject(right); | 7764 BuildCheckHeapObject(right); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8095 // TODO(olivf) InvokeFunction produces a check for the parameter count, | 8095 // TODO(olivf) InvokeFunction produces a check for the parameter count, |
8096 // even though we are certain to pass the correct number of arguments here. | 8096 // even though we are certain to pass the correct number of arguments here. |
8097 HInstruction* result = new(zone()) HInvokeFunction(context, function, 2); | 8097 HInstruction* result = new(zone()) HInvokeFunction(context, function, 2); |
8098 result->set_position(expr->position()); | 8098 result->set_position(expr->position()); |
8099 return ast_context()->ReturnInstruction(result, expr->id()); | 8099 return ast_context()->ReturnInstruction(result, expr->id()); |
8100 } | 8100 } |
8101 | 8101 |
8102 // Cases handled below depend on collected type feedback. They should | 8102 // Cases handled below depend on collected type feedback. They should |
8103 // soft deoptimize when there is no type feedback. | 8103 // soft deoptimize when there is no type feedback. |
8104 if (combined_type->Is(Type::None())) { | 8104 if (combined_type->Is(Type::None())) { |
8105 Add<HDeoptimize>("insufficient type feedback for combined type", | 8105 Add<HDeoptimize>("Insufficient type feedback for combined type " |
| 8106 "of binary operation", |
8106 Deoptimizer::SOFT); | 8107 Deoptimizer::SOFT); |
8107 combined_type = left_type = right_type = handle(Type::Any(), isolate()); | 8108 combined_type = left_type = right_type = handle(Type::Any(), isolate()); |
8108 } | 8109 } |
8109 | 8110 |
8110 if (combined_type->Is(Type::Receiver())) { | 8111 if (combined_type->Is(Type::Receiver())) { |
8111 switch (op) { | 8112 switch (op) { |
8112 case Token::EQ: | 8113 case Token::EQ: |
8113 case Token::EQ_STRICT: { | 8114 case Token::EQ_STRICT: { |
8114 // Can we get away with map check and not instance type check? | 8115 // Can we get away with map check and not instance type check? |
8115 if (combined_type->IsClass()) { | 8116 if (combined_type->IsClass()) { |
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9718 if (ShouldProduceTraceOutput()) { | 9719 if (ShouldProduceTraceOutput()) { |
9719 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9720 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9720 } | 9721 } |
9721 | 9722 |
9722 #ifdef DEBUG | 9723 #ifdef DEBUG |
9723 graph_->Verify(false); // No full verify. | 9724 graph_->Verify(false); // No full verify. |
9724 #endif | 9725 #endif |
9725 } | 9726 } |
9726 | 9727 |
9727 } } // namespace v8::internal | 9728 } } // namespace v8::internal |
OLD | NEW |