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

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

Issue 766703002: MIPS: harmony-scoping: make assignment to 'const' a late error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 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 | « src/mips/full-codegen-mips.cc ('k') | 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 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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 MemOperand location = VarOperand(var, a1); 2631 MemOperand location = VarOperand(var, a1);
2632 __ ld(a3, location); 2632 __ ld(a3, location);
2633 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2633 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2634 __ Branch(&assign, ne, a3, Operand(a4)); 2634 __ Branch(&assign, ne, a3, Operand(a4));
2635 __ li(a3, Operand(var->name())); 2635 __ li(a3, Operand(var->name()));
2636 __ push(a3); 2636 __ push(a3);
2637 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2637 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2638 // Perform the assignment. 2638 // Perform the assignment.
2639 __ bind(&assign); 2639 __ bind(&assign);
2640 EmitStoreToStackLocalOrContextSlot(var, location); 2640 EmitStoreToStackLocalOrContextSlot(var, location);
2641
2642 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { 2641 } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
2643 if (var->IsLookupSlot()) { 2642 if (var->IsLookupSlot()) {
2644 // Assignment to var. 2643 // Assignment to var.
2645 __ li(a4, Operand(var->name())); 2644 __ li(a4, Operand(var->name()));
2646 __ li(a3, Operand(Smi::FromInt(strict_mode()))); 2645 __ li(a3, Operand(Smi::FromInt(strict_mode())));
2647 // jssp[0] : mode. 2646 // jssp[0] : mode.
2648 // jssp[8] : name. 2647 // jssp[8] : name.
2649 // jssp[16] : context. 2648 // jssp[16] : context.
2650 // jssp[24] : value. 2649 // jssp[24] : value.
2651 __ Push(v0, cp, a4, a3); 2650 __ Push(v0, cp, a4, a3);
2652 __ CallRuntime(Runtime::kStoreLookupSlot, 4); 2651 __ CallRuntime(Runtime::kStoreLookupSlot, 4);
2653 } else { 2652 } else {
2654 // Assignment to var or initializing assignment to let/const in harmony 2653 // Assignment to var or initializing assignment to let/const in harmony
2655 // mode. 2654 // mode.
2656 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2655 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2657 MemOperand location = VarOperand(var, a1); 2656 MemOperand location = VarOperand(var, a1);
2658 if (generate_debug_code_ && op == Token::INIT_LET) { 2657 if (generate_debug_code_ && op == Token::INIT_LET) {
2659 // Check for an uninitialized let binding. 2658 // Check for an uninitialized let binding.
2660 __ ld(a2, location); 2659 __ ld(a2, location);
2661 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2660 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2662 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4)); 2661 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4));
2663 } 2662 }
2664 EmitStoreToStackLocalOrContextSlot(var, location); 2663 EmitStoreToStackLocalOrContextSlot(var, location);
2665 } 2664 }
2665 } else if (IsSignallingAssignmentToConst(var, op, strict_mode())) {
2666 __ CallRuntime(Runtime::kThrowConstAssignError, 0);
2666 } 2667 }
2667 // Non-initializing assignments to consts are ignored.
2668 } 2668 }
2669 2669
2670 2670
2671 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2671 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2672 // Assignment to a property, using a named store IC. 2672 // Assignment to a property, using a named store IC.
2673 Property* prop = expr->target()->AsProperty(); 2673 Property* prop = expr->target()->AsProperty();
2674 DCHECK(prop != NULL); 2674 DCHECK(prop != NULL);
2675 DCHECK(prop->key()->IsLiteral()); 2675 DCHECK(prop->key()->IsLiteral());
2676 2676
2677 // Record source code position before IC call. 2677 // Record source code position before IC call.
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 Assembler::target_address_at(pc_immediate_load_address)) == 5241 Assembler::target_address_at(pc_immediate_load_address)) ==
5242 reinterpret_cast<uint64_t>( 5242 reinterpret_cast<uint64_t>(
5243 isolate->builtins()->OsrAfterStackCheck()->entry())); 5243 isolate->builtins()->OsrAfterStackCheck()->entry()));
5244 return OSR_AFTER_STACK_CHECK; 5244 return OSR_AFTER_STACK_CHECK;
5245 } 5245 }
5246 5246
5247 5247
5248 } } // namespace v8::internal 5248 } } // namespace v8::internal
5249 5249
5250 #endif // V8_TARGET_ARCH_MIPS64 5250 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698