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/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 // Exit and decrement the loop depth. | 1094 // Exit and decrement the loop depth. |
1095 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); | 1095 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); |
1096 __ bind(&exit); | 1096 __ bind(&exit); |
1097 decrement_loop_depth(); | 1097 decrement_loop_depth(); |
1098 } | 1098 } |
1099 | 1099 |
1100 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, | 1100 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, |
1101 FeedbackVectorSlot slot) { | 1101 FeedbackVectorSlot slot) { |
1102 DCHECK(NeedsHomeObject(initializer)); | 1102 DCHECK(NeedsHomeObject(initializer)); |
1103 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); | 1103 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
| 1104 __ mov(StoreDescriptor::NameRegister(), |
| 1105 Operand(isolate()->factory()->home_object_symbol())); |
1104 __ LoadP(StoreDescriptor::ValueRegister(), | 1106 __ LoadP(StoreDescriptor::ValueRegister(), |
1105 MemOperand(sp, offset * kPointerSize)); | 1107 MemOperand(sp, offset * kPointerSize)); |
1106 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); | 1108 EmitLoadStoreICSlot(slot); |
| 1109 CallStoreIC(); |
1107 } | 1110 } |
1108 | 1111 |
1109 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, | 1112 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, |
1110 int offset, | 1113 int offset, |
1111 FeedbackVectorSlot slot) { | 1114 FeedbackVectorSlot slot) { |
1112 DCHECK(NeedsHomeObject(initializer)); | 1115 DCHECK(NeedsHomeObject(initializer)); |
1113 __ Move(StoreDescriptor::ReceiverRegister(), r2); | 1116 __ Move(StoreDescriptor::ReceiverRegister(), r2); |
| 1117 __ mov(StoreDescriptor::NameRegister(), |
| 1118 Operand(isolate()->factory()->home_object_symbol())); |
1114 __ LoadP(StoreDescriptor::ValueRegister(), | 1119 __ LoadP(StoreDescriptor::ValueRegister(), |
1115 MemOperand(sp, offset * kPointerSize)); | 1120 MemOperand(sp, offset * kPointerSize)); |
1116 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); | 1121 EmitLoadStoreICSlot(slot); |
| 1122 CallStoreIC(); |
1117 } | 1123 } |
1118 | 1124 |
1119 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1125 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1120 TypeofMode typeof_mode, | 1126 TypeofMode typeof_mode, |
1121 Label* slow) { | 1127 Label* slow) { |
1122 Register current = cp; | 1128 Register current = cp; |
1123 Register next = r3; | 1129 Register next = r3; |
1124 Register temp = r4; | 1130 Register temp = r4; |
1125 | 1131 |
1126 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); | 1132 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1340 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1335 // Fall through. | 1341 // Fall through. |
1336 case ObjectLiteral::Property::COMPUTED: | 1342 case ObjectLiteral::Property::COMPUTED: |
1337 // It is safe to use [[Put]] here because the boilerplate already | 1343 // It is safe to use [[Put]] here because the boilerplate already |
1338 // contains computed properties with an uninitialized value. | 1344 // contains computed properties with an uninitialized value. |
1339 if (key->IsStringLiteral()) { | 1345 if (key->IsStringLiteral()) { |
1340 DCHECK(key->IsPropertyName()); | 1346 DCHECK(key->IsPropertyName()); |
1341 if (property->emit_store()) { | 1347 if (property->emit_store()) { |
1342 VisitForAccumulatorValue(value); | 1348 VisitForAccumulatorValue(value); |
1343 DCHECK(StoreDescriptor::ValueRegister().is(r2)); | 1349 DCHECK(StoreDescriptor::ValueRegister().is(r2)); |
| 1350 __ mov(StoreDescriptor::NameRegister(), Operand(key->value())); |
1344 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); | 1351 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
1345 CallStoreIC(property->GetSlot(0), key->value()); | 1352 EmitLoadStoreICSlot(property->GetSlot(0)); |
| 1353 CallStoreIC(); |
1346 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); | 1354 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); |
1347 | 1355 |
1348 if (NeedsHomeObject(value)) { | 1356 if (NeedsHomeObject(value)) { |
1349 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); | 1357 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); |
1350 } | 1358 } |
1351 } else { | 1359 } else { |
1352 VisitForEffect(value); | 1360 VisitForEffect(value); |
1353 } | 1361 } |
1354 break; | 1362 break; |
1355 } | 1363 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 | 1538 |
1531 if (!result_saved) { | 1539 if (!result_saved) { |
1532 PushOperand(r2); | 1540 PushOperand(r2); |
1533 result_saved = true; | 1541 result_saved = true; |
1534 } | 1542 } |
1535 VisitForAccumulatorValue(subexpr); | 1543 VisitForAccumulatorValue(subexpr); |
1536 | 1544 |
1537 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), | 1545 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), |
1538 Smi::FromInt(array_index)); | 1546 Smi::FromInt(array_index)); |
1539 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1547 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1540 CallKeyedStoreIC(expr->LiteralFeedbackSlot()); | 1548 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1549 CallKeyedStoreIC(); |
1541 | 1550 |
1542 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1551 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
1543 BailoutState::NO_REGISTERS); | 1552 BailoutState::NO_REGISTERS); |
1544 } | 1553 } |
1545 | 1554 |
1546 if (result_saved) { | 1555 if (result_saved) { |
1547 context()->PlugTOS(); | 1556 context()->PlugTOS(); |
1548 } else { | 1557 } else { |
1549 context()->Plug(r2); | 1558 context()->Plug(r2); |
1550 } | 1559 } |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 Variable* var = expr->AsVariableProxy()->var(); | 2011 Variable* var = expr->AsVariableProxy()->var(); |
2003 EffectContext context(this); | 2012 EffectContext context(this); |
2004 EmitVariableAssignment(var, Token::ASSIGN, slot); | 2013 EmitVariableAssignment(var, Token::ASSIGN, slot); |
2005 break; | 2014 break; |
2006 } | 2015 } |
2007 case NAMED_PROPERTY: { | 2016 case NAMED_PROPERTY: { |
2008 PushOperand(r2); // Preserve value. | 2017 PushOperand(r2); // Preserve value. |
2009 VisitForAccumulatorValue(prop->obj()); | 2018 VisitForAccumulatorValue(prop->obj()); |
2010 __ Move(StoreDescriptor::ReceiverRegister(), r2); | 2019 __ Move(StoreDescriptor::ReceiverRegister(), r2); |
2011 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2020 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
2012 CallStoreIC(slot, prop->key()->AsLiteral()->value()); | 2021 __ mov(StoreDescriptor::NameRegister(), |
| 2022 Operand(prop->key()->AsLiteral()->value())); |
| 2023 EmitLoadStoreICSlot(slot); |
| 2024 CallStoreIC(); |
2013 break; | 2025 break; |
2014 } | 2026 } |
2015 case NAMED_SUPER_PROPERTY: { | 2027 case NAMED_SUPER_PROPERTY: { |
2016 PushOperand(r2); | 2028 PushOperand(r2); |
2017 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2029 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2018 VisitForAccumulatorValue( | 2030 VisitForAccumulatorValue( |
2019 prop->obj()->AsSuperPropertyReference()->home_object()); | 2031 prop->obj()->AsSuperPropertyReference()->home_object()); |
2020 // stack: value, this; r2: home_object | 2032 // stack: value, this; r2: home_object |
2021 Register scratch = r4; | 2033 Register scratch = r4; |
2022 Register scratch2 = r5; | 2034 Register scratch2 = r5; |
(...skipping 26 matching lines...) Expand all Loading... |
2049 EmitKeyedSuperPropertyStore(prop); | 2061 EmitKeyedSuperPropertyStore(prop); |
2050 break; | 2062 break; |
2051 } | 2063 } |
2052 case KEYED_PROPERTY: { | 2064 case KEYED_PROPERTY: { |
2053 PushOperand(r2); // Preserve value. | 2065 PushOperand(r2); // Preserve value. |
2054 VisitForStackValue(prop->obj()); | 2066 VisitForStackValue(prop->obj()); |
2055 VisitForAccumulatorValue(prop->key()); | 2067 VisitForAccumulatorValue(prop->key()); |
2056 __ Move(StoreDescriptor::NameRegister(), r2); | 2068 __ Move(StoreDescriptor::NameRegister(), r2); |
2057 PopOperands(StoreDescriptor::ValueRegister(), | 2069 PopOperands(StoreDescriptor::ValueRegister(), |
2058 StoreDescriptor::ReceiverRegister()); | 2070 StoreDescriptor::ReceiverRegister()); |
2059 CallKeyedStoreIC(slot); | 2071 EmitLoadStoreICSlot(slot); |
| 2072 CallKeyedStoreIC(); |
2060 break; | 2073 break; |
2061 } | 2074 } |
2062 } | 2075 } |
2063 context()->Plug(r2); | 2076 context()->Plug(r2); |
2064 } | 2077 } |
2065 | 2078 |
2066 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 2079 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
2067 Variable* var, MemOperand location) { | 2080 Variable* var, MemOperand location) { |
2068 __ StoreP(result_register(), location); | 2081 __ StoreP(result_register(), location); |
2069 if (var->IsContextSlot()) { | 2082 if (var->IsContextSlot()) { |
2070 // RecordWrite may destroy all its register arguments. | 2083 // RecordWrite may destroy all its register arguments. |
2071 __ LoadRR(r5, result_register()); | 2084 __ LoadRR(r5, result_register()); |
2072 int offset = Context::SlotOffset(var->index()); | 2085 int offset = Context::SlotOffset(var->index()); |
2073 __ RecordWriteContextSlot(r3, offset, r5, r4, kLRHasBeenSaved, | 2086 __ RecordWriteContextSlot(r3, offset, r5, r4, kLRHasBeenSaved, |
2074 kDontSaveFPRegs); | 2087 kDontSaveFPRegs); |
2075 } | 2088 } |
2076 } | 2089 } |
2077 | 2090 |
2078 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2091 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
2079 FeedbackVectorSlot slot) { | 2092 FeedbackVectorSlot slot) { |
2080 if (var->IsUnallocated()) { | 2093 if (var->IsUnallocated()) { |
2081 // Global var, const, or let. | 2094 // Global var, const, or let. |
| 2095 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2082 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); | 2096 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); |
2083 CallStoreIC(slot, var->name()); | 2097 EmitLoadStoreICSlot(slot); |
| 2098 CallStoreIC(); |
2084 | 2099 |
2085 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { | 2100 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { |
2086 // Non-initializing assignment to let variable needs a write barrier. | 2101 // Non-initializing assignment to let variable needs a write barrier. |
2087 DCHECK(!var->IsLookupSlot()); | 2102 DCHECK(!var->IsLookupSlot()); |
2088 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2103 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2089 MemOperand location = VarOperand(var, r3); | 2104 MemOperand location = VarOperand(var, r3); |
2090 // Perform an initialization check for lexically declared variables. | 2105 // Perform an initialization check for lexically declared variables. |
2091 if (var->binding_needs_init()) { | 2106 if (var->binding_needs_init()) { |
2092 Label assign; | 2107 Label assign; |
2093 __ LoadP(r5, location); | 2108 __ LoadP(r5, location); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 } | 2155 } |
2141 } | 2156 } |
2142 } | 2157 } |
2143 | 2158 |
2144 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2159 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2145 // Assignment to a property, using a named store IC. | 2160 // Assignment to a property, using a named store IC. |
2146 Property* prop = expr->target()->AsProperty(); | 2161 Property* prop = expr->target()->AsProperty(); |
2147 DCHECK(prop != NULL); | 2162 DCHECK(prop != NULL); |
2148 DCHECK(prop->key()->IsLiteral()); | 2163 DCHECK(prop->key()->IsLiteral()); |
2149 | 2164 |
| 2165 __ mov(StoreDescriptor::NameRegister(), |
| 2166 Operand(prop->key()->AsLiteral()->value())); |
2150 PopOperand(StoreDescriptor::ReceiverRegister()); | 2167 PopOperand(StoreDescriptor::ReceiverRegister()); |
2151 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); | 2168 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2169 CallStoreIC(); |
2152 | 2170 |
2153 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2171 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2154 context()->Plug(r2); | 2172 context()->Plug(r2); |
2155 } | 2173 } |
2156 | 2174 |
2157 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { | 2175 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { |
2158 // Assignment to named property of super. | 2176 // Assignment to named property of super. |
2159 // r2 : value | 2177 // r2 : value |
2160 // stack : receiver ('this'), home_object | 2178 // stack : receiver ('this'), home_object |
2161 DCHECK(prop != NULL); | 2179 DCHECK(prop != NULL); |
(...skipping 18 matching lines...) Expand all Loading... |
2180 ? Runtime::kStoreKeyedToSuper_Strict | 2198 ? Runtime::kStoreKeyedToSuper_Strict |
2181 : Runtime::kStoreKeyedToSuper_Sloppy)); | 2199 : Runtime::kStoreKeyedToSuper_Sloppy)); |
2182 } | 2200 } |
2183 | 2201 |
2184 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2202 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2185 // Assignment to a property, using a keyed store IC. | 2203 // Assignment to a property, using a keyed store IC. |
2186 PopOperands(StoreDescriptor::ReceiverRegister(), | 2204 PopOperands(StoreDescriptor::ReceiverRegister(), |
2187 StoreDescriptor::NameRegister()); | 2205 StoreDescriptor::NameRegister()); |
2188 DCHECK(StoreDescriptor::ValueRegister().is(r2)); | 2206 DCHECK(StoreDescriptor::ValueRegister().is(r2)); |
2189 | 2207 |
2190 CallKeyedStoreIC(expr->AssignmentSlot()); | 2208 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2209 CallKeyedStoreIC(); |
2191 | 2210 |
2192 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2211 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2193 context()->Plug(r2); | 2212 context()->Plug(r2); |
2194 } | 2213 } |
2195 | 2214 |
2196 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { | 2215 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { |
2197 ic_total_count_++; | 2216 ic_total_count_++; |
2198 __ Call(code, RelocInfo::CODE_TARGET, ast_id); | 2217 __ Call(code, RelocInfo::CODE_TARGET, ast_id); |
2199 } | 2218 } |
2200 | 2219 |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3193 } | 3212 } |
3194 } else { | 3213 } else { |
3195 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3214 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
3196 Token::ASSIGN, expr->CountSlot()); | 3215 Token::ASSIGN, expr->CountSlot()); |
3197 PrepareForBailoutForId(expr->AssignmentId(), | 3216 PrepareForBailoutForId(expr->AssignmentId(), |
3198 BailoutState::TOS_REGISTER); | 3217 BailoutState::TOS_REGISTER); |
3199 context()->Plug(r2); | 3218 context()->Plug(r2); |
3200 } | 3219 } |
3201 break; | 3220 break; |
3202 case NAMED_PROPERTY: { | 3221 case NAMED_PROPERTY: { |
| 3222 __ mov(StoreDescriptor::NameRegister(), |
| 3223 Operand(prop->key()->AsLiteral()->value())); |
3203 PopOperand(StoreDescriptor::ReceiverRegister()); | 3224 PopOperand(StoreDescriptor::ReceiverRegister()); |
3204 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); | 3225 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3226 CallStoreIC(); |
3205 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3227 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
3206 if (expr->is_postfix()) { | 3228 if (expr->is_postfix()) { |
3207 if (!context()->IsEffect()) { | 3229 if (!context()->IsEffect()) { |
3208 context()->PlugTOS(); | 3230 context()->PlugTOS(); |
3209 } | 3231 } |
3210 } else { | 3232 } else { |
3211 context()->Plug(r2); | 3233 context()->Plug(r2); |
3212 } | 3234 } |
3213 break; | 3235 break; |
3214 } | 3236 } |
(...skipping 17 matching lines...) Expand all Loading... |
3232 context()->PlugTOS(); | 3254 context()->PlugTOS(); |
3233 } | 3255 } |
3234 } else { | 3256 } else { |
3235 context()->Plug(r2); | 3257 context()->Plug(r2); |
3236 } | 3258 } |
3237 break; | 3259 break; |
3238 } | 3260 } |
3239 case KEYED_PROPERTY: { | 3261 case KEYED_PROPERTY: { |
3240 PopOperands(StoreDescriptor::ReceiverRegister(), | 3262 PopOperands(StoreDescriptor::ReceiverRegister(), |
3241 StoreDescriptor::NameRegister()); | 3263 StoreDescriptor::NameRegister()); |
3242 CallKeyedStoreIC(expr->CountSlot()); | 3264 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3265 CallKeyedStoreIC(); |
3243 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3266 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
3244 if (expr->is_postfix()) { | 3267 if (expr->is_postfix()) { |
3245 if (!context()->IsEffect()) { | 3268 if (!context()->IsEffect()) { |
3246 context()->PlugTOS(); | 3269 context()->PlugTOS(); |
3247 } | 3270 } |
3248 } else { | 3271 } else { |
3249 context()->Plug(r2); | 3272 context()->Plug(r2); |
3250 } | 3273 } |
3251 break; | 3274 break; |
3252 } | 3275 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 DCHECK(kOSRBranchInstruction == br_instr); | 3626 DCHECK(kOSRBranchInstruction == br_instr); |
3604 | 3627 |
3605 DCHECK(interrupt_address == | 3628 DCHECK(interrupt_address == |
3606 isolate->builtins()->OnStackReplacement()->entry()); | 3629 isolate->builtins()->OnStackReplacement()->entry()); |
3607 return ON_STACK_REPLACEMENT; | 3630 return ON_STACK_REPLACEMENT; |
3608 } | 3631 } |
3609 | 3632 |
3610 } // namespace internal | 3633 } // namespace internal |
3611 } // namespace v8 | 3634 } // namespace v8 |
3612 #endif // V8_TARGET_ARCH_S390 | 3635 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |