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

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

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