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

Side by Side Diff: src/arm/full-codegen-arm.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
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 Scope* s = scope(); 1120 Scope* s = scope();
1121 while (s != NULL) { 1121 while (s != NULL) {
1122 if (s->num_heap_slots() > 0) { 1122 if (s->num_heap_slots() > 0) {
1123 if (s->calls_eval()) { 1123 if (s->calls_eval()) {
1124 // Check that extension is NULL. 1124 // Check that extension is NULL.
1125 __ ldr(temp, ContextOperand(current, Context::EXTENSION_INDEX)); 1125 __ ldr(temp, ContextOperand(current, Context::EXTENSION_INDEX));
1126 __ tst(temp, temp); 1126 __ tst(temp, temp);
1127 __ b(ne, slow); 1127 __ b(ne, slow);
1128 } 1128 }
1129 // Load next context in chain. 1129 // Load next context in chain.
1130 __ ldr(next, ContextOperand(current, Context::CLOSURE_INDEX)); 1130 __ ldr(next, ContextOperand(current, Context::PREVIOUS_INDEX));
1131 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
1132 // Walk the rest of the chain without clobbering cp. 1131 // Walk the rest of the chain without clobbering cp.
1133 current = next; 1132 current = next;
1134 } 1133 }
1135 // If no outer scope calls eval, we do not need to check more 1134 // If no outer scope calls eval, we do not need to check more
1136 // context extensions. 1135 // context extensions.
1137 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; 1136 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break;
1138 s = s->outer_scope(); 1137 s = s->outer_scope();
1139 } 1138 }
1140 1139
1141 if (s->is_eval_scope()) { 1140 if (s->is_eval_scope()) {
1142 Label loop, fast; 1141 Label loop, fast;
1143 if (!current.is(next)) { 1142 if (!current.is(next)) {
1144 __ Move(next, current); 1143 __ Move(next, current);
1145 } 1144 }
1146 __ bind(&loop); 1145 __ bind(&loop);
1147 // Terminate at global context. 1146 // Terminate at global context.
1148 __ ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset)); 1147 __ ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset));
1149 __ LoadRoot(ip, Heap::kGlobalContextMapRootIndex); 1148 __ LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
1150 __ cmp(temp, ip); 1149 __ cmp(temp, ip);
1151 __ b(eq, &fast); 1150 __ b(eq, &fast);
1152 // Check that extension is NULL. 1151 // Check that extension is NULL.
1153 __ ldr(temp, ContextOperand(next, Context::EXTENSION_INDEX)); 1152 __ ldr(temp, ContextOperand(next, Context::EXTENSION_INDEX));
1154 __ tst(temp, temp); 1153 __ tst(temp, temp);
1155 __ b(ne, slow); 1154 __ b(ne, slow);
1156 // Load next context in chain. 1155 // Load next context in chain.
1157 __ ldr(next, ContextOperand(next, Context::CLOSURE_INDEX)); 1156 __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX));
1158 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
1159 __ b(&loop); 1157 __ b(&loop);
1160 __ bind(&fast); 1158 __ bind(&fast);
1161 } 1159 }
1162 1160
1163 __ ldr(r0, GlobalObjectOperand()); 1161 __ ldr(r0, GlobalObjectOperand());
1164 __ mov(r2, Operand(slot->var()->name())); 1162 __ mov(r2, Operand(slot->var()->name()));
1165 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) 1163 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
1166 ? RelocInfo::CODE_TARGET 1164 ? RelocInfo::CODE_TARGET
1167 : RelocInfo::CODE_TARGET_CONTEXT; 1165 : RelocInfo::CODE_TARGET_CONTEXT;
1168 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 1166 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
(...skipping 10 matching lines...) Expand all
1179 Register temp = r4; 1177 Register temp = r4;
1180 1178
1181 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { 1179 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) {
1182 if (s->num_heap_slots() > 0) { 1180 if (s->num_heap_slots() > 0) {
1183 if (s->calls_eval()) { 1181 if (s->calls_eval()) {
1184 // Check that extension is NULL. 1182 // Check that extension is NULL.
1185 __ ldr(temp, ContextOperand(context, Context::EXTENSION_INDEX)); 1183 __ ldr(temp, ContextOperand(context, Context::EXTENSION_INDEX));
1186 __ tst(temp, temp); 1184 __ tst(temp, temp);
1187 __ b(ne, slow); 1185 __ b(ne, slow);
1188 } 1186 }
1189 __ ldr(next, ContextOperand(context, Context::CLOSURE_INDEX)); 1187 __ ldr(next, ContextOperand(context, Context::PREVIOUS_INDEX));
1190 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
1191 // Walk the rest of the chain without clobbering cp. 1188 // Walk the rest of the chain without clobbering cp.
1192 context = next; 1189 context = next;
1193 } 1190 }
1194 } 1191 }
1195 // Check that last extension is NULL. 1192 // Check that last extension is NULL.
1196 __ ldr(temp, ContextOperand(context, Context::EXTENSION_INDEX)); 1193 __ ldr(temp, ContextOperand(context, Context::EXTENSION_INDEX));
1197 __ tst(temp, temp); 1194 __ tst(temp, temp);
1198 __ b(ne, slow); 1195 __ b(ne, slow);
1199 1196
1200 // This function is used only for loads, not stores, so it's safe to 1197 // This function is used only for loads, not stores, so it's safe to
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
4367 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4364 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4368 __ add(pc, r1, Operand(masm_->CodeObject())); 4365 __ add(pc, r1, Operand(masm_->CodeObject()));
4369 } 4366 }
4370 4367
4371 4368
4372 #undef __ 4369 #undef __
4373 4370
4374 } } // namespace v8::internal 4371 } } // namespace v8::internal
4375 4372
4376 #endif // V8_TARGET_ARCH_ARM 4373 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698