Commit 89eb451c authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[cleanup] Add helpers/use existing ones more in bootstrapper

This CL makes several changes to bootstrapper to reduce
code verbosity:

  - Adds an InstallToStringTag helper and uses it everywhere (while
    removing now-redundant comments).
  - Reduces explicit calls to Factory::InternalizeUtf8String
    by adding some overloads of helpers and of JSObject::AddProperty.
  - Uses InstallConstant in all applicable cases.
  - Removes attributes arguments when all callers pass DONT_ENUM.

Change-Id: Ifb5f5102f5fbf89d475045270eeda78a2ee99248
Reviewed-on: https://chromium-review.googlesource.com/c/1385526Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58413}
parent 379b3e38
This diff is collapsed.
......@@ -6450,6 +6450,13 @@ void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
.IsJust());
}
void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
const char* name, Handle<Object> value,
PropertyAttributes attributes) {
JSObject::AddProperty(isolate, object,
isolate->factory()->InternalizeUtf8String(name), value,
attributes);
}
// Reconfigures a property to a data property with attributes, even if it is not
// reconfigurable.
......
......@@ -408,6 +408,11 @@ class JSObject : public JSReceiver {
Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes);
// {name} must be a UTF-8 encoded, null-terminated string.
static void AddProperty(Isolate* isolate, Handle<JSObject> object,
const char* name, Handle<Object> value,
PropertyAttributes attributes);
static void AddDataElement(Handle<JSObject> receiver, uint32_t index,
Handle<Object> value,
PropertyAttributes attributes);
......
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