Reviewers: Rodolph Perfetta (ARM), baptiste.afsa1,

Description:
A64: Todos - peek/poke and branch generator

Fix some todos: add peek and poke support for fp registers and extend
BranchGenerator for branching on heap numbers.

BUG=

Please review this at https://codereview.chromium.org/150513002/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64

Affected files (+42, -14 lines):
  M src/a64/assembler-a64.h
  M src/a64/lithium-a64.cc
  M src/a64/lithium-codegen-a64.h
  M src/a64/lithium-codegen-a64.cc
  M src/a64/macro-assembler-a64.h
  M src/a64/macro-assembler-a64.cc


Index: src/a64/assembler-a64.h
diff --git a/src/a64/assembler-a64.h b/src/a64/assembler-a64.h
index 8a11e52057872660ce47b087a9ed39a8eedb20db..5ba7a9ec03125d737ea6c881eb1211ea9978743b 100644
--- a/src/a64/assembler-a64.h
+++ b/src/a64/assembler-a64.h
@@ -1968,7 +1968,7 @@ class Assembler : public AssemblerBase {
 #endif

  private:
-  // TODO(jbramley): [GOOGJSE-238] W16 uses next_literal_pool_check_ and
+  // TODO(jbramley): VIXL uses next_literal_pool_check_ and
   // literal_pool_monitor_ to determine when to consider emitting a literal
// pool. V8 doesn't use them, so they should either not be here at all, or
   // should replace or be merged with next_buffer_check_ and
Index: src/a64/lithium-a64.cc
diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
index 5048275526f6031166819e452fbca4dc621951e0..dac3d143559ecac09211520932bf6054f06d63b7 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -2123,7 +2123,7 @@ LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
   LOperand* value;
   if (instr->NeedsWriteBarrier()) {
     // TODO(all): Replace these constraints when RecordWriteStub has been
-    // rewritten. See GOOGJSE-586.
+    // rewritten.
     context = UseRegisterAndClobber(instr->context());
     value = UseRegisterAndClobber(instr->value());
   } else {
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index 56b29ceb09e0d5d9622517e584476bdc2a57e702..50dca3a7d620a569e9ad133a8523d6491828f5e7 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -196,6 +196,25 @@ class BranchIfNonZeroNumber : public BranchGenerator {
 };


+// Test the input and branch if it is a heap number.
+class BranchIfHeapNumber : public BranchGenerator {
+ public:
+  BranchIfHeapNumber(LCodeGen* codegen, const Register& value)
+      : BranchGenerator(codegen), value_(value) { }
+
+  virtual void Emit(Label* label) const {
+    __ JumpIfHeapNumber(value_, label);
+  }
+
+  virtual void EmitInverted(Label* label) const {
+    __ JumpIfNotHeapNumber(value_, label);
+  }
+
+ private:
+  const Register& value_;
+};
+
+
 void LCodeGen::WriteTranslation(LEnvironment* environment,
                                 Translation* translation) {
   if (environment == NULL) return;
@@ -603,8 +622,7 @@ bool LCodeGen::GeneratePrologue() {
     int count = 0;
     while (!iterator.Done()) {
FPRegister value = FPRegister::FromAllocationIndex(iterator.Current());
-      // TODO(jbramley): Make Poke support FPRegisters.
-      __ Str(value, MemOperand(__ StackPointer(), count * kDoubleSize));
+      __ Poke(value, count * kDoubleSize);
       iterator.Advance();
       count++;
     }
@@ -1222,6 +1240,14 @@ void LCodeGen::EmitBranchIfNonZeroNumber(InstrType instr,
 }


+template<class InstrType>
+void LCodeGen::EmitBranchIfHeapNumber(InstrType instr,
+                                      const Register& value) {
+  BranchIfHeapNumber branch(this, value);
+  EmitBranchGeneric(instr, branch);
+}
+
+
 void LCodeGen::DoGap(LGap* gap) {
   for (int i = LGap::FIRST_INNER_POSITION;
        i <= LGap::LAST_INNER_POSITION;
@@ -2896,9 +2922,8 @@ void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
       __ B(instr->TrueLabel(chunk_));
     }
     __ JumpIfSmi(value, instr->TrueLabel(chunk_));
-    // TODO(jbramley): Add an EmitBranch helper for this.
-    __ JumpForHeapNumber(value, NoReg,
- instr->TrueLabel(chunk_), instr->FalseLabel(chunk_));
+
+    EmitBranchIfHeapNumber(instr, value);
   }
 }

@@ -4396,8 +4421,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
     int count = 0;
     while (!iterator.Done()) {
FPRegister value = FPRegister::FromAllocationIndex(iterator.Current());
-      // TODO(jbramley): Make Peek support FPRegisters.
-      __ Ldr(value, MemOperand(__ StackPointer(), count * kDoubleSize));
+      __ Peek(value, count * kDoubleSize);
       iterator.Advance();
       count++;
     }
Index: src/a64/lithium-codegen-a64.h
diff --git a/src/a64/lithium-codegen-a64.h b/src/a64/lithium-codegen-a64.h
index 5179cb4052090a98520736e3d731222a17d34948..f0a26abdfe74253ef50e9b09c04b5146dc643aad 100644
--- a/src/a64/lithium-codegen-a64.h
+++ b/src/a64/lithium-codegen-a64.h
@@ -212,6 +212,10 @@ class LCodeGen BASE_EMBEDDED {
                                  const FPRegister& value,
                                  const FPRegister& scratch);

+  template<class InstrType>
+  void EmitBranchIfHeapNumber(InstrType instr,
+                              const Register& value);
+
// Emits optimized code to deep-copy the contents of statically known object
   // graphs (e.g. object literal boilerplate). Expects a pointer to the
// allocated destination object in the result register, and a pointer to the
Index: src/a64/macro-assembler-a64.cc
diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc
index 3c1a6e8a33098e5ca33ecf8a22d049fd14d8f16c..d998075ba8dd506e6eb795e43045be8ffe4502f4 100644
--- a/src/a64/macro-assembler-a64.cc
+++ b/src/a64/macro-assembler-a64.cc
@@ -760,7 +760,7 @@ void MacroAssembler::PrepareForPop(int count, int size) {
 }


-void MacroAssembler::Poke(const Register& src, const Operand& offset) {
+void MacroAssembler::Poke(const CPURegister& src, const Operand& offset) {
   if (offset.IsImmediate()) {
     ASSERT(offset.immediate() >= 0);
   } else if (emit_debug_code()) {
@@ -772,7 +772,7 @@ void MacroAssembler::Poke(const Register& src, const Operand& offset) {
 }


-void MacroAssembler::Peek(const Register& dst, const Operand& offset) {
+void MacroAssembler::Peek(const CPURegister& dst, const Operand& offset) {
   if (offset.IsImmediate()) {
     ASSERT(offset.immediate() >= 0);
   } else if (emit_debug_code()) {
@@ -2663,7 +2663,7 @@ void MacroAssembler::ExitFrameRestoreFPRegs() {
 }


-// TODO(jbramley): Check that we're handling FP correctly [GOOGJSE-33].
+// TODO(jbramley): Check that we're handling the frame pointer correctly.
 void MacroAssembler::EnterExitFrame(bool save_doubles,
                                     const Register& scratch,
                                     int extra_space) {
Index: src/a64/macro-assembler-a64.h
diff --git a/src/a64/macro-assembler-a64.h b/src/a64/macro-assembler-a64.h
index c139137107b648fb8ec5935b6ba6510118cdcffd..375390f119caca80d442151899b5db45baef4196 100644
--- a/src/a64/macro-assembler-a64.h
+++ b/src/a64/macro-assembler-a64.h
@@ -531,13 +531,13 @@ class MacroAssembler : public Assembler {
   //
// If the current stack pointer (according to StackPointer()) is csp, then
   // csp must be aligned to 16 bytes.
-  void Poke(const Register& src, const Operand& offset);
+  void Poke(const CPURegister& src, const Operand& offset);

// Peek at a value on the stack, and put it in 'dst'. The offset is in bytes.
   //
// If the current stack pointer (according to StackPointer()) is csp, then
   // csp must be aligned to 16 bytes.
-  void Peek(const Register& dst, const Operand& offset);
+  void Peek(const CPURegister& dst, const Operand& offset);

   // Claim or drop stack space without actually accessing memory.
   //


--
--
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/groups/opt_out.

Reply via email to