MIPS: Move Maps' back pointers from "transitions" to "constructor" field
Port affcfaf428
BUG=
Review URL: https://codereview.chromium.org/954863002
Cr-Commit-Position: refs/heads/master@{#26837}
This commit is contained in:
parent
1a8dc98cbf
commit
ee908a2b6a
@ -3757,9 +3757,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1);
|
||||
|
||||
// Check if the constructor in the map is a JS function.
|
||||
__ lw(v0, FieldMemOperand(v0, Map::kConstructorOffset));
|
||||
__ GetObjectType(v0, a1, a1);
|
||||
__ Branch(&non_function_constructor, ne, a1, Operand(JS_FUNCTION_TYPE));
|
||||
Register instance_type = a2;
|
||||
__ GetMapConstructor(v0, v0, a1, instance_type);
|
||||
__ Branch(&non_function_constructor, ne, instance_type,
|
||||
Operand(JS_FUNCTION_TYPE));
|
||||
|
||||
// v0 now contains the constructor function. Grab the
|
||||
// instance class name from there.
|
||||
|
@ -2657,14 +2657,16 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
|
||||
|
||||
// Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
|
||||
// Check if the constructor in the map is a function.
|
||||
__ lw(temp, FieldMemOperand(temp, Map::kConstructorOffset));
|
||||
Register instance_type = scratch1();
|
||||
DCHECK(!instance_type.is(temp));
|
||||
DCHECK(!instance_type.is(temp2));
|
||||
__ GetMapConstructor(temp, temp, temp2, instance_type);
|
||||
|
||||
// Objects with a non-function constructor have class 'Object'.
|
||||
__ GetObjectType(temp, temp2, temp2);
|
||||
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
|
||||
__ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE));
|
||||
} else {
|
||||
__ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE));
|
||||
}
|
||||
|
||||
// temp now contains the constructor function. Grab the
|
||||
|
@ -4321,6 +4321,20 @@ void MacroAssembler::IsObjectNameType(Register object,
|
||||
// Support functions.
|
||||
|
||||
|
||||
void MacroAssembler::GetMapConstructor(Register result, Register map,
|
||||
Register temp, Register temp2) {
|
||||
Label done, loop;
|
||||
lw(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset));
|
||||
bind(&loop);
|
||||
JumpIfSmi(result, &done);
|
||||
GetObjectType(result, temp, temp2);
|
||||
Branch(&done, ne, temp2, Operand(MAP_TYPE));
|
||||
lw(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset));
|
||||
Branch(&loop);
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::TryGetFunctionPrototype(Register function,
|
||||
Register result,
|
||||
Register scratch,
|
||||
@ -4373,7 +4387,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
|
||||
// Non-instance prototype: Fetch prototype from constructor field
|
||||
// in initial map.
|
||||
bind(&non_instance);
|
||||
lw(result, FieldMemOperand(result, Map::kConstructorOffset));
|
||||
GetMapConstructor(result, result, scratch, at);
|
||||
}
|
||||
|
||||
// All done.
|
||||
|
@ -998,6 +998,11 @@ class MacroAssembler: public Assembler {
|
||||
// -------------------------------------------------------------------------
|
||||
// Support functions.
|
||||
|
||||
// Machine code version of Map::GetConstructor().
|
||||
// |temp| holds |result|'s map when done, and |temp2| its instance type.
|
||||
void GetMapConstructor(Register result, Register map, Register temp,
|
||||
Register temp2);
|
||||
|
||||
// Try to get function prototype of a function and puts the value in
|
||||
// the result register. Checks that the function really is a
|
||||
// function and jumps to the miss label if the fast checks fail. The
|
||||
|
@ -3758,9 +3758,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1);
|
||||
|
||||
// Check if the constructor in the map is a JS function.
|
||||
__ ld(v0, FieldMemOperand(v0, Map::kConstructorOffset));
|
||||
__ GetObjectType(v0, a1, a1);
|
||||
__ Branch(&non_function_constructor, ne, a1, Operand(JS_FUNCTION_TYPE));
|
||||
Register instance_type = a2;
|
||||
__ GetMapConstructor(v0, v0, a1, instance_type);
|
||||
__ Branch(&non_function_constructor, ne, instance_type,
|
||||
Operand(JS_FUNCTION_TYPE));
|
||||
|
||||
// v0 now contains the constructor function. Grab the
|
||||
// instance class name from there.
|
||||
|
@ -2618,14 +2618,16 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
|
||||
|
||||
// Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
|
||||
// Check if the constructor in the map is a function.
|
||||
__ ld(temp, FieldMemOperand(temp, Map::kConstructorOffset));
|
||||
Register instance_type = scratch1();
|
||||
DCHECK(!instance_type.is(temp));
|
||||
DCHECK(!instance_type.is(temp2));
|
||||
__ GetMapConstructor(temp, temp, temp2, instance_type);
|
||||
|
||||
// Objects with a non-function constructor have class 'Object'.
|
||||
__ GetObjectType(temp, temp2, temp2);
|
||||
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
|
||||
__ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE));
|
||||
} else {
|
||||
__ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE));
|
||||
}
|
||||
|
||||
// temp now contains the constructor function. Grab the
|
||||
|
@ -4243,6 +4243,20 @@ void MacroAssembler::IsObjectNameType(Register object,
|
||||
// Support functions.
|
||||
|
||||
|
||||
void MacroAssembler::GetMapConstructor(Register result, Register map,
|
||||
Register temp, Register temp2) {
|
||||
Label done, loop;
|
||||
ld(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset));
|
||||
bind(&loop);
|
||||
JumpIfSmi(result, &done);
|
||||
GetObjectType(result, temp, temp2);
|
||||
Branch(&done, ne, temp2, Operand(MAP_TYPE));
|
||||
ld(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset));
|
||||
Branch(&loop);
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::TryGetFunctionPrototype(Register function,
|
||||
Register result,
|
||||
Register scratch,
|
||||
@ -4295,7 +4309,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
|
||||
// Non-instance prototype: Fetch prototype from constructor field
|
||||
// in initial map.
|
||||
bind(&non_instance);
|
||||
ld(result, FieldMemOperand(result, Map::kConstructorOffset));
|
||||
GetMapConstructor(result, result, scratch, at);
|
||||
}
|
||||
|
||||
// All done.
|
||||
|
@ -1028,6 +1028,11 @@ class MacroAssembler: public Assembler {
|
||||
// -------------------------------------------------------------------------
|
||||
// Support functions.
|
||||
|
||||
// Machine code version of Map::GetConstructor().
|
||||
// |temp| holds |result|'s map when done, and |temp2| its instance type.
|
||||
void GetMapConstructor(Register result, Register map, Register temp,
|
||||
Register temp2);
|
||||
|
||||
// Try to get function prototype of a function and puts the value in
|
||||
// the result register. Checks that the function really is a
|
||||
// function and jumps to the miss label if the fast checks fail. The
|
||||
|
Loading…
Reference in New Issue
Block a user