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

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

Issue 1491453002: PPC: [runtime] Use "the hole" instead of smi 0 as sentinel for context extension. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@patch13
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 TypeofMode typeof_mode, 1228 TypeofMode typeof_mode,
1229 Label* slow) { 1229 Label* slow) {
1230 Register current = cp; 1230 Register current = cp;
1231 Register next = r4; 1231 Register next = r4;
1232 Register temp = r5; 1232 Register temp = r5;
1233 1233
1234 Scope* s = scope(); 1234 Scope* s = scope();
1235 while (s != NULL) { 1235 while (s != NULL) {
1236 if (s->num_heap_slots() > 0) { 1236 if (s->num_heap_slots() > 0) {
1237 if (s->calls_sloppy_eval()) { 1237 if (s->calls_sloppy_eval()) {
1238 // Check that extension is NULL. 1238 // Check that extension is "the hole".
1239 __ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); 1239 __ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX));
1240 __ cmpi(temp, Operand::Zero()); 1240 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
1241 __ bne(slow);
1242 } 1241 }
1243 // Load next context in chain. 1242 // Load next context in chain.
1244 __ LoadP(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); 1243 __ LoadP(next, ContextMemOperand(current, Context::PREVIOUS_INDEX));
1245 // Walk the rest of the chain without clobbering cp. 1244 // Walk the rest of the chain without clobbering cp.
1246 current = next; 1245 current = next;
1247 } 1246 }
1248 // If no outer scope calls eval, we do not need to check more 1247 // If no outer scope calls eval, we do not need to check more
1249 // context extensions. 1248 // context extensions.
1250 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; 1249 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
1251 s = s->outer_scope(); 1250 s = s->outer_scope();
1252 } 1251 }
1253 1252
1254 if (s->is_eval_scope()) { 1253 if (s->is_eval_scope()) {
1255 Label loop, fast; 1254 Label loop, fast;
1256 if (!current.is(next)) { 1255 if (!current.is(next)) {
1257 __ Move(next, current); 1256 __ Move(next, current);
1258 } 1257 }
1259 __ bind(&loop); 1258 __ bind(&loop);
1260 // Terminate at native context. 1259 // Terminate at native context.
1261 __ LoadP(temp, FieldMemOperand(next, HeapObject::kMapOffset)); 1260 __ LoadP(temp, FieldMemOperand(next, HeapObject::kMapOffset));
1262 __ LoadRoot(ip, Heap::kNativeContextMapRootIndex); 1261 __ LoadRoot(ip, Heap::kNativeContextMapRootIndex);
1263 __ cmp(temp, ip); 1262 __ cmp(temp, ip);
1264 __ beq(&fast); 1263 __ beq(&fast);
1265 // Check that extension is NULL. 1264 // Check that extension is "the hole".
1266 __ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); 1265 __ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
1267 __ cmpi(temp, Operand::Zero()); 1266 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
1268 __ bne(slow);
1269 // Load next context in chain. 1267 // Load next context in chain.
1270 __ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); 1268 __ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
1271 __ b(&loop); 1269 __ b(&loop);
1272 __ bind(&fast); 1270 __ bind(&fast);
1273 } 1271 }
1274 1272
1275 // All extension objects were empty and it is safe to use a normal global 1273 // All extension objects were empty and it is safe to use a normal global
1276 // load machinery. 1274 // load machinery.
1277 EmitGlobalVariableLoad(proxy, typeof_mode); 1275 EmitGlobalVariableLoad(proxy, typeof_mode);
1278 } 1276 }
1279 1277
1280 1278
1281 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, 1279 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
1282 Label* slow) { 1280 Label* slow) {
1283 DCHECK(var->IsContextSlot()); 1281 DCHECK(var->IsContextSlot());
1284 Register context = cp; 1282 Register context = cp;
1285 Register next = r6; 1283 Register next = r6;
1286 Register temp = r7; 1284 Register temp = r7;
1287 1285
1288 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { 1286 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) {
1289 if (s->num_heap_slots() > 0) { 1287 if (s->num_heap_slots() > 0) {
1290 if (s->calls_sloppy_eval()) { 1288 if (s->calls_sloppy_eval()) {
1291 // Check that extension is NULL. 1289 // Check that extension is "the hole".
1292 __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); 1290 __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX));
1293 __ cmpi(temp, Operand::Zero()); 1291 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
1294 __ bne(slow);
1295 } 1292 }
1296 __ LoadP(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); 1293 __ LoadP(next, ContextMemOperand(context, Context::PREVIOUS_INDEX));
1297 // Walk the rest of the chain without clobbering cp. 1294 // Walk the rest of the chain without clobbering cp.
1298 context = next; 1295 context = next;
1299 } 1296 }
1300 } 1297 }
1301 // Check that last extension is NULL. 1298 // Check that last extension is "the hole".
1302 __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); 1299 __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX));
1303 __ cmpi(temp, Operand::Zero()); 1300 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
1304 __ bne(slow);
1305 1301
1306 // This function is used only for loads, not stores, so it's safe to 1302 // This function is used only for loads, not stores, so it's safe to
1307 // return an cp-based operand (the write barrier cannot be allowed to 1303 // return an cp-based operand (the write barrier cannot be allowed to
1308 // destroy the cp register). 1304 // destroy the cp register).
1309 return ContextMemOperand(context, var->index()); 1305 return ContextMemOperand(context, var->index());
1310 } 1306 }
1311 1307
1312 1308
1313 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, 1309 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
1314 TypeofMode typeof_mode, 1310 TypeofMode typeof_mode,
(...skipping 3640 matching lines...) Expand 10 before | Expand all | Expand 10 after
4955 return ON_STACK_REPLACEMENT; 4951 return ON_STACK_REPLACEMENT;
4956 } 4952 }
4957 4953
4958 DCHECK(interrupt_address == 4954 DCHECK(interrupt_address ==
4959 isolate->builtins()->OsrAfterStackCheck()->entry()); 4955 isolate->builtins()->OsrAfterStackCheck()->entry());
4960 return OSR_AFTER_STACK_CHECK; 4956 return OSR_AFTER_STACK_CHECK;
4961 } 4957 }
4962 } // namespace internal 4958 } // namespace internal
4963 } // namespace v8 4959 } // namespace v8
4964 #endif // V8_TARGET_ARCH_PPC 4960 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698