MIPS: Only to the relevant checks in LoadFunctionPrototype.

Port r22550 (c5209a6)

BUG=
R=paul.lind@imgtec.com

Review URL: https://codereview.chromium.org/416513002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22566 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0f687199
...@@ -3846,14 +3846,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -3846,14 +3846,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
Register scratch, Register scratch,
Label* miss, Label* miss,
bool miss_on_bound_function) { bool miss_on_bound_function) {
// Check that the receiver isn't a smi. Label non_instance;
JumpIfSmi(function, miss); if (miss_on_bound_function) {
// Check that the receiver isn't a smi.
JumpIfSmi(function, miss);
// Check that the function really is a function. Load map into result reg. // Check that the function really is a function. Load map into result reg.
GetObjectType(function, result, scratch); GetObjectType(function, result, scratch);
Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));
if (miss_on_bound_function) {
lw(scratch, lw(scratch,
FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
lw(scratch, lw(scratch,
...@@ -3861,13 +3862,12 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -3861,13 +3862,12 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
And(scratch, scratch, And(scratch, scratch,
Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction)));
Branch(miss, ne, scratch, Operand(zero_reg)); Branch(miss, ne, scratch, Operand(zero_reg));
}
// Make sure that the function has an instance prototype. // Make sure that the function has an instance prototype.
Label non_instance; lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype));
And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); Branch(&non_instance, ne, scratch, Operand(zero_reg));
Branch(&non_instance, ne, scratch, Operand(zero_reg)); }
// Get the prototype or initial map from the function. // Get the prototype or initial map from the function.
lw(result, lw(result,
...@@ -3886,12 +3886,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -3886,12 +3886,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
// Get the prototype from the initial map. // Get the prototype from the initial map.
lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); lw(result, FieldMemOperand(result, Map::kPrototypeOffset));
jmp(&done);
// Non-instance prototype: Fetch prototype from constructor field if (miss_on_bound_function) {
// in initial map. jmp(&done);
bind(&non_instance);
lw(result, FieldMemOperand(result, Map::kConstructorOffset)); // Non-instance prototype: Fetch prototype from constructor field
// in initial map.
bind(&non_instance);
lw(result, FieldMemOperand(result, Map::kConstructorOffset));
}
// All done. // All done.
bind(&done); bind(&done);
......
...@@ -3933,32 +3933,28 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -3933,32 +3933,28 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
Register scratch, Register scratch,
Label* miss, Label* miss,
bool miss_on_bound_function) { bool miss_on_bound_function) {
// Check that the receiver isn't a smi. Label non_instance;
JumpIfSmi(function, miss); if (miss_on_bound_function) {
// Check that the receiver isn't a smi.
JumpIfSmi(function, miss);
// Check that the function really is a function. Load map into result reg. // Check that the function really is a function. Load map into result reg.
GetObjectType(function, result, scratch); GetObjectType(function, result, scratch);
Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));
if (miss_on_bound_function) {
ld(scratch, ld(scratch,
FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
// ld(scratch,
// FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
// And(scratch, scratch,
// Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction)));
lwu(scratch, lwu(scratch,
FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
And(scratch, scratch, And(scratch, scratch,
Operand(1 << SharedFunctionInfo::kBoundFunction)); Operand(1 << SharedFunctionInfo::kBoundFunction));
Branch(miss, ne, scratch, Operand(zero_reg)); Branch(miss, ne, scratch, Operand(zero_reg));
}
// Make sure that the function has an instance prototype. // Make sure that the function has an instance prototype.
Label non_instance; lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype));
And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); Branch(&non_instance, ne, scratch, Operand(zero_reg));
Branch(&non_instance, ne, scratch, Operand(zero_reg)); }
// Get the prototype or initial map from the function. // Get the prototype or initial map from the function.
ld(result, ld(result,
...@@ -3977,12 +3973,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -3977,12 +3973,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
// Get the prototype from the initial map. // Get the prototype from the initial map.
ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); ld(result, FieldMemOperand(result, Map::kPrototypeOffset));
jmp(&done);
// Non-instance prototype: Fetch prototype from constructor field if (miss_on_bound_function) {
// in initial map. jmp(&done);
bind(&non_instance);
ld(result, FieldMemOperand(result, Map::kConstructorOffset)); // Non-instance prototype: Fetch prototype from constructor field
// in initial map.
bind(&non_instance);
ld(result, FieldMemOperand(result, Map::kConstructorOffset));
}
// All done. // All done.
bind(&done); bind(&done);
......
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