Revision: 20036
Author:   [email protected]
Date:     Tue Mar 18 14:26:26 2014 UTC
Log:      A64: Force emission of the veneer pool emission when required.

[email protected]

Review URL: https://codereview.chromium.org/203443003
http://code.google.com/p/v8/source/detail?r=20036

Modified:
 /branches/bleeding_edge/src/a64/assembler-a64-inl.h
 /branches/bleeding_edge/src/a64/assembler-a64.cc
 /branches/bleeding_edge/src/a64/assembler-a64.h
 /branches/bleeding_edge/src/a64/full-codegen-a64.cc
 /branches/bleeding_edge/src/a64/lithium-codegen-a64.cc
 /branches/bleeding_edge/src/a64/macro-assembler-a64-inl.h

=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64-inl.h Wed Mar 12 15:23:54 2014 UTC +++ /branches/bleeding_edge/src/a64/assembler-a64-inl.h Tue Mar 18 14:26:26 2014 UTC
@@ -1207,7 +1207,7 @@
     GrowBuffer();
   }
   if (pc_offset() >= next_veneer_pool_check_) {
-    CheckVeneerPool(true);
+    CheckVeneerPool(false, true);
   }
   if (pc_offset() >= next_constant_pool_check_) {
     CheckConstPool(false, true);
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64.cc Mon Mar 17 13:32:39 2014 UTC +++ /branches/bleeding_edge/src/a64/assembler-a64.cc Tue Mar 18 14:26:26 2014 UTC
@@ -2566,7 +2566,7 @@

// Emit veneers for branches that would go out of range during emission of the
   // constant pool.
-  CheckVeneerPool(require_jump, kVeneerDistanceMargin + pool_size);
+  CheckVeneerPool(false, require_jump, kVeneerDistanceMargin + pool_size);

   Label size_check;
   bind(&size_check);
@@ -2659,7 +2659,7 @@
 }


-void Assembler::EmitVeneers(bool need_protection, int margin) {
+void Assembler::EmitVeneers(bool force_emit, bool need_protection, int margin) {
   BlockPoolsScope scope(this);
   RecordComment("[ Veneers");

@@ -2685,7 +2685,7 @@

   it = unresolved_branches_.begin();
   while (it != unresolved_branches_.end()) {
-    if (ShouldEmitVeneer(it->first, margin)) {
+    if (force_emit || ShouldEmitVeneer(it->first, margin)) {
       Instruction* branch = InstructionAt(it->second.pc_offset_);
       Label* label = it->second.label_;

@@ -2728,7 +2728,7 @@
 }


-void Assembler::CheckVeneerPool(bool require_jump,
+void Assembler::CheckVeneerPool(bool force_emit, bool require_jump,
                                 int margin) {
   // There is nothing to do if there are no pending veneer pool entries.
   if (unresolved_branches_.empty())  {
@@ -2742,6 +2742,7 @@
// emission, such sequences are protected by calls to BlockVeneerPoolFor and
   // BlockVeneerPoolScope.
   if (is_veneer_pool_blocked()) {
+    ASSERT(!force_emit);
     return;
   }

@@ -2749,8 +2750,8 @@
     // Prefer emitting veneers protected by an existing instruction.
     margin *= kVeneerNoProtectionFactor;
   }
-  if (ShouldEmitVeneers(margin)) {
-    EmitVeneers(require_jump, margin);
+  if (force_emit || ShouldEmitVeneers(margin)) {
+    EmitVeneers(force_emit, require_jump, margin);
   } else {
     next_veneer_pool_check_ =
       unresolved_branches_first_limit() - kVeneerDistanceCheckMargin;
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64.h Fri Mar 14 15:14:42 2014 UTC +++ /branches/bleeding_edge/src/a64/assembler-a64.h Tue Mar 18 14:26:26 2014 UTC
@@ -1808,10 +1808,13 @@
   // Emits veneers for branches that are approaching their maximum range.
// If need_protection is true, the veneers are protected by a branch jumping
   // over the code.
- void EmitVeneers(bool need_protection, int margin = kVeneerDistanceMargin);
+  void EmitVeneers(bool force_emit, bool need_protection,
+                   int margin = kVeneerDistanceMargin);
   void EmitVeneersGuard() { EmitPoolGuard(); }
   // Checks whether veneers need to be emitted at this point.
- void CheckVeneerPool(bool require_jump, int margin = kVeneerDistanceMargin); + // If force_emit is set, a veneer is generated for *all* unresolved branches.
+  void CheckVeneerPool(bool force_emit, bool require_jump,
+                       int margin = kVeneerDistanceMargin);


   class BlockPoolsScope {
=======================================
--- /branches/bleeding_edge/src/a64/full-codegen-a64.cc Mon Mar 17 10:21:01 2014 UTC +++ /branches/bleeding_edge/src/a64/full-codegen-a64.cc Tue Mar 18 14:26:26 2014 UTC
@@ -314,8 +314,9 @@
   }
   EmitReturnSequence();

-  // Force emit the constant pool, so it doesn't get emitted in the middle
+  // Force emission of the pools, so they don't get emitted in the middle
   // of the back edge table.
+  masm()->CheckVeneerPool(true, false);
   masm()->CheckConstPool(true, false);
 }

=======================================
--- /branches/bleeding_edge/src/a64/lithium-codegen-a64.cc Tue Mar 18 13:29:29 2014 UTC +++ /branches/bleeding_edge/src/a64/lithium-codegen-a64.cc Tue Mar 18 14:26:26 2014 UTC
@@ -895,6 +895,9 @@

 bool LCodeGen::GenerateSafepointTable() {
   ASSERT(is_done());
+ // We do not know how much data will be emitted for the safepoint table, so
+  // force emission of the veneer pool.
+  masm()->CheckVeneerPool(true, true);
   safepoints_.Emit(masm(), GetStackSlotCount());
   return !is_aborted();
 }
=======================================
--- /branches/bleeding_edge/src/a64/macro-assembler-a64-inl.h Tue Mar 18 14:00:21 2014 UTC +++ /branches/bleeding_edge/src/a64/macro-assembler-a64-inl.h Tue Mar 18 14:26:26 2014 UTC
@@ -346,7 +346,7 @@

 void MacroAssembler::B(Label* label) {
   b(label);
-  CheckVeneerPool(false);
+  CheckVeneerPool(false, false);
 }


@@ -1036,7 +1036,7 @@
   ASSERT(allow_macro_instructions_);
   ASSERT(!xn.IsZero());
   ret(xn);
-  CheckVeneerPool(false);
+  CheckVeneerPool(false, false);
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to