Revision: 8248
Author: [email protected]
Date: Thu Jun 9 10:44:50 2011
Log: Use the previous context link when checking context extension
objects.
In generated code, when walking the context to inspect context extension
objects, use the previous context link directly.
[email protected]
BUG=
TEST=
Review URL: http://codereview.chromium.org/7044081
http://code.google.com/p/v8/source/detail?r=8248
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Jun 9 04:26:01
2011
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Jun 9 10:44:50
2011
@@ -1127,8 +1127,7 @@
__ b(ne, slow);
}
// Load next context in chain.
- __ ldr(next, ContextOperand(current, Context::CLOSURE_INDEX));
- __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ ldr(next, ContextOperand(current, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering cp.
current = next;
}
@@ -1154,8 +1153,7 @@
__ tst(temp, temp);
__ b(ne, slow);
// Load next context in chain.
- __ ldr(next, ContextOperand(next, Context::CLOSURE_INDEX));
- __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX));
__ b(&loop);
__ bind(&fast);
}
@@ -1186,8 +1184,7 @@
__ tst(temp, temp);
__ b(ne, slow);
}
- __ ldr(next, ContextOperand(context, Context::CLOSURE_INDEX));
- __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ ldr(next, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering cp.
context = next;
}
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jun 9
08:19:37 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jun 9
10:44:50 2011
@@ -2847,8 +2847,7 @@
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ ldr(result,
- MemOperand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
- __ ldr(result, FieldMemOperand(result, JSFunction::kContextOffset));
+ MemOperand(context,
Context::SlotOffset(Context::PREVIOUS_INDEX)));
}
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Thu Jun 9
04:26:01 2011
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Thu Jun 9
10:44:50 2011
@@ -1078,8 +1078,7 @@
__ j(not_equal, slow);
}
// Load next context in chain.
- __ mov(temp, ContextOperand(context, Context::CLOSURE_INDEX));
- __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering esi.
context = temp;
}
@@ -1106,8 +1105,7 @@
__ cmp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0));
__ j(not_equal, slow);
// Load next context in chain.
- __ mov(temp, ContextOperand(temp, Context::CLOSURE_INDEX));
- __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
__ jmp(&next);
__ bind(&fast);
}
@@ -1139,8 +1137,7 @@
Immediate(0));
__ j(not_equal, slow);
}
- __ mov(temp, ContextOperand(context, Context::CLOSURE_INDEX));
- __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering esi.
context = temp;
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu Jun 9
08:19:37 2011
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu Jun 9
10:44:50 2011
@@ -2678,8 +2678,8 @@
void LCodeGen::DoOuterContext(LOuterContext* instr) {
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
- __ mov(result, Operand(context,
Context::SlotOffset(Context::CLOSURE_INDEX)));
- __ mov(result, FieldOperand(result, JSFunction::kContextOffset));
+ __ mov(result,
+ Operand(context, Context::SlotOffset(Context::PREVIOUS_INDEX)));
}
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Jun 6
01:49:15 2011
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Thu Jun 9
10:44:50 2011
@@ -1128,8 +1128,7 @@
__ Branch(slow, ne, temp, Operand(zero_reg));
}
// Load next context in chain.
- __ lw(next, ContextOperand(current, Context::CLOSURE_INDEX));
- __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ lw(next, ContextOperand(current, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering cp.
current = next;
}
@@ -1153,8 +1152,7 @@
__ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX));
__ Branch(slow, ne, temp, Operand(zero_reg));
// Load next context in chain.
- __ lw(next, ContextOperand(next, Context::CLOSURE_INDEX));
- __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ lw(next, ContextOperand(next, Context::PREVIOUS_INDEX));
__ Branch(&loop);
__ bind(&fast);
}
@@ -1184,8 +1182,7 @@
__ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX));
__ Branch(slow, ne, temp, Operand(zero_reg));
}
- __ lw(next, ContextOperand(context, Context::CLOSURE_INDEX));
- __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
+ __ lw(next, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering cp.
context = next;
}
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Thu Jun 9
00:06:15 2011
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Thu Jun 9
10:44:50 2011
@@ -3571,12 +3571,9 @@
void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
if (context_chain_length > 0) {
// Move up the chain of contexts to the context containing the slot.
- lw(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX)));
- // Load the function context (which is the incoming, outer context).
- lw(dst, FieldMemOperand(dst, JSFunction::kContextOffset));
+ lw(dst, MemOperand(cp, Context::SlotOffset(Context::PREVIOUS_INDEX)));
for (int i = 1; i < context_chain_length; i++) {
- lw(dst, MemOperand(dst,
Context::SlotOffset(Context::CLOSURE_INDEX)));
- lw(dst, FieldMemOperand(dst, JSFunction::kContextOffset));
+ lw(dst, MemOperand(dst,
Context::SlotOffset(Context::PREVIOUS_INDEX)));
}
} else {
// Slot is in the current function context. Move it into the
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Jun 9 04:26:01
2011
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Jun 9 10:44:50
2011
@@ -1089,8 +1089,7 @@
__ j(not_equal, slow);
}
// Load next context in chain.
- __ movq(temp, ContextOperand(context, Context::CLOSURE_INDEX));
- __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ movq(temp, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering rsi.
context = temp;
}
@@ -1118,8 +1117,7 @@
__ cmpq(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0));
__ j(not_equal, slow);
// Load next context in chain.
- __ movq(temp, ContextOperand(temp, Context::CLOSURE_INDEX));
- __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ movq(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
__ jmp(&next);
__ bind(&fast);
}
@@ -1151,8 +1149,7 @@
Immediate(0));
__ j(not_equal, slow);
}
- __ movq(temp, ContextOperand(context, Context::CLOSURE_INDEX));
- __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset));
+ __ movq(temp, ContextOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering rsi.
context = temp;
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu Jun 9
08:19:37 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu Jun 9
10:44:50 2011
@@ -2682,8 +2682,7 @@
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ movq(result,
- Operand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
- __ movq(result, FieldOperand(result, JSFunction::kContextOffset));
+ Operand(context, Context::SlotOffset(Context::PREVIOUS_INDEX)));
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev