Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/hydrogen.cc

Issue 24267012: Use New<> constructors in BuildBinaryOperation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7696 matching lines...) Expand 10 before | Expand all | Expand 10 after
7707 } 7707 }
7708 7708
7709 return value; 7709 return value;
7710 } 7710 }
7711 7711
7712 7712
7713 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( 7713 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
7714 BinaryOperation* expr, 7714 BinaryOperation* expr,
7715 HValue* left, 7715 HValue* left,
7716 HValue* right) { 7716 HValue* right) {
7717 HValue* context = environment()->context();
7718 Handle<Type> left_type = expr->left()->bounds().lower; 7717 Handle<Type> left_type = expr->left()->bounds().lower;
7719 Handle<Type> right_type = expr->right()->bounds().lower; 7718 Handle<Type> right_type = expr->right()->bounds().lower;
7720 Handle<Type> result_type = expr->bounds().lower; 7719 Handle<Type> result_type = expr->bounds().lower;
7721 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); 7720 Maybe<int> fixed_right_arg = expr->fixed_right_arg();
7722 7721
7723 return HGraphBuilder::BuildBinaryOperation(expr->op(), left, right, 7722 return HGraphBuilder::BuildBinaryOperation(expr->op(), left, right,
7724 left_type, right_type, result_type, fixed_right_arg, context); 7723 left_type, right_type, result_type, fixed_right_arg);
7725 } 7724 }
7726 7725
7727 7726
7728 HInstruction* HGraphBuilder::BuildBinaryOperation( 7727 HInstruction* HGraphBuilder::BuildBinaryOperation(
7729 Token::Value op, 7728 Token::Value op,
7730 HValue* left, 7729 HValue* left,
7731 HValue* right, 7730 HValue* right,
7732 Handle<Type> left_type, 7731 Handle<Type> left_type,
7733 Handle<Type> right_type, 7732 Handle<Type> right_type,
7734 Handle<Type> result_type, 7733 Handle<Type> result_type,
7735 Maybe<int> fixed_right_arg, 7734 Maybe<int> fixed_right_arg) {
7736 HValue* context) {
7737 7735
7738 Representation left_rep = Representation::FromType(left_type); 7736 Representation left_rep = Representation::FromType(left_type);
7739 Representation right_rep = Representation::FromType(right_type); 7737 Representation right_rep = Representation::FromType(right_type);
7740 7738
7741 bool maybe_string_add = op == Token::ADD && 7739 bool maybe_string_add = op == Token::ADD &&
7742 (left_type->Maybe(Type::String()) || 7740 (left_type->Maybe(Type::String()) ||
7743 right_type->Maybe(Type::String())); 7741 right_type->Maybe(Type::String()));
7744 7742
7745 if (left_type->Is(Type::None())) { 7743 if (left_type->Is(Type::None())) {
7746 Add<HDeoptimize>("Insufficient type feedback for LHS of binary operation", 7744 Add<HDeoptimize>("Insufficient type feedback for LHS of binary operation",
(...skipping 30 matching lines...) Expand all
7777 BuildCheckHeapObject(left); 7775 BuildCheckHeapObject(left);
7778 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); 7776 AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
7779 flags = STRING_ADD_CHECK_RIGHT; 7777 flags = STRING_ADD_CHECK_RIGHT;
7780 } 7778 }
7781 if (right_type->Is(Type::String())) { 7779 if (right_type->Is(Type::String())) {
7782 BuildCheckHeapObject(right); 7780 BuildCheckHeapObject(right);
7783 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); 7781 AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
7784 flags = (flags == STRING_ADD_CHECK_BOTH) 7782 flags = (flags == STRING_ADD_CHECK_BOTH)
7785 ? STRING_ADD_CHECK_LEFT : STRING_ADD_CHECK_NONE; 7783 ? STRING_ADD_CHECK_LEFT : STRING_ADD_CHECK_NONE;
7786 } 7784 }
7787 instr = HStringAdd::New(zone(), context, left, right, flags); 7785 instr = NewUncasted<HStringAdd>(left, right, flags);
7788 } else { 7786 } else {
7789 instr = HAdd::New(zone(), context, left, right); 7787 instr = NewUncasted<HAdd>(left, right);
7790 } 7788 }
7791 break; 7789 break;
7792 case Token::SUB: 7790 case Token::SUB:
7793 instr = HSub::New(zone(), context, left, right); 7791 instr = NewUncasted<HSub>(left, right);
7794 break; 7792 break;
7795 case Token::MUL: 7793 case Token::MUL:
7796 instr = HMul::New(zone(), context, left, right); 7794 instr = NewUncasted<HMul>(left, right);
7797 break; 7795 break;
7798 case Token::MOD: 7796 case Token::MOD:
7799 instr = HMod::New(zone(), context, left, right, fixed_right_arg); 7797 instr = NewUncasted<HMod>(left, right, fixed_right_arg);
7800 break; 7798 break;
7801 case Token::DIV: 7799 case Token::DIV:
7802 instr = HDiv::New(zone(), context, left, right); 7800 instr = NewUncasted<HDiv>(left, right);
7803 break; 7801 break;
7804 case Token::BIT_XOR: 7802 case Token::BIT_XOR:
7805 case Token::BIT_AND: 7803 case Token::BIT_AND:
7806 instr = NewUncasted<HBitwise>(op, left, right); 7804 instr = NewUncasted<HBitwise>(op, left, right);
7807 break; 7805 break;
7808 case Token::BIT_OR: { 7806 case Token::BIT_OR: {
7809 HValue* operand, *shift_amount; 7807 HValue* operand, *shift_amount;
7810 if (left_type->Is(Type::Signed32()) && 7808 if (left_type->Is(Type::Signed32()) &&
7811 right_type->Is(Type::Signed32()) && 7809 right_type->Is(Type::Signed32()) &&
7812 MatchRotateRight(left, right, &operand, &shift_amount)) { 7810 MatchRotateRight(left, right, &operand, &shift_amount)) {
7813 instr = new(zone()) HRor(context, operand, shift_amount); 7811 instr = NewUncasted<HRor>(operand, shift_amount);
7814 } else { 7812 } else {
7815 instr = NewUncasted<HBitwise>(op, left, right); 7813 instr = NewUncasted<HBitwise>(op, left, right);
7816 } 7814 }
7817 break; 7815 break;
7818 } 7816 }
7819 case Token::SAR: 7817 case Token::SAR:
7820 instr = HSar::New(zone(), context, left, right); 7818 instr = NewUncasted<HSar>(left, right);
7821 break; 7819 break;
7822 case Token::SHR: 7820 case Token::SHR:
7823 instr = HShr::New(zone(), context, left, right); 7821 instr = NewUncasted<HShr>(left, right);
7824 if (FLAG_opt_safe_uint32_operations && instr->IsShr() && 7822 if (FLAG_opt_safe_uint32_operations && instr->IsShr() &&
7825 CanBeZero(right)) { 7823 CanBeZero(right)) {
7826 graph()->RecordUint32Instruction(instr); 7824 graph()->RecordUint32Instruction(instr);
7827 } 7825 }
7828 break; 7826 break;
7829 case Token::SHL: 7827 case Token::SHL:
7830 instr = HShl::New(zone(), context, left, right); 7828 instr = NewUncasted<HShl>(left, right);
7831 break; 7829 break;
7832 default: 7830 default:
7833 UNREACHABLE(); 7831 UNREACHABLE();
7834 } 7832 }
7835 7833
7836 if (instr->IsBinaryOperation()) { 7834 if (instr->IsBinaryOperation()) {
7837 HBinaryOperation* binop = HBinaryOperation::cast(instr); 7835 HBinaryOperation* binop = HBinaryOperation::cast(instr);
7838 binop->set_observed_input_representation(1, left_rep); 7836 binop->set_observed_input_representation(1, left_rep);
7839 binop->set_observed_input_representation(2, right_rep); 7837 binop->set_observed_input_representation(2, right_rep);
7840 binop->initialize_output_representation(result_rep); 7838 binop->initialize_output_representation(result_rep);
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
9743 if (ShouldProduceTraceOutput()) { 9741 if (ShouldProduceTraceOutput()) {
9744 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9742 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9745 } 9743 }
9746 9744
9747 #ifdef DEBUG 9745 #ifdef DEBUG
9748 graph_->Verify(false); // No full verify. 9746 graph_->Verify(false); // No full verify.
9749 #endif 9747 #endif
9750 } 9748 }
9751 9749
9752 } } // namespace v8::internal 9750 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698