Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.cc

Issue 2361393005: Reland of [fullcodegen] Refactor code that calls store ICs. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); 1157 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
1158 __ bind(&exit); 1158 __ bind(&exit);
1159 decrement_loop_depth(); 1159 decrement_loop_depth();
1160 } 1160 }
1161 1161
1162 1162
1163 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, 1163 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset,
1164 FeedbackVectorSlot slot) { 1164 FeedbackVectorSlot slot) {
1165 DCHECK(NeedsHomeObject(initializer)); 1165 DCHECK(NeedsHomeObject(initializer));
1166 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); 1166 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp));
1167 __ li(StoreDescriptor::NameRegister(),
1168 Operand(isolate()->factory()->home_object_symbol()));
1169 __ ld(StoreDescriptor::ValueRegister(), 1167 __ ld(StoreDescriptor::ValueRegister(),
1170 MemOperand(sp, offset * kPointerSize)); 1168 MemOperand(sp, offset * kPointerSize));
1171 EmitLoadStoreICSlot(slot); 1169 CallStoreIC(slot, isolate()->factory()->home_object_symbol());
1172 CallStoreIC();
1173 } 1170 }
1174 1171
1175 1172
1176 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, 1173 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer,
1177 int offset, 1174 int offset,
1178 FeedbackVectorSlot slot) { 1175 FeedbackVectorSlot slot) {
1179 DCHECK(NeedsHomeObject(initializer)); 1176 DCHECK(NeedsHomeObject(initializer));
1180 __ Move(StoreDescriptor::ReceiverRegister(), v0); 1177 __ Move(StoreDescriptor::ReceiverRegister(), v0);
1181 __ li(StoreDescriptor::NameRegister(),
1182 Operand(isolate()->factory()->home_object_symbol()));
1183 __ ld(StoreDescriptor::ValueRegister(), 1178 __ ld(StoreDescriptor::ValueRegister(),
1184 MemOperand(sp, offset * kPointerSize)); 1179 MemOperand(sp, offset * kPointerSize));
1185 EmitLoadStoreICSlot(slot); 1180 CallStoreIC(slot, isolate()->factory()->home_object_symbol());
1186 CallStoreIC();
1187 } 1181 }
1188 1182
1189 1183
1190 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1184 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1191 TypeofMode typeof_mode, 1185 TypeofMode typeof_mode,
1192 Label* slow) { 1186 Label* slow) {
1193 Register current = cp; 1187 Register current = cp;
1194 Register next = a1; 1188 Register next = a1;
1195 Register temp = a2; 1189 Register temp = a2;
1196 1190
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 // Fall through. 1407 // Fall through.
1414 case ObjectLiteral::Property::COMPUTED: 1408 case ObjectLiteral::Property::COMPUTED:
1415 // It is safe to use [[Put]] here because the boilerplate already 1409 // It is safe to use [[Put]] here because the boilerplate already
1416 // contains computed properties with an uninitialized value. 1410 // contains computed properties with an uninitialized value.
1417 if (key->IsStringLiteral()) { 1411 if (key->IsStringLiteral()) {
1418 DCHECK(key->IsPropertyName()); 1412 DCHECK(key->IsPropertyName());
1419 if (property->emit_store()) { 1413 if (property->emit_store()) {
1420 VisitForAccumulatorValue(value); 1414 VisitForAccumulatorValue(value);
1421 __ mov(StoreDescriptor::ValueRegister(), result_register()); 1415 __ mov(StoreDescriptor::ValueRegister(), result_register());
1422 DCHECK(StoreDescriptor::ValueRegister().is(a0)); 1416 DCHECK(StoreDescriptor::ValueRegister().is(a0));
1423 __ li(StoreDescriptor::NameRegister(), Operand(key->value()));
1424 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); 1417 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp));
1425 EmitLoadStoreICSlot(property->GetSlot(0)); 1418 CallStoreIC(property->GetSlot(0), key->value());
1426 CallStoreIC();
1427 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); 1419 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS);
1428 1420
1429 if (NeedsHomeObject(value)) { 1421 if (NeedsHomeObject(value)) {
1430 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); 1422 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1));
1431 } 1423 }
1432 } else { 1424 } else {
1433 VisitForEffect(value); 1425 VisitForEffect(value);
1434 } 1426 }
1435 break; 1427 break;
1436 } 1428 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 if (!result_saved) { 1606 if (!result_saved) {
1615 PushOperand(v0); // array literal 1607 PushOperand(v0); // array literal
1616 result_saved = true; 1608 result_saved = true;
1617 } 1609 }
1618 1610
1619 VisitForAccumulatorValue(subexpr); 1611 VisitForAccumulatorValue(subexpr);
1620 1612
1621 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index))); 1613 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
1622 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 1614 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1623 __ mov(StoreDescriptor::ValueRegister(), result_register()); 1615 __ mov(StoreDescriptor::ValueRegister(), result_register());
1624 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1616 CallKeyedStoreIC(expr->LiteralFeedbackSlot());
1625 CallKeyedStoreIC();
1626 1617
1627 PrepareForBailoutForId(expr->GetIdForElement(array_index), 1618 PrepareForBailoutForId(expr->GetIdForElement(array_index),
1628 BailoutState::NO_REGISTERS); 1619 BailoutState::NO_REGISTERS);
1629 } 1620 }
1630 1621
1631 if (result_saved) { 1622 if (result_saved) {
1632 context()->PlugTOS(); 1623 context()->PlugTOS();
1633 } else { 1624 } else {
1634 context()->Plug(v0); 1625 context()->Plug(v0);
1635 } 1626 }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 Variable* var = expr->AsVariableProxy()->var(); 2044 Variable* var = expr->AsVariableProxy()->var();
2054 EffectContext context(this); 2045 EffectContext context(this);
2055 EmitVariableAssignment(var, Token::ASSIGN, slot); 2046 EmitVariableAssignment(var, Token::ASSIGN, slot);
2056 break; 2047 break;
2057 } 2048 }
2058 case NAMED_PROPERTY: { 2049 case NAMED_PROPERTY: {
2059 PushOperand(result_register()); // Preserve value. 2050 PushOperand(result_register()); // Preserve value.
2060 VisitForAccumulatorValue(prop->obj()); 2051 VisitForAccumulatorValue(prop->obj());
2061 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); 2052 __ mov(StoreDescriptor::ReceiverRegister(), result_register());
2062 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. 2053 PopOperand(StoreDescriptor::ValueRegister()); // Restore value.
2063 __ li(StoreDescriptor::NameRegister(), 2054 CallStoreIC(slot, prop->key()->AsLiteral()->value());
2064 Operand(prop->key()->AsLiteral()->value()));
2065 EmitLoadStoreICSlot(slot);
2066 CallStoreIC();
2067 break; 2055 break;
2068 } 2056 }
2069 case NAMED_SUPER_PROPERTY: { 2057 case NAMED_SUPER_PROPERTY: {
2070 PushOperand(v0); 2058 PushOperand(v0);
2071 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2059 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2072 VisitForAccumulatorValue( 2060 VisitForAccumulatorValue(
2073 prop->obj()->AsSuperPropertyReference()->home_object()); 2061 prop->obj()->AsSuperPropertyReference()->home_object());
2074 // stack: value, this; v0: home_object 2062 // stack: value, this; v0: home_object
2075 Register scratch = a2; 2063 Register scratch = a2;
2076 Register scratch2 = a3; 2064 Register scratch2 = a3;
(...skipping 26 matching lines...) Expand all
2103 EmitKeyedSuperPropertyStore(prop); 2091 EmitKeyedSuperPropertyStore(prop);
2104 break; 2092 break;
2105 } 2093 }
2106 case KEYED_PROPERTY: { 2094 case KEYED_PROPERTY: {
2107 PushOperand(result_register()); // Preserve value. 2095 PushOperand(result_register()); // Preserve value.
2108 VisitForStackValue(prop->obj()); 2096 VisitForStackValue(prop->obj());
2109 VisitForAccumulatorValue(prop->key()); 2097 VisitForAccumulatorValue(prop->key());
2110 __ Move(StoreDescriptor::NameRegister(), result_register()); 2098 __ Move(StoreDescriptor::NameRegister(), result_register());
2111 PopOperands(StoreDescriptor::ValueRegister(), 2099 PopOperands(StoreDescriptor::ValueRegister(),
2112 StoreDescriptor::ReceiverRegister()); 2100 StoreDescriptor::ReceiverRegister());
2113 EmitLoadStoreICSlot(slot); 2101 CallKeyedStoreIC(slot);
2114 CallKeyedStoreIC();
2115 break; 2102 break;
2116 } 2103 }
2117 } 2104 }
2118 context()->Plug(v0); 2105 context()->Plug(v0);
2119 } 2106 }
2120 2107
2121 2108
2122 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( 2109 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
2123 Variable* var, MemOperand location) { 2110 Variable* var, MemOperand location) {
2124 __ sd(result_register(), location); 2111 __ sd(result_register(), location);
2125 if (var->IsContextSlot()) { 2112 if (var->IsContextSlot()) {
2126 // RecordWrite may destroy all its register arguments. 2113 // RecordWrite may destroy all its register arguments.
2127 __ Move(a3, result_register()); 2114 __ Move(a3, result_register());
2128 int offset = Context::SlotOffset(var->index()); 2115 int offset = Context::SlotOffset(var->index());
2129 __ RecordWriteContextSlot( 2116 __ RecordWriteContextSlot(
2130 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); 2117 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs);
2131 } 2118 }
2132 } 2119 }
2133 2120
2134 2121
2135 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2122 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2136 FeedbackVectorSlot slot) { 2123 FeedbackVectorSlot slot) {
2137 if (var->IsUnallocated()) { 2124 if (var->IsUnallocated()) {
2138 // Global var, const, or let. 2125 // Global var, const, or let.
2139 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2126 __ mov(StoreDescriptor::ValueRegister(), result_register());
2140 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2141 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); 2127 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister());
2142 EmitLoadStoreICSlot(slot); 2128 CallStoreIC(slot, var->name());
2143 CallStoreIC();
2144 2129
2145 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { 2130 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) {
2146 DCHECK(!var->IsLookupSlot()); 2131 DCHECK(!var->IsLookupSlot());
2147 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2132 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2148 MemOperand location = VarOperand(var, a1); 2133 MemOperand location = VarOperand(var, a1);
2149 // Perform an initialization check for lexically declared variables. 2134 // Perform an initialization check for lexically declared variables.
2150 if (var->binding_needs_init()) { 2135 if (var->binding_needs_init()) {
2151 Label assign; 2136 Label assign;
2152 __ ld(a3, location); 2137 __ ld(a3, location);
2153 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2138 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 } 2186 }
2202 2187
2203 2188
2204 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2189 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2205 // Assignment to a property, using a named store IC. 2190 // Assignment to a property, using a named store IC.
2206 Property* prop = expr->target()->AsProperty(); 2191 Property* prop = expr->target()->AsProperty();
2207 DCHECK(prop != NULL); 2192 DCHECK(prop != NULL);
2208 DCHECK(prop->key()->IsLiteral()); 2193 DCHECK(prop->key()->IsLiteral());
2209 2194
2210 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2195 __ mov(StoreDescriptor::ValueRegister(), result_register());
2211 __ li(StoreDescriptor::NameRegister(),
2212 Operand(prop->key()->AsLiteral()->value()));
2213 PopOperand(StoreDescriptor::ReceiverRegister()); 2196 PopOperand(StoreDescriptor::ReceiverRegister());
2214 EmitLoadStoreICSlot(expr->AssignmentSlot()); 2197 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value());
2215 CallStoreIC();
2216 2198
2217 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 2199 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
2218 context()->Plug(v0); 2200 context()->Plug(v0);
2219 } 2201 }
2220 2202
2221 2203
2222 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { 2204 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
2223 // Assignment to named property of super. 2205 // Assignment to named property of super.
2224 // v0 : value 2206 // v0 : value
2225 // stack : receiver ('this'), home_object 2207 // stack : receiver ('this'), home_object
(...skipping 27 matching lines...) Expand all
2253 // Call keyed store IC. 2235 // Call keyed store IC.
2254 // The arguments are: 2236 // The arguments are:
2255 // - a0 is the value, 2237 // - a0 is the value,
2256 // - a1 is the key, 2238 // - a1 is the key,
2257 // - a2 is the receiver. 2239 // - a2 is the receiver.
2258 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2240 __ mov(StoreDescriptor::ValueRegister(), result_register());
2259 PopOperands(StoreDescriptor::ReceiverRegister(), 2241 PopOperands(StoreDescriptor::ReceiverRegister(),
2260 StoreDescriptor::NameRegister()); 2242 StoreDescriptor::NameRegister());
2261 DCHECK(StoreDescriptor::ValueRegister().is(a0)); 2243 DCHECK(StoreDescriptor::ValueRegister().is(a0));
2262 2244
2263 EmitLoadStoreICSlot(expr->AssignmentSlot()); 2245 CallKeyedStoreIC(expr->AssignmentSlot());
2264 CallKeyedStoreIC();
2265 2246
2266 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 2247 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
2267 context()->Plug(v0); 2248 context()->Plug(v0);
2268 } 2249 }
2269 2250
2270 2251
2271 void FullCodeGenerator::CallIC(Handle<Code> code, 2252 void FullCodeGenerator::CallIC(Handle<Code> code,
2272 TypeFeedbackId id) { 2253 TypeFeedbackId id) {
2273 ic_total_count_++; 2254 ic_total_count_++;
2274 __ Call(code, RelocInfo::CODE_TARGET, id); 2255 __ Call(code, RelocInfo::CODE_TARGET, id);
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 } else { 3284 } else {
3304 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3285 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3305 Token::ASSIGN, expr->CountSlot()); 3286 Token::ASSIGN, expr->CountSlot());
3306 PrepareForBailoutForId(expr->AssignmentId(), 3287 PrepareForBailoutForId(expr->AssignmentId(),
3307 BailoutState::TOS_REGISTER); 3288 BailoutState::TOS_REGISTER);
3308 context()->Plug(v0); 3289 context()->Plug(v0);
3309 } 3290 }
3310 break; 3291 break;
3311 case NAMED_PROPERTY: { 3292 case NAMED_PROPERTY: {
3312 __ mov(StoreDescriptor::ValueRegister(), result_register()); 3293 __ mov(StoreDescriptor::ValueRegister(), result_register());
3313 __ li(StoreDescriptor::NameRegister(),
3314 Operand(prop->key()->AsLiteral()->value()));
3315 PopOperand(StoreDescriptor::ReceiverRegister()); 3294 PopOperand(StoreDescriptor::ReceiverRegister());
3316 EmitLoadStoreICSlot(expr->CountSlot()); 3295 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value());
3317 CallStoreIC();
3318 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 3296 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
3319 if (expr->is_postfix()) { 3297 if (expr->is_postfix()) {
3320 if (!context()->IsEffect()) { 3298 if (!context()->IsEffect()) {
3321 context()->PlugTOS(); 3299 context()->PlugTOS();
3322 } 3300 }
3323 } else { 3301 } else {
3324 context()->Plug(v0); 3302 context()->Plug(v0);
3325 } 3303 }
3326 break; 3304 break;
3327 } 3305 }
(...skipping 18 matching lines...) Expand all
3346 } 3324 }
3347 } else { 3325 } else {
3348 context()->Plug(v0); 3326 context()->Plug(v0);
3349 } 3327 }
3350 break; 3328 break;
3351 } 3329 }
3352 case KEYED_PROPERTY: { 3330 case KEYED_PROPERTY: {
3353 __ mov(StoreDescriptor::ValueRegister(), result_register()); 3331 __ mov(StoreDescriptor::ValueRegister(), result_register());
3354 PopOperands(StoreDescriptor::ReceiverRegister(), 3332 PopOperands(StoreDescriptor::ReceiverRegister(),
3355 StoreDescriptor::NameRegister()); 3333 StoreDescriptor::NameRegister());
3356 EmitLoadStoreICSlot(expr->CountSlot()); 3334 CallKeyedStoreIC(expr->CountSlot());
3357 CallKeyedStoreIC();
3358 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 3335 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
3359 if (expr->is_postfix()) { 3336 if (expr->is_postfix()) {
3360 if (!context()->IsEffect()) { 3337 if (!context()->IsEffect()) {
3361 context()->PlugTOS(); 3338 context()->PlugTOS();
3362 } 3339 }
3363 } else { 3340 } else {
3364 context()->Plug(v0); 3341 context()->Plug(v0);
3365 } 3342 }
3366 break; 3343 break;
3367 } 3344 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 reinterpret_cast<uint64_t>( 3716 reinterpret_cast<uint64_t>(
3740 isolate->builtins()->OnStackReplacement()->entry())); 3717 isolate->builtins()->OnStackReplacement()->entry()));
3741 return ON_STACK_REPLACEMENT; 3718 return ON_STACK_REPLACEMENT;
3742 } 3719 }
3743 3720
3744 3721
3745 } // namespace internal 3722 } // namespace internal
3746 } // namespace v8 3723 } // namespace v8
3747 3724
3748 #endif // V8_TARGET_ARCH_MIPS64 3725 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698