OLD | NEW |
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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 Loading... |
2165 if (var->binding_needs_init()) { | 2165 if (var->binding_needs_init()) { |
2166 Label assign; | 2166 Label assign; |
2167 __ ld(a3, location); | 2167 __ ld(a3, location); |
2168 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); | 2168 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); |
2169 __ Branch(&assign, ne, a3, Operand(a4)); | 2169 __ Branch(&assign, ne, a3, Operand(a4)); |
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 __ ld(a3, location); | 2185 __ ld(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 __ Push(var->name()); | 2197 __ Push(var->name()); |
2197 __ Push(v0); | 2198 __ Push(v0); |
2198 __ CallRuntime(is_strict(language_mode()) | 2199 __ CallRuntime(is_strict(language_mode()) |
2199 ? Runtime::kStoreLookupSlot_Strict | 2200 ? Runtime::kStoreLookupSlot_Strict |
2200 : Runtime::kStoreLookupSlot_Sloppy); | 2201 : Runtime::kStoreLookupSlot_Sloppy); |
2201 } else { | 2202 } else { |
2202 // Assignment to var or initializing assignment to let/const in harmony | 2203 // Assignment to var or initializing assignment to let/const in harmony |
2203 // mode. | 2204 // mode. |
2204 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); | 2205 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); |
2205 MemOperand location = VarOperand(var, a1); | 2206 MemOperand location = VarOperand(var, a1); |
2206 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { | 2207 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
2207 // Check for an uninitialized let binding. | 2208 // Check for an uninitialized let binding. |
2208 __ ld(a2, location); | 2209 __ ld(a2, location); |
2209 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); | 2210 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); |
2210 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4)); | 2211 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4)); |
2211 } | 2212 } |
2212 EmitStoreToStackLocalOrContextSlot(var, location); | 2213 EmitStoreToStackLocalOrContextSlot(var, location); |
2213 } | 2214 } |
2214 | |
2215 } else { | |
2216 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); | |
2217 if (is_strict(language_mode())) { | |
2218 __ CallRuntime(Runtime::kThrowConstAssignError); | |
2219 } | |
2220 // Silently ignore store in sloppy mode. | |
2221 } | 2215 } |
2222 } | 2216 } |
2223 | 2217 |
2224 | 2218 |
2225 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2219 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2226 // Assignment to a property, using a named store IC. | 2220 // Assignment to a property, using a named store IC. |
2227 Property* prop = expr->target()->AsProperty(); | 2221 Property* prop = expr->target()->AsProperty(); |
2228 DCHECK(prop != NULL); | 2222 DCHECK(prop != NULL); |
2229 DCHECK(prop->key()->IsLiteral()); | 2223 DCHECK(prop->key()->IsLiteral()); |
2230 | 2224 |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3764 reinterpret_cast<uint64_t>( | 3758 reinterpret_cast<uint64_t>( |
3765 isolate->builtins()->OnStackReplacement()->entry())); | 3759 isolate->builtins()->OnStackReplacement()->entry())); |
3766 return ON_STACK_REPLACEMENT; | 3760 return ON_STACK_REPLACEMENT; |
3767 } | 3761 } |
3768 | 3762 |
3769 | 3763 |
3770 } // namespace internal | 3764 } // namespace internal |
3771 } // namespace v8 | 3765 } // namespace v8 |
3772 | 3766 |
3773 #endif // V8_TARGET_ARCH_MIPS64 | 3767 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |