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

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

Issue 10698128: Improve code for checked instance calls (polymorphic calls) and expand printing of PolymorphicInsta… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « no previous file | runtime/vm/flow_graph_compiler_ia32.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 GrowableArray<intptr_t> args; 383 GrowableArray<intptr_t> args;
384 args.Add(kArray); 384 args.Add(kArray);
385 args.Add(kGrowableObjectArray); 385 args.Add(kGrowableObjectArray);
386 args.Add(kImmutableArray); 386 args.Add(kImmutableArray);
387 CheckClassIds(kClassIdReg, args, is_instance_lbl, &unknown); 387 CheckClassIds(kClassIdReg, args, is_instance_lbl, &unknown);
388 assembler()->Bind(&unknown); 388 assembler()->Bind(&unknown);
389 } 389 }
390 390
391 391
392 void FlowGraphCompiler::EmitComment(Instruction* instr) { 392 void FlowGraphCompiler::EmitComment(Instruction* instr) {
393 char buffer[80]; 393 char buffer[256];
394 BufferFormatter f(buffer, sizeof(buffer)); 394 BufferFormatter f(buffer, sizeof(buffer));
395 instr->PrintTo(&f); 395 instr->PrintTo(&f);
396 assembler()->Comment("@%d: %s", instr->cid(), buffer); 396 assembler()->Comment("@%d: %s", instr->cid(), buffer);
397 } 397 }
398 398
399 399
400 void FlowGraphCompiler::EmitLoadIndexedGeneric(LoadIndexedComp* comp) { 400 void FlowGraphCompiler::EmitLoadIndexedGeneric(LoadIndexedComp* comp) {
401 const String& function_name = 401 const String& function_name =
402 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kINDEX))); 402 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kINDEX)));
403 403
(...skipping 16 matching lines...) Expand all
420 420
421 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 421 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
422 Register class_id_reg, 422 Register class_id_reg,
423 intptr_t arg_count, 423 intptr_t arg_count,
424 const Array& arg_names, 424 const Array& arg_names,
425 Label* deopt, 425 Label* deopt,
426 Label* done, 426 Label* done,
427 intptr_t cid, 427 intptr_t cid,
428 intptr_t token_index, 428 intptr_t token_index,
429 intptr_t try_index) { 429 intptr_t try_index) {
430 // TODO(srdjan): better loop please! 430 Label match_found;
431 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { 431 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
432 const bool is_last_check = (i == (ic_data.NumberOfChecks() - 1));
432 Label next_test; 433 Label next_test;
433 assembler()->cmpl(class_id_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); 434 assembler()->cmpl(class_id_reg, Immediate(ic_data.GetReceiverClassIdAt(i)));
434 assembler()->j(NOT_EQUAL, &next_test); 435 if (is_last_check) {
436 assembler()->j(NOT_EQUAL, deopt);
437 } else {
438 assembler()->j(NOT_EQUAL, &next_test);
439 }
435 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i)); 440 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i));
436 GenerateStaticCall(cid, 441 GenerateStaticCall(cid,
437 token_index, 442 token_index,
438 try_index, 443 try_index,
439 target, 444 target,
440 arg_count, 445 arg_count,
441 arg_names); 446 arg_names);
442 assembler()->jmp(done); 447 if (!is_last_check) {
448 assembler()->jmp(&match_found);
449 }
443 assembler()->Bind(&next_test); 450 assembler()->Bind(&next_test);
444 } 451 }
445 assembler()->jmp(deopt); 452 assembler()->Bind(&match_found);
453 if (done != NULL) {
454 assembler()->jmp(done);
455 }
446 } 456 }
447 457
448 458
449 459
450 460
451 461
452 Register FrameRegisterAllocator::AllocateFreeRegister(bool* blocked_registers) { 462 Register FrameRegisterAllocator::AllocateFreeRegister(bool* blocked_registers) {
453 for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) { 463 for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) {
454 if (!blocked_registers[regno] && (registers_[regno] == NULL)) { 464 if (!blocked_registers[regno] && (registers_[regno] == NULL)) {
455 blocked_registers[regno] = true; 465 blocked_registers[regno] = true;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 633
624 634
625 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) { 635 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) {
626 for (int i = 0; i < stack_.length(); i++) { 636 for (int i = 0; i < stack_.length(); i++) {
627 stub->Push(stack_[i]); 637 stub->Push(stack_[i]);
628 } 638 }
629 } 639 }
630 640
631 641
632 } // namespace dart 642 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698