} else if (((shift == LSR) || (shift == ASR)) && (shift_amount == 0)) {
shift_amount = 32;
}
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ", %s #%d",
- shift_names[shift_index],
- shift_amount);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ ", %s #%d",
+ shift_names[shift_index],
+ shift_amount);
} else {
// by register
int rs = instr->RsValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ", %s ", shift_names[shift_index]);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ ", %s ", shift_names[shift_index]);
PrintRegister(rs);
}
}
int rotate = instr->RotateValue() * 2;
int immed8 = instr->Immed8Value();
int imm = (immed8 >> rotate) | (immed8 << (32 - rotate));
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "#%d", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "#%d", imm);
}
void Decoder::PrintShiftSat(Instruction* instr) {
int shift = instr->Bits(11, 7);
if (shift > 0) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ", %s #%d",
- shift_names[instr->Bit(6) * 2],
- instr->Bits(11, 7));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ ", %s #%d",
+ shift_names[instr->Bit(6) * 2],
+ instr->Bits(11, 7));
}
}
return;
default:
if (svc >= kStopCode) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d - 0x%x",
- svc & kStopCodeMask,
- svc & kStopCodeMask);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%d - 0x%x",
+ svc & kStopCodeMask,
+ svc & kStopCodeMask);
} else {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d",
- svc);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%d",
+ svc);
}
return;
}
void Decoder::FormatNeonList(int Vd, int type) {
if (type == nlt_1) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "{d%d}", Vd);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "{d%d}", Vd);
} else if (type == nlt_2) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "{d%d, d%d}", Vd, Vd + 1);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "{d%d, d%d}", Vd, Vd + 1);
} else if (type == nlt_3) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "{d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "{d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2);
} else if (type == nlt_4) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "{d%d, d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2, Vd + 3);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "{d%d, d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2, Vd + 3);
}
}
void Decoder::FormatNeonMemory(int Rn, int align, int Rm) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "[r%d", Rn);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "[r%d", Rn);
if (align != 0) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ":%d", (1 << align) << 6);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ ":%d", (1 << align) << 6);
}
if (Rm == 15) {
Print("]");
} else if (Rm == 13) {
Print("]!");
} else {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "], r%d", Rm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "], r%d", Rm);
}
}
int imm = instr->ImmedMovwMovtValue();
int rd = instr->RdValue();
PrintRegister(rd);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ", #%d", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, ", #%d", imm);
}
}
case 'd': { // 'd: vmov double immediate.
double d = instr->DoubleImmedVmov();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "#%g", d);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "#%g", d);
return 1;
}
case 'f': { // 'f: bitfield instructions - v7 and above.
ASSERT(width > 0);
}
ASSERT((width + lsbit) <= 32);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "#%d, #%d", lsbit, width);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "#%d, #%d", lsbit, width);
return 1;
}
case 'h': { // 'h: halfword operation for extra loads and stores
ASSERT((lsb >= 0) && (lsb <= 31));
ASSERT((width + lsb) <= 32);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d",
- instr->Bits(width + lsb - 1, lsb));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%d",
+ instr->Bits(width + lsb - 1, lsb));
return 8;
}
case 'l': { // 'l: branch and link
ASSERT(STRING_STARTS_WITH(format, "msg"));
byte* str =
reinterpret_cast<byte*>(instr->InstructionBits() & 0x0fffffff);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%s", converter_.NameInCode(str));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%s", converter_.NameInCode(str));
return 3;
}
case 'o': {
if ((format[3] == '1') && (format[4] == '2')) {
// 'off12: 12-bit offset for load and store instructions
ASSERT(STRING_STARTS_WITH(format, "off12"));
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d", instr->Offset12Value());
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%d", instr->Offset12Value());
return 5;
} else if (format[3] == '0') {
// 'off0to3and8to19 16-bit immediate encoded in bits 19-8 and 3-0.
ASSERT(STRING_STARTS_WITH(format, "off0to3and8to19"));
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d",
- (instr->Bits(19, 8) << 4) +
- instr->Bits(3, 0));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%d",
+ (instr->Bits(19, 8) << 4) +
+ instr->Bits(3, 0));
return 15;
}
// 'off8: 8-bit offset for extra load and store instructions
ASSERT(STRING_STARTS_WITH(format, "off8"));
int offs8 = (instr->ImmedHValue() << 4) | instr->ImmedLValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%d", offs8);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", offs8);
return 4;
}
case 'p': { // 'pu: P and U bits for load and store instructions
case 't': { // 'target: target of branch instructions
ASSERT(STRING_STARTS_WITH(format, "target"));
int off = (instr->SImmed24Value() << 2) + 8;
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%+d -> %s",
- off,
- converter_.NameOfAddress(
- reinterpret_cast<byte*>(instr) + off));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%+d -> %s",
+ off,
+ converter_.NameOfAddress(
+ reinterpret_cast<byte*>(instr) + off));
return 6;
}
case 'u': { // 'u: signed or unsigned multiplies
Format(instr, "stop'cond 'svc");
// Also print the stop message. Its address is encoded
// in the following 4 bytes.
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "\n %p %08x stop message: %s",
- reinterpret_cast<int32_t*>(instr
- + Instruction::kInstrSize),
- *reinterpret_cast<char**>(instr
- + Instruction::kInstrSize),
- *reinterpret_cast<char**>(instr
- + Instruction::kInstrSize));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "\n %p %08x stop message: %s",
+ reinterpret_cast<void*>(instr
+ + Instruction::kInstrSize),
+ *reinterpret_cast<uint32_t*>(instr
+ + Instruction::kInstrSize),
+ *reinterpret_cast<char**>(instr
+ + Instruction::kInstrSize));
// We have decoded 2 * Instruction::kInstrSize bytes.
return 2 * Instruction::kInstrSize;
} else {
// vcvt.f64.s32 Dd, Dd, #<fbits>
int fraction_bits = 32 - ((instr->Bits(3, 0) << 1) | instr->Bit(5));
Format(instr, "vcvt'cond.f64.s32 'Dd, 'Dd");
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- ", #%d", fraction_bits);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ ", #%d", fraction_bits);
} else if (((instr->Opc2Value() >> 1) == 0x6) &&
(instr->Opc3Value() & 0x1)) {
DecodeVCVTBetweenFloatingPointAndInteger(instr);
int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1);
int Vm = (instr->Bit(5) << 4) | instr->VmValue();
int imm3 = instr->Bits(21, 19);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "vmovl.s%d q%d, d%d", imm3*8, Vd, Vm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "vmovl.s%d q%d, d%d", imm3*8, Vd, Vm);
} else {
Unknown(instr);
}
int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1);
int Vm = (instr->Bit(5) << 4) | instr->VmValue();
int imm3 = instr->Bits(21, 19);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "vmovl.u%d q%d, d%d", imm3*8, Vd, Vm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "vmovl.u%d q%d, d%d", imm3*8, Vd, Vm);
} else {
Unknown(instr);
}
int size = instr->Bits(7, 6);
int align = instr->Bits(5, 4);
int Rm = instr->VmValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "vst1.%d ", (1 << size) << 3);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "vst1.%d ", (1 << size) << 3);
FormatNeonList(Vd, type);
Print(", ");
FormatNeonMemory(Rn, align, Rm);
int size = instr->Bits(7, 6);
int align = instr->Bits(5, 4);
int Rm = instr->VmValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "vld1.%d ", (1 << size) << 3);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "vld1.%d ", (1 << size) << 3);
FormatNeonList(Vd, type);
Print(", ");
FormatNeonMemory(Rn, align, Rm);
int Rn = instr->Bits(19, 16);
int offset = instr->Bits(11, 0);
if (offset == 0) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "pld [r%d]", Rn);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "pld [r%d]", Rn);
} else if (instr->Bit(23) == 0) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "pld [r%d, #-%d]", Rn, offset);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "pld [r%d, #-%d]", Rn, offset);
} else {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "pld [r%d, #+%d]", Rn, offset);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "pld [r%d, #+%d]", Rn, offset);
}
} else {
Unknown(instr);
int Decoder::InstructionDecode(byte* instr_ptr) {
Instruction* instr = Instruction::At(instr_ptr);
// Print raw instruction bytes.
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%08x ",
- instr->InstructionBits());
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%08x ",
+ instr->InstructionBits());
if (instr->ConditionField() == kSpecialCondition) {
DecodeSpecialCondition(instr);
return Instruction::kInstrSize;
}
int instruction_bits = *(reinterpret_cast<int*>(instr_ptr));
if ((instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker) {
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "constant pool begin (length %d)",
- DecodeConstantPoolLength(instruction_bits));
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "constant pool begin (length %d)",
+ DecodeConstantPoolLength(instruction_bits));
return Instruction::kInstrSize;
} else if (instruction_bits == kCodeAgeJumpInstruction) {
// The code age prologue has a constant immediatly following the jump
// instruction.
Instruction* target = Instruction::At(instr_ptr + Instruction::kInstrSize);
DecodeType2(instr);
- OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- " (0x%08x)", target->InstructionBits());
+ SNPrintF(out_buffer_ + out_buffer_pos_,
+ " (0x%08x)", target->InstructionBits());
return 2 * Instruction::kInstrSize;
}
switch (instr->TypeValue()) {
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
if (ureg == v8::internal::kZeroRegCode) {
return "xzr";
}
- v8::internal::OS::SNPrintF(tmp_buffer_, "x%u", ureg);
+ v8::internal::SNPrintF(tmp_buffer_, "x%u", ureg);
return tmp_buffer_.start();
}
~BufferDisassembler() { }
virtual void ProcessOutput(v8::internal::Instruction* instr) {
- v8::internal::OS::SNPrintF(out_buffer_, "%s", GetOutput());
+ v8::internal::SNPrintF(out_buffer_, "%s", GetOutput());
}
private:
const char* str;
if (value()->IsSmi()) {
// Optimization only, the heap number case would subsume this.
- OS::SNPrintF(buffer, "%d", Smi::cast(*value())->value());
+ SNPrintF(buffer, "%d", Smi::cast(*value())->value());
str = arr;
} else {
str = DoubleToCString(value()->Number(), buffer);
const char* V8NameConverter::NameOfAddress(byte* pc) const {
const char* name = code_->GetIsolate()->builtins()->Lookup(pc);
if (name != NULL) {
- OS::SNPrintF(v8_buffer_, "%s (%p)", name, pc);
+ SNPrintF(v8_buffer_, "%s (%p)", name, pc);
return v8_buffer_.start();
}
int offs = static_cast<int>(pc - code_->instruction_start());
// print as code offset, if it seems reasonable
if (0 <= offs && offs < code_->instruction_size()) {
- OS::SNPrintF(v8_buffer_, "%d (%p)", offs, pc);
+ SNPrintF(v8_buffer_, "%d (%p)", offs, pc);
return v8_buffer_.start();
}
}
// First decode instruction so that we know its length.
byte* prev_pc = pc;
if (constants > 0) {
- OS::SNPrintF(decode_buffer,
- "%08x constant",
- *reinterpret_cast<int32_t*>(pc));
+ SNPrintF(decode_buffer,
+ "%08x constant",
+ *reinterpret_cast<int32_t*>(pc));
constants--;
pc += 4;
} else {
int num_const = d.ConstantPoolSizeAt(pc);
if (num_const >= 0) {
- OS::SNPrintF(decode_buffer,
- "%08x constant pool begin",
- *reinterpret_cast<int32_t*>(pc));
+ SNPrintF(decode_buffer,
+ "%08x constant pool begin",
+ *reinterpret_cast<int32_t*>(pc));
constants = num_const;
pc += 4;
} else if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) {
// raw pointer embedded in code stream, e.g., jump table
byte* ptr = *reinterpret_cast<byte**>(pc);
- OS::SNPrintF(decode_buffer,
- "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR,
- ptr,
- ptr - begin);
+ SNPrintF(decode_buffer,
+ "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR,
+ reinterpret_cast<intptr_t>(ptr),
+ ptr - begin);
pc += 4;
} else {
decode_buffer[0] = '\0';
private:
static const char* BuildSource(char* buf, size_t size, const char* fun_name) {
- OS::SNPrintF(Vector<char>(buf, static_cast<int>(size)),
- "native function %s();", fun_name);
+ SNPrintF(Vector<char>(buf, static_cast<int>(size)),
+ "native function %s();", fun_name);
return buf;
}
char* p = &buffer[0];
Vector<char> v(buffer, kBufferSize);
- OS::StrNCpy(v, message, space);
+ StrNCpy(v, message, space);
space -= Min(space, strlen(message));
p = &buffer[kBufferSize] - space;
Object::GetElement(isolate(), args, i).ToHandleChecked());
SmartArrayPointer<char> arg = arg_str->ToCString();
Vector<char> v2(p, static_cast<int>(space));
- OS::StrNCpy(v2, arg.get(), space);
+ StrNCpy(v2, arg.get(), space);
space -= Min(space, strlen(arg.get()));
p = &buffer[kBufferSize] - space;
}
static const char* kObjFileExt = ".o";
char file_name[64];
- OS::SNPrintF(Vector<char>(file_name, kMaxFileNameSize),
- "%s%s%d%s",
- kElfFilePrefix,
- (name_hint != NULL) ? name_hint : "",
- file_num++,
- kObjFileExt);
+ SNPrintF(Vector<char>(file_name, kMaxFileNameSize),
+ "%s%s%d%s",
+ kElfFilePrefix,
+ (name_hint != NULL) ? name_hint : "",
+ file_num++,
+ kObjFileExt);
WriteBytes(file_name, entry->symfile_addr_, entry->symfile_size_);
}
#endif
edge_name = edge.name();
break;
case HeapGraphEdge::kElement:
- OS::SNPrintF(index, "%d", edge.index());
+ SNPrintF(index, "%d", edge.index());
break;
case HeapGraphEdge::kInternal:
edge_prefix = "$";
break;
case HeapGraphEdge::kHidden:
edge_prefix = "$";
- OS::SNPrintF(index, "%d", edge.index());
+ SNPrintF(index, "%d", edge.index());
break;
case HeapGraphEdge::kShortcut:
edge_prefix = "^";
edge_name = edge.name();
break;
default:
- OS::SNPrintF(index, "!!! unknown edge type: %d ", edge.type());
+ SNPrintF(index, "!!! unknown edge type: %d ", edge.type());
}
edge.to()->Print(edge_prefix, edge_name, max_depth, indent + 2);
}
static const int kMaxNumberSize =
MaxDecimalDigitsIn<sizeof(T)>::kUnsigned + 1;
if (chunk_size_ - chunk_pos_ >= kMaxNumberSize) {
- int result = OS::SNPrintF(
+ int result = SNPrintF(
chunk_.SubVector(chunk_pos_, chunk_size_), format, n);
ASSERT(result != -1);
chunk_pos_ += result;
MaybeWriteChunk();
} else {
EmbeddedVector<char, kMaxNumberSize> buffer;
- int result = OS::SNPrintF(buffer, format, n);
+ int result = SNPrintF(buffer, format, n);
USE(result);
ASSERT(result != -1);
AddString(buffer.start());
explicit HTracer(int isolate_id)
: trace_(&string_allocator_), indent_(0) {
if (FLAG_trace_hydrogen_file == NULL) {
- OS::SNPrintF(filename_,
- "hydrogen-%d-%d.cfg",
- OS::GetCurrentProcessId(),
- isolate_id);
+ SNPrintF(filename_,
+ "hydrogen-%d-%d.cfg",
+ OS::GetCurrentProcessId(),
+ isolate_id);
} else {
- OS::StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
+ StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
}
WriteChars(filename_.start(), "", 0, false);
}
v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_;
va_list args;
va_start(args, format);
- int result = v8::internal::OS::VSNPrintF(buf, format, args);
+ int result = v8::internal::VSNPrintF(buf, format, args);
va_end(args);
tmp_buffer_pos_ += result;
}
int outp = 0;
// Instruction bytes.
for (byte* bp = instr; bp < data; bp++) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- "%02x",
- *bp);
+ outp += v8::internal::SNPrintF(out_buffer + outp,
+ "%02x",
+ *bp);
}
for (int i = 6 - instr_len; i >= 0; i--) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- " ");
+ outp += v8::internal::SNPrintF(out_buffer + outp, " ");
}
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- " %s",
- tmp_buffer_.start());
+ outp += v8::internal::SNPrintF(out_buffer + outp,
+ " %s",
+ tmp_buffer_.start());
return instr_len;
} // NOLINT (function is too long)
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
}
if (FLAG_redirect_code_traces_to == NULL) {
- OS::SNPrintF(filename_,
- "code-%d-%d.asm",
- OS::GetCurrentProcessId(),
- isolate_id);
+ SNPrintF(filename_,
+ "code-%d-%d.asm",
+ OS::GetCurrentProcessId(),
+ isolate_id);
} else {
- OS::StrNCpy(filename_, FLAG_redirect_code_traces_to, filename_.length());
+ StrNCpy(filename_, FLAG_redirect_code_traces_to, filename_.length());
}
WriteChars(filename_.start(), "", 0, false);
void Log::MessageBuilder::AppendVA(const char* format, va_list args) {
Vector<char> buf(log_->message_buffer_ + pos_,
Log::kMessageBufferSize - pos_);
- int result = v8::internal::OS::VSNPrintF(buf, format, args);
+ int result = v8::internal::VSNPrintF(buf, format, args);
// Result is -1 if output was truncated.
if (result >= 0) {
}
Vector<char> buf(log_->message_buffer_ + pos_,
Log::kMessageBufferSize - pos_);
- OS::StrNCpy(buf, str, len);
+ StrNCpy(buf, str, len);
pos_ += len;
ASSERT(pos_ <= Log::kMessageBufferSize);
}
void AppendInt(int n) {
Vector<char> buffer(utf8_buffer_ + utf8_pos_,
kUtf8BufferSize - utf8_pos_);
- int size = OS::SNPrintF(buffer, "%d", n);
+ int size = SNPrintF(buffer, "%d", n);
if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
utf8_pos_ += size;
}
void AppendHex(uint32_t n) {
Vector<char> buffer(utf8_buffer_ + utf8_pos_,
kUtf8BufferSize - utf8_pos_);
- int size = OS::SNPrintF(buffer, "%x", n);
+ int size = SNPrintF(buffer, "%x", n);
if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) {
utf8_pos_ += size;
}
// Open the perf JIT dump file.
int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding;
ScopedVector<char> perf_dump_name(bufferSize);
- int size = OS::SNPrintF(
+ int size = SNPrintF(
perf_dump_name,
kFilenameFormatString,
OS::GetCurrentProcessId());
// Open the perf JIT dump file.
int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding;
ScopedVector<char> perf_dump_name(bufferSize);
- int size = OS::SNPrintF(
+ int size = SNPrintF(
perf_dump_name,
kFilenameFormatString,
OS::GetCurrentProcessId());
// Print the integer value of the sa field.
void Decoder::PrintSa(Instruction* instr) {
int sa = instr->SaValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa);
}
// Print the integer value of the rd field, when it is not used as reg.
void Decoder::PrintSd(Instruction* instr) {
int sd = instr->RdValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sd);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sd);
}
// Print the integer value of the rd field, when used as 'ext' size.
void Decoder::PrintSs1(Instruction* instr) {
int ss = instr->RdValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss + 1);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss + 1);
}
int ss = instr->RdValue();
int pos = instr->SaValue();
out_buffer_pos_ +=
- OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss - pos + 1);
+ SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss - pos + 1);
}
// Print the integer value of the cc field for the bc1t/f instructions.
void Decoder::PrintBc(Instruction* instr) {
int cc = instr->FBccValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", cc);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", cc);
}
// Print the integer value of the cc field for the FP compare instructions.
void Decoder::PrintCc(Instruction* instr) {
int cc = instr->FCccValue();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc);
}
// Print 16-bit unsigned immediate value.
void Decoder::PrintUImm16(Instruction* instr) {
int32_t imm = instr->Imm16Value();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
}
// Print 16-bit signed immediate value.
void Decoder::PrintSImm16(Instruction* instr) {
int32_t imm = ((instr->Imm16Value()) << 16) >> 16;
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
}
// Print 16-bit hexa immediate value.
void Decoder::PrintXImm16(Instruction* instr) {
int32_t imm = instr->Imm16Value();
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
}
// Print 26-bit immediate value.
void Decoder::PrintXImm26(Instruction* instr) {
uint32_t imm = instr->Imm26Value() << kImmFieldShift;
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
}
switch (instr->FunctionFieldRaw()) {
case BREAK: {
int32_t code = instr->Bits(25, 6);
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "0x%05x (%d)", code, code);
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "0x%05x (%d)", code, code);
break;
}
case TGE:
case TNE: {
int32_t code = instr->Bits(15, 6);
out_buffer_pos_ +=
- OS::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code);
+ SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code);
break;
}
default: // Not a break or trap instruction.
int Decoder::InstructionDecode(byte* instr_ptr) {
Instruction* instr = Instruction::At(instr_ptr);
// Print raw instruction bytes.
- out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
- "%08x ",
- instr->InstructionBits());
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
+ "%08x ",
+ instr->InstructionBits());
switch (instr->InstructionType()) {
case Instruction::kRegisterType: {
DecodeTypeRegister(instr);
namespace disasm {
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
// print that using vsnprintf (which may truncate but never allocate if
// there is no more space in the buffer).
EmbeddedVector<char, 100> buffer;
- OS::SNPrintF(buffer, "%.16g", Number());
+ SNPrintF(buffer, "%.16g", Number());
accumulator->Add("%s", buffer.start());
}
}
-int OS::SNPrintF(Vector<char> str, const char* format, ...) {
+int OS::SNPrintF(char* str, int length, const char* format, ...) {
va_list args;
va_start(args, format);
- int result = VSNPrintF(str, format, args);
+ int result = VSNPrintF(str, length, format, args);
va_end(args);
return result;
}
-int OS::VSNPrintF(Vector<char> str,
+int OS::VSNPrintF(char* str,
+ int length,
const char* format,
va_list args) {
- int n = vsnprintf(str.start(), str.length(), format, args);
- if (n < 0 || n >= str.length()) {
+ int n = vsnprintf(str, length, format, args);
+ if (n < 0 || n >= length) {
// If the length is zero, the assignment fails.
- if (str.length() > 0)
- str[str.length() - 1] = '\0';
+ if (length > 0)
+ str[length - 1] = '\0';
return -1;
} else {
return n;
}
-void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) {
- strncpy(dest.start(), src, n);
+void OS::StrNCpy(char* dest, int length, const char* src, size_t n) {
+ strncpy(dest, src, n);
}
}
-struct StackWalker {
- Vector<OS::StackFrame>& frames;
- int index;
-};
-
-
-static int StackWalkCallback(uintptr_t pc, int signo, void* data) {
- struct StackWalker* walker = static_cast<struct StackWalker*>(data);
- Dl_info info;
-
- int i = walker->index;
-
- walker->frames[i].address = reinterpret_cast<void*>(pc);
-
- // Make sure line termination is in place.
- walker->frames[i].text[OS::kStackWalkMaxTextLen - 1] = '\0';
-
- Vector<char> text = MutableCStrVector(walker->frames[i].text,
- OS::kStackWalkMaxTextLen);
-
- if (dladdr(reinterpret_cast<void*>(pc), &info) == 0) {
- OS::SNPrintF(text, "[0x%p]", pc);
- } else if ((info.dli_fname != NULL && info.dli_sname != NULL)) {
- // We have symbol info.
- OS::SNPrintF(text, "%s'%s+0x%x", info.dli_fname, info.dli_sname, pc);
- } else {
- // No local symbol info.
- OS::SNPrintF(text,
- "%s'0x%p [0x%p]",
- info.dli_fname,
- pc - reinterpret_cast<uintptr_t>(info.dli_fbase),
- pc);
- }
- walker->index++;
- return 0;
-}
-
-
// Constants used for mmap.
static const int kMmapFd = -1;
static const int kMmapFdOffset = 0;
// To properly resolve the resource identifier requires a library load,
// which is not possible in a sandbox.
if (std_tz_name_[0] == '\0' || std_tz_name_[0] == '@') {
- OS::SNPrintF(Vector<char>(std_tz_name_, kTzNameSize - 1),
+ OS::SNPrintF(std_tz_name_, kTzNameSize - 1,
"%s Standard Time",
GuessTimezoneNameFromBias(tzinfo_.Bias));
}
if (dst_tz_name_[0] == '\0' || dst_tz_name_[0] == '@') {
- OS::SNPrintF(Vector<char>(dst_tz_name_, kTzNameSize - 1),
+ OS::SNPrintF(dst_tz_name_, kTzNameSize - 1,
"%s Daylight Time",
GuessTimezoneNameFromBias(tzinfo_.Bias));
}
// It is important to use safe print here in order to avoid
// overflowing the buffer. We might truncate the output, but this
// does not crash.
- EmbeddedVector<char, 4096> buffer;
- OS::VSNPrintF(buffer, format, args);
- OutputDebugStringA(buffer.start());
+ char buffer[4096];
+ OS::VSNPrintF(buffer, sizeof(buffer), format, args);
+ OutputDebugStringA(buffer);
} else {
vfprintf(stream, format, args);
}
}
-int OS::SNPrintF(Vector<char> str, const char* format, ...) {
+int OS::SNPrintF(char* str, int length, const char* format, ...) {
va_list args;
va_start(args, format);
- int result = VSNPrintF(str, format, args);
+ int result = VSNPrintF(str, length, format, args);
va_end(args);
return result;
}
-int OS::VSNPrintF(Vector<char> str, const char* format, va_list args) {
- int n = _vsnprintf_s(str.start(), str.length(), _TRUNCATE, format, args);
+int OS::VSNPrintF(char* str, int length, const char* format, va_list args) {
+ int n = _vsnprintf_s(str, length, _TRUNCATE, format, args);
// Make sure to zero-terminate the string if the output was
// truncated or if there was an error.
- if (n < 0 || n >= str.length()) {
- if (str.length() > 0)
- str[str.length() - 1] = '\0';
+ if (n < 0 || n >= length) {
+ if (length > 0)
+ str[length - 1] = '\0';
return -1;
} else {
return n;
}
-void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) {
+void OS::StrNCpy(char* dest, int length, const char* src, size_t n) {
// Use _TRUNCATE or strncpy_s crashes (by design) if buffer is too small.
- size_t buffer_size = static_cast<size_t>(dest.length());
+ size_t buffer_size = static_cast<size_t>(length);
if (n + 1 > buffer_size) // count for trailing '\0'
n = _TRUNCATE;
- int result = strncpy_s(dest.start(), dest.length(), src, n);
+ int result = strncpy_s(dest, length, src, n);
USE(result);
ASSERT(result == 0 || (n == _TRUNCATE && result == STRUNCATE));
}
void Thread::set_name(const char* name) {
- OS::StrNCpy(Vector<char>(name_, sizeof(name_)), name, strlen(name));
+ OS::StrNCpy(name_, sizeof(name_), name, strlen(name));
name_[sizeof(name_) - 1] = '\0';
}
#include "src/base/build_config.h"
#include "src/platform/mutex.h"
#include "src/platform/semaphore.h"
-#include "src/vector.h"
#ifdef __sun
# ifndef signbit
const intptr_t kTibExtraTlsOffset = 0xF94;
const intptr_t kMaxInlineSlots = 64;
const intptr_t kMaxSlots = kMaxInlineSlots + 1024;
+ const intptr_t kPointerSize = sizeof(void*);
ASSERT(0 <= index && index < kMaxSlots);
if (index < kMaxInlineSlots) {
return static_cast<intptr_t>(__readfsdword(kTibInlineTlsOffset +
// Safe formatting print. Ensures that str is always null-terminated.
// Returns the number of chars written, or -1 if output was truncated.
- static int SNPrintF(Vector<char> str, const char* format, ...);
- static int VSNPrintF(Vector<char> str,
+ static int SNPrintF(char* str, int length, const char* format, ...);
+ static int VSNPrintF(char* str,
+ int length,
const char* format,
va_list args);
static char* StrChr(char* str, int c);
- static void StrNCpy(Vector<char> dest, const char* src, size_t n);
+ static void StrNCpy(char* dest, int length, const char* src, size_t n);
// Support for the profiler. Can do nothing, in which case ticks
// occuring in shared libraries will not be properly accounted for.
class Thread {
public:
// Opaque data type for thread-local storage keys.
- // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified
- // to ensure that enumeration type has correct value range (see Issue 830 for
- // more details).
- enum LocalStorageKey {
- LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt,
- LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
- };
+ typedef int32_t LocalStorageKey;
class Options {
public:
for (;;) {
va_list arguments;
va_start(arguments, format);
- int n = OS::VSNPrintF(Vector<char>(output_, size_) + pos_,
- format,
- arguments);
+ int n = VSNPrintF(Vector<char>(output_, size_) + pos_,
+ format,
+ arguments);
va_end(arguments);
if (n >= 0) {
PrintLiteralIndented(info, value, true);
} else {
EmbeddedVector<char, 256> buf;
- int pos = OS::SNPrintF(buf, "%s (mode = %s", info,
- Variable::Mode2String(var->mode()));
- OS::SNPrintF(buf + pos, ")");
+ int pos = SNPrintF(buf, "%s (mode = %s", info,
+ Variable::Mode2String(var->mode()));
+ SNPrintF(buf + pos, ")");
PrintLiteralIndented(buf.start(), value, true);
}
}
void AstPrinter::VisitVariableProxy(VariableProxy* node) {
Variable* var = node->var();
EmbeddedVector<char, 128> buf;
- int pos = OS::SNPrintF(buf, "VAR PROXY");
+ int pos = SNPrintF(buf, "VAR PROXY");
switch (var->location()) {
case Variable::UNALLOCATED:
break;
case Variable::PARAMETER:
- OS::SNPrintF(buf + pos, " parameter[%d]", var->index());
+ SNPrintF(buf + pos, " parameter[%d]", var->index());
break;
case Variable::LOCAL:
- OS::SNPrintF(buf + pos, " local[%d]", var->index());
+ SNPrintF(buf + pos, " local[%d]", var->index());
break;
case Variable::CONTEXT:
- OS::SNPrintF(buf + pos, " context[%d]", var->index());
+ SNPrintF(buf + pos, " context[%d]", var->index());
break;
case Variable::LOOKUP:
- OS::SNPrintF(buf + pos, " lookup");
+ SNPrintF(buf + pos, " lookup");
break;
}
PrintLiteralWithModeIndented(buf.start(), var, node->name());
void AstPrinter::VisitCountOperation(CountOperation* node) {
EmbeddedVector<char, 128> buf;
- OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
- Token::Name(node->op()));
+ SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
+ Token::Name(node->op()));
IndentedScope indent(this, buf.start());
Visit(node->expression());
}
HashMap::Entry* entry = GetEntry(src, len);
if (entry->value == NULL) {
Vector<char> dst = Vector<char>::New(len + 1);
- OS::StrNCpy(dst, src, len);
+ StrNCpy(dst, src, len);
dst[len] = '\0';
entry->key = dst.start();
entry->value = entry->key;
const char* StringsStorage::GetVFormatted(const char* format, va_list args) {
Vector<char> str = Vector<char>::New(1024);
- int len = OS::VSNPrintF(str, format, args);
+ int len = VSNPrintF(str, format, args);
if (len == -1) {
DeleteArray(str.start());
return GetCopy(format);
const char* file_name) {
int file_name_length = StrLength(file_name) + 10;
Vector<char> name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(name, "%s.size", file_name);
+ SNPrintF(name, "%s.size", file_name);
FILE* fp = OS::FOpen(name.start(), "r");
CHECK_NE(NULL, fp);
int new_size, pointer_size, data_size, code_size, map_size, cell_size,
case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': {
int value = current.data_.u_int_;
EmbeddedVector<char, 24> formatted;
- int length = OS::SNPrintF(formatted, temp.start(), value);
+ int length = SNPrintF(formatted, temp.start(), value);
Add(Vector<const char>(formatted.start(), length));
break;
}
case 'f': case 'g': case 'G': case 'e': case 'E': {
double value = current.data_.u_double_;
EmbeddedVector<char, 28> formatted;
- OS::SNPrintF(formatted, temp.start(), value);
+ SNPrintF(formatted, temp.start(), value);
Add(formatted.start());
break;
}
case 'p': {
void* value = current.data_.u_pointer_;
EmbeddedVector<char, 20> formatted;
- OS::SNPrintF(formatted, temp.start(), value);
+ SNPrintF(formatted, temp.start(), value);
Add(formatted.start());
break;
}
}
+int SNPrintF(Vector<char> str, const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ int result = VSNPrintF(str, format, args);
+ va_end(args);
+ return result;
+}
+
+
+int VSNPrintF(Vector<char> str, const char* format, va_list args) {
+ return OS::VSNPrintF(str.start(), str.length(), format, args);
+}
+
+
+void StrNCpy(Vector<char> dest, const char* src, size_t n) {
+ OS::StrNCpy(dest.start(), dest.length(), src, n);
+}
+
+
void Flush(FILE* out) {
fflush(out);
}
void StringBuilder::AddFormattedList(const char* format, va_list list) {
ASSERT(!is_finalized() && position_ <= buffer_.length());
- int n = OS::VSNPrintF(buffer_ + position_, format, list);
+ int n = VSNPrintF(buffer_ + position_, format, list);
if (n < 0 || n >= (buffer_.length() - position_)) {
position_ = buffer_.length();
} else {
// Prepends the current process ID to the output.
void PRINTF_CHECKING PrintPID(const char* format, ...);
+// Safe formatting print. Ensures that str is always null-terminated.
+// Returns the number of chars written, or -1 if output was truncated.
+int FPRINTF_CHECKING SNPrintF(Vector<char> str, const char* format, ...);
+int VSNPrintF(Vector<char> str, const char* format, va_list args);
+
+void StrNCpy(Vector<char> dest, const char* src, size_t n);
+
// Our version of fflush.
void Flush(FILE* out);
const char* is_simulator = "";
#endif // USE_SIMULATOR
if (GetPatch() > 0) {
- OS::SNPrintF(str, "%d.%d.%d.%d%s%s",
- GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate,
- is_simulator);
+ SNPrintF(str, "%d.%d.%d.%d%s%s",
+ GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate,
+ is_simulator);
} else {
- OS::SNPrintF(str, "%d.%d.%d%s%s",
- GetMajor(), GetMinor(), GetBuild(), candidate,
- is_simulator);
+ SNPrintF(str, "%d.%d.%d%s%s",
+ GetMajor(), GetMinor(), GetBuild(), candidate,
+ is_simulator);
}
}
// Generate generic SONAME if no specific SONAME is defined.
const char* candidate = IsCandidate() ? "-candidate" : "";
if (GetPatch() > 0) {
- OS::SNPrintF(str, "libv8-%d.%d.%d.%d%s.so",
- GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate);
+ SNPrintF(str, "libv8-%d.%d.%d.%d%s.so",
+ GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate);
} else {
- OS::SNPrintF(str, "libv8-%d.%d.%d%s.so",
- GetMajor(), GetMinor(), GetBuild(), candidate);
+ SNPrintF(str, "libv8-%d.%d.%d%s.so",
+ GetMajor(), GetMinor(), GetBuild(), candidate);
}
} else {
// Use specific SONAME.
- OS::SNPrintF(str, "%s", soname_);
+ SNPrintF(str, "%s", soname_);
}
}
v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_;
va_list args;
va_start(args, format);
- int result = v8::internal::OS::VSNPrintF(buf, format, args);
+ int result = v8::internal::VSNPrintF(buf, format, args);
va_end(args);
tmp_buffer_pos_ += result;
}
int outp = 0;
// Instruction bytes.
for (byte* bp = instr; bp < data; bp++) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp, "%02x", *bp);
+ outp += v8::internal::SNPrintF(out_buffer + outp, "%02x", *bp);
}
for (int i = 6 - instr_len; i >= 0; i--) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp, " ");
+ outp += v8::internal::SNPrintF(out_buffer + outp, " ");
}
- outp += v8::internal::OS::SNPrintF(out_buffer + outp, " %s",
- tmp_buffer_.start());
+ outp += v8::internal::SNPrintF(out_buffer + outp, " %s",
+ tmp_buffer_.start());
return instr_len;
}
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_;
va_list args;
va_start(args, format);
- int result = v8::internal::OS::VSNPrintF(buf, format, args);
+ int result = v8::internal::VSNPrintF(buf, format, args);
va_end(args);
tmp_buffer_pos_ += result;
}
int outp = 0;
// Instruction bytes.
for (byte* bp = instr; bp < data; bp++) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- "%02x",
- *bp);
+ outp += v8::internal:::SNPrintF(out_buffer + outp, "%02x", *bp);
}
for (int i = 6 - instr_len; i >= 0; i--) {
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- " ");
+ outp += v8::internal::SNPrintF(out_buffer + outp, " ");
}
- outp += v8::internal::OS::SNPrintF(out_buffer + outp,
- " %s",
- tmp_buffer_.start());
+ outp += v8::internal::SNPrintF(out_buffer + outp, " %s", tmp_buffer_.start());
return instr_len;
} // NOLINT (function is too long)
const char* NameConverter::NameOfAddress(byte* addr) const {
- v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr);
+ v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
return tmp_buffer_.start();
}
static void TestSignature(const char* loop_js, Local<Value> receiver) {
i::ScopedVector<char> source(200);
- i::OS::SNPrintF(source,
- "for (var i = 0; i < 10; i++) {"
- " %s"
- "}",
- loop_js);
+ i::SNPrintF(source,
+ "for (var i = 0; i < 10; i++) {"
+ " %s"
+ "}",
+ loop_js);
signature_callback_count = 0;
signature_expected_receiver = receiver;
bool expected_to_throw = receiver.IsEmpty();
unsigned bad_signature_start_offset = 2;
for (unsigned i = 0; i < ARRAY_SIZE(test_objects); i++) {
i::ScopedVector<char> source(200);
- i::OS::SNPrintF(
+ i::SNPrintF(
source, "var test_object = %s; test_object", test_objects[i]);
Local<Value> test_object = CompileRun(source.start());
TestSignature("test_object.prop();", test_object);
static void CheckIsTypedArrayVarNeutered(const char* name) {
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(source,
+ i::SNPrintF(source,
"%s.byteLength == 0 && %s.byteOffset == 0 && %s.length == 0",
name, name, name);
CHECK(CompileRun(source.start())->IsTrue());
source_len <= kEmbeddedExtensionSourceValidLen + 1; ++source_len) {
v8::HandleScope handle_scope(CcTest::isolate());
i::ScopedVector<char> extension_name(32);
- i::OS::SNPrintF(extension_name, "ext #%d", source_len);
+ i::SNPrintF(extension_name, "ext #%d", source_len);
v8::RegisterExtension(new Extension(extension_name.start(),
kEmbeddedExtensionSource, 0, 0,
source_len));
// Force dictionary-based properties.
i::ScopedVector<char> name_buf(1024);
for (int i = 1; i <= 1000; i++) {
- i::OS::SNPrintF(name_buf, "sdf%d", i);
+ i::SNPrintF(name_buf, "sdf%d", i);
t2->InstanceTemplate()->Set(v8_str(name_buf.start()), v8_num(2));
}
" }"
"}"
"res;";
- i::OS::SNPrintF(test_buf,
- boundary_program,
- low);
+ i::SNPrintF(test_buf,
+ boundary_program,
+ low);
result = CompileRun(test_buf.start());
CHECK_EQ(low, result->IntegerValue());
- i::OS::SNPrintF(test_buf,
- boundary_program,
- high);
+ i::SNPrintF(test_buf,
+ boundary_program,
+ high);
result = CompileRun(test_buf.start());
CHECK_EQ(high, result->IntegerValue());
CHECK_EQ(28, result->Int32Value());
// Make sure out-of-range loads do not throw.
- i::OS::SNPrintF(test_buf,
- "var caught_exception = false;"
- "try {"
- " ext_array[%d];"
- "} catch (e) {"
- " caught_exception = true;"
- "}"
- "caught_exception;",
- element_count);
+ i::SNPrintF(test_buf,
+ "var caught_exception = false;"
+ "try {"
+ " ext_array[%d];"
+ "} catch (e) {"
+ " caught_exception = true;"
+ "}"
+ "caught_exception;",
+ element_count);
result = CompileRun(test_buf.start());
CHECK_EQ(false, result->BooleanValue());
// Make sure out-of-range stores do not throw.
- i::OS::SNPrintF(test_buf,
- "var caught_exception = false;"
- "try {"
- " ext_array[%d] = 1;"
- "} catch (e) {"
- " caught_exception = true;"
- "}"
- "caught_exception;",
- element_count);
+ i::SNPrintF(test_buf,
+ "var caught_exception = false;"
+ "try {"
+ " ext_array[%d] = 1;"
+ "} catch (e) {"
+ " caught_exception = true;"
+ "}"
+ "caught_exception;",
+ element_count);
result = CompileRun(test_buf.start());
CHECK_EQ(false, result->BooleanValue());
array_type == v8::kExternalUint32Array);
bool is_pixel_data = array_type == v8::kExternalUint8ClampedArray;
- i::OS::SNPrintF(test_buf,
- "%s"
- "var all_passed = true;"
- "for (var i = 0; i < source_data.length; i++) {"
- " for (var j = 0; j < 8; j++) {"
- " ext_array[j] = source_data[i];"
- " }"
- " all_passed = all_passed &&"
- " (ext_array[5] == expected_results[i]);"
- "}"
- "all_passed;",
- (is_unsigned ?
- unsigned_data :
- (is_pixel_data ? pixel_data : signed_data)));
+ i::SNPrintF(test_buf,
+ "%s"
+ "var all_passed = true;"
+ "for (var i = 0; i < source_data.length; i++) {"
+ " for (var j = 0; j < 8; j++) {"
+ " ext_array[j] = source_data[i];"
+ " }"
+ " all_passed = all_passed &&"
+ " (ext_array[5] == expected_results[i]);"
+ "}"
+ "all_passed;",
+ (is_unsigned ?
+ unsigned_data :
+ (is_pixel_data ? pixel_data : signed_data)));
result = CompileRun(test_buf.start());
CHECK_EQ(true, result->BooleanValue());
}
"eval('(' + outer +')()%s');";
i::ScopedVector<char> code(1024);
- i::OS::SNPrintF(code, source, "//# sourceURL=eval_url");
+ i::SNPrintF(code, source, "//# sourceURL=eval_url");
CHECK(CompileRun(code.start())->IsUndefined());
- i::OS::SNPrintF(code, source, "//@ sourceURL=eval_url");
+ i::SNPrintF(code, source, "//@ sourceURL=eval_url");
CHECK(CompileRun(code.start())->IsUndefined());
}
"outer()\n%s";
i::ScopedVector<char> code(1024);
- i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
+ i::SNPrintF(code, source, "//# sourceURL=source_url");
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
- i::OS::SNPrintF(code, source, "//@ sourceURL=source_url");
+ i::SNPrintF(code, source, "//@ sourceURL=source_url");
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
}
"outer()\n%s";
i::ScopedVector<char> code(1024);
- i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
+ i::SNPrintF(code, source, "//# sourceURL=source_url");
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
- i::OS::SNPrintF(code, source, "//@ sourceURL=source_url");
+ i::SNPrintF(code, source, "//@ sourceURL=source_url");
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
}
"outer()\n%s";
i::ScopedVector<char> code(1024);
- i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
+ i::SNPrintF(code, source, "//# sourceURL=source_url");
v8::TryCatch try_catch;
CompileRunWithOrigin(code.start(), "", 0, 0);
CHECK(try_catch.HasCaught());
v8::HandleScope scope(isolate);
LocalContext context(isolate);
i::ScopedVector<char> code(1024);
- i::OS::SNPrintF(code, "function fib(n) {"
- " if (n <= 2) return 1;"
- " return fib(n-1) + fib(n-2);"
- "}"
- "fib(%d)", limit);
+ i::SNPrintF(code, "function fib(n) {"
+ " if (n <= 2) return 1;"
+ " return fib(n-1) + fib(n-2);"
+ "}"
+ "fib(%d)", limit);
Local<Value> value = CompileRun(code.start());
CHECK(value->IsNumber());
return static_cast<int>(value->NumberValue());
i::OS::Print("Entering recursion level %d.\n", level);
char script[64];
i::Vector<char> script_vector(script, sizeof(script));
- i::OS::SNPrintF(script_vector, "recursion(%d)", level);
+ i::SNPrintF(script_vector, "recursion(%d)", level);
CompileRun(script_vector.start());
i::OS::Print("Leaving recursion level %d.\n", level);
CHECK_EQ(0, callback_fired);
access_check_fail_thrown = false;
catch_callback_called = false;
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(source, "try { %s; } catch (e) { catcher(e); }", script);
+ i::SNPrintF(source, "try { %s; } catch (e) { catcher(e); }", script);
CompileRun(source.start());
CHECK(access_check_fail_thrown);
CHECK(catch_callback_called);
// build wrap_function
i::ScopedVector<char> wrap_function(200);
if (global) {
- i::OS::SNPrintF(
+ i::SNPrintF(
wrap_function,
"function wrap_f_%d() { var f = g_f; return f(); }\n"
"function wrap_get_%d() { return this.g_acc; }\n"
"function wrap_set_%d() { return this.g_acc = 1; }\n",
key, key, key);
} else {
- i::OS::SNPrintF(
+ i::SNPrintF(
wrap_function,
"function wrap_f_%d() { return receiver_subclass.f(); }\n"
"function wrap_get_%d() { return receiver_subclass.acc; }\n"
}
// build source string
i::ScopedVector<char> source(1000);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"%s\n" // wrap functions
"function wrap_f() { return wrap_f_%d(); }\n"
static double Inc(Isolate* isolate, int x) {
const char* source = "result = %d + 1;";
EmbeddedVector<char, 512> buffer;
- OS::SNPrintF(buffer, source, x);
+ SNPrintF(buffer, source, x);
Handle<JSFunction> fun = Compile(buffer.start());
if (fun.is_null()) return -1;
v8::internal::EmbeddedVector<char, 128> decode_buffer;
v8::internal::EmbeddedVector<char, 128> smi_hex_buffer;
Smi* smi = Smi::FromInt(12345678);
- OS::SNPrintF(smi_hex_buffer, "0x%lx", reinterpret_cast<intptr_t>(smi));
+ SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi));
while (pc < end) {
int num_const = d.ConstantPoolSizeAt(pc);
if (num_const >= 0) {
i::EmbeddedVector<char, 256> script;
i::EmbeddedVector<char, 32> name;
- i::OS::SNPrintF(name, "function_%d", ++counter);
+ i::SNPrintF(name, "function_%d", ++counter);
const char* name_start = name.start();
- i::OS::SNPrintF(script,
+ i::SNPrintF(script,
"function %s() {\n"
"var counter = 0;\n"
"for (var i = 0; i < %d; ++i) counter += i;\n"
const v8::CpuProfileNode* result = FindChild(isolate, node, name);
if (!result) {
char buffer[100];
- i::OS::SNPrintF(Vector<char>(buffer, ARRAY_SIZE(buffer)),
- "Failed to GetChild: %s", name);
+ i::SNPrintF(Vector<char>(buffer, ARRAY_SIZE(buffer)),
+ "Failed to GetChild: %s", name);
FATAL(buffer);
}
return result;
const char* function_name,
int line, int position) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.setBreakPoint(%s,%d,%d)",
- function_name, line, position);
+ SNPrintF(buffer,
+ "debug.Debug.setBreakPoint(%s,%d,%d)",
+ function_name, line, position);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Handle<v8::String> str = v8::String::NewFromUtf8(isolate, buffer.start());
return v8::Script::Compile(str)->Run()->Int32Value();
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
if (column >= 0) {
// Column specified set script break point on precise location.
- OS::SNPrintF(buffer,
- "debug.Debug.setScriptBreakPointById(%d,%d,%d)",
- script_id, line, column);
+ SNPrintF(buffer,
+ "debug.Debug.setScriptBreakPointById(%d,%d,%d)",
+ script_id, line, column);
} else {
// Column not specified set script break point on line.
- OS::SNPrintF(buffer,
- "debug.Debug.setScriptBreakPointById(%d,%d)",
- script_id, line);
+ SNPrintF(buffer,
+ "debug.Debug.setScriptBreakPointById(%d,%d)",
+ script_id, line);
}
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
{
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
if (column >= 0) {
// Column specified set script break point on precise location.
- OS::SNPrintF(buffer,
- "debug.Debug.setScriptBreakPointByName(\"%s\",%d,%d)",
- script_name, line, column);
+ SNPrintF(buffer,
+ "debug.Debug.setScriptBreakPointByName(\"%s\",%d,%d)",
+ script_name, line, column);
} else {
// Column not specified set script break point on line.
- OS::SNPrintF(buffer,
- "debug.Debug.setScriptBreakPointByName(\"%s\",%d)",
- script_name, line);
+ SNPrintF(buffer,
+ "debug.Debug.setScriptBreakPointByName(\"%s\",%d)",
+ script_name, line);
}
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
{
static void ClearBreakPointFromJS(v8::Isolate* isolate,
int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.clearBreakPoint(%d)",
- break_point_number);
+ SNPrintF(buffer,
+ "debug.Debug.clearBreakPoint(%d)",
+ break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
static void EnableScriptBreakPointFromJS(v8::Isolate* isolate,
int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.enableScriptBreakPoint(%d)",
- break_point_number);
+ SNPrintF(buffer,
+ "debug.Debug.enableScriptBreakPoint(%d)",
+ break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
static void DisableScriptBreakPointFromJS(v8::Isolate* isolate,
int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.disableScriptBreakPoint(%d)",
- break_point_number);
+ SNPrintF(buffer,
+ "debug.Debug.disableScriptBreakPoint(%d)",
+ break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
int break_point_number,
const char* condition) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")",
- break_point_number, condition);
+ SNPrintF(buffer,
+ "debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")",
+ break_point_number, condition);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
int break_point_number,
int ignoreCount) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
- break_point_number, ignoreCount);
+ SNPrintF(buffer,
+ "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
+ break_point_number, ignoreCount);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
if (len > buffer_size - 1) {
len = buffer_size - 1;
}
- OS::StrNCpy(buf, pos1, len);
+ StrNCpy(buf, pos1, len);
buffer[buffer_size - 1] = '\0';
return true;
}
// Check that the properties are interceptor properties.
for (int i = 0; i < 3; i++) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "named_values[%d] instanceof debug.PropertyMirror", i);
+ SNPrintF(buffer,
+ "named_values[%d] instanceof debug.PropertyMirror", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
- OS::SNPrintF(buffer, "named_values[%d].propertyType()", i);
+ SNPrintF(buffer, "named_values[%d].propertyType()", i);
CHECK_EQ(v8::internal::INTERCEPTOR,
CompileRun(buffer.start())->Int32Value());
- OS::SNPrintF(buffer, "named_values[%d].isNative()", i);
+ SNPrintF(buffer, "named_values[%d].isNative()", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
}
// Check that the properties are interceptor properties.
for (int i = 0; i < 2; i++) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer,
- "indexed_values[%d] instanceof debug.PropertyMirror", i);
+ SNPrintF(buffer,
+ "indexed_values[%d] instanceof debug.PropertyMirror", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
}
// Check that the properties are interceptor properties.
for (int i = 0; i < 5; i++) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- OS::SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i);
+ SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
}
terminate_after_max_break_point_hit = true;
EmbeddedVector<char, 1024> buffer;
- OS::SNPrintF(buffer,
- "function f() {%s%s%s}",
- loop_head, loop_bodies[i], loop_tail);
+ SNPrintF(buffer,
+ "function f() {%s%s%s}",
+ loop_head, loop_bodies[i], loop_tail);
// Function with infinite loop.
CompileRun(buffer.start());
int break_id = CcTest::i_isolate()->debug()->break_id();
char script[128];
i::Vector<char> script_vector(script, sizeof(script));
- OS::SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id);
+ SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id);
v8::Local<v8::Value> result = CompileRun(script);
int frame_count = result->Int32Value();
for (int i = 0; i < frame_count; i++) {
// The 5. element in the returned array of GetFrameDetails contains the
// source position of that frame.
- OS::SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i);
+ SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i);
v8::Local<v8::Value> result = CompileRun(script);
CHECK_EQ(expected_line_number[i],
i::Script::GetLineNumber(source_script, result->Int32Value()));
static void TestDeoptimizeBinaryOpHelper(LocalContext* env,
const char* binary_op) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> f_source_buffer;
- OS::SNPrintF(f_source_buffer,
- "function f(x, y) { return x %s y; };",
- binary_op);
+ SNPrintF(f_source_buffer,
+ "function f(x, y) { return x %s y; };",
+ binary_op);
char* f_source = f_source_buffer.start();
AllowNativesSyntaxNoInlining options;
// ... well check just every 15th because otherwise it's too slow in debug.
for (int i = 0; i < num_objects - 1; i += 15) {
i::EmbeddedVector<char, 100> var_name;
- i::OS::SNPrintF(var_name, "f_%d", i);
+ i::SNPrintF(var_name, "f_%d", i);
const v8::HeapGraphNode* f_object = GetProperty(
context_object, v8::HeapGraphEdge::kContextVariable, var_name.start());
CHECK_NE(NULL, f_object);
v8::String::Utf8Value edge_name(edge->GetName());
v8::String::Utf8Value node_name(to_node->GetName());
i::EmbeddedVector<char, 100> name;
- i::OS::SNPrintF(name, "%s::%s", *edge_name, *node_name);
+ i::SNPrintF(name, "%s::%s", *edge_name, *node_name);
if (strstr(name.start(), path[current_depth])) {
node = to_node;
break;
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array();"
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = 100;"
"var elements = new Array(number_elements);"
"f(); gc();"
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
- "f();",
- AllocationSite::kPretenureMinimumCreated);
+ "f();");
v8::Local<v8::Value> res = CompileRun(source.start());
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
// Call new is doing slack tracking for the first
// JSFunction::kGenerousAllocationCount allocations, and we can't find
// mementos during that time.
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
// Call new is doing slack tracking for the first
// JSFunction::kGenerousAllocationCount allocations, and we can't find
// mementos during that time.
- i::OS::SNPrintF(
+ i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
AlwaysAllocateScope always_allocate(CcTest::i_isolate());
for (int i = 0; i < transitions_count; i++) {
EmbeddedVector<char, 64> buffer;
- OS::SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i);
+ SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i);
CompileRun(buffer.start());
}
CompileRun("var root = new F;");
AlwaysAllocateScope always_allocate(CcTest::i_isolate());
for (int i = 0; i < transitions_count; i++) {
EmbeddedVector<char, 64> buffer;
- OS::SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i);
+ SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i);
CompileRun(buffer.start());
}
}
LocalContext context;
HandleScope scope(heap->isolate());
EmbeddedVector<char, 256> source;
- OS::SNPrintF(source,
- "function bar%d() {"
- " return foo%d(1);"
- "};"
- "function foo%d(x) { with (x) { return 1 + x; } };"
- "bar%d();"
- "bar%d();"
- "bar%d();"
- "%OptimizeFunctionOnNextCall(bar%d);"
- "bar%d();", i, i, i, i, i, i, i, i);
+ SNPrintF(source,
+ "function bar%d() {"
+ " return foo%d(1);"
+ "};"
+ "function foo%d(x) { with (x) { return 1 + x; } };"
+ "bar%d();"
+ "bar%d();"
+ "bar%d();"
+ "%%OptimizeFunctionOnNextCall(bar%d);"
+ "bar%d();", i, i, i, i, i, i, i, i);
CompileRun(source.start());
}
heap->CollectAllGarbage(i::Heap::kNoGCFlags);
static Handle<JSFunction> OptimizeDummyFunction(const char* name) {
EmbeddedVector<char, 256> source;
- OS::SNPrintF(source,
- "function %s() { return 0; }"
- "%s(); %s();"
- "%%OptimizeFunctionOnNextCall(%s);"
- "%s();", name, name, name, name, name);
+ SNPrintF(source,
+ "function %s() { return 0; }"
+ "%s(); %s();"
+ "%%OptimizeFunctionOnNextCall(%s);"
+ "%s();", name, name, name, name, name);
CompileRun(source.start());
Handle<JSFunction> fun =
v8::Utils::OpenHandle(
const char* func_name,
const char* trace_func_name) {
i::EmbeddedVector<char, 256> trace_call_buf;
- i::OS::SNPrintF(trace_call_buf,
- "function %s() {"
- " fp = new FPGrabber();"
- " %s(fp.low_bits, fp.high_bits);"
- "}",
- func_name, trace_func_name);
+ i::SNPrintF(trace_call_buf,
+ "function %s() {"
+ " fp = new FPGrabber();"
+ " %s(fp.low_bits, fp.high_bits);"
+ "}",
+ func_name, trace_func_name);
// Create the FPGrabber function, which grabs the caller's frame pointer
// when called as a constructor.
static const char* StrNStr(const char* s1, const char* s2, int n) {
if (s1[n] == '\0') return strstr(s1, s2);
i::ScopedVector<char> str(n + 1);
- i::OS::StrNCpy(str, s1, static_cast<size_t>(n));
+ i::StrNCpy(str, s1, static_cast<size_t>(n));
str[n] = '\0';
char* found = strstr(str.start(), s2);
return found != NULL ? s1 + (found - str.start()) : NULL;
CHECK(exists);
i::EmbeddedVector<char, 100> ref_data;
- i::OS::SNPrintF(ref_data,
- "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"\0",
- ObjMethod1);
+ i::SNPrintF(ref_data,
+ "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"",
+ reinterpret_cast<intptr_t>(ObjMethod1));
CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
CHECK(exists);
EmbeddedVector<char, 100> prop1_getter_record;
- i::OS::SNPrintF(prop1_getter_record,
- "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"",
- Prop1Getter);
+ i::SNPrintF(prop1_getter_record,
+ "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"",
+ reinterpret_cast<intptr_t>(Prop1Getter));
CHECK_NE(NULL,
StrNStr(log.start(), prop1_getter_record.start(), log.length()));
EmbeddedVector<char, 100> prop1_setter_record;
- i::OS::SNPrintF(prop1_setter_record,
- "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"",
- Prop1Setter);
+ i::SNPrintF(prop1_setter_record,
+ "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"",
+ reinterpret_cast<intptr_t>(Prop1Setter));
CHECK_NE(NULL,
StrNStr(log.start(), prop1_setter_record.start(), log.length()));
EmbeddedVector<char, 100> prop2_getter_record;
- i::OS::SNPrintF(prop2_getter_record,
- "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"",
- Prop2Getter);
+ i::SNPrintF(prop2_getter_record,
+ "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"",
+ reinterpret_cast<intptr_t>(Prop2Getter));
CHECK_NE(NULL,
StrNStr(log.start(), prop2_getter_record.start(), log.length()));
log.Dispose();
" a = new f();"
"}"
"a;";
- i::OS::SNPrintF(test_buf, program, call_count);
+ i::SNPrintF(test_buf, program, call_count);
v8::Local<v8::Value> res = CompileRun(test_buf.start());
Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
int kProgramByteSize = kPrefixByteLen + kInnerByteLen + kSuffixByteLen;
i::ScopedVector<char> program(kProgramByteSize + 1);
- i::OS::SNPrintF(program, "%s%s%s",
- source_data[i].outer_prefix,
- source_data[i].inner_source,
- source_data[i].outer_suffix);
+ i::SNPrintF(program, "%s%s%s",
+ source_data[i].outer_prefix,
+ source_data[i].inner_source,
+ source_data[i].outer_suffix);
// Parse program source.
i::Handle<i::String> source = factory->NewStringFromUtf8(
// Plug the source code pieces together.
i::ScopedVector<char> program(kProgramSize + 1);
- int length = i::OS::SNPrintF(program,
+ int length = i::SNPrintF(program,
"label: for (;;) { %s%s%s%s }",
context_data[i][0],
statement_data[j],
// Plug the source code pieces together.
i::ScopedVector<char> program(kProgramSize + 1);
- int length = i::OS::SNPrintF(program,
- "%s%s%s",
- context_data[i][0],
- statement_data[j],
- context_data[i][1]);
+ int length = i::SNPrintF(program,
+ "%s%s%s",
+ context_data[i][0],
+ statement_data[j],
+ context_data[i][1]);
CHECK(length == kProgramSize);
TestParserSync(program.start(),
flags,
CpuProfilesCollection::kMaxSimultaneousProfiles> titles;
for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) {
i::Vector<char> title = i::Vector<char>::New(16);
- i::OS::SNPrintF(title, "%d", i);
+ i::SNPrintF(title, "%d", i);
CHECK(collection.StartProfiling(title.start(), false));
titles[i] = title.start();
}
int property_cell_space_used) {
int file_name_length = StrLength(file_name_) + 10;
Vector<char> name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(name, "%s.size", file_name_);
+ SNPrintF(name, "%s.size", file_name_);
FILE* fp = OS::FOpen(name.start(), "w");
name.Dispose();
fprintf(fp, "new %d\n", new_space_used);
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
+ SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
{
v8::HandleScope handle_scope(v8_isolate);
const char* file_name) {
int file_name_length = StrLength(file_name) + 10;
Vector<char> name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(name, "%s.size", file_name);
+ SNPrintF(name, "%s.size", file_name);
FILE* fp = OS::FOpen(name.start(), "r");
name.Dispose();
int new_size, pointer_size, data_size, code_size, map_size, cell_size,
if (!Snapshot::IsEnabled()) {
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
+ SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
CHECK(Snapshot::Initialize(startup_name.start()));
startup_name.Dispose();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
+ SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
{
v8::HandleScope handle_scope(v8_isolate);
if (!Snapshot::HaveASnapshotToStartFrom()) {
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
- OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
+ SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
CHECK(Snapshot::Initialize(startup_name.start()));
startup_name.Dispose();
static const char kMarker = static_cast<char>(42);
Vector<char> buffer = Vector<char>::New(i + 1);
buffer[i] = kMarker;
- int n = OS::SNPrintF(Vector<char>(buffer.start(), i), "%s", s);
+ int n = SNPrintF(Vector<char>(buffer.start(), i), "%s", s);
CHECK(n <= i);
CHECK(n == length || n == -1);
CHECK_EQ(0, strncmp(buffer.start(), s, i - 1));
}
i::ScopedVector<char> source(1024);
- i::OS::SNPrintF(source, "ab%d = null;", i);
+ i::SNPrintF(source, "ab%d = null;", i);
CompileRun(source.start());
isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
v8::HandleScope s2(context->GetIsolate());
for (int j = 1; j <= 3; j++) {
if (j == i) continue;
- i::OS::SNPrintF(source, "ab%d", j);
+ i::SNPrintF(source, "ab%d", j);
v8::Handle<v8::ArrayBuffer> ab =
v8::Handle<v8::ArrayBuffer>::Cast(CompileRun(source.start()));
CHECK(HasArrayBufferInWeakList(isolate->heap(),
{
v8::HandleScope s1(context->GetIsolate());
- i::OS::SNPrintF(source,
- "var ta1 = new %s(ab);"
- "var ta2 = new %s(ab);"
- "var ta3 = new %s(ab)",
- constructor, constructor, constructor);
+ i::SNPrintF(source,
+ "var ta1 = new %s(ab);"
+ "var ta2 = new %s(ab);"
+ "var ta3 = new %s(ab)",
+ constructor, constructor, constructor);
CompileRun(source.start());
v8::Handle<v8::ArrayBuffer> ab =
CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta3)));
}
- i::OS::SNPrintF(source, "ta%d = null;", i);
+ i::SNPrintF(source, "ta%d = null;", i);
CompileRun(source.start());
isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
CHECK_EQ(2, CountViews(*iab));
for (int j = 1; j <= 3; j++) {
if (j == i) continue;
- i::OS::SNPrintF(source, "ta%d", j);
+ i::SNPrintF(source, "ta%d", j);
v8::Handle<TypedArray> ta =
v8::Handle<TypedArray>::Cast(CompileRun(source.start()));
CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta)));