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

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

Issue 976053002: Fix exception for assignment to uninitialised const (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Jeez 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 | « no previous file | src/arm64/full-codegen-arm64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 7 #if V8_TARGET_ARCH_ARM
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 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 __ ldr(r3, location); 2754 __ ldr(r3, location);
2755 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); 2755 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
2756 __ b(ne, &assign); 2756 __ b(ne, &assign);
2757 __ mov(r3, Operand(var->name())); 2757 __ mov(r3, Operand(var->name()));
2758 __ push(r3); 2758 __ push(r3);
2759 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2759 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2760 // Perform the assignment. 2760 // Perform the assignment.
2761 __ bind(&assign); 2761 __ bind(&assign);
2762 EmitStoreToStackLocalOrContextSlot(var, location); 2762 EmitStoreToStackLocalOrContextSlot(var, location);
2763 2763
2764 } 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 2800 anymore should be
2765 // Assignment to const variable needs a write barrier.
2766 DCHECK(!var->IsLookupSlot());
2767 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2768 Label const_error;
2769 MemOperand location = VarOperand(var, r1);
2770 __ ldr(r3, location);
2771 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
2772 __ b(ne, &const_error);
2773 __ mov(r3, Operand(var->name()));
2774 __ push(r3);
2775 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2776 __ bind(&const_error);
2777 __ CallRuntime(Runtime::kThrowConstAssignError, 0);
2778
2764 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { 2779 } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
2765 if (var->IsLookupSlot()) { 2780 if (var->IsLookupSlot()) {
2766 // Assignment to var. 2781 // Assignment to var.
2767 __ push(r0); // Value. 2782 __ push(r0); // Value.
2768 __ mov(r1, Operand(var->name())); 2783 __ mov(r1, Operand(var->name()));
2769 __ mov(r0, Operand(Smi::FromInt(language_mode()))); 2784 __ mov(r0, Operand(Smi::FromInt(language_mode())));
2770 __ Push(cp, r1, r0); // Context, name, language mode. 2785 __ Push(cp, r1, r0); // Context, name, language mode.
2771 __ CallRuntime(Runtime::kStoreLookupSlot, 4); 2786 __ CallRuntime(Runtime::kStoreLookupSlot, 4);
2772 } else { 2787 } else {
2773 // Assignment to var or initializing assignment to let/const in harmony 2788 // Assignment to var or initializing assignment to let/const in harmony
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5502 5517
5503 DCHECK(interrupt_address == 5518 DCHECK(interrupt_address ==
5504 isolate->builtins()->OsrAfterStackCheck()->entry()); 5519 isolate->builtins()->OsrAfterStackCheck()->entry());
5505 return OSR_AFTER_STACK_CHECK; 5520 return OSR_AFTER_STACK_CHECK;
5506 } 5521 }
5507 5522
5508 5523
5509 } } // namespace v8::internal 5524 } } // namespace v8::internal
5510 5525
5511 #endif // V8_TARGET_ARCH_ARM 5526 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698