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

Side by Side Diff: src/full-codegen/full-codegen.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/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.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 #include "src/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 CallIC(ic, id); 228 CallIC(ic, id);
229 if (FLAG_tf_load_ic_stub) RestoreContext(); 229 if (FLAG_tf_load_ic_stub) RestoreContext();
230 } 230 }
231 231
232 void FullCodeGenerator::CallLoadGlobalIC(TypeofMode typeof_mode, 232 void FullCodeGenerator::CallLoadGlobalIC(TypeofMode typeof_mode,
233 TypeFeedbackId id) { 233 TypeFeedbackId id) {
234 Handle<Code> ic = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code(); 234 Handle<Code> ic = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code();
235 CallIC(ic, id); 235 CallIC(ic, id);
236 } 236 }
237 237
238 void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) { 238 void FullCodeGenerator::CallStoreIC(FeedbackVectorSlot slot,
239 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code(); 239 Handle<Object> name, TypeFeedbackId id) {
240 DCHECK(name->IsName());
241 __ Move(StoreDescriptor::NameRegister(), name);
240 242
241 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || 243 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack ||
242 StoreDescriptor::kStackArgumentsCount == 2); 244 StoreDescriptor::kStackArgumentsCount == 2);
243 if (StoreDescriptor::kPassLastArgsOnStack) { 245 if (StoreDescriptor::kPassLastArgsOnStack) {
244 __ Push(StoreDescriptor::ValueRegister()); 246 __ Push(StoreDescriptor::ValueRegister());
245 __ Push(StoreDescriptor::SlotRegister()); 247 EmitPushSlot(slot);
248 } else {
249 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot);
246 } 250 }
247 251
252 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code();
248 CallIC(ic, id); 253 CallIC(ic, id);
249 RestoreContext(); 254 RestoreContext();
250 } 255 }
251 256
252 void FullCodeGenerator::CallKeyedStoreIC() { 257 void FullCodeGenerator::CallKeyedStoreIC(FeedbackVectorSlot slot) {
253 Handle<Code> ic =
254 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
255
256 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || 258 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack ||
257 StoreDescriptor::kStackArgumentsCount == 2); 259 StoreDescriptor::kStackArgumentsCount == 2);
258 if (StoreDescriptor::kPassLastArgsOnStack) { 260 if (StoreDescriptor::kPassLastArgsOnStack) {
259 __ Push(StoreDescriptor::ValueRegister()); 261 __ Push(StoreDescriptor::ValueRegister());
260 __ Push(StoreDescriptor::SlotRegister()); 262 EmitPushSlot(slot);
263 } else {
264 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot);
261 } 265 }
262 266
267 Handle<Code> ic =
268 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
263 CallIC(ic); 269 CallIC(ic);
264 RestoreContext(); 270 RestoreContext();
265 } 271 }
266 272
267 void FullCodeGenerator::RecordJSReturnSite(Call* call) { 273 void FullCodeGenerator::RecordJSReturnSite(Call* call) {
268 // We record the offset of the function return so we can rebuild the frame 274 // We record the offset of the function return so we can rebuild the frame
269 // if the function was inlined, i.e., this is the return address in the 275 // if the function was inlined, i.e., this is the return address in the
270 // inlined function's frame. 276 // inlined function's frame.
271 // 277 //
272 // The bailout state is ignored. We defensively set it to TOS_REGISTER, which 278 // The bailout state is ignored. We defensively set it to TOS_REGISTER, which
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 487
482 globals_ = saved_globals; 488 globals_ = saved_globals;
483 } 489 }
484 490
485 491
486 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 492 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
487 Comment cmnt(masm_, "[ VariableProxy"); 493 Comment cmnt(masm_, "[ VariableProxy");
488 EmitVariableLoad(expr); 494 EmitVariableLoad(expr);
489 } 495 }
490 496
491
492 void FullCodeGenerator::VisitSloppyBlockFunctionStatement( 497 void FullCodeGenerator::VisitSloppyBlockFunctionStatement(
493 SloppyBlockFunctionStatement* declaration) { 498 SloppyBlockFunctionStatement* declaration) {
494 Visit(declaration->statement()); 499 Visit(declaration->statement());
495 } 500 }
496 501
497 502
498 int FullCodeGenerator::DeclareGlobalsFlags() { 503 int FullCodeGenerator::DeclareGlobalsFlags() {
499 return info_->GetDeclareGlobalsFlags(); 504 return info_->GetDeclareGlobalsFlags();
500 } 505 }
501 506
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1126 }
1122 1127
1123 void FullCodeGenerator::EmitPropertyKey(LiteralProperty* property, 1128 void FullCodeGenerator::EmitPropertyKey(LiteralProperty* property,
1124 BailoutId bailout_id) { 1129 BailoutId bailout_id) {
1125 VisitForStackValue(property->key()); 1130 VisitForStackValue(property->key());
1126 CallRuntimeWithOperands(Runtime::kToName); 1131 CallRuntimeWithOperands(Runtime::kToName);
1127 PrepareForBailoutForId(bailout_id, BailoutState::TOS_REGISTER); 1132 PrepareForBailoutForId(bailout_id, BailoutState::TOS_REGISTER);
1128 PushOperand(result_register()); 1133 PushOperand(result_register());
1129 } 1134 }
1130 1135
1131 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorSlot slot) { 1136 void FullCodeGenerator::EmitLoadSlot(Register destination,
1137 FeedbackVectorSlot slot) {
1132 DCHECK(!slot.IsInvalid()); 1138 DCHECK(!slot.IsInvalid());
1133 __ Move(StoreDescriptor::SlotRegister(), SmiFromSlot(slot)); 1139 __ Move(destination, SmiFromSlot(slot));
1140 }
1141
1142 void FullCodeGenerator::EmitPushSlot(FeedbackVectorSlot slot) {
1143 __ Push(SmiFromSlot(slot));
1134 } 1144 }
1135 1145
1136 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { 1146 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
1137 Comment cmnt(masm_, "[ ReturnStatement"); 1147 Comment cmnt(masm_, "[ ReturnStatement");
1138 SetStatementPosition(stmt); 1148 SetStatementPosition(stmt);
1139 Expression* expr = stmt->expression(); 1149 Expression* expr = stmt->expression();
1140 VisitForAccumulatorValue(expr); 1150 VisitForAccumulatorValue(expr);
1141 EmitUnwindAndReturn(); 1151 EmitUnwindAndReturn();
1142 } 1152 }
1143 1153
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 return info_->has_simple_parameters(); 2041 return info_->has_simple_parameters();
2032 } 2042 }
2033 2043
2034 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } 2044 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); }
2035 2045
2036 #undef __ 2046 #undef __
2037 2047
2038 2048
2039 } // namespace internal 2049 } // namespace internal
2040 } // namespace v8 2050 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698