Reviewers: ulan, Benedikt Meurer,
Description:
ARM: Optimize WrapReceiver
Optimize register constraints and code generated for WrapReceiver Lithium
instruction.
TEST=none
BUG=
Please review this at https://codereview.chromium.org/96993002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+18, -9 lines):
M src/arm/lithium-arm.cc
M src/arm/lithium-codegen-arm.cc
Index: src/arm/lithium-arm.cc
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
index
7b605f7665a71e3e9713f900b1f2d324ec540f8b..5a09ae8158f578c4c0a8ef180ed003ff5d1baef8
100644
--- a/src/arm/lithium-arm.cc
+++ b/src/arm/lithium-arm.cc
@@ -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));
}
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
4e1cc2f7a58bce915542263d8f182b8058f34463..c81d3e963900f4f4da120a8c9c6b24f6e0818ad1
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -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);
+ }
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.