Revision: 4397
Author: [email protected]
Date: Tue Apr 13 04:59:37 2010
Log: Fix build problems on Windows 64-bit by casting.
Gave the root register a name for reference.

Review URL: http://codereview.chromium.org/1539033
http://code.google.com/p/v8/source/detail?r=4397

Modified:
 /branches/bleeding_edge/src/circular-queue-inl.h
 /branches/bleeding_edge/src/circular-queue.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/liveedit.cc
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/x64/builtins-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h
 /branches/bleeding_edge/src/x64/register-allocator-x64-inl.h
 /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
 /branches/bleeding_edge/test/cctest/test-heap.cc

=======================================
--- /branches/bleeding_edge/src/circular-queue-inl.h Mon Mar 22 07:23:45 2010 +++ /branches/bleeding_edge/src/circular-queue-inl.h Tue Apr 13 04:59:37 2010
@@ -38,7 +38,8 @@
 CircularQueue<Record>::CircularQueue(int desired_buffer_size_in_bytes)
: buffer_(NewArray<Record>(desired_buffer_size_in_bytes / sizeof(Record))),
       buffer_end_(buffer_ + desired_buffer_size_in_bytes / sizeof(Record)),
-      enqueue_semaphore_(OS::CreateSemaphore((buffer_end_ - buffer_) - 1)),
+      enqueue_semaphore_(
+ OS::CreateSemaphore(static_cast<int>(buffer_end_ - buffer_) - 1)),
       enqueue_pos_(buffer_),
       dequeue_pos_(buffer_) {
   // To be able to distinguish between a full and an empty queue
=======================================
--- /branches/bleeding_edge/src/circular-queue.cc       Mon Mar 22 07:23:45 2010
+++ /branches/bleeding_edge/src/circular-queue.cc       Tue Apr 13 04:59:37 2010
@@ -58,8 +58,10 @@
   // updates of positions by different processor cores.
   const int positions_size =
       RoundUp(1, kProcessorCacheLineSize) +
-      RoundUp(sizeof(ProducerPosition), kProcessorCacheLineSize) +
-      RoundUp(sizeof(ConsumerPosition), kProcessorCacheLineSize);
+      RoundUp(static_cast<int>(sizeof(ProducerPosition)),
+              kProcessorCacheLineSize) +
+      RoundUp(static_cast<int>(sizeof(ConsumerPosition)),
+              kProcessorCacheLineSize);
   positions_ = NewArray<byte>(positions_size);

   producer_pos_ = reinterpret_cast<ProducerPosition*>(
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Apr 12 06:36:52 2010
+++ /branches/bleeding_edge/src/heap.cc Tue Apr 13 04:59:37 2010
@@ -2307,7 +2307,8 @@

   Address old_addr = code->address();

-  int relocation_offset = code->relocation_start() - old_addr;
+  size_t relocation_offset =
+      static_cast<size_t>(code->relocation_start() - old_addr);

   Object* result;
   if (new_obj_size > MaxObjectSizeInPagedSpace()) {
=======================================
--- /branches/bleeding_edge/src/liveedit.cc     Fri Apr  9 06:51:11 2010
+++ /branches/bleeding_edge/src/liveedit.cc     Tue Apr 13 04:59:37 2010
@@ -558,8 +558,9 @@

   Vector<byte> GetResult() {
     // Return the bytes from pos up to end of buffer.
-    return Vector<byte>(reloc_info_writer_.pos(),
-                        buffer_ + buffer_size_ - reloc_info_writer_.pos());
+    int result_size =
+ static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer_.pos());
+    return Vector<byte>(reloc_info_writer_.pos(), result_size);
   }

  private:
@@ -581,7 +582,8 @@
     byte* new_buffer = NewArray<byte>(new_buffer_size);

     // Copy the data.
- int curently_used_size = buffer_ + buffer_size_ - reloc_info_writer_.pos();
+    int curently_used_size =
+ static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos());
     memmove(new_buffer + new_buffer_size - curently_used_size,
             reloc_info_writer_.pos(), curently_used_size);

@@ -986,7 +988,7 @@
       DropActivationsInActiveThread(shared_info_array, result, do_drop);
   if (error_message != NULL) {
     // Add error message as an array extra element.
- Vector<const char> vector_message(error_message, strlen(error_message)); + Vector<const char> vector_message(error_message, StrLength(error_message));
     Handle<String> str = Factory::NewStringFromAscii(vector_message);
     SetElement(result, len, str);
   }
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Wed Apr 7 07:18:26 2010 +++ /branches/bleeding_edge/src/profile-generator.cc Tue Apr 13 04:59:37 2010
@@ -327,7 +327,7 @@


 CpuProfile* CpuProfilesCollection::StopProfiling(const char* title) {
-  const int title_len = strlen(title);
+  const int title_len = StrLength(title);
   CpuProfile* profile = NULL;
   current_profiles_semaphore_->Wait();
   for (int i = current_profiles_.length() - 1; i >= 0; --i) {
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Apr 13 02:31:03 2010
+++ /branches/bleeding_edge/src/runtime.cc      Tue Apr 13 04:59:37 2010
@@ -2542,7 +2542,7 @@
                pattern_char,
                string.length() - start_index));
     if (pos == NULL) return -1;
-    return pos - string.start();
+    return static_cast<int>(pos - string.start());
   }
   for (int i = start_index, n = string.length(); i < n; i++) {
     if (pattern_char == string[i]) {
@@ -2600,7 +2600,7 @@
         *complete = true;
         return -1;
       }
-      i = pos - subject.start();
+      i = static_cast<int>(pos - subject.start());
     } else {
       if (subject[i] != pattern_first_char) continue;
     }
@@ -2634,7 +2634,7 @@
                  pattern_first_char,
                  n - i + 1));
       if (pos == NULL) return -1;
-      i = pos - subject.start();
+      i = static_cast<int>(pos - subject.start());
     } else {
       if (subject[i] != pattern_first_char) continue;
     }
@@ -6366,7 +6366,7 @@
 static inline void DateYMDFromTimeAfter1970(int date,
int& year, int& month, int& day) {
 #ifdef DEBUG
-  int save_date = date;  // Need this for ASSERT in the end.
+  int save_date = date;  // Need this for ASSERT in the end.
 #endif

   year = 1970 + (4 * date + 2) / kDaysIn4Years;
@@ -6382,7 +6382,7 @@
 static inline void DateYMDFromTimeSlow(int date,
                                        int& year, int& month, int& day) {
 #ifdef DEBUG
-  int save_date = date;  // Need this for ASSERT in the end.
+  int save_date = date;  // Need this for ASSERT in the end.
 #endif

   date += kDaysOffset;
@@ -9779,7 +9779,8 @@
     // Check if this break point is closer that what was previously found.
     if (source_position <= statement_position &&
         statement_position - source_position < distance) {
-      closest_pc = it.rinfo()->pc() - code->instruction_start();
+      closest_pc =
+          static_cast<int>(it.rinfo()->pc() - code->instruction_start());
       distance = statement_position - source_position;
       // Check whether we can't get any closer.
       if (distance == 0) break;
=======================================
--- /branches/bleeding_edge/src/x64/builtins-x64.cc     Wed Feb 24 00:33:51 2010
+++ /branches/bleeding_edge/src/x64/builtins-x64.cc     Tue Apr 13 04:59:37 2010
@@ -1240,7 +1240,7 @@

   // Set up the roots register.
   ExternalReference roots_address = ExternalReference::roots_address();
-  __ movq(r13, roots_address);
+  __ movq(kRootRegister, roots_address);

   // Current stack contents:
   // [rsp + 2 * kPointerSize ... ]: Internal frame
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Mar 30 06:55:03 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Apr 13 04:59:37 2010
@@ -46,17 +46,17 @@


void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
-  movq(destination, Operand(r13, index << kPointerSizeLog2));
+  movq(destination, Operand(kRootRegister, index << kPointerSizeLog2));
 }


 void MacroAssembler::PushRoot(Heap::RootListIndex index) {
-  push(Operand(r13, index << kPointerSizeLog2));
+  push(Operand(kRootRegister, index << kPointerSizeLog2));
 }


void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) {
-  cmpq(with, Operand(r13, index << kPointerSizeLog2));
+  cmpq(with, Operand(kRootRegister, index << kPointerSizeLog2));
 }


=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Tue Mar 30 06:55:03 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Tue Apr 13 04:59:37 2010
@@ -37,6 +37,7 @@
 // a spare register). The register isn't callee save, and not used by the
 // function calling convention.
 static const Register kScratchRegister = { 10 };  // r10.
+static const Register kRootRegister = { 13 };     // r13

 // Convenience for platform-independent signatures.
 typedef Operand MemOperand;
=======================================
--- /branches/bleeding_edge/src/x64/register-allocator-x64-inl.h Mon Aug 31 01:57:36 2009 +++ /branches/bleeding_edge/src/x64/register-allocator-x64-inl.h Tue Apr 13 04:59:37 2010
@@ -38,7 +38,7 @@

 bool RegisterAllocator::IsReserved(Register reg) {
   return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) ||
-      reg.is(kScratchRegister);
+      reg.is(kScratchRegister) || reg.is(kRootRegister);
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Mon Apr 12 00:23:43 2010 +++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Tue Apr 13 04:59:37 2010
@@ -95,7 +95,7 @@
   i::HandleScope scope;
   const char* aaa_str = "aaa";
   i::Handle<i::String> aaa_name = i::Factory::NewStringFromAscii(
-      i::Vector<const char>(aaa_str, strlen(aaa_str)));
+      i::Vector<const char>(aaa_str, i::StrLength(aaa_str)));
   processor.CodeCreateEvent(i::Logger::FUNCTION_TAG,
                             *aaa_name,
                             i::Heap::empty_string(),
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Thu Mar 25 08:32:58 2010 +++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Apr 13 04:59:37 2010
@@ -821,19 +821,20 @@
   Page* page = Page::FromAddress(current_top);
   Address current_page = page->address();
   Address next_page = current_page + Page::kPageSize;
-  int bytes_to_page = next_page - current_top;
+  int bytes_to_page = static_cast<int>(next_page - current_top);
   if (bytes_to_page <= FixedArray::kHeaderSize) {
     // Alas, need to cross another page to be able to
     // put desired value.
     next_page += Page::kPageSize;
-    bytes_to_page = next_page - current_top;
+    bytes_to_page = static_cast<int>(next_page - current_top);
   }
   CHECK(bytes_to_page > FixedArray::kHeaderSize);

   int* is_normal_page_ptr = &Page::FromAddress(next_page)->is_normal_page;
Address is_normal_page_addr = reinterpret_cast<Address>(is_normal_page_ptr);

- int bytes_to_allocate = (is_normal_page_addr - current_top) + kPointerSize;
+  int bytes_to_allocate =
+      static_cast<int>(is_normal_page_addr - current_top) + kPointerSize;

   int n_elements = (bytes_to_allocate - FixedArray::kHeaderSize) /
       kPointerSize;
@@ -917,7 +918,7 @@
   }

// Step 3: now allocate fixed array and JSObject to fill the whole new space.
-  int to_fill = *limit_addr - *top_addr - object_size;
+  int to_fill = static_cast<int>(*limit_addr - *top_addr - object_size);
   int fixed_array_len = LenFromSize(to_fill);
   CHECK(fixed_array_len < FixedArray::kMaxLength);

@@ -935,7 +936,7 @@
   // Create a reference to object in new space in jsobject.
   jsobject->FastPropertyAtPut(-1, array);

-  CHECK_EQ(0L, (*limit_addr - *top_addr));
+  CHECK_EQ(0, static_cast<int>(*limit_addr - *top_addr));

// Step 4: clone jsobject, but force always allocate first to create a clone
   // in old pointer space.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

To unsubscribe, reply using "remove me" as the subject.

Reply via email to