From 199f1e7977fdfe00015c9a1f9129e4be5bcc0ef0 Mon Sep 17 00:00:00 2001 From: "vegorov@chromium.org" Date: Tue, 7 Dec 2010 11:53:19 +0000 Subject: [PATCH] Fix Win64 compilation. Review URL: http://codereview.chromium.org/5597007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5925 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/atomicops_internals_x86_msvc.h | 1 + src/deoptimizer.cc | 80 ++++++++++++++++-------------- src/deoptimizer.h | 40 +++++++-------- src/frames.cc | 4 +- src/hydrogen.cc | 4 +- src/ia32/deoptimizer-ia32.cc | 4 +- src/objects.cc | 2 +- src/runtime.cc | 2 +- src/type-info.cc | 5 +- 9 files changed, 76 insertions(+), 66 deletions(-) diff --git a/src/atomicops_internals_x86_msvc.h b/src/atomicops_internals_x86_msvc.h index a7753e4897..fcf6a65107 100644 --- a/src/atomicops_internals_x86_msvc.h +++ b/src/atomicops_internals_x86_msvc.h @@ -30,6 +30,7 @@ #ifndef V8_ATOMICOPS_INTERNALS_X86_MSVC_H_ #define V8_ATOMICOPS_INTERNALS_X86_MSVC_H_ +#include "checks.h" #include "win32-headers.h" namespace v8 { diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 3aa2f35862..93839a49a8 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -288,7 +288,7 @@ int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { } ASSERT_EQ(0, static_cast(addr - base->GetStartAddress()) % table_entry_size_); - return (addr - base->GetStartAddress()) / table_entry_size_; + return static_cast(addr - base->GetStartAddress()) / table_entry_size_; } @@ -405,7 +405,7 @@ void Deoptimizer::DoComputeOutputFrames() { PrintF("[deoptimizing: end 0x%08" V8PRIxPTR " ", reinterpret_cast(function)); function->PrintName(); - PrintF(" => node=%u, pc=0x%08x, state=%s, took %0.3f ms]\n", + PrintF(" => node=%u, pc=0x%08" V8PRIxPTR ", state=%s, took %0.3f ms]\n", node_id, output_[index]->GetPc(), FullCodeGenerator::State2String( @@ -475,13 +475,14 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, case Translation::REGISTER: { int input_reg = iterator->Next(); - uint32_t input_value = input_->GetRegister(input_reg); + intptr_t input_value = input_->GetRegister(input_reg); if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- 0x%08x ; %s\n", - output_[frame_index]->GetTop() + output_offset, - output_offset, - input_value, - converter.NameOfCPURegister(input_reg)); + PrintF( + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s\n", + output_[frame_index]->GetTop() + output_offset, + output_offset, + input_value, + converter.NameOfCPURegister(input_reg)); } output_[frame_index]->SetFrameSlot(output_offset, input_value); return; @@ -489,25 +490,28 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, case Translation::INT32_REGISTER: { int input_reg = iterator->Next(); - uint32_t value = input_->GetRegister(input_reg); + intptr_t value = input_->GetRegister(input_reg); bool is_smi = Smi::IsValid(value); unsigned output_index = output_offset / kPointerSize; if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- %d ; %s (%s)\n", - output_[frame_index]->GetTop() + output_offset, - output_offset, - value, - converter.NameOfCPURegister(input_reg), - is_smi ? "smi" : "heap number"); + PrintF( + " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n", + output_[frame_index]->GetTop() + output_offset, + output_offset, + value, + converter.NameOfCPURegister(input_reg), + is_smi ? "smi" : "heap number"); } if (is_smi) { intptr_t tagged_value = - reinterpret_cast(Smi::FromInt(value)); + reinterpret_cast(Smi::FromInt(static_cast(value))); output_[frame_index]->SetFrameSlot(output_offset, tagged_value); } else { // We save the untagged value on the side and store a GC-safe // temporary placeholder in the frame. - AddInteger32Value(frame_index, output_index, value); + AddInteger32Value(frame_index, + output_index, + static_cast(value)); output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); } return; @@ -518,7 +522,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, double value = input_->GetDoubleRegister(input_reg); unsigned output_index = output_offset / kPointerSize; if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- %e ; %s\n", + PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n", output_[frame_index]->GetTop() + output_offset, output_offset, value, @@ -535,10 +539,11 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, int input_slot_index = iterator->Next(); unsigned input_offset = input_->GetOffsetFromSlotIndex(this, input_slot_index); - uint32_t input_value = input_->GetFrameSlot(input_offset); + intptr_t input_value = input_->GetFrameSlot(input_offset); if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- 0x%08x ; [esp + %d]\n", - output_[frame_index]->GetTop() + output_offset, + PrintF(" 0x%08" V8PRIxPTR ": ", + output_[frame_index]->GetTop() + output_offset); + PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", output_offset, input_value, input_offset); @@ -551,12 +556,13 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, int input_slot_index = iterator->Next(); unsigned input_offset = input_->GetOffsetFromSlotIndex(this, input_slot_index); - int32_t value = input_->GetFrameSlot(input_offset); + intptr_t value = input_->GetFrameSlot(input_offset); bool is_smi = Smi::IsValid(value); unsigned output_index = output_offset / kPointerSize; if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- %d ; [esp + %d] (%s)\n", - output_[frame_index]->GetTop() + output_offset, + PrintF(" 0x%08" V8PRIxPTR ": ", + output_[frame_index]->GetTop() + output_offset); + PrintF("[top + %d] <- %" V8PRIdPTR " ; [esp + %d] (%s)\n", output_offset, value, input_offset, @@ -564,12 +570,14 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, } if (is_smi) { intptr_t tagged_value = - reinterpret_cast(Smi::FromInt(value)); + reinterpret_cast(Smi::FromInt(static_cast(value))); output_[frame_index]->SetFrameSlot(output_offset, tagged_value); } else { // We save the untagged value on the side and store a GC-safe // temporary placeholder in the frame. - AddInteger32Value(frame_index, output_index, value); + AddInteger32Value(frame_index, + output_index, + static_cast(value)); output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); } return; @@ -582,7 +590,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, double value = input_->GetDoubleFrameSlot(input_offset); unsigned output_index = output_offset / kPointerSize; if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- %e ; [esp + %d]\n", + PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [esp + %d]\n", output_[frame_index]->GetTop() + output_offset, output_offset, value, @@ -598,7 +606,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, case Translation::LITERAL: { Object* literal = ComputeLiteral(iterator->Next()); if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- ", + PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ", output_[frame_index]->GetTop() + output_offset, output_offset); literal->ShortPrint(); @@ -614,7 +622,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, // after the deoptimized frame is built. ASSERT(frame_index == 0); // Only supported for first frame. if (FLAG_trace_deopt) { - PrintF(" 0x%08x: [top + %d] <- ", + PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ", output_[frame_index]->GetTop() + output_offset, output_offset); Heap::the_hole_value()->ShortPrint(); @@ -635,7 +643,7 @@ bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, // The input values are all part of the unoptimized frame so they // are all tagged pointers. - uint32_t input_value = input_->GetFrameSlot(*input_offset); + uintptr_t input_value = input_->GetFrameSlot(*input_offset); Object* input_object = reinterpret_cast(input_value); Translation::Opcode opcode = @@ -655,7 +663,7 @@ bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, case Translation::REGISTER: { int output_reg = iterator->Next(); if (FLAG_trace_osr) { - PrintF(" %s <- 0x%08x ; [esp + %d]\n", + PrintF(" %s <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", converter.NameOfCPURegister(output_reg), input_value, *input_offset); @@ -712,7 +720,7 @@ bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, unsigned output_offset = output->GetOffsetFromSlotIndex(this, output_index); if (FLAG_trace_osr) { - PrintF(" [esp + %d] <- 0x%08x ; [esp + %d]\n", + PrintF(" [esp + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", output_offset, input_value, *input_offset); @@ -954,13 +962,13 @@ unsigned FrameDescription::GetOffsetFromSlotIndex(Deoptimizer* deoptimizer, if (slot_index >= 0) { // Local or spill slots. Skip the fixed part of the frame // including all arguments. - unsigned base = - GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction()); + unsigned base = static_cast( + GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction())); return base - ((slot_index + 1) * kPointerSize); } else { // Incoming parameter. - unsigned base = GetFrameSize() - - deoptimizer->ComputeIncomingArgumentSize(GetFunction()); + unsigned base = static_cast(GetFrameSize() - + deoptimizer->ComputeIncomingArgumentSize(GetFunction())); return base - ((slot_index + 1) * kPointerSize); } } diff --git a/src/deoptimizer.h b/src/deoptimizer.h index 7a39d16afd..32edd1009f 100644 --- a/src/deoptimizer.h +++ b/src/deoptimizer.h @@ -293,13 +293,13 @@ class FrameDescription { free(description); } - uint32_t GetFrameSize() const { return frame_size_; } + intptr_t GetFrameSize() const { return frame_size_; } JSFunction* GetFunction() const { return function_; } unsigned GetOffsetFromSlotIndex(Deoptimizer* deoptimizer, int slot_index); - uint32_t GetFrameSlot(unsigned offset) { + intptr_t GetFrameSlot(unsigned offset) { return *GetFrameSlotPointer(offset); } @@ -307,11 +307,11 @@ class FrameDescription { return *reinterpret_cast(GetFrameSlotPointer(offset)); } - void SetFrameSlot(unsigned offset, uint32_t value) { + void SetFrameSlot(unsigned offset, intptr_t value) { *GetFrameSlotPointer(offset) = value; } - uint32_t GetRegister(unsigned n) const { + intptr_t GetRegister(unsigned n) const { ASSERT(n < ARRAY_SIZE(registers_)); return registers_[n]; } @@ -321,7 +321,7 @@ class FrameDescription { return double_registers_[n]; } - void SetRegister(unsigned n, uint32_t value) { + void SetRegister(unsigned n, intptr_t value) { ASSERT(n < ARRAY_SIZE(registers_)); registers_[n] = value; } @@ -331,19 +331,19 @@ class FrameDescription { double_registers_[n] = value; } - uint32_t GetTop() const { return top_; } - void SetTop(uint32_t top) { top_ = top; } + intptr_t GetTop() const { return top_; } + void SetTop(intptr_t top) { top_ = top; } - uint32_t GetPc() const { return pc_; } - void SetPc(uint32_t pc) { pc_ = pc; } + intptr_t GetPc() const { return pc_; } + void SetPc(intptr_t pc) { pc_ = pc; } - uint32_t GetFp() const { return fp_; } - void SetFp(uint32_t fp) { fp_ = fp; } + intptr_t GetFp() const { return fp_; } + void SetFp(intptr_t fp) { fp_ = fp; } Smi* GetState() const { return state_; } void SetState(Smi* state) { state_ = state; } - void SetContinuation(uint32_t pc) { continuation_ = pc; } + void SetContinuation(intptr_t pc) { continuation_ = pc; } static int registers_offset() { return OFFSET_OF(FrameDescription, registers_); @@ -376,22 +376,22 @@ class FrameDescription { private: static const uint32_t kZapUint32 = 0xbeeddead; - uint32_t frame_size_; // Number of bytes. + uintptr_t frame_size_; // Number of bytes. JSFunction* function_; - uint32_t registers_[Register::kNumRegisters]; + intptr_t registers_[Register::kNumRegisters]; double double_registers_[DoubleRegister::kNumAllocatableRegisters]; - uint32_t top_; - uint32_t pc_; - uint32_t fp_; + intptr_t top_; + intptr_t pc_; + intptr_t fp_; Smi* state_; // Continuation is the PC where the execution continues after // deoptimizing. - uint32_t continuation_; + intptr_t continuation_; - uint32_t* GetFrameSlotPointer(unsigned offset) { + intptr_t* GetFrameSlotPointer(unsigned offset) { ASSERT(offset < frame_size_); - return reinterpret_cast( + return reinterpret_cast( reinterpret_cast
(this) + frame_content_offset() + offset); } }; diff --git a/src/frames.cc b/src/frames.cc index 775404d3ee..3af72887e9 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -655,7 +655,7 @@ void JavaScriptFrame::GetFunctions(List* functions) { void JavaScriptFrame::Summarize(List* functions) { ASSERT(functions->length() == 0); Code* code_pointer = code(); - int offset = pc() - code_pointer->address(); + int offset = static_cast(pc() - code_pointer->address()); FrameSummary summary(receiver(), JSFunction::cast(function()), code_pointer, @@ -779,7 +779,7 @@ DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); SafepointTable table(code); - unsigned pc_offset = pc() - code->instruction_start(); + unsigned pc_offset = static_cast(pc() - code->instruction_start()); for (unsigned i = 0; i < table.length(); i++) { if (table.GetPcOffset(i) == pc_offset) { *deopt_index = table.GetDeoptimizationIndex(i); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index d25917b0b1..18b6d152d6 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1164,7 +1164,7 @@ void HValueMap::Kill(int flags) { HValue* HValueMap::Lookup(HValue* value) const { - uint32_t hash = value->Hashcode(); + uint32_t hash = static_cast(value->Hashcode()); uint32_t pos = Bound(hash); if (array_[pos].value != NULL) { if (array_[pos].value->Equals(value)) return array_[pos].value; @@ -1252,7 +1252,7 @@ void HValueMap::Insert(HValue* value) { if (count_ >= array_size_ >> 1) Resize(array_size_ << 1); ASSERT(count_ < array_size_); count_++; - uint32_t pos = Bound(value->Hashcode()); + uint32_t pos = Bound(static_cast(value->Hashcode())); if (array_[pos].value == NULL) { array_[pos].value = value; array_[pos].next = kNil; diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc index f3e62dbcec..d95df3e7ea 100644 --- a/src/ia32/deoptimizer-ia32.cc +++ b/src/ia32/deoptimizer-ia32.cc @@ -352,7 +352,7 @@ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, // function code and AST id of the bailout. output_offset -= kPointerSize; input_offset -= kPointerSize; - uint32_t value; + intptr_t value; if (is_bottommost) { value = input_->GetFrameSlot(input_offset); } else { @@ -376,7 +376,7 @@ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, value = output_[frame_index - 1]->GetFp(); } output_frame->SetFrameSlot(output_offset, value); - unsigned fp_value = top_address + output_offset; + intptr_t fp_value = top_address + output_offset; ASSERT(!is_bottommost || input_->GetRegister(ebp.code()) == fp_value); output_frame->SetFp(fp_value); if (is_topmost) output_frame->SetRegister(ebp.code(), fp_value); diff --git a/src/objects.cc b/src/objects.cc index 1c652f64f1..399ab092a7 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -5967,7 +5967,7 @@ int Code::SourceStatementPosition(Address pc) { uint8_t* Code::GetSafepointEntry(Address pc) { SafepointTable table(this); - unsigned pc_offset = pc - instruction_start(); + unsigned pc_offset = static_cast(pc - instruction_start()); for (unsigned i = 0; i < table.length(); i++) { // TODO(kasperl): Replace the linear search with binary search. if (table.GetPcOffset(i) == pc_offset) return table.GetEntry(i); diff --git a/src/runtime.cc b/src/runtime.cc index c74704699c..efdb508794 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -6865,7 +6865,7 @@ static MaybeObject* Runtime_CompileForOnStackReplacement(Arguments args) { // Use linear search of the unoptimized code's stack check table to find // the AST id matching the PC. Address start = unoptimized->instruction_start(); - unsigned target_pc_offset = frame->pc() - start; + unsigned target_pc_offset = static_cast(frame->pc() - start); Address table_cursor = start + unoptimized->stack_check_table_start(); uint32_t table_length = Memory::uint32_at(table_cursor); table_cursor += kIntSize; diff --git a/src/type-info.cc b/src/type-info.cc index f9ee47d491..5f6022b6f1 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -337,12 +337,13 @@ void TypeFeedbackOracle::CollectPositions(Code* code, target->check_type() != RECEIVER_MAP_CHECK) continue; if (state != MONOMORPHIC && state != MEGAMORPHIC) continue; } - code_positions->Add(info->pc() - code->instruction_start()); + code_positions->Add( + static_cast(info->pc() - code->instruction_start())); source_positions->Add(position); } } else { ASSERT(RelocInfo::IsPosition(mode)); - position = info->data(); + position = static_cast(info->data()); } } }