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

Side by Side Diff: src/mips/full-codegen-mips.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 | « no previous file | src/mips64/full-codegen-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 MemOperand location = VarOperand(var, a1); 2635 MemOperand location = VarOperand(var, a1);
2636 __ lw(a3, location); 2636 __ lw(a3, location);
2637 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2637 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2638 __ Branch(&assign, ne, a3, Operand(t0)); 2638 __ Branch(&assign, ne, a3, Operand(t0));
2639 __ li(a3, Operand(var->name())); 2639 __ li(a3, Operand(var->name()));
2640 __ push(a3); 2640 __ push(a3);
2641 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2641 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2642 // Perform the assignment. 2642 // Perform the assignment.
2643 __ bind(&assign); 2643 __ bind(&assign);
2644 EmitStoreToStackLocalOrContextSlot(var, location); 2644 EmitStoreToStackLocalOrContextSlot(var, location);
2645
2646 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { 2645 } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
2647 if (var->IsLookupSlot()) { 2646 if (var->IsLookupSlot()) {
2648 // Assignment to var. 2647 // Assignment to var.
2649 __ li(a1, Operand(var->name())); 2648 __ li(a1, Operand(var->name()));
2650 __ li(a0, Operand(Smi::FromInt(strict_mode()))); 2649 __ li(a0, Operand(Smi::FromInt(strict_mode())));
2651 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode. 2650 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode.
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 __ lw(a2, location); 2659 __ lw(a2, location);
2661 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2660 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2662 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0)); 2661 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0));
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 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after
5237 Assembler::target_address_at(pc_immediate_load_address)) == 5237 Assembler::target_address_at(pc_immediate_load_address)) ==
5238 reinterpret_cast<uint32_t>( 5238 reinterpret_cast<uint32_t>(
5239 isolate->builtins()->OsrAfterStackCheck()->entry())); 5239 isolate->builtins()->OsrAfterStackCheck()->entry()));
5240 return OSR_AFTER_STACK_CHECK; 5240 return OSR_AFTER_STACK_CHECK;
5241 } 5241 }
5242 5242
5243 5243
5244 } } // namespace v8::internal 5244 } } // namespace v8::internal
5245 5245
5246 #endif // V8_TARGET_ARCH_MIPS 5246 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698