Move the is_pregenerated flag so it does not overlap other flags.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Sep 2011 12:23:40 +0000 (12:23 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Sep 2011 12:23:40 +0000 (12:23 +0000)
Remove the before-or-after InstanceOf stub rule, which was too
subtle and lacked checking ssertions.
Unify the way the CEntry stub is pregenerated so that it is done
in the same way.
Review URL: http://codereview.chromium.org/8065006

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

src/arm/code-stubs-arm.cc
src/code-stubs.cc
src/code-stubs.h
src/heap.cc
src/ia32/code-stubs-ia32.cc
src/objects.h
src/x64/code-stubs-x64.cc

index 16ffba9547467cb84e3b63e9adb98cd591ade348..319787313440a76c1df0a3fb717d5da378226bba 100644 (file)
@@ -3405,6 +3405,7 @@ bool CEntryStub::IsPregenerated() {
 
 
 void CodeStub::GenerateStubsAheadOfTime() {
+  CEntryStub::GenerateAheadOfTime();
   WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime();
   StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
   RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
@@ -3419,6 +3420,13 @@ void CodeStub::GenerateFPStubs() {
 }
 
 
+void CEntryStub::GenerateAheadOfTime() {
+  CEntryStub stub(1, kDontSaveFPRegs);
+  Handle<Code> code = stub.GetCode();
+  code->set_is_pregenerated(true);
+}
+
+
 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
   __ Throw(r0);
 }
index bf593f7bf0cce9efec0255bc6aeca706fd3466c0..8828e92dd1b4bedc86d91a4b1ddbc02ed0230610 100644 (file)
@@ -130,6 +130,8 @@ Handle<Code> CodeStub::GetCode() {
     heap->public_set_code_stubs(*dict);
     code = *new_object;
     Activate(code);
+  } else {
+    ASSERT(IsPregenerated() == code->is_pregenerated());
   }
 
   ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code));
index 9480fc4b1da26c84edf0deda689d272950e95e7b..0cc70c904e543cd9ce5cee6000fdd11df29f0f28 100644 (file)
@@ -50,13 +50,6 @@ namespace internal {
   V(RegExpExec)                          \
   V(TranscendentalCache)                 \
   V(Instanceof)                          \
-  /* All stubs above this line only exist in a few versions, which are  */  \
-  /* generated ahead of time.  Therefore compiling a call to one of     */  \
-  /* them can't cause a new stub to be compiled, so compiling a call to */  \
-  /* them is GC safe.  The ones below this line exist in many variants  */  \
-  /* so code compiling a call to one can cause a GC.  This means they   */  \
-  /* can't be called from other stubs, since stub generation code is    */  \
-  /* not GC safe.                                                       */  \
   V(ConvertToDouble)                     \
   V(WriteInt32ToHeapNumber)              \
   V(StackCheck)                          \
@@ -154,9 +147,7 @@ class CodeStub BASE_EMBEDDED {
   }
 
   // See comment above, where Instanceof is defined.
-  virtual bool IsPregenerated() {
-    return MajorKey() <= Instanceof;
-  }
+  virtual bool IsPregenerated() { return false; }
 
   static void GenerateStubsAheadOfTime();
   static void GenerateFPStubs();
@@ -574,6 +565,7 @@ class CEntryStub : public CodeStub {
   // their code generation.  On machines that always have gp registers (x64) we
   // can generate both variants ahead of time.
   virtual bool IsPregenerated();
+  static void GenerateAheadOfTime();
 
  private:
   void GenerateCore(MacroAssembler* masm,
index 580a764d334462a5b930aff5cea827151c77d508..75a1e5f07911e3228542a2ebd32bb6301ad62358 100644 (file)
@@ -2170,9 +2170,6 @@ void Heap::CreateFixedStubs() {
   // create them if we need them during the creation of another stub.
   // Stub creation mixes raw pointers and handles in an unsafe manner so
   // we cannot create stubs while we are creating stubs.
-  CEntryStub ces(1);
-  ces.GetCode();
-
   CodeStub::GenerateStubsAheadOfTime();
 }
 
index 197c8c9a4ab142ec766c3e3936017b9ed65d112f..00265dd7178a5eaa6507961df2850435c1313ee6 100644 (file)
@@ -4415,6 +4415,7 @@ bool CEntryStub::IsPregenerated() {
 
 
 void CodeStub::GenerateStubsAheadOfTime() {
+  CEntryStub::GenerateAheadOfTime();
   StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
   // It is important that the store buffer overflow stubs are generated first.
   RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
@@ -4429,6 +4430,13 @@ void CodeStub::GenerateFPStubs() {
 }
 
 
+void CEntryStub::GenerateAheadOfTime() {
+  CEntryStub stub(1, kDontSaveFPRegs);
+  Handle<Code> code = stub.GetCode();
+  code->set_is_pregenerated(true);
+}
+
+
 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
   __ Throw(eax);
 }
index 29564d434ac2a8e9c6ddc0a41f8d7a98f99b3cd9..2bf99f313975da3bbf36ed8c8518721fae414c44 100644 (file)
@@ -3888,7 +3888,7 @@ class Code: public HeapObject {
   class IsPregeneratedField: public BitField<bool, 14, 1> {};
 
   // Signed field cannot be encoded using the BitField class.
-  static const int kArgumentsCountShift = 14;
+  static const int kArgumentsCountShift = 15;
   static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1);
 
   static const int kFlagsNotUsedInLookup =
index 059a79e97a2e6268be2fd99c9e208dab6db6c86d..8d9dba781dccd39b30928749e4d5c03fa1fb2624 100644 (file)
@@ -3370,13 +3370,16 @@ bool CEntryStub::NeedsImmovableCode() {
 
 
 bool CEntryStub::IsPregenerated() {
+#ifdef _WIN64
   return result_size_ == 1;
+#else
+  return true;
+#endif
 }
 
 
 void CodeStub::GenerateStubsAheadOfTime() {
-  CEntryStub save_doubles(1, kSaveFPRegs);
-  save_doubles.GetCode()->set_is_pregenerated(true);
+  CEntryStub::GenerateAheadOfTime();
   StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
   // It is important that the store buffer overflow stubs are generated first.
   RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
@@ -3387,6 +3390,14 @@ void CodeStub::GenerateFPStubs() {
 }
 
 
+void CEntryStub::GenerateAheadOfTime() {
+  CEntryStub stub(1, kDontSaveFPRegs);
+  stub.GetCode()->set_is_pregenerated(true);
+  CEntryStub save_doubles(1, kSaveFPRegs);
+  save_doubles.GetCode()->set_is_pregenerated(true);
+}
+
+
 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
   // Throw exception in eax.
   __ Throw(rax);