Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: src/arm/code-stubs-arm.cc

Issue 1053143005: Collect type feedback on result of Math.[round|ceil|floor] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: MIPS port Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index d0ff12a8d8bb347f390f687637270122961243cb..1e9f625783d8fff9e3a88ffed317c457c75d1d8f 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -2712,6 +2712,166 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
}
+void CallIC_RoundStub::Generate(MacroAssembler* masm) {
+ Register function = r1;
+ Register vector = r2;
+ Register slot = r3;
+
+ Register temp1 = r0;
+ Register temp2 = r4;
+ DwVfpRegister double_temp1 = d1;
+ DwVfpRegister double_temp2 = d2;
+ Label tail, miss;
+
+ // Ensure nobody has snuck in another function.
+ __ BranchIfNotBuiltin(function, temp1, kMathRound, &miss);
+
+ if (arg_count() > 0) {
+ __ ldr(temp1, MemOperand(sp, (arg_count() - 1) * kPointerSize));
+ Handle<Map> map = isolate()->factory()->heap_number_map();
+ __ CheckMap(temp1, temp2, map, &tail, DO_SMI_CHECK);
+ __ sub(temp1, temp1, Operand(kHeapObjectTag));
+ __ vldr(double_temp1, temp1, HeapNumber::kValueOffset);
+
+ // If the number is >0, it doesn't round to -0
+ __ Vmov(double_temp2, 0, temp1);
+ __ VFPCompareAndSetFlags(double_temp1, double_temp2);
+ __ b(gt, &tail);
+
+ // If the number is <-.5, it doesn't round to -0
+ __ Vmov(double_temp2, -.5, temp1);
+ __ VFPCompareAndSetFlags(double_temp1, double_temp2);
+ __ b(lt, &tail);
+
+ // +0 doesn't round to -0
+ __ VmovHigh(temp1, double_temp1);
+ __ cmp(temp1, Operand(0x80000000));
+ __ b(ne, &tail);
+
+ __ mov(temp1, Operand(slot, LSL, 1));
+ __ add(temp1, temp1, vector);
+ __ Move(temp2, Operand(Smi::FromInt(kHasReturnedMinusZeroSentinel)));
+ __ str(temp2,
+ FieldMemOperand(temp1, FixedArray::kHeaderSize + kPointerSize));
+ }
+
+ __ bind(&tail);
+ // The slow case, we need this no matter what to complete a call after a miss.
+ CallFunctionNoFeedback(masm, arg_count(), true, CallAsMethod());
+
+ // Unreachable.
+ __ stop("Unreachable");
+
+ __ bind(&miss);
+ GenerateMiss(masm);
+ __ b(&tail);
+}
+
+
+void CallIC_FloorStub::Generate(MacroAssembler* masm) {
+ Register function = r1;
+ Register vector = r2;
+ Register slot = r3;
+
+ Register temp1 = r0;
+ Register temp2 = r4;
+ DwVfpRegister double_temp = d1;
+ Label tail, miss;
+
+ // Ensure nobody has snuck in another function.
+ __ BranchIfNotBuiltin(function, temp1, kMathFloor, &miss);
+
+ if (arg_count() > 0) {
+ __ ldr(temp1, MemOperand(sp, (arg_count() - 1) * kPointerSize));
+ Handle<Map> map = isolate()->factory()->heap_number_map();
+ __ CheckMap(temp1, temp2, map, &tail, DO_SMI_CHECK);
+ __ sub(temp1, temp1, Operand(kHeapObjectTag));
+ __ vldr(double_temp, temp1, HeapNumber::kValueOffset);
+
+ // Only -0 floors to -0.
+ __ VmovHigh(temp1, double_temp);
+ __ cmp(temp1, Operand(0x80000000));
+ __ b(ne, &tail);
+ __ VmovLow(temp1, double_temp);
+ __ cmp(temp1, Operand(0));
+ __ b(ne, &tail);
+
+ __ mov(temp1, Operand(slot, LSL, 1));
+ __ add(temp1, temp1, vector);
+ __ Move(temp2, Operand(Smi::FromInt(kHasReturnedMinusZeroSentinel)));
+ __ str(temp2,
+ FieldMemOperand(temp1, FixedArray::kHeaderSize + kPointerSize));
+ }
+
+ __ bind(&tail);
+ // The slow case, we need this no matter what to complete a call after a miss.
+ CallFunctionNoFeedback(masm, arg_count(), true, CallAsMethod());
+
+ // Unreachable.
+ __ stop("Unreachable");
+
+ __ bind(&miss);
+ GenerateMiss(masm);
+ __ b(&tail);
+}
+
+
+void CallIC_CeilStub::Generate(MacroAssembler* masm) {
+ Register function = r1;
+ Register vector = r2;
+ Register slot = r3;
+
+ Register temp1 = r0;
+ Register temp2 = r4;
+ DwVfpRegister double_temp1 = d1;
+ DwVfpRegister double_temp2 = d2;
+ Label tail, miss;
+
+ // Ensure nobody has snuck in another function.
+ __ BranchIfNotBuiltin(function, temp1, kMathCeil, &miss);
+
+ if (arg_count() > 0) {
+ __ ldr(temp1, MemOperand(sp, (arg_count() - 1) * kPointerSize));
+ Handle<Map> map = isolate()->factory()->heap_number_map();
+ __ CheckMap(temp1, temp2, map, &tail, DO_SMI_CHECK);
+ __ sub(temp1, temp1, Operand(kHeapObjectTag));
+ __ vldr(double_temp1, temp1, HeapNumber::kValueOffset);
+
+ // If the number is >0, it doesn't round to -0
+ __ Vmov(double_temp2, 0, temp1);
+ __ VFPCompareAndSetFlags(double_temp1, double_temp2);
+ __ b(gt, &tail);
+
+ // If the number is <=-1, it doesn't round to -0
+ __ Vmov(double_temp2, -1, temp1);
+ __ VFPCompareAndSetFlags(double_temp1, double_temp2);
+ __ b(le, &tail);
+
+ // +0 doesn't round to -0.
+ __ VmovHigh(temp1, double_temp1);
+ __ cmp(temp1, Operand(0x80000000));
+ __ b(ne, &tail);
+
+ __ mov(temp1, Operand(slot, LSL, 1));
+ __ add(temp1, temp1, vector);
+ __ Move(temp2, Operand(Smi::FromInt(kHasReturnedMinusZeroSentinel)));
+ __ str(temp2,
+ FieldMemOperand(temp1, FixedArray::kHeaderSize + kPointerSize));
+ }
+
+ __ bind(&tail);
+ // The slow case, we need this no matter what to complete a call after a miss.
+ CallFunctionNoFeedback(masm, arg_count(), true, CallAsMethod());
+
+ // Unreachable.
+ __ stop("Unreachable");
+
+ __ bind(&miss);
+ GenerateMiss(masm);
+ __ b(&tail);
+}
+
+
void CallICStub::Generate(MacroAssembler* masm) {
// r1 - function
// r3 - slot id (Smi)
@@ -2822,6 +2982,12 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ cmp(r1, r4);
__ b(eq, &miss);
+ // Some builtin functions require special handling, miss to the runtime.
+ __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
+ __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset));
+ __ cmp(r0, Operand(Smi::FromInt(0)));
+ __ b(ne, &miss);
+
// Update stats.
__ ldr(r4, FieldMemOperand(r2, with_types_offset));
__ add(r4, r4, Operand(Smi::FromInt(1)));
@@ -4365,6 +4531,27 @@ void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
}
+void CallIC_RoundTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, r2);
+ CallIC_RoundStub stub(isolate(), state());
+ __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void CallIC_FloorTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, r2);
+ CallIC_FloorStub stub(isolate(), state());
+ __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void CallIC_CeilTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, r2);
+ CallIC_CeilStub stub(isolate(), state());
+ __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
void VectorRawLoadStub::Generate(MacroAssembler* masm) {
GenerateImpl(masm, false);
}
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698