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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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/x64/full-codegen-x64.cc ('k') | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); 1077 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
1078 __ bind(&exit); 1078 __ bind(&exit);
1079 decrement_loop_depth(); 1079 decrement_loop_depth();
1080 } 1080 }
1081 1081
1082 1082
1083 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, 1083 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset,
1084 FeedbackVectorSlot slot) { 1084 FeedbackVectorSlot slot) {
1085 DCHECK(NeedsHomeObject(initializer)); 1085 DCHECK(NeedsHomeObject(initializer));
1086 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); 1086 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1087 __ mov(StoreDescriptor::NameRegister(),
1088 Immediate(isolate()->factory()->home_object_symbol()));
1087 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize)); 1089 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize));
1088 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); 1090 EmitLoadStoreICSlot(slot);
1091 CallStoreIC();
1089 } 1092 }
1090 1093
1091 1094
1092 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, 1095 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer,
1093 int offset, 1096 int offset,
1094 FeedbackVectorSlot slot) { 1097 FeedbackVectorSlot slot) {
1095 DCHECK(NeedsHomeObject(initializer)); 1098 DCHECK(NeedsHomeObject(initializer));
1096 __ mov(StoreDescriptor::ReceiverRegister(), eax); 1099 __ mov(StoreDescriptor::ReceiverRegister(), eax);
1100 __ mov(StoreDescriptor::NameRegister(),
1101 Immediate(isolate()->factory()->home_object_symbol()));
1097 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize)); 1102 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize));
1098 CallStoreIC(slot, isolate()->factory()->home_object_symbol()); 1103 EmitLoadStoreICSlot(slot);
1104 CallStoreIC();
1099 } 1105 }
1100 1106
1101 1107
1102 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1108 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1103 TypeofMode typeof_mode, 1109 TypeofMode typeof_mode,
1104 Label* slow) { 1110 Label* slow) {
1105 Register context = esi; 1111 Register context = esi;
1106 Register temp = edx; 1112 Register temp = edx;
1107 1113
1108 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); 1114 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); 1329 DCHECK(!CompileTimeValue::IsCompileTimeValue(value));
1324 // Fall through. 1330 // Fall through.
1325 case ObjectLiteral::Property::COMPUTED: 1331 case ObjectLiteral::Property::COMPUTED:
1326 // It is safe to use [[Put]] here because the boilerplate already 1332 // It is safe to use [[Put]] here because the boilerplate already
1327 // contains computed properties with an uninitialized value. 1333 // contains computed properties with an uninitialized value.
1328 if (key->IsStringLiteral()) { 1334 if (key->IsStringLiteral()) {
1329 DCHECK(key->IsPropertyName()); 1335 DCHECK(key->IsPropertyName());
1330 if (property->emit_store()) { 1336 if (property->emit_store()) {
1331 VisitForAccumulatorValue(value); 1337 VisitForAccumulatorValue(value);
1332 DCHECK(StoreDescriptor::ValueRegister().is(eax)); 1338 DCHECK(StoreDescriptor::ValueRegister().is(eax));
1339 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value()));
1333 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); 1340 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1334 CallStoreIC(property->GetSlot(0), key->value()); 1341 EmitLoadStoreICSlot(property->GetSlot(0));
1342 CallStoreIC();
1335 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS); 1343 PrepareForBailoutForId(key->id(), BailoutState::NO_REGISTERS);
1336 if (NeedsHomeObject(value)) { 1344 if (NeedsHomeObject(value)) {
1337 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); 1345 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1));
1338 } 1346 }
1339 } else { 1347 } else {
1340 VisitForEffect(value); 1348 VisitForEffect(value);
1341 } 1349 }
1342 break; 1350 break;
1343 } 1351 }
1344 PushOperand(Operand(esp, 0)); // Duplicate receiver. 1352 PushOperand(Operand(esp, 0)); // Duplicate receiver.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 1523
1516 if (!result_saved) { 1524 if (!result_saved) {
1517 PushOperand(eax); // array literal. 1525 PushOperand(eax); // array literal.
1518 result_saved = true; 1526 result_saved = true;
1519 } 1527 }
1520 VisitForAccumulatorValue(subexpr); 1528 VisitForAccumulatorValue(subexpr);
1521 1529
1522 __ mov(StoreDescriptor::NameRegister(), 1530 __ mov(StoreDescriptor::NameRegister(),
1523 Immediate(Smi::FromInt(array_index))); 1531 Immediate(Smi::FromInt(array_index)));
1524 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); 1532 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1525 CallKeyedStoreIC(expr->LiteralFeedbackSlot()); 1533 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1534 CallKeyedStoreIC();
1526 PrepareForBailoutForId(expr->GetIdForElement(array_index), 1535 PrepareForBailoutForId(expr->GetIdForElement(array_index),
1527 BailoutState::NO_REGISTERS); 1536 BailoutState::NO_REGISTERS);
1528 } 1537 }
1529 1538
1530 if (result_saved) { 1539 if (result_saved) {
1531 context()->PlugTOS(); 1540 context()->PlugTOS();
1532 } else { 1541 } else {
1533 context()->Plug(eax); 1542 context()->Plug(eax);
1534 } 1543 }
1535 } 1544 }
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 Variable* var = expr->AsVariableProxy()->var(); 1947 Variable* var = expr->AsVariableProxy()->var();
1939 EffectContext context(this); 1948 EffectContext context(this);
1940 EmitVariableAssignment(var, Token::ASSIGN, slot); 1949 EmitVariableAssignment(var, Token::ASSIGN, slot);
1941 break; 1950 break;
1942 } 1951 }
1943 case NAMED_PROPERTY: { 1952 case NAMED_PROPERTY: {
1944 PushOperand(eax); // Preserve value. 1953 PushOperand(eax); // Preserve value.
1945 VisitForAccumulatorValue(prop->obj()); 1954 VisitForAccumulatorValue(prop->obj());
1946 __ Move(StoreDescriptor::ReceiverRegister(), eax); 1955 __ Move(StoreDescriptor::ReceiverRegister(), eax);
1947 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. 1956 PopOperand(StoreDescriptor::ValueRegister()); // Restore value.
1948 CallStoreIC(slot, prop->key()->AsLiteral()->value()); 1957 __ mov(StoreDescriptor::NameRegister(),
1958 prop->key()->AsLiteral()->value());
1959 EmitLoadStoreICSlot(slot);
1960 CallStoreIC();
1949 break; 1961 break;
1950 } 1962 }
1951 case NAMED_SUPER_PROPERTY: { 1963 case NAMED_SUPER_PROPERTY: {
1952 PushOperand(eax); 1964 PushOperand(eax);
1953 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 1965 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
1954 VisitForAccumulatorValue( 1966 VisitForAccumulatorValue(
1955 prop->obj()->AsSuperPropertyReference()->home_object()); 1967 prop->obj()->AsSuperPropertyReference()->home_object());
1956 // stack: value, this; eax: home_object 1968 // stack: value, this; eax: home_object
1957 Register scratch = ecx; 1969 Register scratch = ecx;
1958 Register scratch2 = edx; 1970 Register scratch2 = edx;
(...skipping 26 matching lines...) Expand all
1985 EmitKeyedSuperPropertyStore(prop); 1997 EmitKeyedSuperPropertyStore(prop);
1986 break; 1998 break;
1987 } 1999 }
1988 case KEYED_PROPERTY: { 2000 case KEYED_PROPERTY: {
1989 PushOperand(eax); // Preserve value. 2001 PushOperand(eax); // Preserve value.
1990 VisitForStackValue(prop->obj()); 2002 VisitForStackValue(prop->obj());
1991 VisitForAccumulatorValue(prop->key()); 2003 VisitForAccumulatorValue(prop->key());
1992 __ Move(StoreDescriptor::NameRegister(), eax); 2004 __ Move(StoreDescriptor::NameRegister(), eax);
1993 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver. 2005 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver.
1994 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. 2006 PopOperand(StoreDescriptor::ValueRegister()); // Restore value.
1995 CallKeyedStoreIC(slot); 2007 EmitLoadStoreICSlot(slot);
2008 CallKeyedStoreIC();
1996 break; 2009 break;
1997 } 2010 }
1998 } 2011 }
1999 context()->Plug(eax); 2012 context()->Plug(eax);
2000 } 2013 }
2001 2014
2002 2015
2003 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( 2016 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
2004 Variable* var, MemOperand location) { 2017 Variable* var, MemOperand location) {
2005 __ mov(location, eax); 2018 __ mov(location, eax);
2006 if (var->IsContextSlot()) { 2019 if (var->IsContextSlot()) {
2007 __ mov(edx, eax); 2020 __ mov(edx, eax);
2008 int offset = Context::SlotOffset(var->index()); 2021 int offset = Context::SlotOffset(var->index());
2009 __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs); 2022 __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs);
2010 } 2023 }
2011 } 2024 }
2012 2025
2013 2026
2014 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2027 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2015 FeedbackVectorSlot slot) { 2028 FeedbackVectorSlot slot) {
2016 if (var->IsUnallocated()) { 2029 if (var->IsUnallocated()) {
2017 // Global var, const, or let. 2030 // Global var, const, or let.
2031 __ mov(StoreDescriptor::NameRegister(), var->name());
2018 __ mov(StoreDescriptor::ReceiverRegister(), NativeContextOperand()); 2032 __ mov(StoreDescriptor::ReceiverRegister(), NativeContextOperand());
2019 __ mov(StoreDescriptor::ReceiverRegister(), 2033 __ mov(StoreDescriptor::ReceiverRegister(),
2020 ContextOperand(StoreDescriptor::ReceiverRegister(), 2034 ContextOperand(StoreDescriptor::ReceiverRegister(),
2021 Context::EXTENSION_INDEX)); 2035 Context::EXTENSION_INDEX));
2022 CallStoreIC(slot, var->name()); 2036 EmitLoadStoreICSlot(slot);
2037 CallStoreIC();
2023 2038
2024 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { 2039 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) {
2025 DCHECK(!var->IsLookupSlot()); 2040 DCHECK(!var->IsLookupSlot());
2026 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2041 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2027 MemOperand location = VarOperand(var, ecx); 2042 MemOperand location = VarOperand(var, ecx);
2028 // Perform an initialization check for lexically declared variables. 2043 // Perform an initialization check for lexically declared variables.
2029 if (var->binding_needs_init()) { 2044 if (var->binding_needs_init()) {
2030 Label assign; 2045 Label assign;
2031 __ mov(edx, location); 2046 __ mov(edx, location);
2032 __ cmp(edx, isolate()->factory()->the_hole_value()); 2047 __ cmp(edx, isolate()->factory()->the_hole_value());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 2095
2081 2096
2082 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2097 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2083 // Assignment to a property, using a named store IC. 2098 // Assignment to a property, using a named store IC.
2084 // eax : value 2099 // eax : value
2085 // esp[0] : receiver 2100 // esp[0] : receiver
2086 Property* prop = expr->target()->AsProperty(); 2101 Property* prop = expr->target()->AsProperty();
2087 DCHECK(prop != NULL); 2102 DCHECK(prop != NULL);
2088 DCHECK(prop->key()->IsLiteral()); 2103 DCHECK(prop->key()->IsLiteral());
2089 2104
2105 __ mov(StoreDescriptor::NameRegister(), prop->key()->AsLiteral()->value());
2090 PopOperand(StoreDescriptor::ReceiverRegister()); 2106 PopOperand(StoreDescriptor::ReceiverRegister());
2091 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); 2107 EmitLoadStoreICSlot(expr->AssignmentSlot());
2108 CallStoreIC();
2092 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 2109 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
2093 context()->Plug(eax); 2110 context()->Plug(eax);
2094 } 2111 }
2095 2112
2096 2113
2097 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { 2114 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
2098 // Assignment to named property of super. 2115 // Assignment to named property of super.
2099 // eax : value 2116 // eax : value
2100 // stack : receiver ('this'), home_object 2117 // stack : receiver ('this'), home_object
2101 DCHECK(prop != NULL); 2118 DCHECK(prop != NULL);
(...skipping 22 matching lines...) Expand all
2124 2141
2125 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2142 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2126 // Assignment to a property, using a keyed store IC. 2143 // Assignment to a property, using a keyed store IC.
2127 // eax : value 2144 // eax : value
2128 // esp[0] : key 2145 // esp[0] : key
2129 // esp[kPointerSize] : receiver 2146 // esp[kPointerSize] : receiver
2130 2147
2131 PopOperand(StoreDescriptor::NameRegister()); // Key. 2148 PopOperand(StoreDescriptor::NameRegister()); // Key.
2132 PopOperand(StoreDescriptor::ReceiverRegister()); 2149 PopOperand(StoreDescriptor::ReceiverRegister());
2133 DCHECK(StoreDescriptor::ValueRegister().is(eax)); 2150 DCHECK(StoreDescriptor::ValueRegister().is(eax));
2134 CallKeyedStoreIC(expr->AssignmentSlot()); 2151 EmitLoadStoreICSlot(expr->AssignmentSlot());
2152 CallKeyedStoreIC();
2135 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 2153 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
2136 context()->Plug(eax); 2154 context()->Plug(eax);
2137 } 2155 }
2138 2156
2139 2157
2140 void FullCodeGenerator::CallIC(Handle<Code> code, 2158 void FullCodeGenerator::CallIC(Handle<Code> code,
2141 TypeFeedbackId ast_id) { 2159 TypeFeedbackId ast_id) {
2142 ic_total_count_++; 2160 ic_total_count_++;
2143 __ call(code, RelocInfo::CODE_TARGET, ast_id); 2161 __ call(code, RelocInfo::CODE_TARGET, ast_id);
2144 } 2162 }
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 } else { 3187 } else {
3170 // Perform the assignment as if via '='. 3188 // Perform the assignment as if via '='.
3171 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3189 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3172 Token::ASSIGN, expr->CountSlot()); 3190 Token::ASSIGN, expr->CountSlot());
3173 PrepareForBailoutForId(expr->AssignmentId(), 3191 PrepareForBailoutForId(expr->AssignmentId(),
3174 BailoutState::TOS_REGISTER); 3192 BailoutState::TOS_REGISTER);
3175 context()->Plug(eax); 3193 context()->Plug(eax);
3176 } 3194 }
3177 break; 3195 break;
3178 case NAMED_PROPERTY: { 3196 case NAMED_PROPERTY: {
3197 __ mov(StoreDescriptor::NameRegister(),
3198 prop->key()->AsLiteral()->value());
3179 PopOperand(StoreDescriptor::ReceiverRegister()); 3199 PopOperand(StoreDescriptor::ReceiverRegister());
3180 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); 3200 EmitLoadStoreICSlot(expr->CountSlot());
3201 CallStoreIC();
3181 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 3202 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
3182 if (expr->is_postfix()) { 3203 if (expr->is_postfix()) {
3183 if (!context()->IsEffect()) { 3204 if (!context()->IsEffect()) {
3184 context()->PlugTOS(); 3205 context()->PlugTOS();
3185 } 3206 }
3186 } else { 3207 } else {
3187 context()->Plug(eax); 3208 context()->Plug(eax);
3188 } 3209 }
3189 break; 3210 break;
3190 } 3211 }
(...skipping 17 matching lines...) Expand all
3208 context()->PlugTOS(); 3229 context()->PlugTOS();
3209 } 3230 }
3210 } else { 3231 } else {
3211 context()->Plug(eax); 3232 context()->Plug(eax);
3212 } 3233 }
3213 break; 3234 break;
3214 } 3235 }
3215 case KEYED_PROPERTY: { 3236 case KEYED_PROPERTY: {
3216 PopOperand(StoreDescriptor::NameRegister()); 3237 PopOperand(StoreDescriptor::NameRegister());
3217 PopOperand(StoreDescriptor::ReceiverRegister()); 3238 PopOperand(StoreDescriptor::ReceiverRegister());
3218 CallKeyedStoreIC(expr->CountSlot()); 3239 EmitLoadStoreICSlot(expr->CountSlot());
3240 CallKeyedStoreIC();
3219 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 3241 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
3220 if (expr->is_postfix()) { 3242 if (expr->is_postfix()) {
3221 // Result is on the stack 3243 // Result is on the stack
3222 if (!context()->IsEffect()) { 3244 if (!context()->IsEffect()) {
3223 context()->PlugTOS(); 3245 context()->PlugTOS();
3224 } 3246 }
3225 } else { 3247 } else {
3226 context()->Plug(eax); 3248 context()->Plug(eax);
3227 } 3249 }
3228 break; 3250 break;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3591 isolate->builtins()->OnStackReplacement()->entry(), 3613 isolate->builtins()->OnStackReplacement()->entry(),
3592 Assembler::target_address_at(call_target_address, unoptimized_code)); 3614 Assembler::target_address_at(call_target_address, unoptimized_code));
3593 return ON_STACK_REPLACEMENT; 3615 return ON_STACK_REPLACEMENT;
3594 } 3616 }
3595 3617
3596 3618
3597 } // namespace internal 3619 } // namespace internal
3598 } // namespace v8 3620 } // namespace v8
3599 3621
3600 #endif // V8_TARGET_ARCH_X87 3622 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698