Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: src/api-natives.cc

Issue 2407313003: Use arraysize() instead of hardcoded kSize constants in api-natives.cc (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api-natives.cc
diff --git a/src/api-natives.cc b/src/api-natives.cc
index ea2cce5c889cf400a0d195ffde69d8fb5d7d3ffa..a620b210a4b65156560b3788d3fa3ce8322d3ccb 100644
--- a/src/api-natives.cc
+++ b/src/api-natives.cc
@@ -533,24 +533,22 @@ MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
void ApiNatives::AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes) {
- const int kSize = 3;
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
- Handle<Object> data[kSize] = {name, details_handle, value};
- AddPropertyToPropertyList(isolate, info, kSize, data);
+ Handle<Object> data[] = {name, details_handle, value};
+ AddPropertyToPropertyList(isolate, info, arraysize(data), data);
}
void ApiNatives::AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
Handle<Name> name, v8::Intrinsic intrinsic,
PropertyAttributes attributes) {
- const int kSize = 4;
auto value = handle(Smi::FromInt(intrinsic), isolate);
auto intrinsic_marker = isolate->factory()->true_value();
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
- Handle<Object> data[kSize] = {name, intrinsic_marker, details_handle, value};
- AddPropertyToPropertyList(isolate, info, kSize, data);
+ Handle<Object> data[] = {name, intrinsic_marker, details_handle, value};
+ AddPropertyToPropertyList(isolate, info, arraysize(data), data);
}
@@ -560,11 +558,10 @@ void ApiNatives::AddAccessorProperty(Isolate* isolate,
Handle<FunctionTemplateInfo> getter,
Handle<FunctionTemplateInfo> setter,
PropertyAttributes attributes) {
- const int kSize = 4;
PropertyDetails details(attributes, ACCESSOR, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
- Handle<Object> data[kSize] = {name, details_handle, getter, setter};
- AddPropertyToPropertyList(isolate, info, kSize, data);
+ Handle<Object> data[] = {name, details_handle, getter, setter};
+ AddPropertyToPropertyList(isolate, info, arraysize(data), data);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698