OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 if (var->binding_needs_init()) { | 2122 if (var->binding_needs_init()) { |
2123 Label assign; | 2123 Label assign; |
2124 __ LoadP(r5, location); | 2124 __ LoadP(r5, location); |
2125 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); | 2125 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); |
2126 __ bne(&assign); | 2126 __ bne(&assign); |
2127 __ mov(r5, Operand(var->name())); | 2127 __ mov(r5, Operand(var->name())); |
2128 __ push(r5); | 2128 __ push(r5); |
2129 __ CallRuntime(Runtime::kThrowReferenceError); | 2129 __ CallRuntime(Runtime::kThrowReferenceError); |
2130 __ bind(&assign); | 2130 __ bind(&assign); |
2131 } | 2131 } |
2132 if (var->mode() == CONST) { | 2132 if (var->mode() != CONST) { |
| 2133 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2134 } else if (var->throw_on_const_assignment(language_mode())) { |
2133 __ CallRuntime(Runtime::kThrowConstAssignError); | 2135 __ CallRuntime(Runtime::kThrowConstAssignError); |
2134 } else { | |
2135 EmitStoreToStackLocalOrContextSlot(var, location); | |
2136 } | 2136 } |
2137 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { | 2137 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
2138 // Initializing assignment to const {this} needs a write barrier. | 2138 // Initializing assignment to const {this} needs a write barrier. |
2139 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2139 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2140 Label uninitialized_this; | 2140 Label uninitialized_this; |
2141 MemOperand location = VarOperand(var, r3); | 2141 MemOperand location = VarOperand(var, r3); |
2142 __ LoadP(r5, location); | 2142 __ LoadP(r5, location); |
2143 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); | 2143 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); |
2144 __ beq(&uninitialized_this); | 2144 __ beq(&uninitialized_this); |
2145 __ mov(r3, Operand(var->name())); | 2145 __ mov(r3, Operand(var->name())); |
2146 __ push(r3); | 2146 __ push(r3); |
2147 __ CallRuntime(Runtime::kThrowReferenceError); | 2147 __ CallRuntime(Runtime::kThrowReferenceError); |
2148 __ bind(&uninitialized_this); | 2148 __ bind(&uninitialized_this); |
2149 EmitStoreToStackLocalOrContextSlot(var, location); | 2149 EmitStoreToStackLocalOrContextSlot(var, location); |
2150 | 2150 } else { |
2151 } else if (!var->is_const_mode() || op == Token::INIT) { | 2151 DCHECK(var->mode() != CONST || op == Token::INIT); |
2152 if (var->IsLookupSlot()) { | 2152 if (var->IsLookupSlot()) { |
2153 // Assignment to var. | 2153 // Assignment to var. |
2154 __ Push(var->name()); | 2154 __ Push(var->name()); |
2155 __ Push(r2); | 2155 __ Push(r2); |
2156 __ CallRuntime(is_strict(language_mode()) | 2156 __ CallRuntime(is_strict(language_mode()) |
2157 ? Runtime::kStoreLookupSlot_Strict | 2157 ? Runtime::kStoreLookupSlot_Strict |
2158 : Runtime::kStoreLookupSlot_Sloppy); | 2158 : Runtime::kStoreLookupSlot_Sloppy); |
2159 } else { | 2159 } else { |
2160 // Assignment to var or initializing assignment to let/const in harmony | 2160 // Assignment to var or initializing assignment to let/const in harmony |
2161 // mode. | 2161 // mode. |
2162 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); | 2162 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); |
2163 MemOperand location = VarOperand(var, r3); | 2163 MemOperand location = VarOperand(var, r3); |
2164 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { | 2164 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
2165 // Check for an uninitialized let binding. | 2165 // Check for an uninitialized let binding. |
2166 __ LoadP(r4, location); | 2166 __ LoadP(r4, location); |
2167 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 2167 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
2168 __ Check(eq, kLetBindingReInitialization); | 2168 __ Check(eq, kLetBindingReInitialization); |
2169 } | 2169 } |
2170 EmitStoreToStackLocalOrContextSlot(var, location); | 2170 EmitStoreToStackLocalOrContextSlot(var, location); |
2171 } | 2171 } |
2172 } else { | |
2173 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); | |
2174 if (is_strict(language_mode())) { | |
2175 __ CallRuntime(Runtime::kThrowConstAssignError); | |
2176 } | |
2177 // Silently ignore store in sloppy mode. | |
2178 } | 2172 } |
2179 } | 2173 } |
2180 | 2174 |
2181 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2175 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2182 // Assignment to a property, using a named store IC. | 2176 // Assignment to a property, using a named store IC. |
2183 Property* prop = expr->target()->AsProperty(); | 2177 Property* prop = expr->target()->AsProperty(); |
2184 DCHECK(prop != NULL); | 2178 DCHECK(prop != NULL); |
2185 DCHECK(prop->key()->IsLiteral()); | 2179 DCHECK(prop->key()->IsLiteral()); |
2186 | 2180 |
2187 __ mov(StoreDescriptor::NameRegister(), | 2181 __ mov(StoreDescriptor::NameRegister(), |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 DCHECK(kOSRBranchInstruction == br_instr); | 3646 DCHECK(kOSRBranchInstruction == br_instr); |
3653 | 3647 |
3654 DCHECK(interrupt_address == | 3648 DCHECK(interrupt_address == |
3655 isolate->builtins()->OnStackReplacement()->entry()); | 3649 isolate->builtins()->OnStackReplacement()->entry()); |
3656 return ON_STACK_REPLACEMENT; | 3650 return ON_STACK_REPLACEMENT; |
3657 } | 3651 } |
3658 | 3652 |
3659 } // namespace internal | 3653 } // namespace internal |
3660 } // namespace v8 | 3654 } // namespace v8 |
3661 #endif // V8_TARGET_ARCH_S390 | 3655 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |