Commit 1dfac258 authored by whesse@chromium.org's avatar whesse@chromium.org

Change some integer types to make the x64 Win32 platform happier.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2743 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 830de0f7
......@@ -814,15 +814,13 @@ Failure* Failure::RetryAfterGC(int requested_bytes) {
Failure* Failure::Construct(Type type, int value) {
int info = (value << kFailureTypeTagSize) | type;
// TODO(X64): Stop using Smi validation for non-smi checks, even if they
// happen to be identical at the moment.
ASSERT(Smi::IsValid(info)); // Same validation check as in Smi
ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
return reinterpret_cast<Failure*>(
(static_cast<intptr_t>(info) << kFailureTagSize) | kFailureTag);
}
bool Smi::IsValid(int value) {
bool Smi::IsValid(intptr_t value) {
#ifdef DEBUG
bool in_range = (value >= kMinValue) && (value <= kMaxValue);
#endif
......@@ -937,12 +935,13 @@ MapWord MapWord::EncodeAddress(Address map_address, int offset) {
Address MapWord::DecodeMapAddress(MapSpace* map_space) {
int map_page_index = (value_ & kMapPageIndexMask) >> kMapPageIndexShift;
int map_page_index =
static_cast<int>((value_ & kMapPageIndexMask) >> kMapPageIndexShift);
ASSERT_MAP_PAGE_INDEX(map_page_index);
int map_page_offset =
int map_page_offset = static_cast<int>(
((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift)
<< kObjectAlignmentBits;
<< kObjectAlignmentBits);
return (map_space->PageAddress(map_page_index) + map_page_offset);
}
......
......@@ -905,7 +905,7 @@ class Smi: public Object {
static inline Smi* FromIntptr(intptr_t value);
// Returns whether value can be represented in a Smi.
static inline bool IsValid(int value);
static inline bool IsValid(intptr_t value);
static inline bool IsIntptrValid(intptr_t);
......
......@@ -54,10 +54,6 @@
#define _WIN32_WINNT 0x500
#endif
#ifdef _WIN64
#error Windows 64-bit blatforms not supported
#endif
#include <windows.h>
#include <time.h> // For LocalOffset() implementation.
......@@ -1190,6 +1186,9 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
memset(&context, 0, sizeof(context));
context.ContextFlags = CONTEXT_CONTROL;
context.ContextFlags = CONTEXT_CONTROL;
#ifdef _WIN64
// TODO(X64): Implement context capture.
#else
__asm call x
__asm x: pop eax
__asm mov context.Eip, eax
......@@ -1199,15 +1198,22 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
// capture the context instead of inline assembler. However it is
// only available on XP, Vista, Server 2003 and Server 2008 which
// might not be sufficient.
#endif
// Initialize the stack walking
STACKFRAME64 stack_frame;
memset(&stack_frame, 0, sizeof(stack_frame));
#ifdef _WIN64
stack_frame.AddrPC.Offset = context.Rip;
stack_frame.AddrFrame.Offset = context.Rbp;
stack_frame.AddrStack.Offset = context.Rsp;
#else
stack_frame.AddrPC.Offset = context.Eip;
stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrFrame.Offset = context.Ebp;
stack_frame.AddrFrame.Mode = AddrModeFlat;
stack_frame.AddrStack.Offset = context.Esp;
#endif
stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrFrame.Mode = AddrModeFlat;
stack_frame.AddrStack.Mode = AddrModeFlat;
int frames_count = 0;
......
......@@ -114,8 +114,10 @@ static inline bool IsAligned(T value, T alignment) {
// Returns true if (addr + offset) is aligned.
static inline bool IsAddressAligned(Address addr, int alignment, int offset) {
int offs = OffsetFrom(addr + offset);
static inline bool IsAddressAligned(Address addr,
intptr_t alignment,
int offset) {
intptr_t offs = OffsetFrom(addr + offset);
return IsAligned(offs, alignment);
}
......@@ -446,15 +448,15 @@ class ScopedVector : public Vector<T> {
inline Vector<const char> CStrVector(const char* data) {
return Vector<const char>(data, strlen(data));
return Vector<const char>(data, static_cast<int>(strlen(data)));
}
inline Vector<char> MutableCStrVector(char* data) {
return Vector<char>(data, strlen(data));
return Vector<char>(data, static_cast<int>(strlen(data)));
}
inline Vector<char> MutableCStrVector(char* data, int max) {
int length = strlen(data);
int length = static_cast<int>(strlen(data));
return Vector<char>(data, (length < max) ? length : max);
}
......
......@@ -6264,8 +6264,8 @@ bool CodeGenerator::FoldConstantSmis(Token::Value op, int left, int right) {
} else {
unsigned_left >>= shift_amount;
}
ASSERT(Smi::IsValid(unsigned_left)); // Converted to signed.
answer_object = Smi::FromInt(unsigned_left); // Converted to signed.
ASSERT(Smi::IsValid(static_cast<int32_t>(unsigned_left)));
answer_object = Smi::FromInt(static_cast<int32_t>(unsigned_left));
break;
}
default:
......
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