Commit 2f1df8a3 authored by clemensh's avatar clemensh Committed by Commit bot

Refactoring to use ArrayVector where applicable

It's more readable than the construction
Vector<T>(buffer, arraysize(buffer)).
All those places are now replaced by ArrayVector(buffer).

R=titzer@chromium.org, jarin@chromium.org, rossberg@chromium.org

Review-Url: https://codereview.chromium.org/1916393002
Cr-Commit-Position: refs/heads/master@{#35843}
parent cd3a5ee9
...@@ -3113,8 +3113,7 @@ BUILTIN(DateConstructor) { ...@@ -3113,8 +3113,7 @@ BUILTIN(DateConstructor) {
HandleScope scope(isolate); HandleScope scope(isolate);
double const time_val = JSDate::CurrentTimeValue(isolate); double const time_val = JSDate::CurrentTimeValue(isolate);
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer)); ToDateString(time_val, ArrayVector(buffer), isolate->date_cache());
ToDateString(time_val, str, isolate->date_cache());
Handle<String> result; Handle<String> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate, result,
...@@ -3697,8 +3696,8 @@ BUILTIN(DatePrototypeToDateString) { ...@@ -3697,8 +3696,8 @@ BUILTIN(DatePrototypeToDateString) {
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSDate, date, "Date.prototype.toDateString"); CHECK_RECEIVER(JSDate, date, "Date.prototype.toDateString");
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer)); ToDateString(date->value()->Number(), ArrayVector(buffer),
ToDateString(date->value()->Number(), str, isolate->date_cache(), kDateOnly); isolate->date_cache(), kDateOnly);
Handle<String> result; Handle<String> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate, result,
...@@ -3721,18 +3720,17 @@ BUILTIN(DatePrototypeToISOString) { ...@@ -3721,18 +3720,17 @@ BUILTIN(DatePrototypeToISOString) {
isolate->date_cache()->BreakDownTime(time_ms, &year, &month, &day, &weekday, isolate->date_cache()->BreakDownTime(time_ms, &year, &month, &day, &weekday,
&hour, &min, &sec, &ms); &hour, &min, &sec, &ms);
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
if (year >= 0 && year <= 9999) { if (year >= 0 && year <= 9999) {
SNPrintF(str, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", year, month + 1, day, SNPrintF(ArrayVector(buffer), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", year,
hour, min, sec, ms); month + 1, day, hour, min, sec, ms);
} else if (year < 0) { } else if (year < 0) {
SNPrintF(str, "-%06d-%02d-%02dT%02d:%02d:%02d.%03dZ", -year, month + 1, day, SNPrintF(ArrayVector(buffer), "-%06d-%02d-%02dT%02d:%02d:%02d.%03dZ", -year,
hour, min, sec, ms); month + 1, day, hour, min, sec, ms);
} else { } else {
SNPrintF(str, "+%06d-%02d-%02dT%02d:%02d:%02d.%03dZ", year, month + 1, day, SNPrintF(ArrayVector(buffer), "+%06d-%02d-%02dT%02d:%02d:%02d.%03dZ", year,
hour, min, sec, ms); month + 1, day, hour, min, sec, ms);
} }
return *isolate->factory()->NewStringFromAsciiChecked(str.start()); return *isolate->factory()->NewStringFromAsciiChecked(buffer);
} }
...@@ -3741,8 +3739,8 @@ BUILTIN(DatePrototypeToString) { ...@@ -3741,8 +3739,8 @@ BUILTIN(DatePrototypeToString) {
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSDate, date, "Date.prototype.toString"); CHECK_RECEIVER(JSDate, date, "Date.prototype.toString");
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer)); ToDateString(date->value()->Number(), ArrayVector(buffer),
ToDateString(date->value()->Number(), str, isolate->date_cache()); isolate->date_cache());
Handle<String> result; Handle<String> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate, result,
...@@ -3756,8 +3754,8 @@ BUILTIN(DatePrototypeToTimeString) { ...@@ -3756,8 +3754,8 @@ BUILTIN(DatePrototypeToTimeString) {
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSDate, date, "Date.prototype.toTimeString"); CHECK_RECEIVER(JSDate, date, "Date.prototype.toTimeString");
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer)); ToDateString(date->value()->Number(), ArrayVector(buffer),
ToDateString(date->value()->Number(), str, isolate->date_cache(), kTimeOnly); isolate->date_cache(), kTimeOnly);
Handle<String> result; Handle<String> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate, result,
...@@ -3775,14 +3773,14 @@ BUILTIN(DatePrototypeToUTCString) { ...@@ -3775,14 +3773,14 @@ BUILTIN(DatePrototypeToUTCString) {
return *isolate->factory()->NewStringFromAsciiChecked("Invalid Date"); return *isolate->factory()->NewStringFromAsciiChecked("Invalid Date");
} }
char buffer[128]; char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
int64_t time_ms = static_cast<int64_t>(time_val); int64_t time_ms = static_cast<int64_t>(time_val);
int year, month, day, weekday, hour, min, sec, ms; int year, month, day, weekday, hour, min, sec, ms;
isolate->date_cache()->BreakDownTime(time_ms, &year, &month, &day, &weekday, isolate->date_cache()->BreakDownTime(time_ms, &year, &month, &day, &weekday,
&hour, &min, &sec, &ms); &hour, &min, &sec, &ms);
SNPrintF(str, "%s, %02d %s %4d %02d:%02d:%02d GMT", kShortWeekDays[weekday], SNPrintF(ArrayVector(buffer), "%s, %02d %s %4d %02d:%02d:%02d GMT",
day, kShortMonths[month], year, hour, min, sec); kShortWeekDays[weekday], day, kShortMonths[month], year, hour, min,
return *isolate->factory()->NewStringFromAsciiChecked(str.start()); sec);
return *isolate->factory()->NewStringFromAsciiChecked(buffer);
} }
......
...@@ -1637,9 +1637,9 @@ HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) { ...@@ -1637,9 +1637,9 @@ HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) {
// Convert the primitive to a string value. // Convert the primitive to a string value.
ToStringStub stub(isolate()); ToStringStub stub(isolate());
HValue* values[] = {context(), Pop()}; HValue* values[] = {context(), Pop()};
Push(AddUncasted<HCallWithDescriptor>( Push(AddUncasted<HCallWithDescriptor>(Add<HConstant>(stub.GetCode()), 0,
Add<HConstant>(stub.GetCode()), 0, stub.GetCallInterfaceDescriptor(), stub.GetCallInterfaceDescriptor(),
Vector<HValue*>(values, arraysize(values)))); ArrayVector(values)));
} }
if_inputisstring.End(); if_inputisstring.End();
} }
......
...@@ -2227,9 +2227,8 @@ HValue* HGraphBuilder::BuildToNumber(HValue* input) { ...@@ -2227,9 +2227,8 @@ HValue* HGraphBuilder::BuildToNumber(HValue* input) {
Callable callable = CodeFactory::ToNumber(isolate()); Callable callable = CodeFactory::ToNumber(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input}; HValue* values[] = {context(), input};
HCallWithDescriptor* instr = HCallWithDescriptor* instr = Add<HCallWithDescriptor>(
Add<HCallWithDescriptor>(stub, 0, callable.descriptor(), stub, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
instr->set_type(HType::TaggedNumber()); instr->set_type(HType::TaggedNumber());
return instr; return instr;
} }
...@@ -5670,8 +5669,8 @@ void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { ...@@ -5670,8 +5669,8 @@ void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
FastNewClosureDescriptor descriptor(isolate()); FastNewClosureDescriptor descriptor(isolate());
HValue* values[] = {context(), shared_info_value}; HValue* values[] = {context(), shared_info_value};
HConstant* stub_value = Add<HConstant>(stub.GetCode()); HConstant* stub_value = Add<HConstant>(stub.GetCode());
instr = New<HCallWithDescriptor>( instr = New<HCallWithDescriptor>(stub_value, 0, descriptor,
stub_value, 0, descriptor, Vector<HValue*>(values, arraysize(values))); ArrayVector(values));
} else { } else {
Add<HPushArguments>(shared_info_value); Add<HPushArguments>(shared_info_value);
Runtime::FunctionId function_id = Runtime::FunctionId function_id =
...@@ -5949,9 +5948,8 @@ void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { ...@@ -5949,9 +5948,8 @@ void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
context(), AddThisFunction(), Add<HConstant>(expr->literal_index()), context(), AddThisFunction(), Add<HConstant>(expr->literal_index()),
Add<HConstant>(expr->pattern()), Add<HConstant>(expr->flags())}; Add<HConstant>(expr->pattern()), Add<HConstant>(expr->flags())};
HConstant* stub_value = Add<HConstant>(callable.code()); HConstant* stub_value = Add<HConstant>(callable.code());
HInstruction* instr = HInstruction* instr = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub_value, 0, callable.descriptor(), stub_value, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
return ast_context()->ReturnInstruction(instr, expr->id()); return ast_context()->ReturnInstruction(instr, expr->id());
} }
...@@ -8173,7 +8171,7 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunction( ...@@ -8173,7 +8171,7 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunction(
HConstant* stub = Add<HConstant>(callable.code()); HConstant* stub = Add<HConstant>(callable.code());
return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(), return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(),
Vector<HValue*>(op_vals, arraysize(op_vals)), ArrayVector(op_vals),
syntactic_tail_call_mode); syntactic_tail_call_mode);
} }
...@@ -8198,7 +8196,7 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunctionViaIC( ...@@ -8198,7 +8196,7 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunctionViaIC(
HConstant* stub = Add<HConstant>(callable.code()); HConstant* stub = Add<HConstant>(callable.code());
return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(), return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(),
Vector<HValue*>(op_vals, arraysize(op_vals)), ArrayVector(op_vals),
syntactic_tail_call_mode); syntactic_tail_call_mode);
} }
...@@ -10237,9 +10235,8 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { ...@@ -10237,9 +10235,8 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
Callable callable = CodeFactory::Construct(isolate()); Callable callable = CodeFactory::Construct(isolate());
HConstant* stub = Add<HConstant>(callable.code()); HConstant* stub = Add<HConstant>(callable.code());
PushArgumentsFromEnvironment(argument_count); PushArgumentsFromEnvironment(argument_count);
HInstruction* construct = HInstruction* construct = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(), stub, argument_count, callable.descriptor(), ArrayVector(op_vals));
Vector<HValue*>(op_vals, arraysize(op_vals)));
return ast_context()->ReturnInstruction(construct, expr->id()); return ast_context()->ReturnInstruction(construct, expr->id());
} }
...@@ -11306,13 +11303,12 @@ HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left, ...@@ -11306,13 +11303,12 @@ HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left,
// operation in optimized code, which is more expensive, than a stub call. // operation in optimized code, which is more expensive, than a stub call.
if (graph()->info()->IsStub() && is_non_primitive) { if (graph()->info()->IsStub() && is_non_primitive) {
HValue* values[] = {context(), left, right}; HValue* values[] = {context(), left, right};
#define GET_STUB(Name) \ #define GET_STUB(Name) \
do { \ do { \
Callable callable = CodeFactory::Name(isolate()); \ Callable callable = CodeFactory::Name(isolate()); \
HValue* stub = Add<HConstant>(callable.code()); \ HValue* stub = Add<HConstant>(callable.code()); \
instr = AddUncasted<HCallWithDescriptor>( \ instr = AddUncasted<HCallWithDescriptor>(stub, 0, callable.descriptor(), \
stub, 0, callable.descriptor(), \ ArrayVector(values)); \
Vector<HValue*>(values, arraysize(values))); \
} while (false) } while (false)
switch (op) { switch (op) {
...@@ -12445,9 +12441,8 @@ void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) { ...@@ -12445,9 +12441,8 @@ void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) {
Callable callable = CodeFactory::ToInteger(isolate()); Callable callable = CodeFactory::ToInteger(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input}; HValue* values[] = {context(), input};
HInstruction* result = HInstruction* result = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub, 0, callable.descriptor(), stub, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
} }
...@@ -12469,9 +12464,8 @@ void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) { ...@@ -12469,9 +12464,8 @@ void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) {
Callable callable = CodeFactory::ToName(isolate()); Callable callable = CodeFactory::ToName(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input}; HValue* values[] = {context(), input};
HInstruction* result = HInstruction* result = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub, 0, callable.descriptor(), stub, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
} }
...@@ -12496,9 +12490,8 @@ void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { ...@@ -12496,9 +12490,8 @@ void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) {
Callable callable = CodeFactory::ToString(isolate()); Callable callable = CodeFactory::ToString(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input}; HValue* values[] = {context(), input};
HInstruction* result = HInstruction* result = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub, 0, callable.descriptor(), stub, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
} }
...@@ -12511,9 +12504,8 @@ void HOptimizedGraphBuilder::GenerateToLength(CallRuntime* call) { ...@@ -12511,9 +12504,8 @@ void HOptimizedGraphBuilder::GenerateToLength(CallRuntime* call) {
HValue* input = Pop(); HValue* input = Pop();
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input}; HValue* values[] = {context(), input};
HInstruction* result = HInstruction* result = New<HCallWithDescriptor>(
New<HCallWithDescriptor>(stub, 0, callable.descriptor(), stub, 0, callable.descriptor(), ArrayVector(values));
Vector<HValue*>(values, arraysize(values)));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12686,9 +12678,9 @@ void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { ...@@ -12686,9 +12678,9 @@ void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) {
Callable callable = CodeFactory::SubString(isolate()); Callable callable = CodeFactory::SubString(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context()}; HValue* values[] = {context()};
HInstruction* result = New<HCallWithDescriptor>( HInstruction* result =
stub, call->arguments()->length(), callable.descriptor(), New<HCallWithDescriptor>(stub, call->arguments()->length(),
Vector<HValue*>(values, arraysize(values))); callable.descriptor(), ArrayVector(values));
result->set_type(HType::String()); result->set_type(HType::String());
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12701,8 +12693,8 @@ void HOptimizedGraphBuilder::GenerateNewObject(CallRuntime* call) { ...@@ -12701,8 +12693,8 @@ void HOptimizedGraphBuilder::GenerateNewObject(CallRuntime* call) {
FastNewObjectDescriptor descriptor(isolate()); FastNewObjectDescriptor descriptor(isolate());
HValue* values[] = {context(), Pop(), Pop()}; HValue* values[] = {context(), Pop(), Pop()};
HConstant* stub_value = Add<HConstant>(stub.GetCode()); HConstant* stub_value = Add<HConstant>(stub.GetCode());
HInstruction* result = New<HCallWithDescriptor>( HInstruction* result =
stub_value, 0, descriptor, Vector<HValue*>(values, arraysize(values))); New<HCallWithDescriptor>(stub_value, 0, descriptor, ArrayVector(values));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12714,9 +12706,9 @@ void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { ...@@ -12714,9 +12706,9 @@ void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) {
Callable callable = CodeFactory::RegExpExec(isolate()); Callable callable = CodeFactory::RegExpExec(isolate());
HValue* stub = Add<HConstant>(callable.code()); HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context()}; HValue* values[] = {context()};
HInstruction* result = New<HCallWithDescriptor>( HInstruction* result =
stub, call->arguments()->length(), callable.descriptor(), New<HCallWithDescriptor>(stub, call->arguments()->length(),
Vector<HValue*>(values, arraysize(values))); callable.descriptor(), ArrayVector(values));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12843,9 +12835,9 @@ void HOptimizedGraphBuilder::GenerateCall(CallRuntime* call) { ...@@ -12843,9 +12835,9 @@ void HOptimizedGraphBuilder::GenerateCall(CallRuntime* call) {
HValue* target = Pop(); HValue* target = Pop();
HValue* values[] = {context(), target, HValue* values[] = {context(), target,
Add<HConstant>(call->arguments()->length() - 2)}; Add<HConstant>(call->arguments()->length() - 2)};
HInstruction* result = New<HCallWithDescriptor>( HInstruction* result =
trampoline, call->arguments()->length() - 1, descriptor, New<HCallWithDescriptor>(trampoline, call->arguments()->length() - 1,
Vector<HValue*>(values, arraysize(values))); descriptor, ArrayVector(values));
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
......
...@@ -602,8 +602,7 @@ const AstRawString* ParserTraits::GetSymbol(Scanner* scanner) { ...@@ -602,8 +602,7 @@ const AstRawString* ParserTraits::GetSymbol(Scanner* scanner) {
const AstRawString* ParserTraits::GetNumberAsSymbol(Scanner* scanner) { const AstRawString* ParserTraits::GetNumberAsSymbol(Scanner* scanner) {
double double_value = parser_->scanner()->DoubleValue(); double double_value = parser_->scanner()->DoubleValue();
char array[100]; char array[100];
const char* string = const char* string = DoubleToCString(double_value, ArrayVector(array));
DoubleToCString(double_value, Vector<char>(array, arraysize(array)));
return parser_->ast_value_factory()->GetOneByteString(string); return parser_->ast_value_factory()->GetOneByteString(string);
} }
......
...@@ -461,8 +461,7 @@ static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context, ...@@ -461,8 +461,7 @@ static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context,
const v8::CpuProfileNode* result = FindChild(context, node, name); const v8::CpuProfileNode* result = FindChild(context, node, name);
if (!result) { if (!result) {
char buffer[100]; char buffer[100];
i::SNPrintF(Vector<char>(buffer, arraysize(buffer)), i::SNPrintF(i::ArrayVector(buffer), "Failed to GetChild: %s", name);
"Failed to GetChild: %s", name);
FATAL(buffer); FATAL(buffer);
} }
return result; return result;
......
...@@ -44,6 +44,7 @@ using i::AllocationTraceNode; ...@@ -44,6 +44,7 @@ using i::AllocationTraceNode;
using i::AllocationTraceTree; using i::AllocationTraceTree;
using i::AllocationTracker; using i::AllocationTracker;
using i::HashMap; using i::HashMap;
using i::ArrayVector;
using i::Vector; using i::Vector;
namespace { namespace {
...@@ -2513,8 +2514,7 @@ TEST(ArrayGrowLeftTrim) { ...@@ -2513,8 +2514,7 @@ TEST(ArrayGrowLeftTrim) {
// Print for better diagnostics in case of failure. // Print for better diagnostics in case of failure.
tracker->trace_tree()->Print(tracker); tracker->trace_tree()->Print(tracker);
AllocationTraceNode* node = AllocationTraceNode* node = FindNode(tracker, ArrayVector(names));
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
CHECK_GE(node->allocation_count(), 2u); CHECK_GE(node->allocation_count(), 2u);
CHECK_GE(node->allocation_size(), 4u * 5u); CHECK_GE(node->allocation_size(), 4u * 5u);
...@@ -2540,8 +2540,7 @@ TEST(TrackHeapAllocations) { ...@@ -2540,8 +2540,7 @@ TEST(TrackHeapAllocations) {
tracker->trace_tree()->Print(tracker); tracker->trace_tree()->Print(tracker);
const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"};
AllocationTraceNode* node = AllocationTraceNode* node = FindNode(tracker, ArrayVector(names));
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
CHECK_GE(node->allocation_count(), 100u); CHECK_GE(node->allocation_count(), 100u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
...@@ -2590,8 +2589,7 @@ TEST(TrackBumpPointerAllocations) { ...@@ -2590,8 +2589,7 @@ TEST(TrackBumpPointerAllocations) {
// Print for better diagnostics in case of failure. // Print for better diagnostics in case of failure.
tracker->trace_tree()->Print(tracker); tracker->trace_tree()->Print(tracker);
AllocationTraceNode* node = AllocationTraceNode* node = FindNode(tracker, ArrayVector(names));
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
CHECK_GE(node->allocation_count(), 100u); CHECK_GE(node->allocation_count(), 100u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
...@@ -2616,8 +2614,7 @@ TEST(TrackBumpPointerAllocations) { ...@@ -2616,8 +2614,7 @@ TEST(TrackBumpPointerAllocations) {
// Print for better diagnostics in case of failure. // Print for better diagnostics in case of failure.
tracker->trace_tree()->Print(tracker); tracker->trace_tree()->Print(tracker);
AllocationTraceNode* node = AllocationTraceNode* node = FindNode(tracker, ArrayVector(names));
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
CHECK_LT(node->allocation_count(), 100u); CHECK_LT(node->allocation_count(), 100u);
...@@ -2646,8 +2643,7 @@ TEST(TrackV8ApiAllocation) { ...@@ -2646,8 +2643,7 @@ TEST(TrackV8ApiAllocation) {
// Print for better diagnostics in case of failure. // Print for better diagnostics in case of failure.
tracker->trace_tree()->Print(tracker); tracker->trace_tree()->Print(tracker);
AllocationTraceNode* node = AllocationTraceNode* node = FindNode(tracker, ArrayVector(names));
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
CHECK_GE(node->allocation_count(), 2u); CHECK_GE(node->allocation_count(), 2u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
...@@ -2922,8 +2918,7 @@ TEST(SamplingHeapProfiler) { ...@@ -2922,8 +2918,7 @@ TEST(SamplingHeapProfiler) {
CHECK(!profile.is_empty()); CHECK(!profile.is_empty());
const char* names[] = {"", "foo", "bar"}; const char* names[] = {"", "foo", "bar"};
auto node_bar = FindAllocationProfileNode( auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names));
*profile, Vector<const char*>(names, arraysize(names)));
CHECK(node_bar); CHECK(node_bar);
// Count the number of allocations we sampled from bar. // Count the number of allocations we sampled from bar.
...@@ -2950,8 +2945,7 @@ TEST(SamplingHeapProfiler) { ...@@ -2950,8 +2945,7 @@ TEST(SamplingHeapProfiler) {
CHECK(!profile.is_empty()); CHECK(!profile.is_empty());
const char* names[] = {"", "foo", "bar"}; const char* names[] = {"", "foo", "bar"};
auto node_bar = FindAllocationProfileNode( auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names));
*profile, Vector<const char*>(names, arraysize(names)));
CHECK(node_bar); CHECK(node_bar);
// Count the number of allocations we sampled from bar. // Count the number of allocations we sampled from bar.
...@@ -2985,13 +2979,11 @@ TEST(SamplingHeapProfiler) { ...@@ -2985,13 +2979,11 @@ TEST(SamplingHeapProfiler) {
CHECK(!profile.is_empty()); CHECK(!profile.is_empty());
const char* names1[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; const char* names1[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"};
auto node1 = FindAllocationProfileNode( auto node1 = FindAllocationProfileNode(*profile, ArrayVector(names1));
*profile, Vector<const char*>(names1, arraysize(names1)));
CHECK(node1); CHECK(node1);
const char* names2[] = {"", "generateFunctions"}; const char* names2[] = {"", "generateFunctions"};
auto node2 = FindAllocationProfileNode( auto node2 = FindAllocationProfileNode(*profile, ArrayVector(names2));
*profile, Vector<const char*>(names2, arraysize(names2)));
CHECK(node2); CHECK(node2);
heap_profiler->StopSamplingHeapProfiler(); heap_profiler->StopSamplingHeapProfiler();
...@@ -3034,8 +3026,7 @@ TEST(SamplingHeapProfilerApiAllocation) { ...@@ -3034,8 +3026,7 @@ TEST(SamplingHeapProfilerApiAllocation) {
heap_profiler->GetAllocationProfile()); heap_profiler->GetAllocationProfile());
CHECK(!profile.is_empty()); CHECK(!profile.is_empty());
const char* names[] = {"(V8 API)"}; const char* names[] = {"(V8 API)"};
auto node = FindAllocationProfileNode( auto node = FindAllocationProfileNode(*profile, ArrayVector(names));
*profile, Vector<const char*>(names, arraysize(names)));
CHECK(node); CHECK(node);
heap_profiler->StopSamplingHeapProfiler(); heap_profiler->StopSamplingHeapProfiler();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment