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

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

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

Powered by Google App Engine
This is Rietveld 408576698