| Index: runtime/vm/flow_graph_compiler_x64.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_compiler_x64.cc (revision 8696)
|
| +++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
|
| @@ -865,6 +865,31 @@
|
| }
|
|
|
|
|
| +// TODO(srdjan): For Math.sqrt read type feedback in Math.sqrt and decide
|
| +// if the argument is double, smi or something else.
|
| +void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) {
|
| + Label smi_to_double, call_method;
|
| + __ movq(RAX, Address(RSP, 0));
|
| + __ testq(RAX, Immediate(kSmiTagMask));
|
| + __ j(ZERO, &smi_to_double, Assembler::kNearJump);
|
| + __ CompareClassId(RAX, kDouble);
|
| + __ j(NOT_EQUAL, &call_method, Assembler::kNearJump);
|
| + __ movsd(XMM1, FieldAddress(RAX, Double::value_offset()));
|
| + __ sqrtsd(XMM0, XMM1);
|
| + // TODO(regis): Should we cache double_class in FlowGraphCompiler instance?
|
| + const Class& double_class =
|
| + Class::ZoneHandle(Isolate::Current()->object_store()->double_class());
|
| + AssemblerMacros::TryAllocate(assembler_,
|
| + double_class,
|
| + &call_method,
|
| + RAX); // Result register.
|
| + __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
|
| + __ jmp(done);
|
| + __ Bind(&smi_to_double);
|
| + __ Bind(&call_method);
|
| +}
|
| +
|
| +
|
| void FlowGraphCompiler::CompileGraph() {
|
| InitCompiler();
|
| if (TryIntrinsify()) {
|
|
|