Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_compiler.cc (revision 39909) |
| +++ runtime/vm/flow_graph_compiler.cc (working copy) |
| @@ -98,6 +98,7 @@ |
| GrowableObjectArray::New())), |
| is_optimizing_(is_optimizing), |
| may_reoptimize_(false), |
| + intrinsic_mode_(false), |
| double_class_(Class::ZoneHandle( |
| isolate_->object_store()->double_class())), |
| mint_class_(Class::ZoneHandle( |
| @@ -547,6 +548,7 @@ |
| void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, |
| intptr_t token_pos) { |
| ASSERT(is_optimizing()); |
| + ASSERT(!intrinsic_mode()); |
| CompilerDeoptInfo* info = |
| new CompilerDeoptInfo(deopt_id, |
| ICData::kDeoptAtCall, |
| @@ -727,6 +729,10 @@ |
| Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
| ICData::DeoptReasonId reason) { |
| + if (intrinsic_mode()) { |
| + return &intrinsic_deopt_label_; |
| + } |
| + |
| ASSERT(is_optimizing_); |
| CompilerDeoptInfoWithStub* stub = |
| new CompilerDeoptInfoWithStub(deopt_id, |
| @@ -855,9 +861,15 @@ |
| } |
| } |
| } |
| - // Even if an intrinsified version of the function was successfully |
| - // generated, it may fall through to the non-intrinsified method body. |
| - Intrinsifier::Intrinsify(parsed_function().function(), assembler()); |
| + |
| + EnterIntrinsicMode(); |
| + |
| + Intrinsifier::Intrinsify(parsed_function(), this); |
| + |
| + ExitIntrinsicMode(); |
| + // "Deoptimization" from intrinsic continues here. |
|
srdjan
2014/09/08 17:34:06
Maybe add comment describing why deoptimization is
Florian Schneider
2014/09/09 09:57:08
Done.
|
| + ASSERT(!intrinsic_deopt_label_.IsBound()); |
| + assembler()->Bind(&intrinsic_deopt_label_); |
| } |
| @@ -1368,6 +1380,10 @@ |
| | MaskBit(TMP) |
| | MaskBit(TMP2) |
| | MaskBit(PP); |
| + if (resolver->compiler_->intrinsic_mode()) { |
| + // Block additional registers that must be preserved for intrinsics. |
| + blocked_mask |= MaskBit(ARGS_DESC_REG); |
| + } |
| reg_ = static_cast<Register>( |
| resolver_->AllocateScratchRegister(Location::kRegister, |
| blocked_mask, |