OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2053 // Perform an initialization check for lexically declared variables. | 2053 // Perform an initialization check for lexically declared variables. |
2054 if (var->binding_needs_init()) { | 2054 if (var->binding_needs_init()) { |
2055 Label assign; | 2055 Label assign; |
2056 __ Ldr(x10, location); | 2056 __ Ldr(x10, location); |
2057 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); | 2057 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); |
2058 __ Mov(x10, Operand(var->name())); | 2058 __ Mov(x10, Operand(var->name())); |
2059 __ Push(x10); | 2059 __ Push(x10); |
2060 __ CallRuntime(Runtime::kThrowReferenceError); | 2060 __ CallRuntime(Runtime::kThrowReferenceError); |
2061 __ Bind(&assign); | 2061 __ Bind(&assign); |
2062 } | 2062 } |
2063 if (var->mode() == CONST) { | 2063 if (var->mode() != CONST) { |
| 2064 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2065 } else if (var->throw_on_const_assignment(language_mode())) { |
2064 __ CallRuntime(Runtime::kThrowConstAssignError); | 2066 __ CallRuntime(Runtime::kThrowConstAssignError); |
2065 } else { | |
2066 EmitStoreToStackLocalOrContextSlot(var, location); | |
2067 } | 2067 } |
2068 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { | 2068 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
2069 // Initializing assignment to const {this} needs a write barrier. | 2069 // Initializing assignment to const {this} needs a write barrier. |
2070 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2070 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2071 Label uninitialized_this; | 2071 Label uninitialized_this; |
2072 MemOperand location = VarOperand(var, x1); | 2072 MemOperand location = VarOperand(var, x1); |
2073 __ Ldr(x10, location); | 2073 __ Ldr(x10, location); |
2074 __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 2074 __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
2075 __ Mov(x0, Operand(var->name())); | 2075 __ Mov(x0, Operand(var->name())); |
2076 __ Push(x0); | 2076 __ Push(x0); |
2077 __ CallRuntime(Runtime::kThrowReferenceError); | 2077 __ CallRuntime(Runtime::kThrowReferenceError); |
2078 __ bind(&uninitialized_this); | 2078 __ bind(&uninitialized_this); |
2079 EmitStoreToStackLocalOrContextSlot(var, location); | 2079 EmitStoreToStackLocalOrContextSlot(var, location); |
2080 | 2080 |
2081 } else if (!var->is_const_mode() || op == Token::INIT) { | 2081 } else { |
| 2082 DCHECK(var->mode() != CONST || op == Token::INIT); |
2082 if (var->IsLookupSlot()) { | 2083 if (var->IsLookupSlot()) { |
2083 // Assignment to var. | 2084 // Assignment to var. |
2084 __ Push(var->name()); | 2085 __ Push(var->name()); |
2085 __ Push(x0); | 2086 __ Push(x0); |
2086 __ CallRuntime(is_strict(language_mode()) | 2087 __ CallRuntime(is_strict(language_mode()) |
2087 ? Runtime::kStoreLookupSlot_Strict | 2088 ? Runtime::kStoreLookupSlot_Strict |
2088 : Runtime::kStoreLookupSlot_Sloppy); | 2089 : Runtime::kStoreLookupSlot_Sloppy); |
2089 } else { | 2090 } else { |
2090 // Assignment to var or initializing assignment to let/const in harmony | 2091 // Assignment to var or initializing assignment to let/const in harmony |
2091 // mode. | 2092 // mode. |
2092 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2093 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2093 MemOperand location = VarOperand(var, x1); | 2094 MemOperand location = VarOperand(var, x1); |
2094 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { | 2095 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
2095 __ Ldr(x10, location); | 2096 __ Ldr(x10, location); |
2096 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); | 2097 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); |
2097 __ Check(eq, kLetBindingReInitialization); | 2098 __ Check(eq, kLetBindingReInitialization); |
2098 } | 2099 } |
2099 EmitStoreToStackLocalOrContextSlot(var, location); | 2100 EmitStoreToStackLocalOrContextSlot(var, location); |
2100 } | 2101 } |
2101 | |
2102 } else { | |
2103 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); | |
2104 if (is_strict(language_mode())) { | |
2105 __ CallRuntime(Runtime::kThrowConstAssignError); | |
2106 } | |
2107 // Silently ignore store in sloppy mode. | |
2108 } | 2102 } |
2109 } | 2103 } |
2110 | 2104 |
2111 | 2105 |
2112 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2106 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2113 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); | 2107 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); |
2114 // Assignment to a property, using a named store IC. | 2108 // Assignment to a property, using a named store IC. |
2115 Property* prop = expr->target()->AsProperty(); | 2109 Property* prop = expr->target()->AsProperty(); |
2116 DCHECK(prop != NULL); | 2110 DCHECK(prop != NULL); |
2117 DCHECK(prop->key()->IsLiteral()); | 2111 DCHECK(prop->key()->IsLiteral()); |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 } | 3820 } |
3827 | 3821 |
3828 return INTERRUPT; | 3822 return INTERRUPT; |
3829 } | 3823 } |
3830 | 3824 |
3831 | 3825 |
3832 } // namespace internal | 3826 } // namespace internal |
3833 } // namespace v8 | 3827 } // namespace v8 |
3834 | 3828 |
3835 #endif // V8_TARGET_ARCH_ARM64 | 3829 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |