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
// 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*>(
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()) {
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:
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);
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);
}
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) {
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]) {
*complete = true;
return -1;
}
- i = pos - subject.start();
+ i = static_cast<int>(pos - subject.start());
} else {
if (subject[i] != pattern_first_char) continue;
}
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;
}
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;
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;
// 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;
// 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
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));
}
// 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;
bool RegisterAllocator::IsReserved(Register reg) {
return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) ||
- reg.is(kScratchRegister);
+ reg.is(kScratchRegister) || reg.is(kRootRegister);
}
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(),
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;
}
// 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);
// 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.