From b84214a5be9271457f5366ab892e9127a2e3c868 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Mon, 19 Sep 2011 07:38:48 +0000 Subject: [PATCH] Fix a harmless assert and a genuine bug in the GC-safety of stub generation on ARM without VFP3. Review URL: http://codereview.chromium.org/7937004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9319 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/code-stubs-arm.cc | 26 ++++++++++++++++++++++++++ src/arm/code-stubs-arm.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 383803d10..8351ebe94 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -859,6 +859,29 @@ void FloatingPointHelper::CallCCodeForDoubleOperation( } +bool WriteInt32ToHeapNumberStub::CompilingCallsToThisStubIsGCSafe() { + // These variants are compiled ahead of time. See next method. + if (the_int_.is(r1) && the_heap_number_.is(r0) && scratch_.is(r2)) { + return true; + } + if (the_int_.is(r2) && the_heap_number_.is(r0) && scratch_.is(r3)) { + return true; + } + // Other register combinations are generated as and when they are needed, + // so it is unsafe to call them from stubs (we can't generate a stub while + // we are generating a stub). + return false; +} + + +void WriteInt32ToHeapNumberStub::GenerateStubsAheadOfTime() { + WriteInt32ToHeapNumberStub stub1(r1, r0, r2); + WriteInt32ToHeapNumberStub stub2(r2, r0, r3); + Handle code1 = stub1.GetCode(); + Handle code2 = stub2.GetCode(); +} + + // See comment for class. void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { Label max_negative_int; @@ -1199,6 +1222,8 @@ static void EmitTwoNonNanDoubleComparison(MacroAssembler* masm, __ vmov(d0, r0, r1); __ vmov(d1, r2, r3); } + + AllowExternalCallThatCantCauseGC scope(masm); __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 0, 2); __ pop(pc); // Return. @@ -3341,6 +3366,7 @@ bool CEntryStub::CompilingCallsToThisStubIsGCSafe() { void CodeStub::GenerateStubsAheadOfTime() { + WriteInt32ToHeapNumberStub::GenerateStubsAheadOfTime(); } diff --git a/src/arm/code-stubs-arm.h b/src/arm/code-stubs-arm.h index 2346077e9..b14f9fc19 100644 --- a/src/arm/code-stubs-arm.h +++ b/src/arm/code-stubs-arm.h @@ -323,6 +323,9 @@ class WriteInt32ToHeapNumberStub : public CodeStub { the_heap_number_(the_heap_number), scratch_(scratch) { } + bool CompilingCallsToThisStubIsGCSafe(); + static void GenerateStubsAheadOfTime(); + private: Register the_int_; Register the_heap_number_; -- 2.34.1