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. R=ager@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7044081 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8248 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
7c26e7143f
commit
9ecfdb340c
@ -1127,8 +1127,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
|
||||
__ 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;
|
||||
}
|
||||
|
@ -2847,8 +2847,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
|
||||
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)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1078,8 +1078,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
|
||||
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;
|
||||
}
|
||||
|
@ -2678,8 +2678,8 @@ void LCodeGen::DoContext(LContext* instr) {
|
||||
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)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1128,8 +1128,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
|
||||
__ 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;
|
||||
}
|
||||
|
@ -3571,12 +3571,9 @@ void MacroAssembler::Abort(const char* msg) {
|
||||
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
|
||||
|
@ -1089,8 +1089,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
|
||||
__ 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 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
|
||||
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;
|
||||
}
|
||||
|
@ -2682,8 +2682,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
|
||||
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)));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user