| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 TypeofMode typeof_mode, | 1257 TypeofMode typeof_mode, |
| 1258 Label* slow) { | 1258 Label* slow) { |
| 1259 Register current = cp; | 1259 Register current = cp; |
| 1260 Register next = x10; | 1260 Register next = x10; |
| 1261 Register temp = x11; | 1261 Register temp = x11; |
| 1262 | 1262 |
| 1263 Scope* s = scope(); | 1263 Scope* s = scope(); |
| 1264 while (s != NULL) { | 1264 while (s != NULL) { |
| 1265 if (s->num_heap_slots() > 0) { | 1265 if (s->num_heap_slots() > 0) { |
| 1266 if (s->calls_sloppy_eval()) { | 1266 if (s->calls_sloppy_eval()) { |
| 1267 // Check that extension is NULL. | 1267 // Check that extension is "the hole". |
| 1268 __ Ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); | 1268 __ Ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); |
| 1269 __ Cbnz(temp, slow); | 1269 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
| 1270 } | 1270 } |
| 1271 // Load next context in chain. | 1271 // Load next context in chain. |
| 1272 __ Ldr(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); | 1272 __ Ldr(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); |
| 1273 // Walk the rest of the chain without clobbering cp. | 1273 // Walk the rest of the chain without clobbering cp. |
| 1274 current = next; | 1274 current = next; |
| 1275 } | 1275 } |
| 1276 // If no outer scope calls eval, we do not need to check more | 1276 // If no outer scope calls eval, we do not need to check more |
| 1277 // context extensions. | 1277 // context extensions. |
| 1278 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; | 1278 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; |
| 1279 s = s->outer_scope(); | 1279 s = s->outer_scope(); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 if (s->is_eval_scope()) { | 1282 if (s->is_eval_scope()) { |
| 1283 Label loop, fast; | 1283 Label loop, fast; |
| 1284 __ Mov(next, current); | 1284 __ Mov(next, current); |
| 1285 | 1285 |
| 1286 __ Bind(&loop); | 1286 __ Bind(&loop); |
| 1287 // Terminate at native context. | 1287 // Terminate at native context. |
| 1288 __ Ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset)); | 1288 __ Ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset)); |
| 1289 __ JumpIfRoot(temp, Heap::kNativeContextMapRootIndex, &fast); | 1289 __ JumpIfRoot(temp, Heap::kNativeContextMapRootIndex, &fast); |
| 1290 // Check that extension is NULL. | 1290 // Check that extension is "the hole". |
| 1291 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); | 1291 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); |
| 1292 __ Cbnz(temp, slow); | 1292 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
| 1293 // Load next context in chain. | 1293 // Load next context in chain. |
| 1294 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); | 1294 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); |
| 1295 __ B(&loop); | 1295 __ B(&loop); |
| 1296 __ Bind(&fast); | 1296 __ Bind(&fast); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 // All extension objects were empty and it is safe to use a normal global | 1299 // All extension objects were empty and it is safe to use a normal global |
| 1300 // load machinery. | 1300 // load machinery. |
| 1301 EmitGlobalVariableLoad(proxy, typeof_mode); | 1301 EmitGlobalVariableLoad(proxy, typeof_mode); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 | 1304 |
| 1305 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1305 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1306 Label* slow) { | 1306 Label* slow) { |
| 1307 DCHECK(var->IsContextSlot()); | 1307 DCHECK(var->IsContextSlot()); |
| 1308 Register context = cp; | 1308 Register context = cp; |
| 1309 Register next = x10; | 1309 Register next = x10; |
| 1310 Register temp = x11; | 1310 Register temp = x11; |
| 1311 | 1311 |
| 1312 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { | 1312 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { |
| 1313 if (s->num_heap_slots() > 0) { | 1313 if (s->num_heap_slots() > 0) { |
| 1314 if (s->calls_sloppy_eval()) { | 1314 if (s->calls_sloppy_eval()) { |
| 1315 // Check that extension is NULL. | 1315 // Check that extension is "the hole". |
| 1316 __ Ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); | 1316 __ Ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); |
| 1317 __ Cbnz(temp, slow); | 1317 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
| 1318 } | 1318 } |
| 1319 __ Ldr(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 1319 __ Ldr(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); |
| 1320 // Walk the rest of the chain without clobbering cp. | 1320 // Walk the rest of the chain without clobbering cp. |
| 1321 context = next; | 1321 context = next; |
| 1322 } | 1322 } |
| 1323 } | 1323 } |
| 1324 // Check that last extension is NULL. | 1324 // Check that last extension is "the hole". |
| 1325 __ Ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); | 1325 __ Ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); |
| 1326 __ Cbnz(temp, slow); | 1326 __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
| 1327 | 1327 |
| 1328 // This function is used only for loads, not stores, so it's safe to | 1328 // This function is used only for loads, not stores, so it's safe to |
| 1329 // return an cp-based operand (the write barrier cannot be allowed to | 1329 // return an cp-based operand (the write barrier cannot be allowed to |
| 1330 // destroy the cp register). | 1330 // destroy the cp register). |
| 1331 return ContextMemOperand(context, var->index()); | 1331 return ContextMemOperand(context, var->index()); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 | 1334 |
| 1335 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, | 1335 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, |
| 1336 TypeofMode typeof_mode, | 1336 TypeofMode typeof_mode, |
| (...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4982 } | 4982 } |
| 4983 | 4983 |
| 4984 return INTERRUPT; | 4984 return INTERRUPT; |
| 4985 } | 4985 } |
| 4986 | 4986 |
| 4987 | 4987 |
| 4988 } // namespace internal | 4988 } // namespace internal |
| 4989 } // namespace v8 | 4989 } // namespace v8 |
| 4990 | 4990 |
| 4991 #endif // V8_TARGET_ARCH_ARM64 | 4991 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |