Commit 7bca61c1 authored by lrn@chromium.org's avatar lrn@chromium.org

Fix build problems on Windows 64-bit by casting.

Gave the root register a name for reference.

Review URL: http://codereview.chromium.org/1539033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4397 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2716660d
......@@ -38,7 +38,8 @@ template<typename Record>
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
......
......@@ -58,8 +58,10 @@ SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes,
// 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*>(
......
......@@ -2307,7 +2307,8 @@ Object* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
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()) {
......
......@@ -558,8 +558,9 @@ class RelocInfoBuffer {
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 @@ class RelocInfoBuffer {
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 @@ Handle<JSArray> LiveEdit::CheckAndDropActivations(
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);
}
......
......@@ -327,7 +327,7 @@ bool CpuProfilesCollection::StartProfiling(String* title, unsigned uid) {
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) {
......
......@@ -2542,7 +2542,7 @@ static inline int SingleCharIndexOf(Vector<const schar> string,
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 @@ static int SimpleIndexOf(Vector<const schar> subject,
*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 @@ static int SimpleIndexOf(Vector<const schar> subject,
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 const char kMonthInYear[] = {
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 DateYMDFromTimeAfter1970(int date,
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 @@ static Object* Runtime_GetFunctionCodePositionFromSource(Arguments args) {
// 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;
......
......@@ -1240,7 +1240,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
// 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
......
......@@ -46,17 +46,17 @@ MacroAssembler::MacroAssembler(void* buffer, int size)
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));
}
......
......@@ -37,6 +37,7 @@ namespace internal {
// 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;
......
......@@ -38,7 +38,7 @@ namespace internal {
bool RegisterAllocator::IsReserved(Register reg) {
return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) ||
reg.is(kScratchRegister);
reg.is(kScratchRegister) || reg.is(kRootRegister);
}
......
......@@ -95,7 +95,7 @@ TEST(CodeEvents) {
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(),
......
......@@ -821,19 +821,20 @@ TEST(LargeObjectSpaceContains) {
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 @@ TEST(Regression39128) {
}
// 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 @@ TEST(Regression39128) {
// 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment