Commit 12250f23 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Add instruction factories to HHasInstanceTypeAndBranch.

R=bmeurer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17150 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0610773d
...@@ -4327,12 +4327,10 @@ class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { ...@@ -4327,12 +4327,10 @@ class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
public: public:
HHasInstanceTypeAndBranch(HValue* value, InstanceType type) DECLARE_INSTRUCTION_FACTORY_P2(
: HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } HHasInstanceTypeAndBranch, HValue*, InstanceType);
HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) DECLARE_INSTRUCTION_FACTORY_P3(
: HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
}
InstanceType from() { return from_; } InstanceType from() { return from_; }
InstanceType to() { return to_; } InstanceType to() { return to_; }
...@@ -4346,6 +4344,13 @@ class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { ...@@ -4346,6 +4344,13 @@ class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
private: private:
HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
: HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
: HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
}
InstanceType from_; InstanceType from_;
InstanceType to_; // Inclusive range, not all combinations work. InstanceType to_; // Inclusive range, not all combinations work.
}; };
......
...@@ -3475,9 +3475,9 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -3475,9 +3475,9 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
HValue* return_value = Pop(); HValue* return_value = Pop();
HValue* receiver = environment()->arguments_environment()->Lookup(0); HValue* receiver = environment()->arguments_environment()->Lookup(0);
HHasInstanceTypeAndBranch* typecheck = HHasInstanceTypeAndBranch* typecheck =
new(zone()) HHasInstanceTypeAndBranch(return_value, New<HHasInstanceTypeAndBranch>(return_value,
FIRST_SPEC_OBJECT_TYPE, FIRST_SPEC_OBJECT_TYPE,
LAST_SPEC_OBJECT_TYPE); LAST_SPEC_OBJECT_TYPE);
HBasicBlock* if_spec_object = graph()->CreateBasicBlock(); HBasicBlock* if_spec_object = graph()->CreateBasicBlock();
HBasicBlock* not_spec_object = graph()->CreateBasicBlock(); HBasicBlock* not_spec_object = graph()->CreateBasicBlock();
typecheck->SetSuccessorAt(0, if_spec_object); typecheck->SetSuccessorAt(0, if_spec_object);
...@@ -8783,9 +8783,9 @@ void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) { ...@@ -8783,9 +8783,9 @@ void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop(); HValue* value = Pop();
HHasInstanceTypeAndBranch* result = HHasInstanceTypeAndBranch* result =
new(zone()) HHasInstanceTypeAndBranch(value, New<HHasInstanceTypeAndBranch>(value,
FIRST_SPEC_OBJECT_TYPE, FIRST_SPEC_OBJECT_TYPE,
LAST_SPEC_OBJECT_TYPE); LAST_SPEC_OBJECT_TYPE);
return ast_context()->ReturnControl(result, call->id()); return ast_context()->ReturnControl(result, call->id());
} }
...@@ -8795,7 +8795,7 @@ void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) { ...@@ -8795,7 +8795,7 @@ void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop(); HValue* value = Pop();
HHasInstanceTypeAndBranch* result = HHasInstanceTypeAndBranch* result =
new(zone()) HHasInstanceTypeAndBranch(value, JS_FUNCTION_TYPE); New<HHasInstanceTypeAndBranch>(value, JS_FUNCTION_TYPE);
return ast_context()->ReturnControl(result, call->id()); return ast_context()->ReturnControl(result, call->id());
} }
...@@ -8815,7 +8815,7 @@ void HOptimizedGraphBuilder::GenerateIsArray(CallRuntime* call) { ...@@ -8815,7 +8815,7 @@ void HOptimizedGraphBuilder::GenerateIsArray(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop(); HValue* value = Pop();
HHasInstanceTypeAndBranch* result = HHasInstanceTypeAndBranch* result =
new(zone()) HHasInstanceTypeAndBranch(value, JS_ARRAY_TYPE); New<HHasInstanceTypeAndBranch>(value, JS_ARRAY_TYPE);
return ast_context()->ReturnControl(result, call->id()); return ast_context()->ReturnControl(result, call->id());
} }
...@@ -8825,7 +8825,7 @@ void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) { ...@@ -8825,7 +8825,7 @@ void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop(); HValue* value = Pop();
HHasInstanceTypeAndBranch* result = HHasInstanceTypeAndBranch* result =
new(zone()) HHasInstanceTypeAndBranch(value, JS_REGEXP_TYPE); New<HHasInstanceTypeAndBranch>(value, JS_REGEXP_TYPE);
return ast_context()->ReturnControl(result, call->id()); return ast_context()->ReturnControl(result, call->id());
} }
...@@ -8979,7 +8979,7 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) { ...@@ -8979,7 +8979,7 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
// Check if object is a JSValue. // Check if object is a JSValue.
set_current_block(if_heap_object); set_current_block(if_heap_object);
HHasInstanceTypeAndBranch* typecheck = HHasInstanceTypeAndBranch* typecheck =
new(zone()) HHasInstanceTypeAndBranch(object, JS_VALUE_TYPE); New<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE);
HBasicBlock* if_js_value = graph()->CreateBasicBlock(); HBasicBlock* if_js_value = graph()->CreateBasicBlock();
HBasicBlock* not_js_value = graph()->CreateBasicBlock(); HBasicBlock* not_js_value = graph()->CreateBasicBlock();
typecheck->SetSuccessorAt(0, if_js_value); typecheck->SetSuccessorAt(0, if_js_value);
...@@ -9144,7 +9144,7 @@ void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) { ...@@ -9144,7 +9144,7 @@ void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) {
// Branch for function proxies, or other non-functions. // Branch for function proxies, or other non-functions.
HHasInstanceTypeAndBranch* typecheck = HHasInstanceTypeAndBranch* typecheck =
new(zone()) HHasInstanceTypeAndBranch(function, JS_FUNCTION_TYPE); New<HHasInstanceTypeAndBranch>(function, JS_FUNCTION_TYPE);
HBasicBlock* if_jsfunction = graph()->CreateBasicBlock(); HBasicBlock* if_jsfunction = graph()->CreateBasicBlock();
HBasicBlock* if_nonfunction = graph()->CreateBasicBlock(); HBasicBlock* if_nonfunction = graph()->CreateBasicBlock();
HBasicBlock* join = graph()->CreateBasicBlock(); HBasicBlock* join = graph()->CreateBasicBlock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment