Use IfBuilder instead of handcrafted basic blocks in GenerateSetValueOf().
R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/130563009 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18898 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d6458eb9a5
commit
5bf5849f9f
@ -10285,32 +10285,24 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
|
||||
HValue* value = Pop();
|
||||
HValue* object = Pop();
|
||||
// Check if object is a not a smi.
|
||||
HBasicBlock* if_smi = graph()->CreateBasicBlock();
|
||||
HBasicBlock* if_heap_object = graph()->CreateBasicBlock();
|
||||
HBasicBlock* join = graph()->CreateBasicBlock();
|
||||
FinishCurrentBlock(New<HIsSmiAndBranch>(object, if_smi, if_heap_object));
|
||||
Goto(if_smi, join);
|
||||
|
||||
// Check if object is a JSValue.
|
||||
set_current_block(if_heap_object);
|
||||
HHasInstanceTypeAndBranch* typecheck =
|
||||
New<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE);
|
||||
HBasicBlock* if_js_value = graph()->CreateBasicBlock();
|
||||
HBasicBlock* not_js_value = graph()->CreateBasicBlock();
|
||||
typecheck->SetSuccessorAt(0, if_js_value);
|
||||
typecheck->SetSuccessorAt(1, not_js_value);
|
||||
FinishCurrentBlock(typecheck);
|
||||
Goto(not_js_value, join);
|
||||
|
||||
// Create in-object property store to kValueOffset.
|
||||
set_current_block(if_js_value);
|
||||
Add<HStoreNamedField>(object,
|
||||
HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset), value,
|
||||
INITIALIZING_STORE);
|
||||
Goto(if_js_value, join);
|
||||
join->SetJoinId(call->id());
|
||||
set_current_block(join);
|
||||
IfBuilder if_objectisvalue(this);
|
||||
if_objectisvalue.If<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE);
|
||||
if_objectisvalue.Then();
|
||||
{
|
||||
// Create in-object property store to kValueOffset.
|
||||
Add<HStoreNamedField>(
|
||||
object, HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset),
|
||||
value, INITIALIZING_STORE);
|
||||
Add<HSimulate>(call->id(), FIXED_SIMULATE);
|
||||
}
|
||||
if_objectisvalue.Else();
|
||||
{
|
||||
// Nothing to do in this case.
|
||||
Add<HSimulate>(call->id(), FIXED_SIMULATE);
|
||||
}
|
||||
if_objectisvalue.End();
|
||||
return ast_context()->ReturnValue(value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user