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

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 24438006: Refactor register allocator a little bit (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: One more ASSERT Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium-allocator.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 arguments()->PrintTo(stream); 379 arguments()->PrintTo(stream);
380 380
381 stream->Add(" length "); 381 stream->Add(" length ");
382 length()->PrintTo(stream); 382 length()->PrintTo(stream);
383 383
384 stream->Add(" index "); 384 stream->Add(" index ");
385 index()->PrintTo(stream); 385 index()->PrintTo(stream);
386 } 386 }
387 387
388 388
389 int LPlatformChunk::GetNextSpillIndex(bool is_double) { 389 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) {
390 // Skip a slot if for a double-width slot. 390 // Skip a slot if for a double-width slot.
391 if (is_double) { 391 if (kind == DOUBLE_REGISTERS) {
392 spill_slot_count_++; 392 spill_slot_count_++;
393 spill_slot_count_ |= 1; 393 spill_slot_count_ |= 1;
394 num_double_slots_++; 394 num_double_slots_++;
395 } 395 }
396 return spill_slot_count_++; 396 return spill_slot_count_++;
397 } 397 }
398 398
399 399
400 LOperand* LPlatformChunk::GetNextSpillSlot(bool is_double) { 400 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
401 int index = GetNextSpillIndex(is_double); 401 int index = GetNextSpillIndex(kind);
402 if (is_double) { 402 if (kind == DOUBLE_REGISTERS) {
403 return LDoubleStackSlot::Create(index, zone()); 403 return LDoubleStackSlot::Create(index, zone());
404 } else { 404 } else {
405 ASSERT(kind == GENERAL_REGISTERS);
405 return LStackSlot::Create(index, zone()); 406 return LStackSlot::Create(index, zone());
406 } 407 }
407 } 408 }
408 409
409 410
410 void LStoreNamedField::PrintDataTo(StringStream* stream) { 411 void LStoreNamedField::PrintDataTo(StringStream* stream) {
411 object()->PrintTo(stream); 412 object()->PrintTo(stream);
412 hydrogen()->access().PrintTo(stream); 413 hydrogen()->access().PrintTo(stream);
413 stream->Add(" <- "); 414 stream->Add(" <- ");
414 value()->PrintTo(stream); 415 value()->PrintTo(stream);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 473
473 474
474 LPlatformChunk* LChunkBuilder::Build() { 475 LPlatformChunk* LChunkBuilder::Build() {
475 ASSERT(is_unused()); 476 ASSERT(is_unused());
476 chunk_ = new(zone()) LPlatformChunk(info(), graph()); 477 chunk_ = new(zone()) LPlatformChunk(info(), graph());
477 LPhase phase("L_Building chunk", chunk_); 478 LPhase phase("L_Building chunk", chunk_);
478 status_ = BUILDING; 479 status_ = BUILDING;
479 480
480 // Reserve the first spill slot for the state of dynamic alignment. 481 // Reserve the first spill slot for the state of dynamic alignment.
481 if (info()->IsOptimizing()) { 482 if (info()->IsOptimizing()) {
482 int alignment_state_index = chunk_->GetNextSpillIndex(false); 483 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS);
483 ASSERT_EQ(alignment_state_index, 0); 484 ASSERT_EQ(alignment_state_index, 0);
484 USE(alignment_state_index); 485 USE(alignment_state_index);
485 } 486 }
486 487
487 // If compiling for OSR, reserve space for the unoptimized frame, 488 // If compiling for OSR, reserve space for the unoptimized frame,
488 // which will be subsumed into this frame. 489 // which will be subsumed into this frame.
489 if (graph()->has_osr()) { 490 if (graph()->has_osr()) {
490 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { 491 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) {
491 chunk_->GetNextSpillIndex(false); 492 chunk_->GetNextSpillIndex(GENERAL_REGISTERS);
492 } 493 }
493 } 494 }
494 495
495 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 496 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
496 for (int i = 0; i < blocks->length(); i++) { 497 for (int i = 0; i < blocks->length(); i++) {
497 HBasicBlock* next = NULL; 498 HBasicBlock* next = NULL;
498 if (i < blocks->length() - 1) next = blocks->at(i + 1); 499 if (i < blocks->length() - 1) next = blocks->at(i + 1);
499 DoBasicBlock(blocks->at(i), next); 500 DoBasicBlock(blocks->at(i), next);
500 if (is_aborted()) return NULL; 501 if (is_aborted()) return NULL;
501 } 502 }
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2720 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2720 LOperand* object = UseRegister(instr->object()); 2721 LOperand* object = UseRegister(instr->object());
2721 LOperand* index = UseTempRegister(instr->index()); 2722 LOperand* index = UseTempRegister(instr->index());
2722 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2723 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2723 } 2724 }
2724 2725
2725 2726
2726 } } // namespace v8::internal 2727 } } // namespace v8::internal
2727 2728
2728 #endif // V8_TARGET_ARCH_IA32 2729 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698