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

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

Issue 2233673003: Remove CONST_LEGACY VariableMode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 3 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
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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 if (var->binding_needs_init()) { 2165 if (var->binding_needs_init()) {
2166 Label assign; 2166 Label assign;
2167 __ lw(a3, location); 2167 __ lw(a3, location);
2168 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2168 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2169 __ Branch(&assign, ne, a3, Operand(t0)); 2169 __ Branch(&assign, ne, a3, Operand(t0));
2170 __ li(a3, Operand(var->name())); 2170 __ li(a3, Operand(var->name()));
2171 __ push(a3); 2171 __ push(a3);
2172 __ CallRuntime(Runtime::kThrowReferenceError); 2172 __ CallRuntime(Runtime::kThrowReferenceError);
2173 __ bind(&assign); 2173 __ bind(&assign);
2174 } 2174 }
2175 if (var->mode() == CONST) { 2175 if (var->mode() != CONST) {
2176 EmitStoreToStackLocalOrContextSlot(var, location);
2177 } else if (var->throw_on_const_assignment(language_mode())) {
2176 __ CallRuntime(Runtime::kThrowConstAssignError); 2178 __ CallRuntime(Runtime::kThrowConstAssignError);
2177 } else {
2178 EmitStoreToStackLocalOrContextSlot(var, location);
2179 } 2179 }
2180 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { 2180 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) {
2181 // Initializing assignment to const {this} needs a write barrier. 2181 // Initializing assignment to const {this} needs a write barrier.
2182 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2182 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2183 Label uninitialized_this; 2183 Label uninitialized_this;
2184 MemOperand location = VarOperand(var, a1); 2184 MemOperand location = VarOperand(var, a1);
2185 __ lw(a3, location); 2185 __ lw(a3, location);
2186 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 2186 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
2187 __ Branch(&uninitialized_this, eq, a3, Operand(at)); 2187 __ Branch(&uninitialized_this, eq, a3, Operand(at));
2188 __ li(a0, Operand(var->name())); 2188 __ li(a0, Operand(var->name()));
2189 __ Push(a0); 2189 __ Push(a0);
2190 __ CallRuntime(Runtime::kThrowReferenceError); 2190 __ CallRuntime(Runtime::kThrowReferenceError);
2191 __ bind(&uninitialized_this); 2191 __ bind(&uninitialized_this);
2192 EmitStoreToStackLocalOrContextSlot(var, location); 2192 EmitStoreToStackLocalOrContextSlot(var, location);
2193 2193
2194 } else if (!var->is_const_mode() || op == Token::INIT) { 2194 } else {
2195 DCHECK(var->mode() != CONST || op == Token::INIT);
2195 if (var->IsLookupSlot()) { 2196 if (var->IsLookupSlot()) {
2196 // Assignment to var. 2197 // Assignment to var.
2197 __ Push(var->name()); 2198 __ Push(var->name());
2198 __ Push(v0); 2199 __ Push(v0);
2199 __ CallRuntime(is_strict(language_mode()) 2200 __ CallRuntime(is_strict(language_mode())
2200 ? Runtime::kStoreLookupSlot_Strict 2201 ? Runtime::kStoreLookupSlot_Strict
2201 : Runtime::kStoreLookupSlot_Sloppy); 2202 : Runtime::kStoreLookupSlot_Sloppy);
2202 } else { 2203 } else {
2203 // Assignment to var or initializing assignment to let/const in harmony 2204 // Assignment to var or initializing assignment to let/const in harmony
2204 // mode. 2205 // mode.
2205 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2206 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2206 MemOperand location = VarOperand(var, a1); 2207 MemOperand location = VarOperand(var, a1);
2207 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { 2208 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
2208 // Check for an uninitialized let binding. 2209 // Check for an uninitialized let binding.
2209 __ lw(a2, location); 2210 __ lw(a2, location);
2210 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2211 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2211 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0)); 2212 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0));
2212 } 2213 }
2213 EmitStoreToStackLocalOrContextSlot(var, location); 2214 EmitStoreToStackLocalOrContextSlot(var, location);
2214 } 2215 }
2215
2216 } else {
2217 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT);
2218 if (is_strict(language_mode())) {
2219 __ CallRuntime(Runtime::kThrowConstAssignError);
2220 }
2221 // Silently ignore store in sloppy mode.
2222 } 2216 }
2223 } 2217 }
2224 2218
2225 2219
2226 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2220 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2227 // Assignment to a property, using a named store IC. 2221 // Assignment to a property, using a named store IC.
2228 Property* prop = expr->target()->AsProperty(); 2222 Property* prop = expr->target()->AsProperty();
2229 DCHECK(prop != NULL); 2223 DCHECK(prop != NULL);
2230 DCHECK(prop->key()->IsLiteral()); 2224 DCHECK(prop->key()->IsLiteral());
2231 2225
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 reinterpret_cast<uint32_t>( 3751 reinterpret_cast<uint32_t>(
3758 isolate->builtins()->OnStackReplacement()->entry())); 3752 isolate->builtins()->OnStackReplacement()->entry()));
3759 return ON_STACK_REPLACEMENT; 3753 return ON_STACK_REPLACEMENT;
3760 } 3754 }
3761 3755
3762 3756
3763 } // namespace internal 3757 } // namespace internal
3764 } // namespace v8 3758 } // namespace v8
3765 3759
3766 #endif // V8_TARGET_ARCH_MIPS 3760 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698