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/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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); | 1126 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); |
1127 __ bind(&exit); | 1127 __ bind(&exit); |
1128 decrement_loop_depth(); | 1128 decrement_loop_depth(); |
1129 } | 1129 } |
1130 | 1130 |
1131 | 1131 |
1132 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, | 1132 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, |
1133 FeedbackVectorSlot slot) { | 1133 FeedbackVectorSlot slot) { |
1134 DCHECK(NeedsHomeObject(initializer)); | 1134 DCHECK(NeedsHomeObject(initializer)); |
1135 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); | 1135 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
| 1136 __ mov(StoreDescriptor::NameRegister(), |
| 1137 Operand(isolate()->factory()->home_object_symbol())); |
1136 __ LoadP(StoreDescriptor::ValueRegister(), | 1138 __ LoadP(StoreDescriptor::ValueRegister(), |
1137 MemOperand(sp, offset * kPointerSize)); | 1139 MemOperand(sp, offset * kPointerSize)); |
1138 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); | 1140 EmitLoadStoreICSlot(slot); |
| 1141 CallStoreIC(); |
1139 } | 1142 } |
1140 | 1143 |
1141 | 1144 |
1142 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, | 1145 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, |
1143 int offset, | 1146 int offset, |
1144 FeedbackVectorSlot slot) { | 1147 FeedbackVectorSlot slot) { |
1145 DCHECK(NeedsHomeObject(initializer)); | 1148 DCHECK(NeedsHomeObject(initializer)); |
1146 __ Move(StoreDescriptor::ReceiverRegister(), r3); | 1149 __ Move(StoreDescriptor::ReceiverRegister(), r3); |
| 1150 __ mov(StoreDescriptor::NameRegister(), |
| 1151 Operand(isolate()->factory()->home_object_symbol())); |
1147 __ LoadP(StoreDescriptor::ValueRegister(), | 1152 __ LoadP(StoreDescriptor::ValueRegister(), |
1148 MemOperand(sp, offset * kPointerSize)); | 1153 MemOperand(sp, offset * kPointerSize)); |
1149 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); | 1154 EmitLoadStoreICSlot(slot); |
| 1155 CallStoreIC(); |
1150 } | 1156 } |
1151 | 1157 |
1152 | 1158 |
1153 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1159 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1154 TypeofMode typeof_mode, | 1160 TypeofMode typeof_mode, |
1155 Label* slow) { | 1161 Label* slow) { |
1156 Register current = cp; | 1162 Register current = cp; |
1157 Register next = r4; | 1163 Register next = r4; |
1158 Register temp = r5; | 1164 Register temp = r5; |
1159 | 1165 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1380 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1375 // Fall through. | 1381 // Fall through. |
1376 case ObjectLiteral::Property::COMPUTED: | 1382 case ObjectLiteral::Property::COMPUTED: |
1377 // It is safe to use [[Put]] here because the boilerplate already | 1383 // It is safe to use [[Put]] here because the boilerplate already |
1378 // contains computed properties with an uninitialized value. | 1384 // contains computed properties with an uninitialized value. |
1379 if (key->IsStringLiteral()) { | 1385 if (key->IsStringLiteral()) { |
1380 DCHECK(key->IsPropertyName()); | 1386 DCHECK(key->IsPropertyName()); |
1381 if (property->emit_store()) { | 1387 if (property->emit_store()) { |
1382 VisitForAccumulatorValue(value); | 1388 VisitForAccumulatorValue(value); |
1383 DCHECK(StoreDescriptor::ValueRegister().is(r3)); | 1389 DCHECK(StoreDescriptor::ValueRegister().is(r3)); |
| 1390 __ mov(StoreDescriptor::NameRegister(), Operand(key->value())); |
1384 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); | 1391 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
1385 CallStoreIC(property->GetSlot(0), key->value()); | 1392 EmitLoadStoreICSlot(property->GetSlot(0)); |
| 1393 CallStoreIC(); |
1386 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); | 1394 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); |
1387 | 1395 |
1388 if (NeedsHomeObject(value)) { | 1396 if (NeedsHomeObject(value)) { |
1389 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); | 1397 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); |
1390 } | 1398 } |
1391 } else { | 1399 } else { |
1392 VisitForEffect(value); | 1400 VisitForEffect(value); |
1393 } | 1401 } |
1394 break; | 1402 break; |
1395 } | 1403 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 | 1579 |
1572 if (!result_saved) { | 1580 if (!result_saved) { |
1573 PushOperand(r3); | 1581 PushOperand(r3); |
1574 result_saved = true; | 1582 result_saved = true; |
1575 } | 1583 } |
1576 VisitForAccumulatorValue(subexpr); | 1584 VisitForAccumulatorValue(subexpr); |
1577 | 1585 |
1578 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), | 1586 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), |
1579 Smi::FromInt(array_index)); | 1587 Smi::FromInt(array_index)); |
1580 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1588 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1581 CallKeyedStoreIC(expr->LiteralFeedbackSlot()); | 1589 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1590 CallKeyedStoreIC(); |
1582 | 1591 |
1583 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1592 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
1584 BailoutState::NO_REGISTERS); | 1593 BailoutState::NO_REGISTERS); |
1585 } | 1594 } |
1586 | 1595 |
1587 if (result_saved) { | 1596 if (result_saved) { |
1588 context()->PlugTOS(); | 1597 context()->PlugTOS(); |
1589 } else { | 1598 } else { |
1590 context()->Plug(r3); | 1599 context()->Plug(r3); |
1591 } | 1600 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 Variable* var = expr->AsVariableProxy()->var(); | 2056 Variable* var = expr->AsVariableProxy()->var(); |
2048 EffectContext context(this); | 2057 EffectContext context(this); |
2049 EmitVariableAssignment(var, Token::ASSIGN, slot); | 2058 EmitVariableAssignment(var, Token::ASSIGN, slot); |
2050 break; | 2059 break; |
2051 } | 2060 } |
2052 case NAMED_PROPERTY: { | 2061 case NAMED_PROPERTY: { |
2053 PushOperand(r3); // Preserve value. | 2062 PushOperand(r3); // Preserve value. |
2054 VisitForAccumulatorValue(prop->obj()); | 2063 VisitForAccumulatorValue(prop->obj()); |
2055 __ Move(StoreDescriptor::ReceiverRegister(), r3); | 2064 __ Move(StoreDescriptor::ReceiverRegister(), r3); |
2056 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2065 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
2057 CallStoreIC(slot, prop->key()->AsLiteral()->value()); | 2066 __ mov(StoreDescriptor::NameRegister(), |
| 2067 Operand(prop->key()->AsLiteral()->value())); |
| 2068 EmitLoadStoreICSlot(slot); |
| 2069 CallStoreIC(); |
2058 break; | 2070 break; |
2059 } | 2071 } |
2060 case NAMED_SUPER_PROPERTY: { | 2072 case NAMED_SUPER_PROPERTY: { |
2061 PushOperand(r3); | 2073 PushOperand(r3); |
2062 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2074 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2063 VisitForAccumulatorValue( | 2075 VisitForAccumulatorValue( |
2064 prop->obj()->AsSuperPropertyReference()->home_object()); | 2076 prop->obj()->AsSuperPropertyReference()->home_object()); |
2065 // stack: value, this; r3: home_object | 2077 // stack: value, this; r3: home_object |
2066 Register scratch = r5; | 2078 Register scratch = r5; |
2067 Register scratch2 = r6; | 2079 Register scratch2 = r6; |
(...skipping 26 matching lines...) Expand all Loading... |
2094 EmitKeyedSuperPropertyStore(prop); | 2106 EmitKeyedSuperPropertyStore(prop); |
2095 break; | 2107 break; |
2096 } | 2108 } |
2097 case KEYED_PROPERTY: { | 2109 case KEYED_PROPERTY: { |
2098 PushOperand(r3); // Preserve value. | 2110 PushOperand(r3); // Preserve value. |
2099 VisitForStackValue(prop->obj()); | 2111 VisitForStackValue(prop->obj()); |
2100 VisitForAccumulatorValue(prop->key()); | 2112 VisitForAccumulatorValue(prop->key()); |
2101 __ Move(StoreDescriptor::NameRegister(), r3); | 2113 __ Move(StoreDescriptor::NameRegister(), r3); |
2102 PopOperands(StoreDescriptor::ValueRegister(), | 2114 PopOperands(StoreDescriptor::ValueRegister(), |
2103 StoreDescriptor::ReceiverRegister()); | 2115 StoreDescriptor::ReceiverRegister()); |
2104 CallKeyedStoreIC(slot); | 2116 EmitLoadStoreICSlot(slot); |
| 2117 CallKeyedStoreIC(); |
2105 break; | 2118 break; |
2106 } | 2119 } |
2107 } | 2120 } |
2108 context()->Plug(r3); | 2121 context()->Plug(r3); |
2109 } | 2122 } |
2110 | 2123 |
2111 | 2124 |
2112 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 2125 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
2113 Variable* var, MemOperand location) { | 2126 Variable* var, MemOperand location) { |
2114 __ StoreP(result_register(), location, r0); | 2127 __ StoreP(result_register(), location, r0); |
2115 if (var->IsContextSlot()) { | 2128 if (var->IsContextSlot()) { |
2116 // RecordWrite may destroy all its register arguments. | 2129 // RecordWrite may destroy all its register arguments. |
2117 __ mr(r6, result_register()); | 2130 __ mr(r6, result_register()); |
2118 int offset = Context::SlotOffset(var->index()); | 2131 int offset = Context::SlotOffset(var->index()); |
2119 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved, | 2132 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved, |
2120 kDontSaveFPRegs); | 2133 kDontSaveFPRegs); |
2121 } | 2134 } |
2122 } | 2135 } |
2123 | 2136 |
2124 | 2137 |
2125 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2138 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
2126 FeedbackVectorSlot slot) { | 2139 FeedbackVectorSlot slot) { |
2127 if (var->IsUnallocated()) { | 2140 if (var->IsUnallocated()) { |
2128 // Global var, const, or let. | 2141 // Global var, const, or let. |
| 2142 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2129 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); | 2143 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); |
2130 CallStoreIC(slot, var->name()); | 2144 EmitLoadStoreICSlot(slot); |
| 2145 CallStoreIC(); |
2131 | 2146 |
2132 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { | 2147 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { |
2133 DCHECK(!var->IsLookupSlot()); | 2148 DCHECK(!var->IsLookupSlot()); |
2134 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2149 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2135 MemOperand location = VarOperand(var, r4); | 2150 MemOperand location = VarOperand(var, r4); |
2136 // Perform an initialization check for lexically declared variables. | 2151 // Perform an initialization check for lexically declared variables. |
2137 if (var->binding_needs_init()) { | 2152 if (var->binding_needs_init()) { |
2138 Label assign; | 2153 Label assign; |
2139 __ LoadP(r6, location); | 2154 __ LoadP(r6, location); |
2140 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2155 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 } | 2203 } |
2189 } | 2204 } |
2190 | 2205 |
2191 | 2206 |
2192 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2207 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2193 // Assignment to a property, using a named store IC. | 2208 // Assignment to a property, using a named store IC. |
2194 Property* prop = expr->target()->AsProperty(); | 2209 Property* prop = expr->target()->AsProperty(); |
2195 DCHECK(prop != NULL); | 2210 DCHECK(prop != NULL); |
2196 DCHECK(prop->key()->IsLiteral()); | 2211 DCHECK(prop->key()->IsLiteral()); |
2197 | 2212 |
| 2213 __ mov(StoreDescriptor::NameRegister(), |
| 2214 Operand(prop->key()->AsLiteral()->value())); |
2198 PopOperand(StoreDescriptor::ReceiverRegister()); | 2215 PopOperand(StoreDescriptor::ReceiverRegister()); |
2199 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); | 2216 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2217 CallStoreIC(); |
2200 | 2218 |
2201 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2219 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2202 context()->Plug(r3); | 2220 context()->Plug(r3); |
2203 } | 2221 } |
2204 | 2222 |
2205 | 2223 |
2206 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { | 2224 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { |
2207 // Assignment to named property of super. | 2225 // Assignment to named property of super. |
2208 // r3 : value | 2226 // r3 : value |
2209 // stack : receiver ('this'), home_object | 2227 // stack : receiver ('this'), home_object |
(...skipping 21 matching lines...) Expand all Loading... |
2231 : Runtime::kStoreKeyedToSuper_Sloppy)); | 2249 : Runtime::kStoreKeyedToSuper_Sloppy)); |
2232 } | 2250 } |
2233 | 2251 |
2234 | 2252 |
2235 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2253 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2236 // Assignment to a property, using a keyed store IC. | 2254 // Assignment to a property, using a keyed store IC. |
2237 PopOperands(StoreDescriptor::ReceiverRegister(), | 2255 PopOperands(StoreDescriptor::ReceiverRegister(), |
2238 StoreDescriptor::NameRegister()); | 2256 StoreDescriptor::NameRegister()); |
2239 DCHECK(StoreDescriptor::ValueRegister().is(r3)); | 2257 DCHECK(StoreDescriptor::ValueRegister().is(r3)); |
2240 | 2258 |
2241 CallKeyedStoreIC(expr->AssignmentSlot()); | 2259 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2260 CallKeyedStoreIC(); |
2242 | 2261 |
2243 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2262 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2244 context()->Plug(r3); | 2263 context()->Plug(r3); |
2245 } | 2264 } |
2246 | 2265 |
2247 | 2266 |
2248 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { | 2267 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { |
2249 ic_total_count_++; | 2268 ic_total_count_++; |
2250 __ Call(code, RelocInfo::CODE_TARGET, ast_id); | 2269 __ Call(code, RelocInfo::CODE_TARGET, ast_id); |
2251 } | 2270 } |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3275 } | 3294 } |
3276 } else { | 3295 } else { |
3277 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3296 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
3278 Token::ASSIGN, expr->CountSlot()); | 3297 Token::ASSIGN, expr->CountSlot()); |
3279 PrepareForBailoutForId(expr->AssignmentId(), | 3298 PrepareForBailoutForId(expr->AssignmentId(), |
3280 BailoutState::TOS_REGISTER); | 3299 BailoutState::TOS_REGISTER); |
3281 context()->Plug(r3); | 3300 context()->Plug(r3); |
3282 } | 3301 } |
3283 break; | 3302 break; |
3284 case NAMED_PROPERTY: { | 3303 case NAMED_PROPERTY: { |
| 3304 __ mov(StoreDescriptor::NameRegister(), |
| 3305 Operand(prop->key()->AsLiteral()->value())); |
3285 PopOperand(StoreDescriptor::ReceiverRegister()); | 3306 PopOperand(StoreDescriptor::ReceiverRegister()); |
3286 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); | 3307 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3308 CallStoreIC(); |
3287 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3309 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
3288 if (expr->is_postfix()) { | 3310 if (expr->is_postfix()) { |
3289 if (!context()->IsEffect()) { | 3311 if (!context()->IsEffect()) { |
3290 context()->PlugTOS(); | 3312 context()->PlugTOS(); |
3291 } | 3313 } |
3292 } else { | 3314 } else { |
3293 context()->Plug(r3); | 3315 context()->Plug(r3); |
3294 } | 3316 } |
3295 break; | 3317 break; |
3296 } | 3318 } |
(...skipping 17 matching lines...) Expand all Loading... |
3314 context()->PlugTOS(); | 3336 context()->PlugTOS(); |
3315 } | 3337 } |
3316 } else { | 3338 } else { |
3317 context()->Plug(r3); | 3339 context()->Plug(r3); |
3318 } | 3340 } |
3319 break; | 3341 break; |
3320 } | 3342 } |
3321 case KEYED_PROPERTY: { | 3343 case KEYED_PROPERTY: { |
3322 PopOperands(StoreDescriptor::ReceiverRegister(), | 3344 PopOperands(StoreDescriptor::ReceiverRegister(), |
3323 StoreDescriptor::NameRegister()); | 3345 StoreDescriptor::NameRegister()); |
3324 CallKeyedStoreIC(expr->CountSlot()); | 3346 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3347 CallKeyedStoreIC(); |
3325 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3348 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
3326 if (expr->is_postfix()) { | 3349 if (expr->is_postfix()) { |
3327 if (!context()->IsEffect()) { | 3350 if (!context()->IsEffect()) { |
3328 context()->PlugTOS(); | 3351 context()->PlugTOS(); |
3329 } | 3352 } |
3330 } else { | 3353 } else { |
3331 context()->Plug(r3); | 3354 context()->Plug(r3); |
3332 } | 3355 } |
3333 break; | 3356 break; |
3334 } | 3357 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 | 3715 |
3693 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3716 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3694 | 3717 |
3695 DCHECK(interrupt_address == | 3718 DCHECK(interrupt_address == |
3696 isolate->builtins()->OnStackReplacement()->entry()); | 3719 isolate->builtins()->OnStackReplacement()->entry()); |
3697 return ON_STACK_REPLACEMENT; | 3720 return ON_STACK_REPLACEMENT; |
3698 } | 3721 } |
3699 } // namespace internal | 3722 } // namespace internal |
3700 } // namespace v8 | 3723 } // namespace v8 |
3701 #endif // V8_TARGET_ARCH_PPC | 3724 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |