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

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

Issue 976053002: Fix exception for assignment to uninitialised const (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 MemOperand location = VarOperand(var, x1); 2440 MemOperand location = VarOperand(var, x1);
2441 __ Ldr(x10, location); 2441 __ Ldr(x10, location);
2442 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); 2442 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign);
2443 __ Mov(x10, Operand(var->name())); 2443 __ Mov(x10, Operand(var->name()));
2444 __ Push(x10); 2444 __ Push(x10);
2445 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2445 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2446 // Perform the assignment. 2446 // Perform the assignment.
2447 __ Bind(&assign); 2447 __ Bind(&assign);
2448 EmitStoreToStackLocalOrContextSlot(var, location); 2448 EmitStoreToStackLocalOrContextSlot(var, location);
2449 2449
2450 } else if (var->mode() == CONST && op != Token::INIT_CONST) {
Dmitry Lomov (no reviews) 2015/03/04 17:57:35 Looks like the case at line 2488 anymore should be
2451 // Assignment to const variable needs a write barrier.
2452 DCHECK(!var->IsLookupSlot());
2453 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2454 Label const_error;
2455 MemOperand location = VarOperand(var, x1);
2456 __ Ldr(x10, location);
2457 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &const_error);
2458 __ Mov(x10, Operand(var->name()));
2459 __ Push(x10);
2460 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2461 __ Bind(&const_error);
2462 __ CallRuntime(Runtime::kThrowConstAssignError, 0);
2463
2450 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { 2464 } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
2451 if (var->IsLookupSlot()) { 2465 if (var->IsLookupSlot()) {
2452 // Assignment to var. 2466 // Assignment to var.
2453 __ Mov(x11, Operand(var->name())); 2467 __ Mov(x11, Operand(var->name()));
2454 __ Mov(x10, Smi::FromInt(language_mode())); 2468 __ Mov(x10, Smi::FromInt(language_mode()));
2455 // jssp[0] : mode. 2469 // jssp[0] : mode.
2456 // jssp[8] : name. 2470 // jssp[8] : name.
2457 // jssp[16] : context. 2471 // jssp[16] : context.
2458 // jssp[24] : value. 2472 // jssp[24] : value.
2459 __ Push(x0, cp, x11, x10); 2473 __ Push(x0, cp, x11, x10);
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
5480 return previous_; 5494 return previous_;
5481 } 5495 }
5482 5496
5483 5497
5484 #undef __ 5498 #undef __
5485 5499
5486 5500
5487 } } // namespace v8::internal 5501 } } // namespace v8::internal
5488 5502
5489 #endif // V8_TARGET_ARCH_ARM64 5503 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698