[Cleanup] Use CmpInstanceTypeRange in MacroAssembler
Bug: v8:11325 Change-Id: Iffe8d049cbb97384e81fa3eeae5066e58b303066 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3787682 Reviewed-by: Igor 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}
This commit is contained in:
parent
b9ba2959e1
commit
ec6368bf12
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user