Record safepoint at calls ToBooleanStub.
authorfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 27 Jul 2011 14:56:36 +0000 (14:56 +0000)
committerfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 27 Jul 2011 14:56:36 +0000 (14:56 +0000)
This fixes the issues when GC happens when invoking
ToBooleanStub.
Review URL: http://codereview.chromium.org/7465066

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8747 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/code-stubs.h
src/ia32/code-stubs-ia32.cc
src/ia32/lithium-codegen-ia32.cc

index c5fd7cfef76e638e28c524b21f3b7ff345bcb9c4..6527fde18a4089d83f1fa76cb5e0b3a117b52ff7 100644 (file)
@@ -922,6 +922,7 @@ class ToBooleanStub: public CodeStub {
     explicit Types(byte bits) : set_(bits) {}
 
     bool IsEmpty() const { return set_.IsEmpty(); }
+    bool IsAll() const { return ToByte() == ((1 << NUMBER_OF_TYPES) - 1); }
     bool Contains(Type type) const { return set_.Contains(type); }
     void Add(Type type) { set_.Add(type); }
     byte ToByte() const { return set_.ToIntegral(); }
@@ -934,6 +935,7 @@ class ToBooleanStub: public CodeStub {
   };
 
   static Types no_types() { return Types(); }
+  static Types all_types() { return Types((1 << NUMBER_OF_TYPES) - 1); }
 
   explicit ToBooleanStub(Register tos, Types types = Types())
       : tos_(tos), types_(types) { }
index 3a33c9e6f91c53979a41cbfbda043837ddd6f455..cd2601ee5220c9ecbe83f8fb575c4f840e7e592f 100644 (file)
@@ -348,8 +348,10 @@ void ToBooleanStub::Generate(MacroAssembler* masm) {
     __ ret(1 * kPointerSize);
   }
 
-  __ bind(&patch);
-  GenerateTypeTransition(masm);
+  if (!types_.IsAll()) {
+    __ bind(&patch);
+    GenerateTypeTransition(masm);
+  }
 }
 
 
index e2a18eb2fc96d8d0ec43548a0f3b6547cd4e4777..6f99781c62bb6e3f263bbdf216afb72b8527e09e 100644 (file)
@@ -1424,7 +1424,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
       // The conversion stub doesn't cause garbage collections so it's
       // safe to not record a safepoint after the call.
       __ bind(&call_stub);
-      ToBooleanStub stub(eax);
+      ToBooleanStub stub(eax, ToBooleanStub::all_types());
       __ pushad();
       __ push(reg);
       __ CallStub(&stub);