ARM: Optimize WrapReceiver
Optimize register constraints and code generated for WrapReceiver Lithium instruction. TEST=none BUG= R=ulan@chromium.org Review URL: https://codereview.chromium.org/96993002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18180 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ae119b1365
commit
b974ede8d5
@ -1084,7 +1084,7 @@ LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
|
||||
LOperand* receiver = UseRegisterAtStart(instr->receiver());
|
||||
LOperand* function = UseRegisterAtStart(instr->function());
|
||||
LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
|
||||
return AssignEnvironment(DefineSameAsFirst(result));
|
||||
return AssignEnvironment(DefineAsRegister(result));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3496,12 +3496,13 @@ void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
|
||||
void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
||||
Register receiver = ToRegister(instr->receiver());
|
||||
Register function = ToRegister(instr->function());
|
||||
Register result = ToRegister(instr->result());
|
||||
Register scratch = scratch0();
|
||||
|
||||
// If the receiver is null or undefined, we have to pass the global
|
||||
// object as a receiver to normal functions. Values have to be
|
||||
// passed unchanged to builtins and strict-mode functions.
|
||||
Label global_object, receiver_ok;
|
||||
Label global_object, result_in_receiver;
|
||||
|
||||
// Do not transform the receiver to object for strict mode
|
||||
// functions.
|
||||
@ -3511,11 +3512,11 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
||||
FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ tst(scratch,
|
||||
Operand(1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize)));
|
||||
__ b(ne, &receiver_ok);
|
||||
__ b(ne, &result_in_receiver);
|
||||
|
||||
// Do not transform the receiver to object for builtins.
|
||||
__ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
||||
__ b(ne, &receiver_ok);
|
||||
__ b(ne, &result_in_receiver);
|
||||
|
||||
// Normal function. Replace undefined or null with global receiver.
|
||||
__ LoadRoot(scratch, Heap::kNullValueRootIndex);
|
||||
@ -3530,13 +3531,21 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
||||
DeoptimizeIf(eq, instr->environment());
|
||||
__ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE);
|
||||
DeoptimizeIf(lt, instr->environment());
|
||||
__ jmp(&receiver_ok);
|
||||
__ b(&result_in_receiver);
|
||||
|
||||
__ bind(&global_object);
|
||||
__ ldr(receiver, GlobalObjectOperand());
|
||||
__ ldr(receiver,
|
||||
FieldMemOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
|
||||
__ bind(&receiver_ok);
|
||||
__ ldr(result, GlobalObjectOperand());
|
||||
__ ldr(result,
|
||||
FieldMemOperand(result, JSGlobalObject::kGlobalReceiverOffset));
|
||||
if (result.is(receiver)) {
|
||||
__ bind(&result_in_receiver);
|
||||
} else {
|
||||
Label result_ok;
|
||||
__ b(&result_ok);
|
||||
__ bind(&result_in_receiver);
|
||||
__ mov(result, receiver);
|
||||
__ bind(&result_ok);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user