Fix IfBuilder to use instruction factories. Add missing instruction factories.
This also makes the instruction constructors private and fixes all uses of the public constructors to use the factory methods instead. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/23654051 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16808 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
bf192205ce
commit
557e9b9d5c
@ -1351,14 +1351,12 @@ class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> {
|
||||
|
||||
class HBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
HBranch(HValue* value,
|
||||
ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target),
|
||||
expected_input_types_(expected_input_types) {
|
||||
SetFlag(kAllowUndefinedAsNaN);
|
||||
}
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*,
|
||||
ToBooleanStub::Types);
|
||||
DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*,
|
||||
ToBooleanStub::Types,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||
return Representation::None();
|
||||
@ -1372,20 +1370,24 @@ class HBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
DECLARE_CONCRETE_INSTRUCTION(Branch)
|
||||
|
||||
private:
|
||||
HBranch(HValue* value,
|
||||
ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target),
|
||||
expected_input_types_(expected_input_types) {
|
||||
SetFlag(kAllowUndefinedAsNaN);
|
||||
}
|
||||
|
||||
ToBooleanStub::Types expected_input_types_;
|
||||
};
|
||||
|
||||
|
||||
class HCompareMap V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
HCompareMap(HValue* value,
|
||||
Handle<Map> map,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target),
|
||||
map_(map) {
|
||||
ASSERT(!map.is_null());
|
||||
}
|
||||
DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>);
|
||||
DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
||||
|
||||
@ -1401,6 +1403,14 @@ class HCompareMap V8_FINAL : public HUnaryControlInstruction {
|
||||
virtual int RedefinedOperandIndex() { return 0; }
|
||||
|
||||
private:
|
||||
HCompareMap(HValue* value,
|
||||
Handle<Map> map,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target), map_(map) {
|
||||
ASSERT(!map.is_null());
|
||||
}
|
||||
|
||||
Handle<Map> map_;
|
||||
};
|
||||
|
||||
@ -4033,13 +4043,11 @@ class HCompareGeneric V8_FINAL : public HBinaryOperation {
|
||||
|
||||
class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
|
||||
public:
|
||||
HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token)
|
||||
: token_(token) {
|
||||
SetFlag(kFlexibleRepresentation);
|
||||
ASSERT(Token::IsCompareOp(token));
|
||||
SetOperandAt(0, left);
|
||||
SetOperandAt(1, right);
|
||||
}
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch,
|
||||
HValue*, HValue*, Token::Value);
|
||||
DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch,
|
||||
HValue*, HValue*, Token::Value,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
HValue* left() { return OperandAt(0); }
|
||||
HValue* right() { return OperandAt(1); }
|
||||
@ -4065,6 +4073,20 @@ class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch)
|
||||
|
||||
private:
|
||||
HCompareNumericAndBranch(HValue* left,
|
||||
HValue* right,
|
||||
Token::Value token,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: token_(token) {
|
||||
SetFlag(kFlexibleRepresentation);
|
||||
ASSERT(Token::IsCompareOp(token));
|
||||
SetOperandAt(0, left);
|
||||
SetOperandAt(1, right);
|
||||
SetSuccessorAt(0, true_target);
|
||||
SetSuccessorAt(1, false_target);
|
||||
}
|
||||
|
||||
Representation observed_input_representation_[2];
|
||||
Token::Value token_;
|
||||
};
|
||||
@ -4072,16 +4094,6 @@ class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
|
||||
|
||||
class HCompareHoleAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
// TODO(danno): make this private when the IfBuilder properly constructs
|
||||
// control flow instructions.
|
||||
HCompareHoleAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {
|
||||
SetFlag(kFlexibleRepresentation);
|
||||
SetFlag(kAllowUndefinedAsNaN);
|
||||
}
|
||||
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
@ -4094,20 +4106,23 @@ class HCompareHoleAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch)
|
||||
|
||||
private:
|
||||
HCompareHoleAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {
|
||||
SetFlag(kFlexibleRepresentation);
|
||||
SetFlag(kAllowUndefinedAsNaN);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> {
|
||||
public:
|
||||
// TODO(danno): make this private when the IfBuilder properly constructs
|
||||
// control flow instructions.
|
||||
HCompareObjectEqAndBranch(HValue* left,
|
||||
HValue* right) {
|
||||
SetOperandAt(0, left);
|
||||
SetOperandAt(1, right);
|
||||
}
|
||||
|
||||
DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
HValue* left() { return OperandAt(0); }
|
||||
HValue* right() { return OperandAt(1); }
|
||||
@ -4123,38 +4138,65 @@ class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> {
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch)
|
||||
|
||||
private:
|
||||
HCompareObjectEqAndBranch(HValue* left,
|
||||
HValue* right,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL) {
|
||||
SetOperandAt(0, left);
|
||||
SetOperandAt(1, right);
|
||||
SetSuccessorAt(0, true_target);
|
||||
SetSuccessorAt(1, false_target);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
explicit HIsObjectAndBranch(HValue* value)
|
||||
: HUnaryControlInstruction(value, NULL, NULL) { }
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||
return Representation::Tagged();
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
|
||||
|
||||
private:
|
||||
HIsObjectAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {}
|
||||
};
|
||||
|
||||
|
||||
class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
explicit HIsStringAndBranch(HValue* value)
|
||||
: HUnaryControlInstruction(value, NULL, NULL) { }
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||
return Representation::Tagged();
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
|
||||
|
||||
private:
|
||||
HIsStringAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {}
|
||||
};
|
||||
|
||||
|
||||
class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
explicit HIsSmiAndBranch(HValue* value)
|
||||
: HUnaryControlInstruction(value, NULL, NULL) { }
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch)
|
||||
|
||||
@ -4164,19 +4206,32 @@ class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
|
||||
protected:
|
||||
virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
||||
|
||||
private:
|
||||
HIsSmiAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {}
|
||||
};
|
||||
|
||||
|
||||
class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction {
|
||||
public:
|
||||
explicit HIsUndetectableAndBranch(HValue* value)
|
||||
: HUnaryControlInstruction(value, NULL, NULL) { }
|
||||
DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*);
|
||||
DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*,
|
||||
HBasicBlock*, HBasicBlock*);
|
||||
|
||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||
return Representation::Tagged();
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
|
||||
|
||||
private:
|
||||
HIsUndetectableAndBranch(HValue* value,
|
||||
HBasicBlock* true_target = NULL,
|
||||
HBasicBlock* false_target = NULL)
|
||||
: HUnaryControlInstruction(value, true_target, false_target) {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ HBasicBlock* HOsrBuilder::BuildPossibleOsrLoopEntry(
|
||||
HBasicBlock* non_osr_entry = graph->CreateBasicBlock();
|
||||
osr_entry_ = graph->CreateBasicBlock();
|
||||
HValue* true_value = graph->GetConstantTrue();
|
||||
HBranch* test = new(zone) HBranch(true_value, ToBooleanStub::Types(),
|
||||
HBranch* test = builder_->New<HBranch>(true_value, ToBooleanStub::Types(),
|
||||
non_osr_entry, osr_entry_);
|
||||
builder_->current_block()->Finish(test);
|
||||
|
||||
|
@ -815,9 +815,8 @@ void HGraphBuilder::IfBuilder::Then() {
|
||||
HConstant* constant_false = builder_->graph()->GetConstantFalse();
|
||||
ToBooleanStub::Types boolean_type = ToBooleanStub::Types();
|
||||
boolean_type.Add(ToBooleanStub::BOOLEAN);
|
||||
HBranch* branch =
|
||||
new(zone()) HBranch(constant_false, boolean_type, first_true_block_,
|
||||
first_false_block_);
|
||||
HBranch* branch = builder()->New<HBranch>(
|
||||
constant_false, boolean_type, first_true_block_, first_false_block_);
|
||||
builder_->current_block()->Finish(branch);
|
||||
}
|
||||
builder_->set_current_block(first_true_block_);
|
||||
@ -949,11 +948,8 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
|
||||
|
||||
builder_->set_current_block(header_block_);
|
||||
env->Pop();
|
||||
HCompareNumericAndBranch* compare =
|
||||
new(zone()) HCompareNumericAndBranch(phi_, terminating, token);
|
||||
compare->SetSuccessorAt(0, body_block_);
|
||||
compare->SetSuccessorAt(1, exit_block_);
|
||||
builder_->current_block()->Finish(compare);
|
||||
builder_->current_block()->Finish(builder_->New<HCompareNumericAndBranch>(
|
||||
phi_, terminating, token, body_block_, exit_block_));
|
||||
|
||||
builder_->set_current_block(body_block_);
|
||||
if (direction_ == kPreIncrement || direction_ == kPreDecrement) {
|
||||
@ -2772,8 +2768,8 @@ void TestContext::BuildBranch(HValue* value) {
|
||||
HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
|
||||
HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
|
||||
ToBooleanStub::Types expected(condition()->to_boolean_types());
|
||||
HBranch* test = new(zone()) HBranch(value, expected, empty_true, empty_false);
|
||||
builder->current_block()->Finish(test);
|
||||
builder->current_block()->Finish(builder->New<HBranch>(
|
||||
value, expected, empty_true, empty_false));
|
||||
|
||||
empty_true->Goto(if_true(), builder->function_state());
|
||||
empty_false->Goto(if_false(), builder->function_state());
|
||||
@ -3374,12 +3370,10 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
||||
|
||||
// Test switch's tag value if all clauses are string literals
|
||||
if (stmt->switch_type() == SwitchStatement::STRING_SWITCH) {
|
||||
string_check = new(zone()) HIsStringAndBranch(tag_value);
|
||||
first_test_block = graph()->CreateBasicBlock();
|
||||
not_string_block = graph()->CreateBasicBlock();
|
||||
|
||||
string_check->SetSuccessorAt(0, first_test_block);
|
||||
string_check->SetSuccessorAt(1, not_string_block);
|
||||
string_check = New<HIsStringAndBranch>(
|
||||
tag_value, first_test_block, not_string_block);
|
||||
current_block()->Finish(string_check);
|
||||
|
||||
set_current_block(first_test_block);
|
||||
@ -3409,7 +3403,7 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
||||
}
|
||||
|
||||
HCompareNumericAndBranch* compare_ =
|
||||
new(zone()) HCompareNumericAndBranch(tag_value,
|
||||
New<HCompareNumericAndBranch>(tag_value,
|
||||
label_value,
|
||||
Token::EQ_STRICT);
|
||||
compare_->set_observed_input_representation(
|
||||
@ -3695,7 +3689,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check that we still have more keys.
|
||||
HCompareNumericAndBranch* compare_index =
|
||||
new(zone()) HCompareNumericAndBranch(index, limit, Token::LT);
|
||||
New<HCompareNumericAndBranch>(index, limit, Token::LT);
|
||||
compare_index->set_observed_input_representation(
|
||||
Representation::Smi(), Representation::Smi());
|
||||
|
||||
@ -4710,7 +4704,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
||||
++count;
|
||||
HBasicBlock* if_true = graph()->CreateBasicBlock();
|
||||
HBasicBlock* if_false = graph()->CreateBasicBlock();
|
||||
HCompareMap* compare = new(zone()) HCompareMap(
|
||||
HCompareMap* compare = New<HCompareMap>(
|
||||
object, info.map(), if_true, if_false);
|
||||
current_block()->Finish(compare);
|
||||
|
||||
@ -4849,8 +4843,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
|
||||
++count;
|
||||
HBasicBlock* if_true = graph()->CreateBasicBlock();
|
||||
HBasicBlock* if_false = graph()->CreateBasicBlock();
|
||||
HCompareMap* compare =
|
||||
new(zone()) HCompareMap(object, map, if_true, if_false);
|
||||
HCompareMap* compare = New<HCompareMap>(object, map, if_true, if_false);
|
||||
current_block()->Finish(compare);
|
||||
|
||||
set_current_block(if_true);
|
||||
@ -5572,7 +5565,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
||||
HBasicBlock* this_map = graph()->CreateBasicBlock();
|
||||
HBasicBlock* other_map = graph()->CreateBasicBlock();
|
||||
HCompareMap* mapcompare =
|
||||
new(zone()) HCompareMap(object, map, this_map, other_map);
|
||||
New<HCompareMap>(object, map, this_map, other_map);
|
||||
current_block()->Finish(mapcompare);
|
||||
|
||||
set_current_block(this_map);
|
||||
@ -6040,10 +6033,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
||||
HBasicBlock* empty_smi_block = graph()->CreateBasicBlock();
|
||||
HBasicBlock* not_smi_block = graph()->CreateBasicBlock();
|
||||
number_block = graph()->CreateBasicBlock();
|
||||
HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(receiver);
|
||||
smicheck->SetSuccessorAt(0, empty_smi_block);
|
||||
smicheck->SetSuccessorAt(1, not_smi_block);
|
||||
current_block()->Finish(smicheck);
|
||||
current_block()->Finish(New<HIsSmiAndBranch>(
|
||||
receiver, empty_smi_block, not_smi_block));
|
||||
empty_smi_block->Goto(number_block);
|
||||
set_current_block(not_smi_block);
|
||||
} else {
|
||||
@ -6055,20 +6046,17 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
||||
HUnaryControlInstruction* compare;
|
||||
|
||||
if (handle_smi && map.is_identical_to(number_marker_map)) {
|
||||
compare = new(zone()) HCompareMap(
|
||||
receiver, heap_number_map, if_true, if_false);
|
||||
compare = New<HCompareMap>(receiver, heap_number_map, if_true, if_false);
|
||||
map = initial_number_map;
|
||||
expr->set_number_check(
|
||||
Handle<JSObject>(JSObject::cast(map->prototype())));
|
||||
} else if (map.is_identical_to(string_marker_map)) {
|
||||
compare = new(zone()) HIsStringAndBranch(receiver);
|
||||
compare->SetSuccessorAt(0, if_true);
|
||||
compare->SetSuccessorAt(1, if_false);
|
||||
compare = New<HIsStringAndBranch>(receiver, if_true, if_false);
|
||||
map = initial_string_map;
|
||||
expr->set_string_check(
|
||||
Handle<JSObject>(JSObject::cast(map->prototype())));
|
||||
} else {
|
||||
compare = new(zone()) HCompareMap(receiver, map, if_true, if_false);
|
||||
compare = New<HCompareMap>(receiver, map, if_true, if_false);
|
||||
expr->set_map_check();
|
||||
}
|
||||
|
||||
@ -7812,8 +7800,8 @@ void HOptimizedGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
|
||||
HBasicBlock* eval_right = graph()->CreateBasicBlock();
|
||||
ToBooleanStub::Types expected(expr->left()->to_boolean_types());
|
||||
HBranch* test = is_logical_and
|
||||
? new(zone()) HBranch(left_value, expected, eval_right, empty_block)
|
||||
: new(zone()) HBranch(left_value, expected, empty_block, eval_right);
|
||||
? New<HBranch>(left_value, expected, eval_right, empty_block)
|
||||
: New<HBranch>(left_value, expected, empty_block, eval_right);
|
||||
current_block()->Finish(test);
|
||||
|
||||
set_current_block(eval_right);
|
||||
@ -8036,7 +8024,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
BuildCheckHeapObject(right);
|
||||
AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone()));
|
||||
HCompareObjectEqAndBranch* result =
|
||||
new(zone()) HCompareObjectEqAndBranch(left, right);
|
||||
New<HCompareObjectEqAndBranch>(left, right);
|
||||
result->set_position(expr->position());
|
||||
return ast_context()->ReturnControl(result, expr->id());
|
||||
}
|
||||
@ -8051,7 +8039,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
BuildCheckHeapObject(right);
|
||||
AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone()));
|
||||
HCompareObjectEqAndBranch* result =
|
||||
new(zone()) HCompareObjectEqAndBranch(left, right);
|
||||
New<HCompareObjectEqAndBranch>(left, right);
|
||||
result->set_position(expr->position());
|
||||
return ast_context()->ReturnControl(result, expr->id());
|
||||
} else {
|
||||
@ -8064,7 +8052,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
return ast_context()->ReturnInstruction(result, expr->id());
|
||||
} else {
|
||||
HCompareNumericAndBranch* result =
|
||||
new(zone()) HCompareNumericAndBranch(left, right, op);
|
||||
New<HCompareNumericAndBranch>(left, right, op);
|
||||
result->set_observed_input_representation(left_rep, right_rep);
|
||||
result->set_position(expr->position());
|
||||
return ast_context()->ReturnControl(result, expr->id());
|
||||
@ -8506,7 +8494,7 @@ void HOptimizedGraphBuilder::GenerateIsSmi(CallRuntime* call) {
|
||||
ASSERT(call->arguments()->length() == 1);
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* value = Pop();
|
||||
HIsSmiAndBranch* result = new(zone()) HIsSmiAndBranch(value);
|
||||
HIsSmiAndBranch* result = New<HIsSmiAndBranch>(value);
|
||||
return ast_context()->ReturnControl(result, call->id());
|
||||
}
|
||||
|
||||
@ -8567,7 +8555,7 @@ void HOptimizedGraphBuilder::GenerateIsObject(CallRuntime* call) {
|
||||
ASSERT(call->arguments()->length() == 1);
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* value = Pop();
|
||||
HIsObjectAndBranch* result = new(zone()) HIsObjectAndBranch(value);
|
||||
HIsObjectAndBranch* result = New<HIsObjectAndBranch>(value);
|
||||
return ast_context()->ReturnControl(result, call->id());
|
||||
}
|
||||
|
||||
@ -8581,8 +8569,7 @@ void HOptimizedGraphBuilder::GenerateIsUndetectableObject(CallRuntime* call) {
|
||||
ASSERT(call->arguments()->length() == 1);
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* value = Pop();
|
||||
HIsUndetectableAndBranch* result =
|
||||
new(zone()) HIsUndetectableAndBranch(value);
|
||||
HIsUndetectableAndBranch* result = New<HIsUndetectableAndBranch>(value);
|
||||
return ast_context()->ReturnControl(result, call->id());
|
||||
}
|
||||
|
||||
@ -8704,13 +8691,10 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
|
||||
HValue* value = Pop();
|
||||
HValue* object = Pop();
|
||||
// Check if object is a not a smi.
|
||||
HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(object);
|
||||
HBasicBlock* if_smi = graph()->CreateBasicBlock();
|
||||
HBasicBlock* if_heap_object = graph()->CreateBasicBlock();
|
||||
HBasicBlock* join = graph()->CreateBasicBlock();
|
||||
smicheck->SetSuccessorAt(0, if_smi);
|
||||
smicheck->SetSuccessorAt(1, if_heap_object);
|
||||
current_block()->Finish(smicheck);
|
||||
current_block()->Finish(New<HIsSmiAndBranch>(object, if_smi, if_heap_object));
|
||||
if_smi->Goto(join);
|
||||
|
||||
// Check if object is a JSValue.
|
||||
|
@ -1285,29 +1285,29 @@ class HGraphBuilder {
|
||||
}
|
||||
|
||||
template<class Condition>
|
||||
HInstruction* If(HValue *p) {
|
||||
HControlInstruction* compare = new(zone()) Condition(p);
|
||||
Condition* If(HValue *p) {
|
||||
Condition* compare = builder()->New<Condition>(p);
|
||||
AddCompare(compare);
|
||||
return compare;
|
||||
}
|
||||
|
||||
template<class Condition, class P2>
|
||||
HInstruction* If(HValue* p1, P2 p2) {
|
||||
HControlInstruction* compare = new(zone()) Condition(p1, p2);
|
||||
Condition* If(HValue* p1, P2 p2) {
|
||||
Condition* compare = builder()->New<Condition>(p1, p2);
|
||||
AddCompare(compare);
|
||||
return compare;
|
||||
}
|
||||
|
||||
template<class Condition, class P2, class P3>
|
||||
HInstruction* If(HValue* p1, P2 p2, P3 p3) {
|
||||
HControlInstruction* compare = new(zone()) Condition(p1, p2, p3);
|
||||
Condition* If(HValue* p1, P2 p2, P3 p3) {
|
||||
Condition* compare = builder()->New<Condition>(p1, p2, p3);
|
||||
AddCompare(compare);
|
||||
return compare;
|
||||
}
|
||||
|
||||
template<class Condition, class P2>
|
||||
HInstruction* IfNot(HValue* p1, P2 p2) {
|
||||
HControlInstruction* compare = new(zone()) Condition(p1, p2);
|
||||
Condition* IfNot(HValue* p1, P2 p2) {
|
||||
Condition* compare = builder()->New<Condition>(p1, p2);
|
||||
AddCompare(compare);
|
||||
HBasicBlock* block0 = compare->SuccessorAt(0);
|
||||
HBasicBlock* block1 = compare->SuccessorAt(1);
|
||||
@ -1317,8 +1317,8 @@ class HGraphBuilder {
|
||||
}
|
||||
|
||||
template<class Condition, class P2, class P3>
|
||||
HInstruction* IfNot(HValue* p1, P2 p2, P3 p3) {
|
||||
HControlInstruction* compare = new(zone()) Condition(p1, p2, p3);
|
||||
Condition* IfNot(HValue* p1, P2 p2, P3 p3) {
|
||||
Condition* compare = builder()->New<Condition>(p1, p2, p3);
|
||||
AddCompare(compare);
|
||||
HBasicBlock* block0 = compare->SuccessorAt(0);
|
||||
HBasicBlock* block1 = compare->SuccessorAt(1);
|
||||
@ -1328,37 +1328,37 @@ class HGraphBuilder {
|
||||
}
|
||||
|
||||
template<class Condition>
|
||||
HInstruction* OrIf(HValue *p) {
|
||||
Condition* OrIf(HValue *p) {
|
||||
Or();
|
||||
return If<Condition>(p);
|
||||
}
|
||||
|
||||
template<class Condition, class P2>
|
||||
HInstruction* OrIf(HValue* p1, P2 p2) {
|
||||
Condition* OrIf(HValue* p1, P2 p2) {
|
||||
Or();
|
||||
return If<Condition>(p1, p2);
|
||||
}
|
||||
|
||||
template<class Condition, class P2, class P3>
|
||||
HInstruction* OrIf(HValue* p1, P2 p2, P3 p3) {
|
||||
Condition* OrIf(HValue* p1, P2 p2, P3 p3) {
|
||||
Or();
|
||||
return If<Condition>(p1, p2, p3);
|
||||
}
|
||||
|
||||
template<class Condition>
|
||||
HInstruction* AndIf(HValue *p) {
|
||||
Condition* AndIf(HValue *p) {
|
||||
And();
|
||||
return If<Condition>(p);
|
||||
}
|
||||
|
||||
template<class Condition, class P2>
|
||||
HInstruction* AndIf(HValue* p1, P2 p2) {
|
||||
Condition* AndIf(HValue* p1, P2 p2) {
|
||||
And();
|
||||
return If<Condition>(p1, p2);
|
||||
}
|
||||
|
||||
template<class Condition, class P2, class P3>
|
||||
HInstruction* AndIf(HValue* p1, P2 p2, P3 p3) {
|
||||
Condition* AndIf(HValue* p1, P2 p2, P3 p3) {
|
||||
And();
|
||||
return If<Condition>(p1, p2, p3);
|
||||
}
|
||||
@ -1383,7 +1383,7 @@ class HGraphBuilder {
|
||||
private:
|
||||
void AddCompare(HControlInstruction* compare);
|
||||
|
||||
Zone* zone() { return builder_->zone(); }
|
||||
HGraphBuilder* builder() const { return builder_; }
|
||||
|
||||
HGraphBuilder* builder_;
|
||||
int position_;
|
||||
|
Loading…
Reference in New Issue
Block a user