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

Side by Side Diff: src/mips/lithium-mips.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/mips/lithium-mips.h ('k') | src/x64/lithium-x64.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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 value()->PrintTo(stream); 410 value()->PrintTo(stream);
411 } 411 }
412 412
413 413
414 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { 414 void LTransitionElementsKind::PrintDataTo(StringStream* stream) {
415 object()->PrintTo(stream); 415 object()->PrintTo(stream);
416 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); 416 stream->Add(" %p -> %p", *original_map(), *transitioned_map());
417 } 417 }
418 418
419 419
420 int LPlatformChunk::GetNextSpillIndex(bool is_double) { 420 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) {
421 // Skip a slot if for a double-width slot. 421 // Skip a slot if for a double-width slot.
422 if (is_double) spill_slot_count_++; 422 if (kind == DOUBLE_REGISTERS) spill_slot_count_++;
423 return spill_slot_count_++; 423 return spill_slot_count_++;
424 } 424 }
425 425
426 426
427 LOperand* LPlatformChunk::GetNextSpillSlot(bool is_double) { 427 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
428 int index = GetNextSpillIndex(is_double); 428 int index = GetNextSpillIndex(kind);
429 if (is_double) { 429 if (kind == DOUBLE_REGISTERS) {
430 return LDoubleStackSlot::Create(index, zone()); 430 return LDoubleStackSlot::Create(index, zone());
431 } else { 431 } else {
432 ASSERT(kind == GENERAL_REGISTERS);
432 return LStackSlot::Create(index, zone()); 433 return LStackSlot::Create(index, zone());
433 } 434 }
434 } 435 }
435 436
436 437
437 LPlatformChunk* LChunkBuilder::Build() { 438 LPlatformChunk* LChunkBuilder::Build() {
438 ASSERT(is_unused()); 439 ASSERT(is_unused());
439 chunk_ = new(zone()) LPlatformChunk(info(), graph()); 440 chunk_ = new(zone()) LPlatformChunk(info(), graph());
440 LPhase phase("L_Building chunk", chunk_); 441 LPhase phase("L_Building chunk", chunk_);
441 status_ = BUILDING; 442 status_ = BUILDING;
442 443
443 // If compiling for OSR, reserve space for the unoptimized frame, 444 // If compiling for OSR, reserve space for the unoptimized frame,
444 // which will be subsumed into this frame. 445 // which will be subsumed into this frame.
445 if (graph()->has_osr()) { 446 if (graph()->has_osr()) {
446 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { 447 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) {
447 chunk_->GetNextSpillIndex(false); 448 chunk_->GetNextSpillIndex(GENERAL_REGISTERS);
448 } 449 }
449 } 450 }
450 451
451 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 452 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
452 for (int i = 0; i < blocks->length(); i++) { 453 for (int i = 0; i < blocks->length(); i++) {
453 HBasicBlock* next = NULL; 454 HBasicBlock* next = NULL;
454 if (i < blocks->length() - 1) next = blocks->at(i + 1); 455 if (i < blocks->length() - 1) next = blocks->at(i + 1);
455 DoBasicBlock(blocks->at(i), next); 456 DoBasicBlock(blocks->at(i), next);
456 if (is_aborted()) return NULL; 457 if (is_aborted()) return NULL;
457 } 458 }
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 2505
2505 2506
2506 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2507 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2507 LOperand* object = UseRegister(instr->object()); 2508 LOperand* object = UseRegister(instr->object());
2508 LOperand* index = UseRegister(instr->index()); 2509 LOperand* index = UseRegister(instr->index());
2509 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2510 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2510 } 2511 }
2511 2512
2512 2513
2513 } } // namespace v8::internal 2514 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698