Remove dependency on Vector from platform files

Add wrappers to utils.h instead.

BUG=none
R=jkummerow@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/328343003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21846 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-06-13 16:43:27 +00:00
parent 27d7656b39
commit 9c2019b25c
43 changed files with 453 additions and 480 deletions

View File

@ -207,15 +207,15 @@ void Decoder::PrintShiftRm(Instruction* instr) {
} 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);
}
}
@ -227,8 +227,7 @@ void Decoder::PrintShiftImm(Instruction* instr) {
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);
}
@ -236,10 +235,10 @@ void Decoder::PrintShiftImm(Instruction* instr) {
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));
}
}
@ -283,14 +282,14 @@ void Decoder::PrintSoftwareInterrupt(SoftwareInterruptCodes svc) {
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;
}
@ -399,35 +398,35 @@ int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) {
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);
}
}
@ -437,8 +436,7 @@ void Decoder::PrintMovwMovt(Instruction* instr) {
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);
}
@ -470,8 +468,7 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
}
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.
@ -484,8 +481,8 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
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
@ -505,9 +502,9 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
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
@ -544,31 +541,30 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
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
@ -619,11 +615,11 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
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
@ -1184,14 +1180,14 @@ int Decoder::DecodeType7(Instruction* instr) {
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 {
@ -1251,8 +1247,8 @@ void Decoder::DecodeTypeVFP(Instruction* instr) {
// 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);
@ -1547,8 +1543,8 @@ void Decoder::DecodeSpecialCondition(Instruction* 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);
}
@ -1561,8 +1557,8 @@ void Decoder::DecodeSpecialCondition(Instruction* 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);
}
@ -1576,8 +1572,8 @@ void Decoder::DecodeSpecialCondition(Instruction* 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);
@ -1589,8 +1585,8 @@ void Decoder::DecodeSpecialCondition(Instruction* 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_,
"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);
@ -1604,14 +1600,14 @@ void Decoder::DecodeSpecialCondition(Instruction* instr) {
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);
@ -1645,26 +1641,26 @@ int Decoder::ConstantPoolSizeAt(byte* instr_ptr) {
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()) {
@ -1716,7 +1712,7 @@ 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();
}

View File

@ -1734,7 +1734,7 @@ 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();
}
@ -1752,7 +1752,7 @@ const char* NameConverter::NameOfCPURegister(int reg) const {
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();
}
@ -1786,7 +1786,7 @@ class BufferDisassembler : public v8::internal::Disassembler {
~BufferDisassembler() { }
virtual void ProcessOutput(v8::internal::Instruction* instr) {
v8::internal::OS::SNPrintF(out_buffer_, "%s", GetOutput());
v8::internal::SNPrintF(out_buffer_, "%s", GetOutput());
}
private:

View File

@ -1140,7 +1140,7 @@ Handle<String> Literal::ToString() {
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);

View File

@ -50,7 +50,7 @@ class V8NameConverter: public disasm::NameConverter {
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();
}
@ -58,7 +58,7 @@ const char* V8NameConverter::NameOfAddress(byte* pc) const {
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();
}
}
@ -114,27 +114,27 @@ static int DecodeIt(Isolate* isolate,
// 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';

View File

@ -22,8 +22,8 @@ class GCExtension : public v8::Extension {
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;
}

View File

@ -1097,7 +1097,7 @@ Handle<String> Factory::EmergencyNewError(const char* message,
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;
@ -1110,7 +1110,7 @@ Handle<String> Factory::EmergencyNewError(const char* message,
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;
}

View File

@ -1857,12 +1857,12 @@ static void RegisterCodeEntry(JITCodeEntry* entry,
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

View File

@ -112,7 +112,7 @@ void HeapEntry::Print(
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 = "$";
@ -123,7 +123,7 @@ void HeapEntry::Print(
break;
case HeapGraphEdge::kHidden:
edge_prefix = "$";
OS::SNPrintF(index, "%d", edge.index());
SNPrintF(index, "%d", edge.index());
break;
case HeapGraphEdge::kShortcut:
edge_prefix = "^";
@ -134,7 +134,7 @@ void HeapEntry::Print(
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);
}
@ -2713,14 +2713,14 @@ class OutputStreamWriter {
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());

View File

@ -2808,12 +2808,12 @@ class HTracer V8_FINAL : public Malloced {
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);
}

View File

@ -357,7 +357,7 @@ void DisassemblerIA32::AppendToBuffer(const char* format, ...) {
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;
}
@ -1645,18 +1645,17 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
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)
@ -1680,7 +1679,7 @@ static const char* xmm_regs[8] = {
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();
}

View File

@ -1440,12 +1440,12 @@ class CodeTracer V8_FINAL : public Malloced {
}
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);

View File

@ -112,7 +112,7 @@ void Log::MessageBuilder::Append(const char* format, ...) {
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) {
@ -211,7 +211,7 @@ void Log::MessageBuilder::AppendStringPart(const char* str, int len) {
}
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);
}

View File

@ -122,7 +122,7 @@ class CodeEventLogger::NameBuffer {
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;
}
@ -131,7 +131,7 @@ class CodeEventLogger::NameBuffer {
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;
}
@ -259,7 +259,7 @@ PerfBasicLogger::PerfBasicLogger()
// 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());
@ -383,7 +383,7 @@ PerfJitLogger::PerfJitLogger()
// 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());

View File

@ -184,21 +184,21 @@ void Decoder::PrintFd(Instruction* instr) {
// 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);
}
@ -207,49 +207,49 @@ void Decoder::PrintSs2(Instruction* instr) {
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);
}
@ -260,8 +260,8 @@ void Decoder::PrintCode(Instruction* instr) {
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:
@ -272,7 +272,7 @@ void Decoder::PrintCode(Instruction* instr) {
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.
@ -931,9 +931,9 @@ void Decoder::DecodeTypeJump(Instruction* 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());
switch (instr->InstructionType()) {
case Instruction::kRegisterType: {
DecodeTypeRegister(instr);
@ -965,7 +965,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) {
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();
}

View File

@ -1733,7 +1733,7 @@ void HeapNumber::HeapNumberPrint(StringStream* accumulator) {
// 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());
}

View File

@ -422,23 +422,24 @@ void OS::VPrintError(const char* format, va_list 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,
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;
@ -455,8 +456,8 @@ char* OS::StrChr(char* str, int c) {
}
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);
}

View File

@ -140,44 +140,6 @@ void OS::SignalCodeMovingGC() {
}
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;

View File

@ -151,12 +151,12 @@ class TimezoneCache {
// 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));
}
@ -551,9 +551,9 @@ static void VPrintHelper(FILE* stream, const char* format, va_list args) {
// 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);
}
@ -638,22 +638,22 @@ void OS::VPrintError(const char* format, va_list 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;
@ -666,12 +666,12 @@ char* OS::StrChr(char* str, int c) {
}
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));
}
@ -1342,7 +1342,7 @@ Thread::Thread(const Options& options)
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';
}

View File

@ -28,7 +28,6 @@
#include "src/base/build_config.h"
#include "src/platform/mutex.h"
#include "src/platform/semaphore.h"
#include "src/vector.h"
#ifdef __sun
# ifndef signbit
@ -91,6 +90,7 @@ inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
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 +
@ -247,13 +247,14 @@ class OS {
// 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.
@ -408,13 +409,7 @@ class VirtualMemory {
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:

View File

@ -493,9 +493,9 @@ void PrettyPrinter::Print(const char* format, ...) {
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) {
@ -674,9 +674,9 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info,
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);
}
}
@ -1039,21 +1039,21 @@ void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
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());
@ -1120,8 +1120,8 @@ void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
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());
}

View File

@ -43,7 +43,7 @@ const char* StringsStorage::GetCopy(const char* src) {
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;
@ -76,7 +76,7 @@ const char* StringsStorage::AddOrDisposeString(char* str, int len) {
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);

View File

@ -19,7 +19,7 @@ static void ReserveSpaceForSnapshot(Deserializer* deserializer,
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,

View File

@ -129,21 +129,21 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) {
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;
}

View File

@ -102,6 +102,25 @@ void PrintPID(const char* format, ...) {
}
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);
}
@ -305,7 +324,7 @@ void StringBuilder::AddFormatted(const char* format, ...) {
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 {

View File

@ -1164,6 +1164,13 @@ void FPRINTF_CHECKING PrintF(FILE* out, const char* format, ...);
// 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);

View File

@ -61,13 +61,13 @@ void Version::GetString(Vector<char> str) {
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);
}
}
@ -78,15 +78,15 @@ void Version::GetSONAME(Vector<char> str) {
// 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_);
}
}

View File

@ -430,7 +430,7 @@ void DisassemblerX64::AppendToBuffer(const char* format, ...) {
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;
}
@ -1793,14 +1793,14 @@ int DisassemblerX64::InstructionDecode(v8::internal::Vector<char> out_buffer,
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;
}
@ -1827,7 +1827,7 @@ static const char* xmm_regs[16] = {
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();
}

View File

@ -357,7 +357,7 @@ void DisassemblerX87::AppendToBuffer(const char* format, ...) {
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;
}
@ -1645,18 +1645,13 @@ int DisassemblerX87::InstructionDecode(v8::internal::Vector<char> out_buffer,
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)
@ -1680,7 +1675,7 @@ static const char* xmm_regs[8] = {
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();
}

View File

@ -186,11 +186,11 @@ THREADED_TEST(IsolateOfContext) {
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();
@ -263,7 +263,7 @@ THREADED_TEST(ReceiverSignature) {
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);
@ -3081,7 +3081,7 @@ static void CheckIsNeutered(v8::Handle<v8::TypedArray> ta) {
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());
@ -6730,7 +6730,7 @@ TEST(ExtensionWithSourceLength) {
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));
@ -10308,7 +10308,7 @@ THREADED_TEST(Regress91517) {
// 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));
}
@ -16316,15 +16316,15 @@ static void ObjectWithExternalArrayTestHelper(
" }"
"}"
"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());
@ -16344,28 +16344,28 @@ static void ObjectWithExternalArrayTestHelper(
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());
@ -16447,20 +16447,20 @@ static void ObjectWithExternalArrayTestHelper(
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());
}
@ -17541,9 +17541,9 @@ TEST(SourceURLInStackTrace) {
"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());
}
@ -17624,9 +17624,9 @@ TEST(InlineScriptWithSourceURLInStackTrace) {
"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());
}
@ -17670,9 +17670,9 @@ TEST(DynamicWithSourceURLInStackTrace) {
"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());
}
@ -17691,7 +17691,7 @@ TEST(DynamicWithSourceURLInStackTraceString) {
"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());
@ -19429,11 +19429,11 @@ static int CalcFibonacci(v8::Isolate* isolate, int limit) {
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());
@ -20640,7 +20640,7 @@ void RecursiveCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
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);
@ -21706,7 +21706,7 @@ void CheckCorrectThrow(const char* script) {
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);
@ -22420,14 +22420,14 @@ class ApiCallOptimizationChecker {
// 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"
@ -22436,7 +22436,7 @@ class ApiCallOptimizationChecker {
}
// 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"

View File

@ -75,7 +75,7 @@ static Handle<JSFunction> Compile(const char* source) {
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;
@ -422,7 +422,7 @@ static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) {
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) {

View File

@ -105,9 +105,9 @@ i::Code* CreateCode(LocalContext* env) {
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"
@ -470,8 +470,8 @@ static const v8::CpuProfileNode* GetChild(v8::Isolate* isolate,
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;

View File

@ -182,9 +182,9 @@ static int SetBreakPointFromJS(v8::Isolate* isolate,
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();
@ -197,14 +197,14 @@ static int SetScriptBreakPointByIdFromJS(v8::Isolate* isolate, int script_id,
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';
{
@ -226,14 +226,14 @@ static int SetScriptBreakPointByNameFromJS(v8::Isolate* isolate,
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';
{
@ -260,9 +260,9 @@ static void ClearBreakPoint(int break_point) {
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();
}
@ -271,9 +271,9 @@ static void ClearBreakPointFromJS(v8::Isolate* isolate,
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();
}
@ -282,9 +282,9 @@ static void EnableScriptBreakPointFromJS(v8::Isolate* isolate,
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();
}
@ -294,9 +294,9 @@ static void ChangeScriptBreakPointConditionFromJS(v8::Isolate* isolate,
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();
}
@ -306,9 +306,9 @@ static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate,
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();
}
@ -2624,7 +2624,7 @@ bool GetEvaluateStringResult(char *message, char* buffer, int buffer_size) {
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;
}
@ -4368,15 +4368,15 @@ TEST(InterceptorPropertyMirror) {
// 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());
}
@ -4387,8 +4387,8 @@ TEST(InterceptorPropertyMirror) {
// 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());
}
@ -4399,7 +4399,7 @@ TEST(InterceptorPropertyMirror) {
// 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());
}
@ -7150,9 +7150,9 @@ static void TestDebugBreakInLoop(const char* loop_head,
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());
@ -7231,7 +7231,7 @@ static void DebugBreakInlineListener(
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();
@ -7240,7 +7240,7 @@ static void DebugBreakInlineListener(
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()));

View File

@ -397,9 +397,9 @@ static void CompileConstructorWithDeoptimizingValueOf() {
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;

View File

@ -2104,7 +2104,7 @@ TEST(ManyLocalsInSharedContext) {
// ... 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);
@ -2199,7 +2199,7 @@ static const v8::HeapGraphNode* GetNodeByPath(const v8::HeapSnapshot* snapshot,
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;

View File

@ -2208,7 +2208,7 @@ TEST(OptimizedPretenuringAllocationFolding) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array();"
@ -2257,7 +2257,7 @@ TEST(OptimizedPretenuringObjectArrayLiterals) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2298,7 +2298,7 @@ TEST(OptimizedPretenuringMixedInObjectProperties) {
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2348,7 +2348,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2388,7 +2388,7 @@ TEST(OptimizedPretenuringdoubleArrayLiterals) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2428,7 +2428,7 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = 100;"
"var elements = new Array(number_elements);"
@ -2441,8 +2441,7 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
"f(); gc();"
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
"f();",
AllocationSite::kPretenureMinimumCreated);
"f();");
v8::Local<v8::Value> res = CompileRun(source.start());
@ -2477,7 +2476,7 @@ TEST(OptimizedPretenuringNestedObjectLiterals) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2526,7 +2525,7 @@ TEST(OptimizedPretenuringNestedDoubleLiterals) {
}
i::ScopedVector<char> source(1024);
i::OS::SNPrintF(
i::SNPrintF(
source,
"var number_elements = %d;"
"var elements = new Array(number_elements);"
@ -2586,7 +2585,7 @@ TEST(OptimizedPretenuringConstructorCalls) {
// 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);"
@ -2637,7 +2636,7 @@ TEST(OptimizedPretenuringCallNew) {
// 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);"
@ -2710,7 +2709,7 @@ TEST(Regress1465) {
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;");
@ -2742,7 +2741,7 @@ static void AddTransitions(int transitions_count) {
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());
}
}
@ -3981,16 +3980,16 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) {
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);
@ -4006,11 +4005,11 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) {
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(

View File

@ -119,12 +119,12 @@ static void CreateTraceCallerFunction(v8::Local<v8::Context> context,
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.

View File

@ -113,7 +113,7 @@ class ScopedLoggerInitializer {
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;
@ -359,9 +359,9 @@ TEST(LogCallbacks) {
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();
@ -403,23 +403,23 @@ TEST(LogAccessorCallbacks) {
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();

View File

@ -102,7 +102,7 @@ TEST(PretenuringCallNew) {
" 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));

View File

@ -1108,10 +1108,10 @@ TEST(ScopePositions) {
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(
@ -1410,7 +1410,7 @@ TEST(ParserSync) {
// 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],
@ -1487,11 +1487,11 @@ void RunParserSyncTest(const char* context_data[][2],
// 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,

View File

@ -602,7 +602,7 @@ TEST(Issue51919) {
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();
}

View File

@ -210,7 +210,7 @@ void FileByteSink::WriteSpaceUsed(
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);
@ -404,7 +404,7 @@ TEST(PartialSerialization) {
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);
@ -447,7 +447,7 @@ static void ReserveSpaceForSnapshot(Deserializer* deserializer,
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,
@ -482,7 +482,7 @@ DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
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();
@ -548,7 +548,7 @@ TEST(ContextSerialization) {
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);
@ -594,7 +594,7 @@ DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
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();

View File

@ -83,7 +83,7 @@ TEST(SNPrintF) {
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));

View File

@ -155,7 +155,7 @@ TEST(WeakArrayBuffersFromScript) {
}
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);
@ -165,7 +165,7 @@ TEST(WeakArrayBuffersFromScript) {
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(),
@ -282,11 +282,11 @@ static void TestTypedArrayFromScript(const char* constructor) {
{
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 =
@ -305,7 +305,7 @@ static void TestTypedArrayFromScript(const char* constructor) {
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);
@ -319,7 +319,7 @@ static void TestTypedArrayFromScript(const char* constructor) {
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)));