Commit 445d26fa authored by JianxiaoLuIntel's avatar JianxiaoLuIntel Committed by V8 LUCI CQ

Avoid unnecessary security cookie in JSObject::GetHeaderSize

From the assembly code(Windows10), we found in the function "JSObject::GetHeaderSize" the __security_check_cookie will be called everytime before return. It is introduced by the stringstream which is used to print the enum string. We can remove the unnecessary __security_check_cookie by removing the stingstream.

Change-Id: I2786e0cf8f216d6a8cb07f502c29018987b3cc43
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769433Reviewed-by: 's avatarSamuel Groß <saelo@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Jianxiao Lu <jianxiao.lu@intel.com>
Cr-Commit-Position: refs/heads/main@{#81993}
parent 64aeabbc
...@@ -2362,6 +2362,19 @@ void JSObject::EnsureWritableFastElements(Handle<JSObject> object) { ...@@ -2362,6 +2362,19 @@ void JSObject::EnsureWritableFastElements(Handle<JSObject> object) {
object->set_elements(*writable_elems); object->set_elements(*writable_elems);
} }
// For FATAL in JSObject::GetHeaderSize
static const char* NonAPIInstanceTypeToString(InstanceType instance_type) {
DCHECK(!InstanceTypeChecker::IsJSApiObject(instance_type));
switch (instance_type) {
#define WRITE_TYPE(TYPE) \
case TYPE: \
return #TYPE;
INSTANCE_TYPE_LIST(WRITE_TYPE)
#undef WRITE_TYPE
}
UNREACHABLE();
}
int JSObject::GetHeaderSize(InstanceType type, int JSObject::GetHeaderSize(InstanceType type,
bool function_has_prototype_slot) { bool function_has_prototype_slot) {
switch (type) { switch (type) {
...@@ -2535,9 +2548,7 @@ int JSObject::GetHeaderSize(InstanceType type, ...@@ -2535,9 +2548,7 @@ int JSObject::GetHeaderSize(InstanceType type,
if (InstanceTypeChecker::IsJSApiObject(type)) { if (InstanceTypeChecker::IsJSApiObject(type)) {
return JSObject::kHeaderSize; return JSObject::kHeaderSize;
} }
std::stringstream ss; FATAL("unexpected instance type: %s\n", NonAPIInstanceTypeToString(type));
ss << type;
FATAL("unexpected instance type: %s\n", ss.str().c_str());
} }
} }
} }
......
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