Commit ec6368bf authored by Lu Yahan's avatar Lu Yahan Committed by V8 LUCI CQ

[Cleanup] Use CmpInstanceTypeRange in MacroAssembler

Bug: v8:11325
Change-Id: Iffe8d049cbb97384e81fa3eeae5066e58b303066
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3787682Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn>
Commit-Queue: Yahan Lu <yahan@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#82013}
parent b9ba2959
......@@ -2208,22 +2208,12 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
LoadMap(map, object);
// Check if JSGeneratorObject
Label do_check;
Register instance_type = object;
CompareInstanceType(map, instance_type, JS_GENERATOR_OBJECT_TYPE);
b(eq, &do_check);
// Check if JSAsyncFunctionObject (See MacroAssembler::CompareInstanceType)
cmp(instance_type, Operand(JS_ASYNC_FUNCTION_OBJECT_TYPE));
b(eq, &do_check);
// Check if JSAsyncGeneratorObject (See MacroAssembler::CompareInstanceType)
cmp(instance_type, Operand(JS_ASYNC_GENERATOR_OBJECT_TYPE));
bind(&do_check);
CompareInstanceTypeRange(map, instance_type, FIRST_JS_GENERATOR_OBJECT_TYPE,
LAST_JS_GENERATOR_OBJECT_TYPE);
// Restore generator object to register and perform assertion
pop(object);
Check(eq, AbortReason::kOperandIsNotAGeneratorObject);
Check(ls, AbortReason::kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
......
......@@ -1626,21 +1626,11 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
Register temp = temps.AcquireX();
LoadMap(temp, object);
Label do_check;
// Load instance type and check if JSGeneratorObject
CompareInstanceType(temp, temp, JS_GENERATOR_OBJECT_TYPE);
B(eq, &do_check);
// Check if JSAsyncFunctionObject
Cmp(temp, JS_ASYNC_FUNCTION_OBJECT_TYPE);
B(eq, &do_check);
// Check if JSAsyncGeneratorObject
Cmp(temp, JS_ASYNC_GENERATOR_OBJECT_TYPE);
bind(&do_check);
CompareInstanceTypeRange(temp, temp, FIRST_JS_GENERATOR_OBJECT_TYPE,
LAST_JS_GENERATOR_OBJECT_TYPE);
// Restore generator object to register and perform assertion
Check(eq, AbortReason::kOperandIsNotAGeneratorObject);
Check(ls, AbortReason::kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
......
......@@ -799,21 +799,12 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
Label do_check;
// Check if JSGeneratorObject
CmpInstanceType(map, JS_GENERATOR_OBJECT_TYPE);
j(equal, &do_check, Label::kNear);
// Check if JSAsyncFunctionObject.
CmpInstanceType(map, JS_ASYNC_FUNCTION_OBJECT_TYPE);
j(equal, &do_check, Label::kNear);
// Check if JSAsyncGeneratorObject
CmpInstanceType(map, JS_ASYNC_GENERATOR_OBJECT_TYPE);
bind(&do_check);
CmpInstanceTypeRange(map, map, map, FIRST_JS_GENERATOR_OBJECT_TYPE,
LAST_JS_GENERATOR_OBJECT_TYPE);
Pop(object);
}
Check(equal, AbortReason::kOperandIsNotAGeneratorObject);
Check(below_equal, AbortReason::kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
......
......@@ -2542,22 +2542,12 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
Push(object);
LoadMap(map, object);
Label do_check;
// Check if JSGeneratorObject
CmpInstanceType(map, JS_GENERATOR_OBJECT_TYPE);
j(equal, &do_check);
// Check if JSAsyncFunctionObject
CmpInstanceType(map, JS_ASYNC_FUNCTION_OBJECT_TYPE);
j(equal, &do_check);
// Check if JSAsyncGeneratorObject
CmpInstanceType(map, JS_ASYNC_GENERATOR_OBJECT_TYPE);
bind(&do_check);
CmpInstanceTypeRange(map, kScratchRegister, FIRST_JS_GENERATOR_OBJECT_TYPE,
LAST_JS_GENERATOR_OBJECT_TYPE);
// Restore generator object to register and perform assertion
Pop(object);
Check(equal, AbortReason::kOperandIsNotAGeneratorObject);
Check(below_equal, AbortReason::kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
......
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