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

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 17421003: Store arguments descriptor in ICData. Remove loading of arguments descriptor at unoptimized call si… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 147
148 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 148 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
149 // The arguments to the stub include the closure, as does the arguments 149 // The arguments to the stub include the closure, as does the arguments
150 // descriptor. 150 // descriptor.
151 Register temp_reg = locs()->temp(0).reg(); 151 Register temp_reg = locs()->temp(0).reg();
152 int argument_count = ArgumentCount(); 152 int argument_count = ArgumentCount();
153 const Array& arguments_descriptor = 153 const Array& arguments_descriptor =
154 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, 154 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
155 argument_names())); 155 argument_names()));
156 ASSERT(temp_reg == S4);
156 __ LoadObject(temp_reg, arguments_descriptor); 157 __ LoadObject(temp_reg, arguments_descriptor);
157 compiler->GenerateDartCall(deopt_id(), 158 compiler->GenerateDartCall(deopt_id(),
158 token_pos(), 159 token_pos(),
159 &StubCode::CallClosureFunctionLabel(), 160 &StubCode::CallClosureFunctionLabel(),
160 PcDescriptors::kClosureCall, 161 PcDescriptors::kClosureCall,
161 locs()); 162 locs());
162 __ Drop(argument_count); 163 __ Drop(argument_count);
163 } 164 }
164 165
165 166
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 intptr_t token_pos, 377 intptr_t token_pos,
377 Token::Kind kind, 378 Token::Kind kind,
378 LocationSummary* locs, 379 LocationSummary* locs,
379 const ICData& original_ic_data) { 380 const ICData& original_ic_data) {
380 if (!compiler->is_optimizing()) { 381 if (!compiler->is_optimizing()) {
381 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 382 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
382 deopt_id, 383 deopt_id,
383 token_pos); 384 token_pos);
384 } 385 }
385 const int kNumberOfArguments = 2; 386 const int kNumberOfArguments = 2;
386 const Array& kNoArgumentNames = Array::Handle(); 387 const Array& kNoArgumentNames = Object::null_array();
387 const int kNumArgumentsChecked = 2; 388 const int kNumArgumentsChecked = 2;
388 389
389 __ TraceSimMsg("EmitEqualityAsInstanceCall"); 390 __ TraceSimMsg("EmitEqualityAsInstanceCall");
390 __ Comment("EmitEqualityAsInstanceCall"); 391 __ Comment("EmitEqualityAsInstanceCall");
391 Label check_identity; 392 Label check_identity;
392 __ lw(A1, Address(SP, 1 * kWordSize)); 393 __ lw(A1, Address(SP, 1 * kWordSize));
393 __ lw(A0, Address(SP, 0 * kWordSize)); 394 __ lw(A0, Address(SP, 0 * kWordSize));
394 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); 395 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null()));
395 __ beq(A1, TMP, &check_identity); 396 __ beq(A1, TMP, &check_identity);
396 __ beq(A0, TMP, &check_identity); 397 __ beq(A0, TMP, &check_identity);
397 398
398 ICData& equality_ic_data = ICData::ZoneHandle(); 399 ICData& equality_ic_data = ICData::ZoneHandle();
399 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { 400 if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
400 ASSERT(!original_ic_data.IsNull()); 401 ASSERT(!original_ic_data.IsNull());
401 if (original_ic_data.NumberOfChecks() == 0) { 402 if (original_ic_data.NumberOfChecks() == 0) {
402 // IC call for reoptimization populates original ICData. 403 // IC call for reoptimization populates original ICData.
403 equality_ic_data = original_ic_data.raw(); 404 equality_ic_data = original_ic_data.raw();
404 } else { 405 } else {
405 // Megamorphic call. 406 // Megamorphic call.
406 equality_ic_data = original_ic_data.AsUnaryClassChecks(); 407 equality_ic_data = original_ic_data.AsUnaryClassChecks();
407 } 408 }
408 } else { 409 } else {
410 const Array& arguments_descriptor =
411 Array::Handle(ArgumentsDescriptor::New(kNumberOfArguments,
412 kNoArgumentNames));
409 equality_ic_data = ICData::New(compiler->parsed_function().function(), 413 equality_ic_data = ICData::New(compiler->parsed_function().function(),
410 Symbols::EqualOperator(), 414 Symbols::EqualOperator(),
415 arguments_descriptor,
411 deopt_id, 416 deopt_id,
412 kNumArgumentsChecked); 417 kNumArgumentsChecked);
413 } 418 }
414 compiler->GenerateInstanceCall(deopt_id, 419 compiler->GenerateInstanceCall(deopt_id,
415 token_pos, 420 token_pos,
416 kNumberOfArguments, 421 kNumberOfArguments,
417 kNoArgumentNames, 422 kNoArgumentNames,
418 locs, 423 locs,
419 equality_ic_data); 424 equality_ic_data);
420 Label check_ne; 425 Label check_ne;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 Register result = locs->out().reg(); 573 Register result = locs->out().reg();
569 Label load_true; 574 Label load_true;
570 EmitBranchAfterCompare(compiler, cond, &load_true); 575 EmitBranchAfterCompare(compiler, cond, &load_true);
571 __ LoadObject(result, Bool::False()); 576 __ LoadObject(result, Bool::False());
572 __ b(&done); 577 __ b(&done);
573 __ Bind(&load_true); 578 __ Bind(&load_true);
574 __ LoadObject(result, Bool::True()); 579 __ LoadObject(result, Bool::True());
575 } 580 }
576 } else { 581 } else {
577 const int kNumberOfArguments = 2; 582 const int kNumberOfArguments = 2;
578 const Array& kNoArgumentNames = Array::Handle(); 583 const Array& kNoArgumentNames = Object::null_array();
579 compiler->GenerateStaticCall(deopt_id, 584 compiler->GenerateStaticCall(deopt_id,
580 token_pos, 585 token_pos,
581 target, 586 target,
582 kNumberOfArguments, 587 kNumberOfArguments,
583 kNoArgumentNames, 588 kNoArgumentNames,
584 locs); 589 locs);
585 if (branch == NULL) { 590 if (branch == NULL) {
586 if (kind == Token::kNE) { 591 if (kind == Token::kNE) {
587 Label is_true; 592 Label is_true;
588 __ CompareObject(CMPRES, TMP1, V0, Bool::True()); 593 __ CompareObject(CMPRES, TMP1, V0, Bool::True());
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 __ sw(left, Address(SP, 1 * kWordSize)); 983 __ sw(left, Address(SP, 1 * kWordSize));
979 __ sw(right, Address(SP, 0 * kWordSize)); 984 __ sw(right, Address(SP, 0 * kWordSize));
980 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { 985 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
981 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp); 986 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp);
982 // Load class into A2. 987 // Load class into A2.
983 const intptr_t kNumArguments = 2; 988 const intptr_t kNumArguments = 2;
984 LoadValueCid(compiler, A2, left); 989 LoadValueCid(compiler, A2, left);
985 compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()), 990 compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()),
986 A2, // Class id register. 991 A2, // Class id register.
987 kNumArguments, 992 kNumArguments,
988 Array::Handle(), // No named arguments. 993 Object::null_array(), // No named arguments.
989 deopt, // Deoptimize target. 994 deopt, // Deoptimize target.
990 deopt_id(), 995 deopt_id(),
991 token_pos(), 996 token_pos(),
992 locs()); 997 locs());
993 return; 998 return;
994 } 999 }
995 const String& function_name = 1000 const String& function_name =
996 String::ZoneHandle(Symbols::New(Token::Str(kind()))); 1001 String::ZoneHandle(Symbols::New(Token::Str(kind())));
997 if (!compiler->is_optimizing()) { 1002 if (!compiler->is_optimizing()) {
998 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 1003 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
999 deopt_id(), 1004 deopt_id(),
1000 token_pos()); 1005 token_pos());
1001 } 1006 }
1002 const intptr_t kNumArguments = 2; 1007 const intptr_t kNumArguments = 2;
1003 const intptr_t kNumArgsChecked = 2; // Type-feedback. 1008 const intptr_t kNumArgsChecked = 2; // Type-feedback.
1004 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw()); 1009 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
1005 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { 1010 if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
1006 ASSERT(!ic_data()->IsNull()); 1011 ASSERT(!ic_data()->IsNull());
1007 if (ic_data()->NumberOfChecks() == 0) { 1012 if (ic_data()->NumberOfChecks() == 0) {
1008 // IC call for reoptimization populates original ICData. 1013 // IC call for reoptimization populates original ICData.
1009 relational_ic_data = ic_data()->raw(); 1014 relational_ic_data = ic_data()->raw();
1010 } else { 1015 } else {
1011 // Megamorphic call. 1016 // Megamorphic call.
1012 relational_ic_data = ic_data()->AsUnaryClassChecks(); 1017 relational_ic_data = ic_data()->AsUnaryClassChecks();
1013 } 1018 }
1014 } else { 1019 } else {
1020 const Array& arguments_descriptor =
1021 Array::Handle(ArgumentsDescriptor::New(kNumArguments,
1022 Object::null_array()));
1015 relational_ic_data = ICData::New(compiler->parsed_function().function(), 1023 relational_ic_data = ICData::New(compiler->parsed_function().function(),
1016 function_name, 1024 function_name,
1025 arguments_descriptor,
1017 deopt_id(), 1026 deopt_id(),
1018 kNumArgsChecked); 1027 kNumArgsChecked);
1019 } 1028 }
1020 compiler->GenerateInstanceCall(deopt_id(), 1029 compiler->GenerateInstanceCall(deopt_id(),
1021 token_pos(), 1030 token_pos(),
1022 kNumArguments, 1031 kNumArguments,
1023 Array::ZoneHandle(), // No optional arguments. 1032 Object::null_array(), // No optional args.
1024 locs(), 1033 locs(),
1025 relational_ic_data); 1034 relational_ic_data);
1026 } 1035 }
1027 1036
1028 1037
1029 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, 1038 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
1030 BranchInstr* branch) { 1039 BranchInstr* branch) {
1031 __ TraceSimMsg("RelationalOpInstr"); 1040 __ TraceSimMsg("RelationalOpInstr");
1032 if (operands_class_id() == kSmiCid) { 1041 if (operands_class_id() == kSmiCid) {
1033 EmitSmiComparisonOp(compiler, *locs(), kind(), branch); 1042 EmitSmiComparisonOp(compiler, *locs(), kind(), branch);
(...skipping 2634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3668 compiler->GenerateCall(token_pos(), 3677 compiler->GenerateCall(token_pos(),
3669 &label, 3678 &label,
3670 PcDescriptors::kOther, 3679 PcDescriptors::kOther,
3671 locs()); 3680 locs());
3672 __ Drop(2); // Discard type arguments and receiver. 3681 __ Drop(2); // Discard type arguments and receiver.
3673 } 3682 }
3674 3683
3675 } // namespace dart 3684 } // namespace dart
3676 3685
3677 #endif // defined TARGET_ARCH_MIPS 3686 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698