mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
Cleanups: int -> intptr_t for "array" lengths, memory sizes.
R=asiva@google.com Review URL: https://codereview.chromium.org//26294002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28324 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
9c5078b378
commit
3a8252f90d
24 changed files with 165 additions and 162 deletions
|
@ -49,8 +49,8 @@ const char* DartUtils::MapLibraryUrl(CommandLineOptions* url_mapping,
|
|||
ASSERT(url_mapping != NULL);
|
||||
// We need to check if the passed in url is found in the url_mapping array,
|
||||
// in that case use the mapped entry.
|
||||
int len = strlen(url_string);
|
||||
for (int idx = 0; idx < url_mapping->count(); idx++) {
|
||||
intptr_t len = strlen(url_string);
|
||||
for (intptr_t idx = 0; idx < url_mapping->count(); idx++) {
|
||||
const char* url_name = url_mapping->GetArgument(idx);
|
||||
if (!strncmp(url_string, url_name, len) && (url_name[len] == ',')) {
|
||||
const char* url_mapped_name = url_name + len + 1;
|
||||
|
@ -939,7 +939,7 @@ Dart_CObject* CObject::NewString(intptr_t length) {
|
|||
|
||||
|
||||
Dart_CObject* CObject::NewString(const char* str) {
|
||||
int length = strlen(str);
|
||||
intptr_t length = strlen(str);
|
||||
Dart_CObject* cobject = NewString(length);
|
||||
memmove(cobject->value.as_string, str, length + 1);
|
||||
return cobject;
|
||||
|
|
|
@ -441,7 +441,7 @@ class CObjectString : public CObject {
|
|||
public:
|
||||
DECLARE_COBJECT_CONSTRUCTORS(String)
|
||||
|
||||
int Length() const { return strlen(cobject_->value.as_string); }
|
||||
intptr_t Length() const { return strlen(cobject_->value.as_string); }
|
||||
char* CString() const { return cobject_->value.as_string; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -62,7 +62,7 @@ AssemblerBuffer::EnsureCapacity::~EnsureCapacity() {
|
|||
|
||||
|
||||
AssemblerBuffer::AssemblerBuffer()
|
||||
: pointer_offsets_(new ZoneGrowableArray<int>(16)) {
|
||||
: pointer_offsets_(new ZoneGrowableArray<intptr_t>(16)) {
|
||||
static const intptr_t kInitialBufferCapacity = 4 * KB;
|
||||
contents_ = NewContents(kInitialBufferCapacity);
|
||||
cursor_ = contents_;
|
||||
|
@ -136,12 +136,12 @@ void AssemblerBuffer::ExtendCapacity() {
|
|||
|
||||
class PatchCodeWithHandle : public AssemblerFixup {
|
||||
public:
|
||||
PatchCodeWithHandle(ZoneGrowableArray<int>* pointer_offsets,
|
||||
PatchCodeWithHandle(ZoneGrowableArray<intptr_t>* pointer_offsets,
|
||||
const Object& object)
|
||||
: pointer_offsets_(pointer_offsets), object_(object) {
|
||||
}
|
||||
|
||||
void Process(const MemoryRegion& region, int position) {
|
||||
void Process(const MemoryRegion& region, intptr_t position) {
|
||||
// Patch the handle into the code. Once the instructions are installed into
|
||||
// a raw code object and the pointer offsets are setup, the handle is
|
||||
// resolved.
|
||||
|
@ -150,7 +150,7 @@ class PatchCodeWithHandle : public AssemblerFixup {
|
|||
}
|
||||
|
||||
private:
|
||||
ZoneGrowableArray<int>* pointer_offsets_;
|
||||
ZoneGrowableArray<intptr_t>* pointer_offsets_;
|
||||
const Object& object_;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class ExternalLabel : public ValueObject {
|
|||
// into executable memory.
|
||||
class AssemblerFixup : public ZoneAllocated {
|
||||
public:
|
||||
virtual void Process(const MemoryRegion& region, int position) = 0;
|
||||
virtual void Process(const MemoryRegion& region, intptr_t position) = 0;
|
||||
|
||||
// It would be ideal if the destructor method could be made private,
|
||||
// but the g++ compiler complains when this is subclassed.
|
||||
|
@ -59,13 +59,13 @@ class AssemblerFixup : public ZoneAllocated {
|
|||
|
||||
private:
|
||||
AssemblerFixup* previous_;
|
||||
int position_;
|
||||
intptr_t position_;
|
||||
|
||||
AssemblerFixup* previous() const { return previous_; }
|
||||
void set_previous(AssemblerFixup* previous) { previous_ = previous; }
|
||||
|
||||
int position() const { return position_; }
|
||||
void set_position(int position) { position_ = position; }
|
||||
intptr_t position() const { return position_; }
|
||||
void set_position(intptr_t position) { position_ = position; }
|
||||
|
||||
friend class AssemblerBuffer;
|
||||
};
|
||||
|
@ -89,17 +89,19 @@ class AssemblerBuffer : public ValueObject {
|
|||
cursor_ -= sizeof(T);
|
||||
}
|
||||
|
||||
template<typename T> T Load(int position) {
|
||||
ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T))));
|
||||
template<typename T> T Load(intptr_t position) {
|
||||
ASSERT(position >= 0 &&
|
||||
position <= (Size() - static_cast<intptr_t>(sizeof(T))));
|
||||
return *reinterpret_cast<T*>(contents_ + position);
|
||||
}
|
||||
|
||||
template<typename T> void Store(int position, T value) {
|
||||
ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T))));
|
||||
template<typename T> void Store(intptr_t position, T value) {
|
||||
ASSERT(position >= 0 &&
|
||||
position <= (Size() - static_cast<intptr_t>(sizeof(T))));
|
||||
*reinterpret_cast<T*>(contents_ + position) = value;
|
||||
}
|
||||
|
||||
const ZoneGrowableArray<int>& pointer_offsets() const {
|
||||
const ZoneGrowableArray<intptr_t>& pointer_offsets() const {
|
||||
#if defined(DEBUG)
|
||||
ASSERT(fixups_processed_);
|
||||
#endif
|
||||
|
@ -174,7 +176,7 @@ class AssemblerBuffer : public ValueObject {
|
|||
uword cursor_;
|
||||
uword limit_;
|
||||
AssemblerFixup* fixup_;
|
||||
ZoneGrowableArray<int>* pointer_offsets_;
|
||||
ZoneGrowableArray<intptr_t>* pointer_offsets_;
|
||||
#if defined(DEBUG)
|
||||
bool fixups_processed_;
|
||||
#endif
|
||||
|
|
|
@ -178,7 +178,7 @@ uint32_t Address::vencoding() const {
|
|||
}
|
||||
|
||||
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
|
||||
ASSERT(Utils::IsAligned(data, 4));
|
||||
ASSERT(Utils::IsAligned(length, 4));
|
||||
const uword end = data + length;
|
||||
|
@ -1767,7 +1767,7 @@ class PatchFarBranch : public AssemblerFixup {
|
|||
public:
|
||||
PatchFarBranch() {}
|
||||
|
||||
void Process(const MemoryRegion& region, int position) {
|
||||
void Process(const MemoryRegion& region, intptr_t position) {
|
||||
const int32_t movw = region.Load<int32_t>(position);
|
||||
const int32_t movt = region.Load<int32_t>(position + Instr::kInstrSize);
|
||||
const int32_t bx = region.Load<int32_t>(position + 2 * Instr::kInstrSize);
|
||||
|
@ -1834,7 +1834,7 @@ void Assembler::EmitBranch(Condition cond, Label* label, bool link) {
|
|||
|
||||
void Assembler::Bind(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int bound_pc = buffer_.Size();
|
||||
intptr_t bound_pc = buffer_.Size();
|
||||
while (label->IsLinked()) {
|
||||
const int32_t position = label->Position();
|
||||
int32_t dest = bound_pc - position;
|
||||
|
@ -2686,7 +2686,7 @@ int32_t Assembler::AddObject(const Object& obj) {
|
|||
ASSERT(Isolate::Current() != Dart::vm_isolate());
|
||||
object_pool_ = GrowableObjectArray::New(Heap::kOld);
|
||||
}
|
||||
for (int i = 0; i < object_pool_.Length(); i++) {
|
||||
for (intptr_t i = 0; i < object_pool_.Length(); i++) {
|
||||
if (object_pool_.At(i) == obj.raw()) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class Label : public ValueObject {
|
|||
|
||||
// Returns the position for bound and linked labels. Cannot be used
|
||||
// for unused labels.
|
||||
int Position() const {
|
||||
intptr_t Position() const {
|
||||
ASSERT(!IsUnused());
|
||||
return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
|
||||
}
|
||||
|
@ -40,19 +40,19 @@ class Label : public ValueObject {
|
|||
bool IsLinked() const { return position_ > 0; }
|
||||
|
||||
private:
|
||||
int position_;
|
||||
intptr_t position_;
|
||||
|
||||
void Reinitialize() {
|
||||
position_ = 0;
|
||||
}
|
||||
|
||||
void BindTo(int position) {
|
||||
void BindTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = -position - kWordSize;
|
||||
ASSERT(IsBound());
|
||||
}
|
||||
|
||||
void LinkTo(int position) {
|
||||
void LinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = position + kWordSize;
|
||||
ASSERT(IsLinked());
|
||||
|
@ -310,9 +310,9 @@ class Assembler : public ValueObject {
|
|||
void Bind(Label* label);
|
||||
|
||||
// Misc. functionality
|
||||
int CodeSize() const { return buffer_.Size(); }
|
||||
int prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<int>& GetPointerOffsets() const {
|
||||
intptr_t CodeSize() const { return buffer_.Size(); }
|
||||
intptr_t prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const {
|
||||
ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code.
|
||||
return buffer_.pointer_offsets();
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ class Assembler : public ValueObject {
|
|||
void Untested(const char* message);
|
||||
void Unreachable(const char* message);
|
||||
|
||||
static void InitializeMemoryWithBreakpoints(uword data, int length);
|
||||
static void InitializeMemoryWithBreakpoints(uword data, intptr_t length);
|
||||
|
||||
void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void CPUFeatures::InitOnce() {
|
|||
|
||||
class DirectCallRelocation : public AssemblerFixup {
|
||||
public:
|
||||
void Process(const MemoryRegion& region, int position) {
|
||||
void Process(const MemoryRegion& region, intptr_t position) {
|
||||
// Direct calls are relative to the following instruction on x86.
|
||||
int32_t pointer = region.Load<int32_t>(position);
|
||||
int32_t delta = region.start() + position + sizeof(int32_t);
|
||||
|
@ -83,7 +83,7 @@ class DirectCallRelocation : public AssemblerFixup {
|
|||
};
|
||||
|
||||
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
|
||||
memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length);
|
||||
}
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ void Assembler::j(Condition condition, Label* label, bool near) {
|
|||
if (label->IsBound()) {
|
||||
static const int kShortSize = 2;
|
||||
static const int kLongSize = 6;
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
if (Utils::IsInt(8, offset - kShortSize)) {
|
||||
EmitUint8(0x70 + condition);
|
||||
|
@ -1840,7 +1840,7 @@ void Assembler::jmp(Label* label, bool near) {
|
|||
if (label->IsBound()) {
|
||||
static const int kShortSize = 2;
|
||||
static const int kLongSize = 5;
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
if (Utils::IsInt(8, offset - kShortSize)) {
|
||||
EmitUint8(0xEB);
|
||||
|
@ -1906,7 +1906,7 @@ void Assembler::PopRegister(Register r) {
|
|||
|
||||
|
||||
void Assembler::AddImmediate(Register reg, const Immediate& imm) {
|
||||
int value = imm.value();
|
||||
intptr_t value = imm.value();
|
||||
if (value > 0) {
|
||||
if (value == 1) {
|
||||
incl(reg);
|
||||
|
@ -2214,14 +2214,14 @@ void Assembler::CallRuntime(const RuntimeEntry& entry,
|
|||
}
|
||||
|
||||
|
||||
void Assembler::Align(int alignment, int offset) {
|
||||
void Assembler::Align(intptr_t alignment, intptr_t offset) {
|
||||
ASSERT(Utils::IsPowerOfTwo(alignment));
|
||||
int pos = offset + buffer_.GetPosition();
|
||||
int mod = pos & (alignment - 1);
|
||||
intptr_t pos = offset + buffer_.GetPosition();
|
||||
intptr_t mod = pos & (alignment - 1);
|
||||
if (mod == 0) {
|
||||
return;
|
||||
}
|
||||
int bytes_needed = alignment - mod;
|
||||
intptr_t bytes_needed = alignment - mod;
|
||||
while (bytes_needed > MAX_NOP_SIZE) {
|
||||
nop(MAX_NOP_SIZE);
|
||||
bytes_needed -= MAX_NOP_SIZE;
|
||||
|
@ -2234,17 +2234,17 @@ void Assembler::Align(int alignment, int offset) {
|
|||
|
||||
|
||||
void Assembler::Bind(Label* label) {
|
||||
int bound = buffer_.Size();
|
||||
intptr_t bound = buffer_.Size();
|
||||
ASSERT(!label->IsBound()); // Labels can only be bound once.
|
||||
while (label->IsLinked()) {
|
||||
int position = label->LinkPosition();
|
||||
int next = buffer_.Load<int32_t>(position);
|
||||
intptr_t position = label->LinkPosition();
|
||||
intptr_t next = buffer_.Load<int32_t>(position);
|
||||
buffer_.Store<int32_t>(position, bound - (position + 4));
|
||||
label->position_ = next;
|
||||
}
|
||||
while (label->HasNear()) {
|
||||
int position = label->NearPosition();
|
||||
int offset = bound - (position + 1);
|
||||
intptr_t position = label->NearPosition();
|
||||
intptr_t offset = bound - (position + 1);
|
||||
ASSERT(Utils::IsInt(8, offset));
|
||||
buffer_.Store<int8_t>(position, offset);
|
||||
}
|
||||
|
@ -2346,13 +2346,13 @@ void Assembler::Stop(const char* message) {
|
|||
|
||||
void Assembler::EmitOperand(int rm, const Operand& operand) {
|
||||
ASSERT(rm >= 0 && rm < 8);
|
||||
const int length = operand.length_;
|
||||
const intptr_t length = operand.length_;
|
||||
ASSERT(length > 0);
|
||||
// Emit the ModRM byte updated with the given RM value.
|
||||
ASSERT((operand.encoding_[0] & 0x38) == 0);
|
||||
EmitUint8(operand.encoding_[0] + (rm << 3));
|
||||
// Emit the rest of the encoded operand.
|
||||
for (int i = 1; i < length; i++) {
|
||||
for (intptr_t i = 1; i < length; i++) {
|
||||
EmitUint8(operand.encoding_[i]);
|
||||
}
|
||||
}
|
||||
|
@ -2384,9 +2384,9 @@ void Assembler::EmitComplex(int rm,
|
|||
}
|
||||
|
||||
|
||||
void Assembler::EmitLabel(Label* label, int instruction_size) {
|
||||
void Assembler::EmitLabel(Label* label, intptr_t instruction_size) {
|
||||
if (label->IsBound()) {
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
EmitInt32(offset - instruction_size);
|
||||
} else {
|
||||
|
@ -2397,7 +2397,7 @@ void Assembler::EmitLabel(Label* label, int instruction_size) {
|
|||
|
||||
void Assembler::EmitLabelLink(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int position = buffer_.Size();
|
||||
intptr_t position = buffer_.Size();
|
||||
EmitInt32(label->position_);
|
||||
label->LinkTo(position);
|
||||
}
|
||||
|
@ -2405,7 +2405,7 @@ void Assembler::EmitLabelLink(Label* label) {
|
|||
|
||||
void Assembler::EmitNearLabelLink(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int position = buffer_.Size();
|
||||
intptr_t position = buffer_.Size();
|
||||
EmitUint8(0);
|
||||
label->NearLinkTo(position);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class Operand : public ValueObject {
|
|||
|
||||
void SetDisp32(int32_t disp) {
|
||||
ASSERT(length_ == 1 || length_ == 2);
|
||||
int disp_size = sizeof(disp);
|
||||
intptr_t disp_size = sizeof(disp);
|
||||
memmove(&encoding_[length_], &disp, disp_size);
|
||||
length_ += disp_size;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class Operand : public ValueObject {
|
|||
explicit Operand(Register reg) { SetModRM(3, reg); }
|
||||
|
||||
// Get the operand encoding byte at the given index.
|
||||
uint8_t encoding_at(int index) const {
|
||||
uint8_t encoding_at(intptr_t index) const {
|
||||
ASSERT(index >= 0 && index < length_);
|
||||
return encoding_[index];
|
||||
}
|
||||
|
@ -235,17 +235,17 @@ class Label : public ValueObject {
|
|||
|
||||
// Returns the position for bound labels. Cannot be used for unused or linked
|
||||
// labels.
|
||||
int Position() const {
|
||||
intptr_t Position() const {
|
||||
ASSERT(IsBound());
|
||||
return -position_ - kWordSize;
|
||||
}
|
||||
|
||||
int LinkPosition() const {
|
||||
intptr_t LinkPosition() const {
|
||||
ASSERT(IsLinked());
|
||||
return position_ - kWordSize;
|
||||
}
|
||||
|
||||
int NearPosition() {
|
||||
intptr_t NearPosition() {
|
||||
ASSERT(HasNear());
|
||||
return unresolved_near_positions_[--unresolved_];
|
||||
}
|
||||
|
@ -256,20 +256,20 @@ class Label : public ValueObject {
|
|||
bool HasNear() const { return unresolved_ != 0; }
|
||||
|
||||
private:
|
||||
void BindTo(int position) {
|
||||
void BindTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
ASSERT(!HasNear());
|
||||
position_ = -position - kWordSize;
|
||||
ASSERT(IsBound());
|
||||
}
|
||||
|
||||
void LinkTo(int position) {
|
||||
void LinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = position + kWordSize;
|
||||
ASSERT(IsLinked());
|
||||
}
|
||||
|
||||
void NearLinkTo(int position) {
|
||||
void NearLinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
ASSERT(unresolved_ < kMaxUnresolvedBranches);
|
||||
unresolved_near_positions_[unresolved_++] = position;
|
||||
|
@ -277,9 +277,9 @@ class Label : public ValueObject {
|
|||
|
||||
static const int kMaxUnresolvedBranches = 20;
|
||||
|
||||
int position_;
|
||||
int unresolved_;
|
||||
int unresolved_near_positions_[kMaxUnresolvedBranches];
|
||||
intptr_t position_;
|
||||
intptr_t unresolved_;
|
||||
intptr_t unresolved_near_positions_[kMaxUnresolvedBranches];
|
||||
|
||||
friend class Assembler;
|
||||
DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
|
@ -696,13 +696,13 @@ class Assembler : public ValueObject {
|
|||
sarl(reg, Immediate(kSmiTagSize));
|
||||
}
|
||||
|
||||
int PreferredLoopAlignment() { return 16; }
|
||||
void Align(int alignment, int offset);
|
||||
intptr_t PreferredLoopAlignment() { return 16; }
|
||||
void Align(intptr_t alignment, intptr_t offset);
|
||||
void Bind(Label* label);
|
||||
|
||||
int CodeSize() const { return buffer_.Size(); }
|
||||
int prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<int>& GetPointerOffsets() const {
|
||||
intptr_t CodeSize() const { return buffer_.Size(); }
|
||||
intptr_t prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const {
|
||||
return buffer_.pointer_offsets();
|
||||
}
|
||||
const GrowableObjectArray& object_pool() const { return object_pool_; }
|
||||
|
@ -774,7 +774,7 @@ class Assembler : public ValueObject {
|
|||
void Untested(const char* message);
|
||||
void Unreachable(const char* message);
|
||||
|
||||
static void InitializeMemoryWithBreakpoints(uword data, int length);
|
||||
static void InitializeMemoryWithBreakpoints(uword data, intptr_t length);
|
||||
|
||||
void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
const Code::Comments& GetCodeComments() const;
|
||||
|
@ -785,7 +785,7 @@ class Assembler : public ValueObject {
|
|||
private:
|
||||
AssemblerBuffer buffer_;
|
||||
GrowableObjectArray& object_pool_; // Object pool is not used on ia32.
|
||||
int prologue_offset_;
|
||||
intptr_t prologue_offset_;
|
||||
|
||||
class CodeComment : public ZoneAllocated {
|
||||
public:
|
||||
|
@ -814,7 +814,7 @@ class Assembler : public ValueObject {
|
|||
void EmitOperand(int rm, const Operand& operand);
|
||||
void EmitImmediate(const Immediate& imm);
|
||||
void EmitComplex(int rm, const Operand& operand, const Immediate& immediate);
|
||||
void EmitLabel(Label* label, int instruction_size);
|
||||
void EmitLabel(Label* label, intptr_t instruction_size);
|
||||
void EmitLabelLink(Label* label);
|
||||
void EmitNearLabelLink(Label* label);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ DECLARE_FLAG(bool, trace_sim);
|
|||
DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
|
||||
DECLARE_FLAG(bool, inline_alloc);
|
||||
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
|
||||
ASSERT(Utils::IsAligned(data, 4));
|
||||
ASSERT(Utils::IsAligned(length, 4));
|
||||
const uword end = data + length;
|
||||
|
@ -63,7 +63,7 @@ int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t instr) {
|
|||
}
|
||||
|
||||
|
||||
static int DecodeBranchOffset(int32_t instr) {
|
||||
static intptr_t DecodeBranchOffset(int32_t instr) {
|
||||
// Sign-extend, left-shift by 2.
|
||||
return (((instr & kBranchOffsetMask) << 16) >> 14);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class PatchFarJump : public AssemblerFixup {
|
|||
public:
|
||||
PatchFarJump() {}
|
||||
|
||||
void Process(const MemoryRegion& region, int position) {
|
||||
void Process(const MemoryRegion& region, intptr_t position) {
|
||||
const int32_t high = region.Load<int32_t>(position);
|
||||
const int32_t low = region.Load<int32_t>(position + Instr::kInstrSize);
|
||||
const int32_t offset = DecodeLoadImmediate(low, high);
|
||||
|
@ -191,7 +191,7 @@ void Assembler::EmitBranch(Opcode b, Register rs, Register rt, Label* label) {
|
|||
EmitIType(b, rs, rt, dest_off);
|
||||
}
|
||||
} else {
|
||||
const int position = buffer_.Size();
|
||||
const intptr_t position = buffer_.Size();
|
||||
if (use_far_branches()) {
|
||||
const uint32_t dest_off = label->position_;
|
||||
EmitFarBranch(b, rs, rt, dest_off);
|
||||
|
@ -216,7 +216,7 @@ void Assembler::EmitRegImmBranch(RtRegImm b, Register rs, Label* label) {
|
|||
EmitRegImmType(REGIMM, rs, b, dest_off);
|
||||
}
|
||||
} else {
|
||||
const int position = buffer_.Size();
|
||||
const intptr_t position = buffer_.Size();
|
||||
if (use_far_branches()) {
|
||||
const uint32_t dest_off = label->position_;
|
||||
EmitFarRegImmBranch(b, rs, dest_off);
|
||||
|
@ -245,7 +245,7 @@ void Assembler::EmitFpuBranch(bool kind, Label *label) {
|
|||
dest_off);
|
||||
}
|
||||
} else {
|
||||
const int position = buffer_.Size();
|
||||
const intptr_t position = buffer_.Size();
|
||||
if (use_far_branches()) {
|
||||
const uint32_t dest_off = label->position_;
|
||||
EmitFarFpuBranch(kind, dest_off);
|
||||
|
@ -278,7 +278,7 @@ static int32_t FlipBranchInstruction(int32_t instr) {
|
|||
|
||||
void Assembler::Bind(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int bound_pc = buffer_.Size();
|
||||
intptr_t bound_pc = buffer_.Size();
|
||||
|
||||
while (label->IsLinked()) {
|
||||
int32_t position = label->Position();
|
||||
|
@ -472,7 +472,7 @@ int32_t Assembler::AddObject(const Object& obj) {
|
|||
ASSERT(Isolate::Current() != Dart::vm_isolate());
|
||||
object_pool_ = GrowableObjectArray::New(Heap::kOld);
|
||||
}
|
||||
for (int i = 0; i < object_pool_.Length(); i++) {
|
||||
for (intptr_t i = 0; i < object_pool_.Length(); i++) {
|
||||
if (object_pool_.At(i) == obj.raw()) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class Label : public ValueObject {
|
|||
|
||||
// Returns the position for bound and linked labels. Cannot be used
|
||||
// for unused labels.
|
||||
int Position() const {
|
||||
intptr_t Position() const {
|
||||
ASSERT(!IsUnused());
|
||||
return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
|
||||
}
|
||||
|
@ -111,19 +111,19 @@ class Label : public ValueObject {
|
|||
bool IsLinked() const { return position_ > 0; }
|
||||
|
||||
private:
|
||||
int position_;
|
||||
intptr_t position_;
|
||||
|
||||
void Reinitialize() {
|
||||
position_ = 0;
|
||||
}
|
||||
|
||||
void BindTo(int position) {
|
||||
void BindTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = -position - kWordSize;
|
||||
ASSERT(IsBound());
|
||||
}
|
||||
|
||||
void LinkTo(int position) {
|
||||
void LinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = position + kWordSize;
|
||||
ASSERT(IsLinked());
|
||||
|
@ -160,9 +160,9 @@ class Assembler : public ValueObject {
|
|||
void Bind(Label* label);
|
||||
|
||||
// Misc. functionality
|
||||
int CodeSize() const { return buffer_.Size(); }
|
||||
int prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<int>& GetPointerOffsets() const {
|
||||
intptr_t CodeSize() const { return buffer_.Size(); }
|
||||
intptr_t prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const {
|
||||
return buffer_.pointer_offsets();
|
||||
}
|
||||
const GrowableObjectArray& object_pool() const { return object_pool_; }
|
||||
|
@ -206,7 +206,7 @@ class Assembler : public ValueObject {
|
|||
void Untested(const char* message);
|
||||
void Unreachable(const char* message);
|
||||
|
||||
static void InitializeMemoryWithBreakpoints(uword data, int length);
|
||||
static void InitializeMemoryWithBreakpoints(uword data, intptr_t length);
|
||||
|
||||
void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ class Assembler : public ValueObject {
|
|||
private:
|
||||
AssemblerBuffer buffer_;
|
||||
GrowableObjectArray& object_pool_; // Objects and patchable jump targets.
|
||||
int prologue_offset_;
|
||||
intptr_t prologue_offset_;
|
||||
|
||||
const bool use_far_branches_;
|
||||
bool delay_slot_available_;
|
||||
|
|
|
@ -108,7 +108,7 @@ Assembler::Assembler(bool use_far_branches)
|
|||
}
|
||||
|
||||
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
|
||||
void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
|
||||
memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length);
|
||||
}
|
||||
|
||||
|
@ -2099,7 +2099,7 @@ void Assembler::j(Condition condition, Label* label, bool near) {
|
|||
if (label->IsBound()) {
|
||||
static const int kShortSize = 2;
|
||||
static const int kLongSize = 6;
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
if (Utils::IsInt(8, offset - kShortSize)) {
|
||||
EmitUint8(0x70 + condition);
|
||||
|
@ -2151,7 +2151,7 @@ void Assembler::jmp(Label* label, bool near) {
|
|||
if (label->IsBound()) {
|
||||
static const int kShortSize = 2;
|
||||
static const int kLongSize = 5;
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
if (Utils::IsInt(8, offset - kShortSize)) {
|
||||
EmitUint8(0xEB);
|
||||
|
@ -2619,17 +2619,17 @@ void Assembler::Stop(const char* message) {
|
|||
|
||||
|
||||
void Assembler::Bind(Label* label) {
|
||||
int bound = buffer_.Size();
|
||||
intptr_t bound = buffer_.Size();
|
||||
ASSERT(!label->IsBound()); // Labels can only be bound once.
|
||||
while (label->IsLinked()) {
|
||||
int position = label->LinkPosition();
|
||||
int next = buffer_.Load<int32_t>(position);
|
||||
intptr_t position = label->LinkPosition();
|
||||
intptr_t next = buffer_.Load<int32_t>(position);
|
||||
buffer_.Store<int32_t>(position, bound - (position + 4));
|
||||
label->position_ = next;
|
||||
}
|
||||
while (label->HasNear()) {
|
||||
int position = label->NearPosition();
|
||||
int offset = bound - (position + 1);
|
||||
intptr_t position = label->NearPosition();
|
||||
intptr_t offset = bound - (position + 1);
|
||||
ASSERT(Utils::IsInt(8, offset));
|
||||
buffer_.Store<int8_t>(position, offset);
|
||||
}
|
||||
|
@ -2899,14 +2899,14 @@ void Assembler::TryAllocate(const Class& cls,
|
|||
}
|
||||
|
||||
|
||||
void Assembler::Align(int alignment, int offset) {
|
||||
void Assembler::Align(int alignment, intptr_t offset) {
|
||||
ASSERT(Utils::IsPowerOfTwo(alignment));
|
||||
int pos = offset + buffer_.GetPosition();
|
||||
intptr_t pos = offset + buffer_.GetPosition();
|
||||
int mod = pos & (alignment - 1);
|
||||
if (mod == 0) {
|
||||
return;
|
||||
}
|
||||
int bytes_needed = alignment - mod;
|
||||
intptr_t bytes_needed = alignment - mod;
|
||||
while (bytes_needed > MAX_NOP_SIZE) {
|
||||
nop(MAX_NOP_SIZE);
|
||||
bytes_needed -= MAX_NOP_SIZE;
|
||||
|
@ -2920,13 +2920,13 @@ void Assembler::Align(int alignment, int offset) {
|
|||
|
||||
void Assembler::EmitOperand(int rm, const Operand& operand) {
|
||||
ASSERT(rm >= 0 && rm < 8);
|
||||
const int length = operand.length_;
|
||||
const intptr_t length = operand.length_;
|
||||
ASSERT(length > 0);
|
||||
// Emit the ModRM byte updated with the given RM value.
|
||||
ASSERT((operand.encoding_[0] & 0x38) == 0);
|
||||
EmitUint8(operand.encoding_[0] + (rm << 3));
|
||||
// Emit the rest of the encoded operand.
|
||||
for (int i = 1; i < length; i++) {
|
||||
for (intptr_t i = 1; i < length; i++) {
|
||||
EmitUint8(operand.encoding_[i]);
|
||||
}
|
||||
}
|
||||
|
@ -2970,9 +2970,9 @@ void Assembler::EmitComplex(int rm,
|
|||
}
|
||||
|
||||
|
||||
void Assembler::EmitLabel(Label* label, int instruction_size) {
|
||||
void Assembler::EmitLabel(Label* label, intptr_t instruction_size) {
|
||||
if (label->IsBound()) {
|
||||
int offset = label->Position() - buffer_.Size();
|
||||
intptr_t offset = label->Position() - buffer_.Size();
|
||||
ASSERT(offset <= 0);
|
||||
EmitInt32(offset - instruction_size);
|
||||
} else {
|
||||
|
@ -2983,7 +2983,7 @@ void Assembler::EmitLabel(Label* label, int instruction_size) {
|
|||
|
||||
void Assembler::EmitLabelLink(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int position = buffer_.Size();
|
||||
intptr_t position = buffer_.Size();
|
||||
EmitInt32(label->position_);
|
||||
label->LinkTo(position);
|
||||
}
|
||||
|
@ -2991,7 +2991,7 @@ void Assembler::EmitLabelLink(Label* label) {
|
|||
|
||||
void Assembler::EmitNearLabelLink(Label* label) {
|
||||
ASSERT(!label->IsBound());
|
||||
int position = buffer_.Size();
|
||||
intptr_t position = buffer_.Size();
|
||||
EmitUint8(0);
|
||||
label->NearLinkTo(position);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class Operand : public ValueObject {
|
|||
explicit Operand(Register reg) : rex_(REX_NONE) { SetModRM(3, reg); }
|
||||
|
||||
// Get the operand encoding byte at the given index.
|
||||
uint8_t encoding_at(int index) const {
|
||||
uint8_t encoding_at(intptr_t index) const {
|
||||
ASSERT(index >= 0 && index < length_);
|
||||
return encoding_[index];
|
||||
}
|
||||
|
@ -265,17 +265,17 @@ class Label : public ValueObject {
|
|||
|
||||
// Returns the position for bound labels. Cannot be used for unused or linked
|
||||
// labels.
|
||||
int Position() const {
|
||||
intptr_t Position() const {
|
||||
ASSERT(IsBound());
|
||||
return -position_ - kWordSize;
|
||||
}
|
||||
|
||||
int LinkPosition() const {
|
||||
intptr_t LinkPosition() const {
|
||||
ASSERT(IsLinked());
|
||||
return position_ - kWordSize;
|
||||
}
|
||||
|
||||
int NearPosition() {
|
||||
intptr_t NearPosition() {
|
||||
ASSERT(HasNear());
|
||||
return unresolved_near_positions_[--unresolved_];
|
||||
}
|
||||
|
@ -286,20 +286,20 @@ class Label : public ValueObject {
|
|||
bool HasNear() const { return unresolved_ != 0; }
|
||||
|
||||
private:
|
||||
void BindTo(int position) {
|
||||
void BindTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
ASSERT(!HasNear());
|
||||
position_ = -position - kWordSize;
|
||||
ASSERT(IsBound());
|
||||
}
|
||||
|
||||
void LinkTo(int position) {
|
||||
void LinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
position_ = position + kWordSize;
|
||||
ASSERT(IsLinked());
|
||||
}
|
||||
|
||||
void NearLinkTo(int position) {
|
||||
void NearLinkTo(intptr_t position) {
|
||||
ASSERT(!IsBound());
|
||||
ASSERT(unresolved_ < kMaxUnresolvedBranches);
|
||||
unresolved_near_positions_[unresolved_++] = position;
|
||||
|
@ -307,9 +307,9 @@ class Label : public ValueObject {
|
|||
|
||||
static const int kMaxUnresolvedBranches = 20;
|
||||
|
||||
int position_;
|
||||
int unresolved_;
|
||||
int unresolved_near_positions_[kMaxUnresolvedBranches];
|
||||
intptr_t position_;
|
||||
intptr_t unresolved_;
|
||||
intptr_t unresolved_near_positions_[kMaxUnresolvedBranches];
|
||||
|
||||
friend class Assembler;
|
||||
DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
|
@ -750,15 +750,15 @@ class Assembler : public ValueObject {
|
|||
}
|
||||
|
||||
int PreferredLoopAlignment() { return 16; }
|
||||
void Align(int alignment, int offset);
|
||||
void Align(int alignment, intptr_t offset);
|
||||
void Bind(Label* label);
|
||||
|
||||
void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
const Code::Comments& GetCodeComments() const;
|
||||
|
||||
int CodeSize() const { return buffer_.Size(); }
|
||||
int prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<int>& GetPointerOffsets() const {
|
||||
intptr_t CodeSize() const { return buffer_.Size(); }
|
||||
intptr_t prologue_offset() const { return prologue_offset_; }
|
||||
const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const {
|
||||
return buffer_.pointer_offsets();
|
||||
}
|
||||
const GrowableObjectArray& object_pool() const { return object_pool_; }
|
||||
|
@ -841,7 +841,7 @@ class Assembler : public ValueObject {
|
|||
void Untested(const char* message);
|
||||
void Unreachable(const char* message);
|
||||
|
||||
static void InitializeMemoryWithBreakpoints(uword data, int length);
|
||||
static void InitializeMemoryWithBreakpoints(uword data, intptr_t length);
|
||||
|
||||
static const char* RegisterName(Register reg);
|
||||
|
||||
|
@ -897,7 +897,7 @@ class Assembler : public ValueObject {
|
|||
// Hashmap for fast lookup in object pool.
|
||||
DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
|
||||
|
||||
int prologue_offset_;
|
||||
intptr_t prologue_offset_;
|
||||
|
||||
class CodeComment : public ZoneAllocated {
|
||||
public:
|
||||
|
@ -952,7 +952,7 @@ class Assembler : public ValueObject {
|
|||
void EmitOperand(int rm, const Operand& operand);
|
||||
void EmitImmediate(const Immediate& imm);
|
||||
void EmitComplex(int rm, const Operand& operand, const Immediate& immediate);
|
||||
void EmitLabel(Label* label, int instruction_size);
|
||||
void EmitLabel(Label* label, intptr_t instruction_size);
|
||||
void EmitLabelLink(Label* label);
|
||||
void EmitNearLabelLink(Label* label);
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ LetNode::LetNode(intptr_t token_pos)
|
|||
LocalVariable* LetNode::AddInitializer(AstNode* node) {
|
||||
initializers_.Add(node);
|
||||
char name[64];
|
||||
OS::SNPrint(name, sizeof(name), ":lt%" Pd "_%d", token_pos(), vars_.length());
|
||||
OS::SNPrint(name, sizeof(name), ":lt%" Pd "_%" Pd "",
|
||||
token_pos(), vars_.length());
|
||||
LocalVariable* temp_var =
|
||||
new LocalVariable(token_pos(),
|
||||
String::ZoneHandle(Symbols::New(name)),
|
||||
|
|
|
@ -1592,7 +1592,7 @@ class NativeBodyNode : public AstNode {
|
|||
|
||||
class CatchClauseNode : public AstNode {
|
||||
public:
|
||||
static const int kInvalidTryIndex = -1;
|
||||
static const intptr_t kInvalidTryIndex = -1;
|
||||
|
||||
CatchClauseNode(intptr_t token_pos,
|
||||
SequenceNode* catch_block,
|
||||
|
|
|
@ -37,7 +37,7 @@ RawBigint* BigintOperations::NewFromSmi(const Smi& smi, Heap::Space space) {
|
|||
|
||||
// Allocate a bigint of the correct size and copy the bits.
|
||||
const Bigint& result = Bigint::Handle(Bigint::Allocate(digit_count, space));
|
||||
for (int i = 0; i < digit_count; i++) {
|
||||
for (intptr_t i = 0; i < digit_count; i++) {
|
||||
result.SetChunkAt(i, static_cast<Chunk>(value & kDigitMask));
|
||||
value >>= kDigitBitSize;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ RawBigint* BigintOperations::NewFromUint64(uint64_t value, Heap::Space space) {
|
|||
|
||||
// Allocate a bigint of the correct size and copy the bits.
|
||||
const Bigint& result = Bigint::Handle(Bigint::Allocate(digit_count, space));
|
||||
for (int i = 0; i < digit_count; i++) {
|
||||
for (intptr_t i = 0; i < digit_count; i++) {
|
||||
result.SetChunkAt(i, static_cast<Chunk>(value & kDigitMask));
|
||||
value >>= kDigitBitSize;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ RawBigint* BigintOperations::FromDecimalCString(const char* str,
|
|||
|
||||
// Read first digit separately. This avoids a multiplication and addition.
|
||||
// The first digit might also not have kDigitsPerIteration decimal digits.
|
||||
int first_digit_decimal_digits = str_length % kDigitsPerIteration;
|
||||
intptr_t first_digit_decimal_digits = str_length % kDigitsPerIteration;
|
||||
Chunk digit = 0;
|
||||
for (intptr_t i = 0; i < first_digit_decimal_digits; i++) {
|
||||
char c = str[str_pos++];
|
||||
|
@ -226,8 +226,8 @@ RawBigint* BigintOperations::NewFromDouble(double d, Heap::Space space) {
|
|||
Exceptions::ThrowByType(Exceptions::kInternalError, exception_arguments);
|
||||
}
|
||||
uint64_t significand = internals.Significand();
|
||||
int exponent = internals.Exponent();
|
||||
int sign = internals.Sign();
|
||||
intptr_t exponent = internals.Exponent();
|
||||
intptr_t sign = internals.Sign();
|
||||
if (exponent <= 0) {
|
||||
significand >>= -exponent;
|
||||
exponent = 0;
|
||||
|
@ -284,7 +284,7 @@ const char* BigintOperations::ToHexCString(intptr_t length,
|
|||
// Compute the number of hex-digits that are needed to represent the
|
||||
// leading bigint-digit. All other digits need exactly kHexCharsPerDigit
|
||||
// characters.
|
||||
int leading_hex_digits = 0;
|
||||
intptr_t leading_hex_digits = 0;
|
||||
Chunk leading_digit = chunk_data[chunk_length - 1];
|
||||
while (leading_digit != 0) {
|
||||
leading_hex_digits++;
|
||||
|
@ -308,7 +308,7 @@ const char* BigintOperations::ToHexCString(intptr_t length,
|
|||
// Print all non-leading characters (which are printed with
|
||||
// kHexCharsPerDigit characters.
|
||||
Chunk digit = chunk_data[i];
|
||||
for (int j = 0; j < kHexCharsPerDigit; j++) {
|
||||
for (intptr_t j = 0; j < kHexCharsPerDigit; j++) {
|
||||
result[pos--] = Utils::IntToHexDigit(static_cast<int>(digit & 0xF));
|
||||
digit >>= 4;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ const char* BigintOperations::ToDecimalCString(
|
|||
char* result =
|
||||
reinterpret_cast<char*>(allocator(static_cast<intptr_t>(required_size)));
|
||||
ASSERT(result != NULL);
|
||||
int result_pos = 0;
|
||||
intptr_t result_pos = 0;
|
||||
|
||||
// We divide the input into pieces of ~27 bits which can be efficiently
|
||||
// handled.
|
||||
|
@ -444,7 +444,7 @@ bool BigintOperations::FitsIntoSmi(const Bigint& bigint) {
|
|||
// Consume the least-significant digits of the bigint.
|
||||
// If bigint_is_greater is set, then the processed sub-part of the bigint is
|
||||
// greater than the corresponding part of the limit.
|
||||
for (int i = 0; i < bigint_length - 1; i++) {
|
||||
for (intptr_t i = 0; i < bigint_length - 1; i++) {
|
||||
Chunk limit_digit = static_cast<Chunk>(limit & kDigitMask);
|
||||
Chunk bigint_digit = bigint.GetChunkAt(i);
|
||||
if (limit_digit < bigint_digit) {
|
||||
|
@ -473,7 +473,7 @@ bool BigintOperations::FitsIntoSmi(const Bigint& bigint) {
|
|||
RawSmi* BigintOperations::ToSmi(const Bigint& bigint) {
|
||||
ASSERT(FitsIntoSmi(bigint));
|
||||
intptr_t value = 0;
|
||||
for (int i = bigint.Length() - 1; i >= 0; i--) {
|
||||
for (intptr_t i = bigint.Length() - 1; i >= 0; i--) {
|
||||
value <<= kDigitBitSize;
|
||||
value += static_cast<intptr_t>(bigint.GetChunkAt(i));
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ bool BigintOperations::FitsIntoInt64(const Bigint& bigint) {
|
|||
// Consume the least-significant digits of the bigint.
|
||||
// If bigint_is_greater is set, then the processed sub-part of the bigint is
|
||||
// greater than the corresponding part of the limit.
|
||||
for (int i = 0; i < bigint_length - 1; i++) {
|
||||
for (intptr_t i = 0; i < bigint_length - 1; i++) {
|
||||
Chunk limit_digit = static_cast<Chunk>(limit & kDigitMask);
|
||||
Chunk bigint_digit = bigint.GetChunkAt(i);
|
||||
if (limit_digit < bigint_digit) {
|
||||
|
@ -672,7 +672,7 @@ bool BigintOperations::FitsIntoInt64(const Bigint& bigint) {
|
|||
uint64_t BigintOperations::AbsToUint64(const Bigint& bigint) {
|
||||
ASSERT(AbsFitsIntoUint64(bigint));
|
||||
uint64_t value = 0;
|
||||
for (int i = bigint.Length() - 1; i >= 0; i--) {
|
||||
for (intptr_t i = bigint.Length() - 1; i >= 0; i--) {
|
||||
value <<= kDigitBitSize;
|
||||
value += static_cast<intptr_t>(bigint.GetChunkAt(i));
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ int64_t BigintOperations::ToInt64(const Bigint& bigint) {
|
|||
|
||||
bool BigintOperations::AbsFitsIntoUint64(const Bigint& bigint) {
|
||||
intptr_t b_length = bigint.Length();
|
||||
int num_bits = CountBits(bigint.GetChunkAt(b_length - 1));
|
||||
intptr_t num_bits = CountBits(bigint.GetChunkAt(b_length - 1));
|
||||
num_bits += (kDigitBitSize * (b_length - 1));
|
||||
if (num_bits > 64) return false;
|
||||
return true;
|
||||
|
@ -1795,8 +1795,8 @@ RawBigint* BigintOperations::Copy(const Bigint& bigint) {
|
|||
}
|
||||
|
||||
|
||||
int BigintOperations::CountBits(Chunk digit) {
|
||||
int result = 0;
|
||||
intptr_t BigintOperations::CountBits(Chunk digit) {
|
||||
intptr_t result = 0;
|
||||
while (digit != 0) {
|
||||
digit >>= 1;
|
||||
result++;
|
||||
|
|
|
@ -148,7 +148,7 @@ class BigintOperations : public AllStatic {
|
|||
|
||||
static RawBigint* Copy(const Bigint& bigint);
|
||||
|
||||
static int CountBits(Chunk digit);
|
||||
static intptr_t CountBits(Chunk digit);
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(BigintOperations);
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) {
|
|||
|
||||
void BitVector::Intersect(const BitVector* other) {
|
||||
ASSERT(other->length() == length());
|
||||
for (int i = 0; i < data_length_; i++) {
|
||||
for (intptr_t i = 0; i < data_length_; i++) {
|
||||
data_[i] = data_[i] & other->data_[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -865,7 +865,7 @@ static RawFunction* InlineCacheMissHandler(
|
|||
}
|
||||
}
|
||||
if (FLAG_trace_ic) {
|
||||
OS::PrintErr("InlineCacheMissHandler %d call at %#" Px "' "
|
||||
OS::PrintErr("InlineCacheMissHandler %" Pd " call at %#" Px "' "
|
||||
"adding <%s> id:%" Pd " -> <%s>\n",
|
||||
args.length(),
|
||||
caller_frame->pc(),
|
||||
|
|
|
@ -793,7 +793,7 @@ class CallSiteInliner : public ValueObject {
|
|||
void InlineStaticCalls() {
|
||||
const GrowableArray<CallSites::StaticCallInfo>& call_info =
|
||||
inlining_call_sites_->static_calls();
|
||||
TRACE_INLINING(OS::Print(" Static Calls (%d)\n", call_info.length()));
|
||||
TRACE_INLINING(OS::Print(" Static Calls (%" Pd ")\n", call_info.length()));
|
||||
for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) {
|
||||
StaticCallInstr* call = call_info[call_idx].call;
|
||||
if (call->function().name() == Symbols::ListFactory().raw()) {
|
||||
|
@ -832,7 +832,7 @@ class CallSiteInliner : public ValueObject {
|
|||
void InlineClosureCalls() {
|
||||
const GrowableArray<ClosureCallInstr*>& calls =
|
||||
inlining_call_sites_->closure_calls();
|
||||
TRACE_INLINING(OS::Print(" Closure Calls (%d)\n", calls.length()));
|
||||
TRACE_INLINING(OS::Print(" Closure Calls (%" Pd ")\n", calls.length()));
|
||||
for (intptr_t i = 0; i < calls.length(); ++i) {
|
||||
ClosureCallInstr* call = calls[i];
|
||||
// Find the closure of the callee.
|
||||
|
@ -869,7 +869,7 @@ class CallSiteInliner : public ValueObject {
|
|||
void InlineInstanceCalls() {
|
||||
const GrowableArray<CallSites::InstanceCallInfo>& call_info =
|
||||
inlining_call_sites_->instance_calls();
|
||||
TRACE_INLINING(OS::Print(" Polymorphic Instance Calls (%d)\n",
|
||||
TRACE_INLINING(OS::Print(" Polymorphic Instance Calls (%" Pd ")\n",
|
||||
call_info.length()));
|
||||
for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) {
|
||||
PolymorphicInstanceCallInstr* call = call_info[call_idx].call;
|
||||
|
|
|
@ -23,7 +23,7 @@ class BaseGrowableArray : public B {
|
|||
ASSERT(zone_ != NULL);
|
||||
}
|
||||
|
||||
BaseGrowableArray(int initial_capacity, Zone* zone)
|
||||
BaseGrowableArray(intptr_t initial_capacity, Zone* zone)
|
||||
: length_(0), capacity_(0), data_(NULL), zone_(zone) {
|
||||
ASSERT(zone_ != NULL);
|
||||
if (initial_capacity > 0) {
|
||||
|
@ -32,7 +32,7 @@ class BaseGrowableArray : public B {
|
|||
}
|
||||
}
|
||||
|
||||
int length() const { return length_; }
|
||||
intptr_t length() const { return length_; }
|
||||
T* data() const { return data_; }
|
||||
bool is_empty() const { return length_ == 0; }
|
||||
|
||||
|
@ -53,7 +53,7 @@ class BaseGrowableArray : public B {
|
|||
return result;
|
||||
}
|
||||
|
||||
T& operator[](int index) const {
|
||||
T& operator[](intptr_t index) const {
|
||||
ASSERT(0 <= index);
|
||||
ASSERT(index < length_);
|
||||
ASSERT(length_ <= capacity_);
|
||||
|
@ -87,12 +87,12 @@ class BaseGrowableArray : public B {
|
|||
inline void Sort(int compare(const T*, const T*));
|
||||
|
||||
private:
|
||||
int length_;
|
||||
int capacity_;
|
||||
intptr_t length_;
|
||||
intptr_t capacity_;
|
||||
T* data_;
|
||||
Zone* zone_; // Zone in which we are allocating the array.
|
||||
|
||||
void Resize(int new_length);
|
||||
void Resize(intptr_t new_length);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BaseGrowableArray);
|
||||
};
|
||||
|
@ -107,9 +107,9 @@ inline void BaseGrowableArray<T, B>::Sort(
|
|||
|
||||
|
||||
template<typename T, typename B>
|
||||
void BaseGrowableArray<T, B>::Resize(int new_length) {
|
||||
void BaseGrowableArray<T, B>::Resize(intptr_t new_length) {
|
||||
if (new_length > capacity_) {
|
||||
int new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
|
||||
intptr_t new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
|
||||
T* new_data = zone_->Realloc<T>(data_, capacity_, new_capacity);
|
||||
ASSERT(new_data != NULL);
|
||||
data_ = new_data;
|
||||
|
@ -122,7 +122,7 @@ void BaseGrowableArray<T, B>::Resize(int new_length) {
|
|||
template<typename T>
|
||||
class GrowableArray : public BaseGrowableArray<T, ValueObject> {
|
||||
public:
|
||||
explicit GrowableArray(int initial_capacity)
|
||||
explicit GrowableArray(intptr_t initial_capacity)
|
||||
: BaseGrowableArray<T, ValueObject>(
|
||||
initial_capacity,
|
||||
Isolate::Current()->current_zone()) {}
|
||||
|
@ -135,7 +135,7 @@ class GrowableArray : public BaseGrowableArray<T, ValueObject> {
|
|||
template<typename T>
|
||||
class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> {
|
||||
public:
|
||||
explicit ZoneGrowableArray(int initial_capacity)
|
||||
explicit ZoneGrowableArray(intptr_t initial_capacity)
|
||||
: BaseGrowableArray<T, ZoneAllocated>(
|
||||
initial_capacity,
|
||||
Isolate::Current()->current_zone()) {}
|
||||
|
|
|
@ -9135,7 +9135,7 @@ RawCode* Code::FinalizeCode(const char* name,
|
|||
instrs.size(),
|
||||
optimized);
|
||||
|
||||
const ZoneGrowableArray<int>& pointer_offsets =
|
||||
const ZoneGrowableArray<intptr_t>& pointer_offsets =
|
||||
assembler->GetPointerOffsets();
|
||||
|
||||
// Allocate the code object.
|
||||
|
@ -9146,8 +9146,8 @@ RawCode* Code::FinalizeCode(const char* name,
|
|||
// Set pointer offsets list in Code object and resolve all handles in
|
||||
// the instruction stream to raw objects.
|
||||
ASSERT(code.pointer_offsets_length() == pointer_offsets.length());
|
||||
for (int i = 0; i < pointer_offsets.length(); i++) {
|
||||
int offset_in_instrs = pointer_offsets[i];
|
||||
for (intptr_t i = 0; i < pointer_offsets.length(); i++) {
|
||||
intptr_t offset_in_instrs = pointer_offsets[i];
|
||||
code.SetPointerOffsetAt(i, offset_in_instrs);
|
||||
const Object* object = region.Load<const Object*>(offset_in_instrs);
|
||||
region.Store<RawObject*>(offset_in_instrs, object->raw());
|
||||
|
|
|
@ -129,7 +129,7 @@ class PerfCodeObserver : public CodeObserver {
|
|||
if (file_open == NULL) {
|
||||
return;
|
||||
}
|
||||
const char* format = "/tmp/perf-%"Pd".map";
|
||||
const char* format = "/tmp/perf-%" Pd ".map";
|
||||
intptr_t pid = getpid();
|
||||
intptr_t len = OS::SNPrint(NULL, 0, format, pid);
|
||||
char* filename = new char[len + 1];
|
||||
|
|
|
@ -88,7 +88,7 @@ void CheckLineNumber(const Scanner::GrowableTokenStream& token_stream,
|
|||
void CheckNumTokens(const Scanner::GrowableTokenStream& token_stream,
|
||||
int index) {
|
||||
if (token_stream.length() != index) {
|
||||
OS::PrintErr("Expected %d tokens but got only %d.\n",
|
||||
OS::PrintErr("Expected %d tokens but got only %" Pd ".\n",
|
||||
index, token_stream.length());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -775,10 +775,10 @@ void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
|
|||
// ESP + 16 : new context containing the current isolate pointer.
|
||||
// Uses EAX, EDX, ECX, EDI as temporary registers.
|
||||
void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
|
||||
const int kEntryPointOffset = 2 * kWordSize;
|
||||
const int kArgumentsDescOffset = 3 * kWordSize;
|
||||
const int kArgumentsOffset = 4 * kWordSize;
|
||||
const int kNewContextOffset = 5 * kWordSize;
|
||||
const intptr_t kEntryPointOffset = 2 * kWordSize;
|
||||
const intptr_t kArgumentsDescOffset = 3 * kWordSize;
|
||||
const intptr_t kArgumentsOffset = 4 * kWordSize;
|
||||
const intptr_t kNewContextOffset = 5 * kWordSize;
|
||||
|
||||
// Save frame pointer coming in.
|
||||
__ EnterFrame(0);
|
||||
|
|
Loading…
Reference in a new issue