| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2285 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| 2286 FeedbackVectorSlot slot) { | 2286 FeedbackVectorSlot slot) { |
| 2287 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); | 2287 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); |
| 2288 if (var->IsUnallocated()) { | 2288 if (var->IsUnallocated()) { |
| 2289 // Global var, const, or let. | 2289 // Global var, const, or let. |
| 2290 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2290 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
| 2291 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 2291 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
| 2292 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2292 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
| 2293 CallStoreIC(); | 2293 CallStoreIC(); |
| 2294 | 2294 |
| 2295 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2295 } else if (var->mode() == LET && op != Token::INIT) { |
| 2296 // Non-initializing assignment to let variable needs a write barrier. | 2296 // Non-initializing assignment to let variable needs a write barrier. |
| 2297 DCHECK(!var->IsLookupSlot()); | 2297 DCHECK(!var->IsLookupSlot()); |
| 2298 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2298 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2299 Label assign; | 2299 Label assign; |
| 2300 MemOperand location = VarOperand(var, x1); | 2300 MemOperand location = VarOperand(var, x1); |
| 2301 __ Ldr(x10, location); | 2301 __ Ldr(x10, location); |
| 2302 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); | 2302 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); |
| 2303 __ Mov(x10, Operand(var->name())); | 2303 __ Mov(x10, Operand(var->name())); |
| 2304 __ Push(x10); | 2304 __ Push(x10); |
| 2305 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2305 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2306 // Perform the assignment. | 2306 // Perform the assignment. |
| 2307 __ Bind(&assign); | 2307 __ Bind(&assign); |
| 2308 EmitStoreToStackLocalOrContextSlot(var, location); | 2308 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2309 | 2309 |
| 2310 } else if (var->mode() == CONST && op != Token::INIT_CONST) { | 2310 } else if (var->mode() == CONST && op != Token::INIT) { |
| 2311 // Assignment to const variable needs a write barrier. | 2311 // Assignment to const variable needs a write barrier. |
| 2312 DCHECK(!var->IsLookupSlot()); | 2312 DCHECK(!var->IsLookupSlot()); |
| 2313 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2313 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2314 Label const_error; | 2314 Label const_error; |
| 2315 MemOperand location = VarOperand(var, x1); | 2315 MemOperand location = VarOperand(var, x1); |
| 2316 __ Ldr(x10, location); | 2316 __ Ldr(x10, location); |
| 2317 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &const_error); | 2317 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &const_error); |
| 2318 __ Mov(x10, Operand(var->name())); | 2318 __ Mov(x10, Operand(var->name())); |
| 2319 __ Push(x10); | 2319 __ Push(x10); |
| 2320 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2320 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2321 __ Bind(&const_error); | 2321 __ Bind(&const_error); |
| 2322 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2322 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2323 | 2323 |
| 2324 } else if (var->is_this() && op == Token::INIT_CONST) { | 2324 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
| 2325 // Initializing assignment to const {this} needs a write barrier. | 2325 // Initializing assignment to const {this} needs a write barrier. |
| 2326 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2326 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2327 Label uninitialized_this; | 2327 Label uninitialized_this; |
| 2328 MemOperand location = VarOperand(var, x1); | 2328 MemOperand location = VarOperand(var, x1); |
| 2329 __ Ldr(x10, location); | 2329 __ Ldr(x10, location); |
| 2330 __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 2330 __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
| 2331 __ Mov(x0, Operand(var->name())); | 2331 __ Mov(x0, Operand(var->name())); |
| 2332 __ Push(x0); | 2332 __ Push(x0); |
| 2333 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2333 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2334 __ bind(&uninitialized_this); | 2334 __ bind(&uninitialized_this); |
| 2335 EmitStoreToStackLocalOrContextSlot(var, location); | 2335 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2336 | 2336 |
| 2337 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 2337 } else if (!var->is_const_mode() || |
| 2338 (var->mode() == CONST && op == Token::INIT)) { |
| 2338 if (var->IsLookupSlot()) { | 2339 if (var->IsLookupSlot()) { |
| 2339 // Assignment to var. | 2340 // Assignment to var. |
| 2340 __ Mov(x11, Operand(var->name())); | 2341 __ Mov(x11, Operand(var->name())); |
| 2341 __ Mov(x10, Smi::FromInt(language_mode())); | 2342 __ Mov(x10, Smi::FromInt(language_mode())); |
| 2342 // jssp[0] : mode. | 2343 // jssp[0] : mode. |
| 2343 // jssp[8] : name. | 2344 // jssp[8] : name. |
| 2344 // jssp[16] : context. | 2345 // jssp[16] : context. |
| 2345 // jssp[24] : value. | 2346 // jssp[24] : value. |
| 2346 __ Push(x0, cp, x11, x10); | 2347 __ Push(x0, cp, x11, x10); |
| 2347 __ CallRuntime(Runtime::kStoreLookupSlot, 4); | 2348 __ CallRuntime(Runtime::kStoreLookupSlot, 4); |
| 2348 } else { | 2349 } else { |
| 2349 // Assignment to var or initializing assignment to let/const in harmony | 2350 // Assignment to var or initializing assignment to let/const in harmony |
| 2350 // mode. | 2351 // mode. |
| 2351 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2352 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2352 MemOperand location = VarOperand(var, x1); | 2353 MemOperand location = VarOperand(var, x1); |
| 2353 if (FLAG_debug_code && op == Token::INIT_LET) { | 2354 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
| 2354 __ Ldr(x10, location); | 2355 __ Ldr(x10, location); |
| 2355 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); | 2356 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); |
| 2356 __ Check(eq, kLetBindingReInitialization); | 2357 __ Check(eq, kLetBindingReInitialization); |
| 2357 } | 2358 } |
| 2358 EmitStoreToStackLocalOrContextSlot(var, location); | 2359 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2359 } | 2360 } |
| 2360 | 2361 |
| 2361 } else if (op == Token::INIT_CONST_LEGACY) { | 2362 } else if (var->mode() == CONST_LEGACY && op == Token::INIT) { |
| 2362 // Const initializers need a write barrier. | 2363 // Const initializers need a write barrier. |
| 2363 DCHECK(var->mode() == CONST_LEGACY); | |
| 2364 DCHECK(!var->IsParameter()); // No const parameters. | 2364 DCHECK(!var->IsParameter()); // No const parameters. |
| 2365 if (var->IsLookupSlot()) { | 2365 if (var->IsLookupSlot()) { |
| 2366 __ Mov(x1, Operand(var->name())); | 2366 __ Mov(x1, Operand(var->name())); |
| 2367 __ Push(x0, cp, x1); | 2367 __ Push(x0, cp, x1); |
| 2368 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); | 2368 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); |
| 2369 } else { | 2369 } else { |
| 2370 DCHECK(var->IsStackLocal() || var->IsContextSlot()); | 2370 DCHECK(var->IsStackLocal() || var->IsContextSlot()); |
| 2371 Label skip; | 2371 Label skip; |
| 2372 MemOperand location = VarOperand(var, x1); | 2372 MemOperand location = VarOperand(var, x1); |
| 2373 __ Ldr(x10, location); | 2373 __ Ldr(x10, location); |
| 2374 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &skip); | 2374 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &skip); |
| 2375 EmitStoreToStackLocalOrContextSlot(var, location); | 2375 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2376 __ Bind(&skip); | 2376 __ Bind(&skip); |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 } else { | 2379 } else { |
| 2380 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT_CONST_LEGACY); | 2380 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); |
| 2381 if (is_strict(language_mode())) { | 2381 if (is_strict(language_mode())) { |
| 2382 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2382 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2383 } | 2383 } |
| 2384 // Silently ignore store in sloppy mode. | 2384 // Silently ignore store in sloppy mode. |
| 2385 } | 2385 } |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 | 2388 |
| 2389 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2389 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2390 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); | 2390 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); |
| (...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5078 } | 5078 } |
| 5079 | 5079 |
| 5080 return INTERRUPT; | 5080 return INTERRUPT; |
| 5081 } | 5081 } |
| 5082 | 5082 |
| 5083 | 5083 |
| 5084 } // namespace internal | 5084 } // namespace internal |
| 5085 } // namespace v8 | 5085 } // namespace v8 |
| 5086 | 5086 |
| 5087 #endif // V8_TARGET_ARCH_ARM64 | 5087 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |