OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
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 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 if (var->binding_needs_init()) { | 2167 if (var->binding_needs_init()) { |
2168 Label assign; | 2168 Label assign; |
2169 __ LoadP(r6, location); | 2169 __ LoadP(r6, location); |
2170 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2170 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
2171 __ bne(&assign); | 2171 __ bne(&assign); |
2172 __ mov(r6, Operand(var->name())); | 2172 __ mov(r6, Operand(var->name())); |
2173 __ push(r6); | 2173 __ push(r6); |
2174 __ CallRuntime(Runtime::kThrowReferenceError); | 2174 __ CallRuntime(Runtime::kThrowReferenceError); |
2175 __ bind(&assign); | 2175 __ bind(&assign); |
2176 } | 2176 } |
2177 if (var->mode() == CONST) { | 2177 if (var->mode() != CONST) { |
| 2178 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2179 } else if (var->throw_on_const_assignment(language_mode())) { |
2178 __ CallRuntime(Runtime::kThrowConstAssignError); | 2180 __ CallRuntime(Runtime::kThrowConstAssignError); |
2179 } else { | |
2180 EmitStoreToStackLocalOrContextSlot(var, location); | |
2181 } | 2181 } |
2182 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { | 2182 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
2183 // Initializing assignment to const {this} needs a write barrier. | 2183 // Initializing assignment to const {this} needs a write barrier. |
2184 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2184 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2185 Label uninitialized_this; | 2185 Label uninitialized_this; |
2186 MemOperand location = VarOperand(var, r4); | 2186 MemOperand location = VarOperand(var, r4); |
2187 __ LoadP(r6, location); | 2187 __ LoadP(r6, location); |
2188 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2188 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
2189 __ beq(&uninitialized_this); | 2189 __ beq(&uninitialized_this); |
2190 __ mov(r4, Operand(var->name())); | 2190 __ mov(r4, Operand(var->name())); |
2191 __ push(r4); | 2191 __ push(r4); |
2192 __ CallRuntime(Runtime::kThrowReferenceError); | 2192 __ CallRuntime(Runtime::kThrowReferenceError); |
2193 __ bind(&uninitialized_this); | 2193 __ bind(&uninitialized_this); |
2194 EmitStoreToStackLocalOrContextSlot(var, location); | 2194 EmitStoreToStackLocalOrContextSlot(var, location); |
2195 | 2195 |
2196 } else if (!var->is_const_mode() || op == Token::INIT) { | 2196 } else { |
| 2197 DCHECK(var->mode() != CONST || op == Token::INIT); |
2197 if (var->IsLookupSlot()) { | 2198 if (var->IsLookupSlot()) { |
2198 // Assignment to var. | 2199 // Assignment to var. |
2199 __ Push(var->name()); | 2200 __ Push(var->name()); |
2200 __ Push(r3); | 2201 __ Push(r3); |
2201 __ CallRuntime(is_strict(language_mode()) | 2202 __ CallRuntime(is_strict(language_mode()) |
2202 ? Runtime::kStoreLookupSlot_Strict | 2203 ? Runtime::kStoreLookupSlot_Strict |
2203 : Runtime::kStoreLookupSlot_Sloppy); | 2204 : Runtime::kStoreLookupSlot_Sloppy); |
2204 } else { | 2205 } else { |
2205 // Assignment to var or initializing assignment to let/const in harmony | 2206 // Assignment to var or initializing assignment to let/const in harmony |
2206 // mode. | 2207 // mode. |
2207 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); | 2208 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); |
2208 MemOperand location = VarOperand(var, r4); | 2209 MemOperand location = VarOperand(var, r4); |
2209 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { | 2210 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
2210 // Check for an uninitialized let binding. | 2211 // Check for an uninitialized let binding. |
2211 __ LoadP(r5, location); | 2212 __ LoadP(r5, location); |
2212 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); | 2213 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); |
2213 __ Check(eq, kLetBindingReInitialization); | 2214 __ Check(eq, kLetBindingReInitialization); |
2214 } | 2215 } |
2215 EmitStoreToStackLocalOrContextSlot(var, location); | 2216 EmitStoreToStackLocalOrContextSlot(var, location); |
2216 } | 2217 } |
2217 } else { | |
2218 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); | |
2219 if (is_strict(language_mode())) { | |
2220 __ CallRuntime(Runtime::kThrowConstAssignError); | |
2221 } | |
2222 // Silently ignore store in sloppy mode. | |
2223 } | 2218 } |
2224 } | 2219 } |
2225 | 2220 |
2226 | 2221 |
2227 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2222 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2228 // Assignment to a property, using a named store IC. | 2223 // Assignment to a property, using a named store IC. |
2229 Property* prop = expr->target()->AsProperty(); | 2224 Property* prop = expr->target()->AsProperty(); |
2230 DCHECK(prop != NULL); | 2225 DCHECK(prop != NULL); |
2231 DCHECK(prop->key()->IsLiteral()); | 2226 DCHECK(prop->key()->IsLiteral()); |
2232 | 2227 |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3739 | 3734 |
3740 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3735 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3741 | 3736 |
3742 DCHECK(interrupt_address == | 3737 DCHECK(interrupt_address == |
3743 isolate->builtins()->OnStackReplacement()->entry()); | 3738 isolate->builtins()->OnStackReplacement()->entry()); |
3744 return ON_STACK_REPLACEMENT; | 3739 return ON_STACK_REPLACEMENT; |
3745 } | 3740 } |
3746 } // namespace internal | 3741 } // namespace internal |
3747 } // namespace v8 | 3742 } // namespace v8 |
3748 #endif // V8_TARGET_ARCH_PPC | 3743 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |