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

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

Issue 6628012: Refactor polymorphic load and inline function graph construction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { 376 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
377 object()->PrintTo(stream); 377 object()->PrintTo(stream);
378 stream->Add("["); 378 stream->Add("[");
379 key()->PrintTo(stream); 379 key()->PrintTo(stream);
380 stream->Add("] <- "); 380 stream->Add("] <- ");
381 value()->PrintTo(stream); 381 value()->PrintTo(stream);
382 } 382 }
383 383
384 384
385 LChunk::LChunk(HGraph* graph) 385 LChunk::LChunk(CompilationInfo* info, HGraph* graph)
386 : spill_slot_count_(0), 386 : spill_slot_count_(0),
387 info_(info),
387 graph_(graph), 388 graph_(graph),
388 instructions_(32), 389 instructions_(32),
389 pointer_maps_(8), 390 pointer_maps_(8),
390 inlined_closures_(1) { 391 inlined_closures_(1) {
391 } 392 }
392 393
393 394
394 int LChunk::GetNextSpillIndex(bool is_double) { 395 int LChunk::GetNextSpillIndex(bool is_double) {
395 // Skip a slot if for a double-width slot. 396 // Skip a slot if for a double-width slot.
396 if (is_double) spill_slot_count_++; 397 if (is_double) spill_slot_count_++;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) { 468 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) {
468 return LConstantOperand::Create(constant->id()); 469 return LConstantOperand::Create(constant->id());
469 } 470 }
470 471
471 472
472 int LChunk::GetParameterStackSlot(int index) const { 473 int LChunk::GetParameterStackSlot(int index) const {
473 // The receiver is at index 0, the first parameter at index 1, so we 474 // The receiver is at index 0, the first parameter at index 1, so we
474 // shift all parameter indexes down by the number of parameters, and 475 // shift all parameter indexes down by the number of parameters, and
475 // make sure they end up negative so they are distinguishable from 476 // make sure they end up negative so they are distinguishable from
476 // spill slots. 477 // spill slots.
477 int result = index - graph()->info()->scope()->num_parameters() - 1; 478 int result = index - info()->scope()->num_parameters() - 1;
478 ASSERT(result < 0); 479 ASSERT(result < 0);
479 return result; 480 return result;
480 } 481 }
481 482
482 // A parameter relative to ebp in the arguments stub. 483 // A parameter relative to ebp in the arguments stub.
483 int LChunk::ParameterAt(int index) { 484 int LChunk::ParameterAt(int index) {
484 ASSERT(-1 <= index); // -1 is the receiver. 485 ASSERT(-1 <= index); // -1 is the receiver.
485 return (1 + graph()->info()->scope()->num_parameters() - index) * 486 return (1 + info()->scope()->num_parameters() - index) *
486 kPointerSize; 487 kPointerSize;
487 } 488 }
488 489
489 490
490 LGap* LChunk::GetGapAt(int index) const { 491 LGap* LChunk::GetGapAt(int index) const {
491 return LGap::cast(instructions_[index]); 492 return LGap::cast(instructions_[index]);
492 } 493 }
493 494
494 495
495 bool LChunk::IsGapAt(int index) const { 496 bool LChunk::IsGapAt(int index) const {
(...skipping 18 matching lines...) Expand all
514 515
515 516
516 Representation LChunk::LookupLiteralRepresentation( 517 Representation LChunk::LookupLiteralRepresentation(
517 LConstantOperand* operand) const { 518 LConstantOperand* operand) const {
518 return graph_->LookupValue(operand->index())->representation(); 519 return graph_->LookupValue(operand->index())->representation();
519 } 520 }
520 521
521 522
522 LChunk* LChunkBuilder::Build() { 523 LChunk* LChunkBuilder::Build() {
523 ASSERT(is_unused()); 524 ASSERT(is_unused());
524 chunk_ = new LChunk(graph()); 525 chunk_ = new LChunk(info(), graph());
525 HPhase phase("Building chunk", chunk_); 526 HPhase phase("Building chunk", chunk_);
526 status_ = BUILDING; 527 status_ = BUILDING;
527 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 528 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
528 for (int i = 0; i < blocks->length(); i++) { 529 for (int i = 0; i < blocks->length(); i++) {
529 HBasicBlock* next = NULL; 530 HBasicBlock* next = NULL;
530 if (i < blocks->length() - 1) next = blocks->at(i + 1); 531 if (i < blocks->length() - 1) next = blocks->at(i + 1);
531 DoBasicBlock(blocks->at(i), next); 532 DoBasicBlock(blocks->at(i), next);
532 if (is_aborted()) return NULL; 533 if (is_aborted()) return NULL;
533 } 534 }
534 status_ = DONE; 535 status_ = DONE;
535 return chunk_; 536 return chunk_;
536 } 537 }
537 538
538 539
539 void LChunkBuilder::Abort(const char* format, ...) { 540 void LChunkBuilder::Abort(const char* format, ...) {
540 if (FLAG_trace_bailout) { 541 if (FLAG_trace_bailout) {
541 SmartPointer<char> debug_name = graph()->debug_name()->ToCString(); 542 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
542 PrintF("Aborting LChunk building in @\"%s\": ", *debug_name); 543 PrintF("Aborting LChunk building in @\"%s\": ", *name);
543 va_list arguments; 544 va_list arguments;
544 va_start(arguments, format); 545 va_start(arguments, format);
545 OS::VPrint(format, arguments); 546 OS::VPrint(format, arguments);
546 va_end(arguments); 547 va_end(arguments);
547 PrintF("\n"); 548 PrintF("\n");
548 } 549 }
549 status_ = ABORTED; 550 status_ = ABORTED;
550 } 551 }
551 552
552 553
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2031
2031 2032
2032 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2033 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2033 HEnvironment* outer = current_block_->last_environment()->outer(); 2034 HEnvironment* outer = current_block_->last_environment()->outer();
2034 current_block_->UpdateEnvironment(outer); 2035 current_block_->UpdateEnvironment(outer);
2035 return NULL; 2036 return NULL;
2036 } 2037 }
2037 2038
2038 2039
2039 } } // namespace v8::internal 2040 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698