Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1473)

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 7044081: Use the previous context link when checking context extension objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1121
1122 Scope* s = scope(); 1122 Scope* s = scope();
1123 while (s != NULL) { 1123 while (s != NULL) {
1124 if (s->num_heap_slots() > 0) { 1124 if (s->num_heap_slots() > 0) {
1125 if (s->calls_eval()) { 1125 if (s->calls_eval()) {
1126 // Check that extension is NULL. 1126 // Check that extension is NULL.
1127 __ lw(temp, ContextOperand(current, Context::EXTENSION_INDEX)); 1127 __ lw(temp, ContextOperand(current, Context::EXTENSION_INDEX));
1128 __ Branch(slow, ne, temp, Operand(zero_reg)); 1128 __ Branch(slow, ne, temp, Operand(zero_reg));
1129 } 1129 }
1130 // Load next context in chain. 1130 // Load next context in chain.
1131 __ lw(next, ContextOperand(current, Context::CLOSURE_INDEX)); 1131 __ lw(next, ContextOperand(current, Context::PREVIOUS_INDEX));
1132 __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
1133 // Walk the rest of the chain without clobbering cp. 1132 // Walk the rest of the chain without clobbering cp.
1134 current = next; 1133 current = next;
1135 } 1134 }
1136 // If no outer scope calls eval, we do not need to check more 1135 // If no outer scope calls eval, we do not need to check more
1137 // context extensions. 1136 // context extensions.
1138 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; 1137 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break;
1139 s = s->outer_scope(); 1138 s = s->outer_scope();
1140 } 1139 }
1141 1140
1142 if (s->is_eval_scope()) { 1141 if (s->is_eval_scope()) {
1143 Label loop, fast; 1142 Label loop, fast;
1144 if (!current.is(next)) { 1143 if (!current.is(next)) {
1145 __ Move(next, current); 1144 __ Move(next, current);
1146 } 1145 }
1147 __ bind(&loop); 1146 __ bind(&loop);
1148 // Terminate at global context. 1147 // Terminate at global context.
1149 __ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset)); 1148 __ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset));
1150 __ LoadRoot(t0, Heap::kGlobalContextMapRootIndex); 1149 __ LoadRoot(t0, Heap::kGlobalContextMapRootIndex);
1151 __ Branch(&fast, eq, temp, Operand(t0)); 1150 __ Branch(&fast, eq, temp, Operand(t0));
1152 // Check that extension is NULL. 1151 // Check that extension is NULL.
1153 __ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX)); 1152 __ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX));
1154 __ Branch(slow, ne, temp, Operand(zero_reg)); 1153 __ Branch(slow, ne, temp, Operand(zero_reg));
1155 // Load next context in chain. 1154 // Load next context in chain.
1156 __ lw(next, ContextOperand(next, Context::CLOSURE_INDEX)); 1155 __ lw(next, ContextOperand(next, Context::PREVIOUS_INDEX));
1157 __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
1158 __ Branch(&loop); 1156 __ Branch(&loop);
1159 __ bind(&fast); 1157 __ bind(&fast);
1160 } 1158 }
1161 1159
1162 __ lw(a0, GlobalObjectOperand()); 1160 __ lw(a0, GlobalObjectOperand());
1163 __ li(a2, Operand(slot->var()->name())); 1161 __ li(a2, Operand(slot->var()->name()));
1164 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) 1162 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
1165 ? RelocInfo::CODE_TARGET 1163 ? RelocInfo::CODE_TARGET
1166 : RelocInfo::CODE_TARGET_CONTEXT; 1164 : RelocInfo::CODE_TARGET_CONTEXT;
1167 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 1165 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
1168 EmitCallIC(ic, mode, AstNode::kNoNumber); 1166 EmitCallIC(ic, mode, AstNode::kNoNumber);
1169 } 1167 }
1170 1168
1171 1169
1172 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions( 1170 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
1173 Slot* slot, 1171 Slot* slot,
1174 Label* slow) { 1172 Label* slow) {
1175 ASSERT(slot->type() == Slot::CONTEXT); 1173 ASSERT(slot->type() == Slot::CONTEXT);
1176 Register context = cp; 1174 Register context = cp;
1177 Register next = a3; 1175 Register next = a3;
1178 Register temp = t0; 1176 Register temp = t0;
1179 1177
1180 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { 1178 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) {
1181 if (s->num_heap_slots() > 0) { 1179 if (s->num_heap_slots() > 0) {
1182 if (s->calls_eval()) { 1180 if (s->calls_eval()) {
1183 // Check that extension is NULL. 1181 // Check that extension is NULL.
1184 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX)); 1182 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX));
1185 __ Branch(slow, ne, temp, Operand(zero_reg)); 1183 __ Branch(slow, ne, temp, Operand(zero_reg));
1186 } 1184 }
1187 __ lw(next, ContextOperand(context, Context::CLOSURE_INDEX)); 1185 __ lw(next, ContextOperand(context, Context::PREVIOUS_INDEX));
1188 __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
1189 // Walk the rest of the chain without clobbering cp. 1186 // Walk the rest of the chain without clobbering cp.
1190 context = next; 1187 context = next;
1191 } 1188 }
1192 } 1189 }
1193 // Check that last extension is NULL. 1190 // Check that last extension is NULL.
1194 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX)); 1191 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX));
1195 __ Branch(slow, ne, temp, Operand(zero_reg)); 1192 __ Branch(slow, ne, temp, Operand(zero_reg));
1196 1193
1197 // This function is used only for loads, not stores, so it's safe to 1194 // This function is used only for loads, not stores, so it's safe to
1198 // return an cp-based operand (the write barrier cannot be allowed to 1195 // return an cp-based operand (the write barrier cannot be allowed to
(...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 __ Addu(at, a1, Operand(masm_->CodeObject())); 4377 __ Addu(at, a1, Operand(masm_->CodeObject()));
4381 __ Jump(at); 4378 __ Jump(at);
4382 } 4379 }
4383 4380
4384 4381
4385 #undef __ 4382 #undef __
4386 4383
4387 } } // namespace v8::internal 4384 } } // namespace v8::internal
4388 4385
4389 #endif // V8_TARGET_ARCH_MIPS 4386 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698