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 c5fd7cf..6527fde 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 3a33c9e..cd2601e 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 e2a18eb..6f99781 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);