Use New<> constructors in BuildBinaryOperation.

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/24267012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16853 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
olivf@chromium.org 2013-09-20 09:25:10 +00:00
parent b4f120eadd
commit 06be8bf0d5
3 changed files with 24 additions and 19 deletions

View File

@ -4961,9 +4961,11 @@ class HSar V8_FINAL : public HBitwiseBinaryOperation {
class HRor V8_FINAL : public HBitwiseBinaryOperation { class HRor V8_FINAL : public HBitwiseBinaryOperation {
public: public:
HRor(HValue* context, HValue* left, HValue* right) static HInstruction* New(Zone* zone,
: HBitwiseBinaryOperation(context, left, right) { HValue* context,
ChangeRepresentation(Representation::Integer32()); HValue* left,
HValue* right) {
return new(zone) HRor(context, left, right);
} }
virtual void UpdateRepresentation(Representation new_rep, virtual void UpdateRepresentation(Representation new_rep,
@ -4977,6 +4979,12 @@ class HRor V8_FINAL : public HBitwiseBinaryOperation {
protected: protected:
virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
private:
HRor(HValue* context, HValue* left, HValue* right)
: HBitwiseBinaryOperation(context, left, right) {
ChangeRepresentation(Representation::Integer32());
}
}; };

View File

@ -7714,14 +7714,13 @@ HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
BinaryOperation* expr, BinaryOperation* expr,
HValue* left, HValue* left,
HValue* right) { HValue* right) {
HValue* context = environment()->context();
Handle<Type> left_type = expr->left()->bounds().lower; Handle<Type> left_type = expr->left()->bounds().lower;
Handle<Type> right_type = expr->right()->bounds().lower; Handle<Type> right_type = expr->right()->bounds().lower;
Handle<Type> result_type = expr->bounds().lower; Handle<Type> result_type = expr->bounds().lower;
Maybe<int> fixed_right_arg = expr->fixed_right_arg(); Maybe<int> fixed_right_arg = expr->fixed_right_arg();
return HGraphBuilder::BuildBinaryOperation(expr->op(), left, right, return HGraphBuilder::BuildBinaryOperation(expr->op(), left, right,
left_type, right_type, result_type, fixed_right_arg, context); left_type, right_type, result_type, fixed_right_arg);
} }
@ -7732,8 +7731,7 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(
Handle<Type> left_type, Handle<Type> left_type,
Handle<Type> right_type, Handle<Type> right_type,
Handle<Type> result_type, Handle<Type> result_type,
Maybe<int> fixed_right_arg, Maybe<int> fixed_right_arg) {
HValue* context) {
Representation left_rep = Representation::FromType(left_type); Representation left_rep = Representation::FromType(left_type);
Representation right_rep = Representation::FromType(right_type); Representation right_rep = Representation::FromType(right_type);
@ -7784,22 +7782,22 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(
flags = (flags == STRING_ADD_CHECK_BOTH) flags = (flags == STRING_ADD_CHECK_BOTH)
? STRING_ADD_CHECK_LEFT : STRING_ADD_CHECK_NONE; ? STRING_ADD_CHECK_LEFT : STRING_ADD_CHECK_NONE;
} }
instr = HStringAdd::New(zone(), context, left, right, flags); instr = NewUncasted<HStringAdd>(left, right, flags);
} else { } else {
instr = HAdd::New(zone(), context, left, right); instr = NewUncasted<HAdd>(left, right);
} }
break; break;
case Token::SUB: case Token::SUB:
instr = HSub::New(zone(), context, left, right); instr = NewUncasted<HSub>(left, right);
break; break;
case Token::MUL: case Token::MUL:
instr = HMul::New(zone(), context, left, right); instr = NewUncasted<HMul>(left, right);
break; break;
case Token::MOD: case Token::MOD:
instr = HMod::New(zone(), context, left, right, fixed_right_arg); instr = NewUncasted<HMod>(left, right, fixed_right_arg);
break; break;
case Token::DIV: case Token::DIV:
instr = HDiv::New(zone(), context, left, right); instr = NewUncasted<HDiv>(left, right);
break; break;
case Token::BIT_XOR: case Token::BIT_XOR:
case Token::BIT_AND: case Token::BIT_AND:
@ -7810,24 +7808,24 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(
if (left_type->Is(Type::Signed32()) && if (left_type->Is(Type::Signed32()) &&
right_type->Is(Type::Signed32()) && right_type->Is(Type::Signed32()) &&
MatchRotateRight(left, right, &operand, &shift_amount)) { MatchRotateRight(left, right, &operand, &shift_amount)) {
instr = new(zone()) HRor(context, operand, shift_amount); instr = NewUncasted<HRor>(operand, shift_amount);
} else { } else {
instr = NewUncasted<HBitwise>(op, left, right); instr = NewUncasted<HBitwise>(op, left, right);
} }
break; break;
} }
case Token::SAR: case Token::SAR:
instr = HSar::New(zone(), context, left, right); instr = NewUncasted<HSar>(left, right);
break; break;
case Token::SHR: case Token::SHR:
instr = HShr::New(zone(), context, left, right); instr = NewUncasted<HShr>(left, right);
if (FLAG_opt_safe_uint32_operations && instr->IsShr() && if (FLAG_opt_safe_uint32_operations && instr->IsShr() &&
CanBeZero(right)) { CanBeZero(right)) {
graph()->RecordUint32Instruction(instr); graph()->RecordUint32Instruction(instr);
} }
break; break;
case Token::SHL: case Token::SHL:
instr = HShl::New(zone(), context, left, right); instr = NewUncasted<HShl>(left, right);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();

View File

@ -1272,8 +1272,7 @@ class HGraphBuilder {
Handle<Type> left_type, Handle<Type> left_type,
Handle<Type> right_type, Handle<Type> right_type,
Handle<Type> result_type, Handle<Type> result_type,
Maybe<int> fixed_right_arg, Maybe<int> fixed_right_arg);
HValue* context);
HLoadNamedField* AddLoadFixedArrayLength(HValue *object); HLoadNamedField* AddLoadFixedArrayLength(HValue *object);