* Fix new snapshot code on ARM.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Oct 2009 12:37:54 +0000 (12:37 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Oct 2009 12:37:54 +0000 (12:37 +0000)
Review URL: http://codereview.chromium.org/344011

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

src/arm/assembler-arm-inl.h
src/arm/assembler-arm.h
src/ia32/assembler-ia32.h
src/serialize.cc
src/x64/assembler-x64.h
test/cctest/cctest.status

index 48cc09081daa4488c0bbfa70ec566b7b6da03c3b..d6046ec8db73d7d7210ad57d8621cf9dea5a501c 100644 (file)
@@ -245,6 +245,12 @@ Address Assembler::target_address_at(Address pc) {
 }
 
 
+void Assembler::set_target_at(Address constant_pool_entry,
+                              Address target) {
+  Memory::Address_at(constant_pool_entry) = target;
+}
+
+
 void Assembler::set_target_address_at(Address pc, Address target) {
   Memory::Address_at(target_address_address_at(pc)) = target;
   // Intuitively, we would think it is necessary to flush the instruction cache
index f63473c37ac70e9a5186ca71c1d2d12757412f88..d617c7e18ef018be26d287152c29fa621f1ac365 100644 (file)
@@ -437,6 +437,9 @@ class Assembler : public Malloced {
   INLINE(static Address target_address_at(Address pc));
   INLINE(static void set_target_address_at(Address pc, Address target));
 
+  // Modify the code target address in a constant pool entry.
+  inline static void set_target_at(Address constant_pool_entry, Address target);
+
   // Here we are patching the address in the constant pool, not the actual call
   // instruction.  The address in the constant pool is the same size as a
   // pointer.
index 9b2da4156d654751f6ed20d8fb65f69d56fd9e54..a431d04c66c9bf74bc5a73bbe4b8ddb337d345d2 100644 (file)
@@ -439,6 +439,12 @@ class Assembler : public Malloced {
   inline static Address target_address_at(Address pc);
   inline static void set_target_address_at(Address pc, Address target);
 
+  // This sets the branch destination (which is in the instruction on x86).
+  inline static void set_target_at(Address instruction_payload,
+                                   Address target) {
+    set_target_address_at(instruction_payload, target);
+  }
+
   static const int kCallTargetSize = kPointerSize;
 
   // Distance between the address of the code target in the call instruction
index f2aeb901d29b23ed8fda08c161800a1c587059f7..6eedeef37bf932d6938d7df94467de18551fe3ca 100644 (file)
@@ -1949,8 +1949,8 @@ bool Deserializer2::ReadObject(Object** write_back) {
         Code* code_object = reinterpret_cast<Code*>(new_code_object);
         // Setting a branch/call to another code object from code.
         Address location_of_branch_data = reinterpret_cast<Address>(current);
-        Assembler::set_target_address_at(location_of_branch_data,
-                                         code_object->instruction_start());
+        Assembler::set_target_at(location_of_branch_data,
+                                 code_object->instruction_start());
         location_of_branch_data += Assembler::kCallTargetSize;
         current = reinterpret_cast<Object**>(location_of_branch_data);
         break;
@@ -1972,8 +1972,8 @@ bool Deserializer2::ReadObject(Object** write_back) {
         Code* code_object = reinterpret_cast<Code*>(GetAddress(backref_space));
         // Setting a branch/call to previously decoded code object from code.
         Address location_of_branch_data = reinterpret_cast<Address>(current);
-        Assembler::set_target_address_at(location_of_branch_data,
-                                         code_object->instruction_start());
+        Assembler::set_target_at(location_of_branch_data,
+                                 code_object->instruction_start());
         location_of_branch_data += Assembler::kCallTargetSize;
         current = reinterpret_cast<Object**>(location_of_branch_data);
         break;
@@ -2173,6 +2173,8 @@ void Serializer2::ObjectSerializer::OutputRawData(Address up_to) {
   Address object_start = object_->address();
   int up_to_offset = up_to - object_start;
   int skipped = up_to_offset - bytes_processed_so_far_;
+  // This assert will fail if the reloc info gives us the target_address_address
+  // locations in a non-ascending order.  Luckily that doesn't happen.
   ASSERT(skipped >= 0);
   if (skipped != 0) {
     sink_->Put(RAW_DATA_SERIALIZATION, "raw data");
index 00d6248add159e6c0b5590d09b24fd71f3215c49..617f092bb46087163a47570c190eb1ea4e9e1a40 100644 (file)
@@ -458,6 +458,11 @@ class Assembler : public Malloced {
   // the relative displacements stored in the code.
   static inline Address target_address_at(Address pc);
   static inline void set_target_address_at(Address pc, Address target);
+  // This sets the branch destination (which is in the instruction on x64).
+  inline static void set_target_at(Address instruction_payload,
+                                   Address target) {
+    set_target_address_at(instruction_payload, target);
+  }
   inline Handle<Object> code_target_object_handle_at(Address pc);
   // Number of bytes taken up by the branch target in the code.
   static const int kCallTargetSize = 4;  // Use 32-bit displacement.
index 6ce241ff1e08e940b36a54ed4f5f25fc593ac1fd..b43cd6437a2e053676215d0e2bae289dedb72bfa 100644 (file)
@@ -47,10 +47,6 @@ test-serialize/DependentTestThatAlwaysFails: FAIL
 
 [ $arch == arm ]
 
-# New serialization doesn't work on ARM yet.
-test-serialize/Deserialize2: SKIP
-test-serialize/DeserializeAndRunScript2: SKIP
-
 # BUG(113): Test seems flaky on ARM.
 test-spaces/LargeObjectSpace: PASS || FAIL