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
This commit is contained in:
vegorov@chromium.org 2010-12-07 11:53:19 +00:00
parent 3b5abbbdef
commit 199f1e7977
9 changed files with 76 additions and 66 deletions

View File

@ -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 {

View File

@ -288,7 +288,7 @@ int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) {
}
ASSERT_EQ(0,
static_cast<int>(addr - base->GetStartAddress()) % table_entry_size_);
return (addr - base->GetStartAddress()) / table_entry_size_;
return static_cast<int>(addr - base->GetStartAddress()) / table_entry_size_;
}
@ -405,7 +405,7 @@ void Deoptimizer::DoComputeOutputFrames() {
PrintF("[deoptimizing: end 0x%08" V8PRIxPTR " ",
reinterpret_cast<intptr_t>(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<intptr_t>(Smi::FromInt(value));
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(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<int32_t>(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<intptr_t>(Smi::FromInt(value));
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(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<int32_t>(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<Object*>(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<unsigned>(
GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction()));
return base - ((slot_index + 1) * kPointerSize);
} else {
// Incoming parameter.
unsigned base = GetFrameSize() -
deoptimizer->ComputeIncomingArgumentSize(GetFunction());
unsigned base = static_cast<unsigned>(GetFrameSize() -
deoptimizer->ComputeIncomingArgumentSize(GetFunction()));
return base - ((slot_index + 1) * kPointerSize);
}
}

View File

@ -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<double*>(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<uint32_t*>(
return reinterpret_cast<intptr_t*>(
reinterpret_cast<Address>(this) + frame_content_offset() + offset);
}
};

View File

@ -655,7 +655,7 @@ void JavaScriptFrame::GetFunctions(List<JSFunction*>* functions) {
void JavaScriptFrame::Summarize(List<FrameSummary>* functions) {
ASSERT(functions->length() == 0);
Code* code_pointer = code();
int offset = pc() - code_pointer->address();
int offset = static_cast<int>(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<unsigned>(pc() - code->instruction_start());
for (unsigned i = 0; i < table.length(); i++) {
if (table.GetPcOffset(i) == pc_offset) {
*deopt_index = table.GetDeoptimizationIndex(i);

View File

@ -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<uint32_t>(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<uint32_t>(value->Hashcode()));
if (array_[pos].value == NULL) {
array_[pos].value = value;
array_[pos].next = kNil;

View File

@ -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);

View File

@ -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<unsigned>(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);

View File

@ -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<unsigned>(frame->pc() - start);
Address table_cursor = start + unoptimized->stack_check_table_start();
uint32_t table_length = Memory::uint32_at(table_cursor);
table_cursor += kIntSize;

View File

@ -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<int>(info->pc() - code->instruction_start()));
source_positions->Add(position);
}
} else {
ASSERT(RelocInfo::IsPosition(mode));
position = info->data();
position = static_cast<int>(info->data());
}
}
}