| OLD | NEW |
| 1 // Copyright 2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 50 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
| 51 #undef DEFINE_COMPILE | 51 #undef DEFINE_COMPILE |
| 52 | 52 |
| 53 | 53 |
| 54 const char* Representation::Mnemonic() const { | 54 const char* Representation::Mnemonic() const { |
| 55 switch (kind_) { | 55 switch (kind_) { |
| 56 case kNone: return "v"; | 56 case kNone: return "v"; |
| 57 case kTagged: return "t"; | 57 case kTagged: return "t"; |
| 58 case kDouble: return "d"; | 58 case kDouble: return "d"; |
| 59 case kInteger32: return "i"; | 59 case kInteger32: return "i"; |
| 60 default: | 60 case kExternal: return "x"; |
| 61 case kNumRepresentations: |
| 61 UNREACHABLE(); | 62 UNREACHABLE(); |
| 62 return NULL; | 63 return NULL; |
| 63 } | 64 } |
| 65 UNREACHABLE(); |
| 66 return NULL; |
| 64 } | 67 } |
| 65 | 68 |
| 66 | 69 |
| 67 static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) { | 70 static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) { |
| 68 if (result > kMaxInt) { | 71 if (result > kMaxInt) { |
| 69 *overflow = true; | 72 *overflow = true; |
| 70 return kMaxInt; | 73 return kMaxInt; |
| 71 } | 74 } |
| 72 if (result < kMinInt) { | 75 if (result < kMinInt) { |
| 73 *overflow = true; | 76 *overflow = true; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 result = HType::Boolean(); | 217 result = HType::Boolean(); |
| 215 } else if (value->IsJSObject()) { | 218 } else if (value->IsJSObject()) { |
| 216 result = HType::JSObject(); | 219 result = HType::JSObject(); |
| 217 } else if (value->IsJSArray()) { | 220 } else if (value->IsJSArray()) { |
| 218 result = HType::JSArray(); | 221 result = HType::JSArray(); |
| 219 } | 222 } |
| 220 return result; | 223 return result; |
| 221 } | 224 } |
| 222 | 225 |
| 223 | 226 |
| 224 int HValue::LookupOperandIndex(int occurrence_index, HValue* op) const { | 227 int HValue::LookupOperandIndex(int occurrence_index, HValue* op) { |
| 225 for (int i = 0; i < OperandCount(); ++i) { | 228 for (int i = 0; i < OperandCount(); ++i) { |
| 226 if (OperandAt(i) == op) { | 229 if (OperandAt(i) == op) { |
| 227 if (occurrence_index == 0) return i; | 230 if (occurrence_index == 0) return i; |
| 228 --occurrence_index; | 231 --occurrence_index; |
| 229 } | 232 } |
| 230 } | 233 } |
| 231 return -1; | 234 return -1; |
| 232 } | 235 } |
| 233 | 236 |
| 234 | 237 |
| 235 bool HValue::IsDefinedAfter(HBasicBlock* other) const { | 238 bool HValue::IsDefinedAfter(HBasicBlock* other) const { |
| 236 return block()->block_id() > other->block_id(); | 239 return block()->block_id() > other->block_id(); |
| 237 } | 240 } |
| 238 | 241 |
| 239 | 242 |
| 240 bool HValue::UsesMultipleTimes(HValue* op) const { | 243 bool HValue::UsesMultipleTimes(HValue* op) { |
| 241 bool seen = false; | 244 bool seen = false; |
| 242 for (int i = 0; i < OperandCount(); ++i) { | 245 for (int i = 0; i < OperandCount(); ++i) { |
| 243 if (OperandAt(i) == op) { | 246 if (OperandAt(i) == op) { |
| 244 if (seen) return true; | 247 if (seen) return true; |
| 245 seen = true; | 248 seen = true; |
| 246 } | 249 } |
| 247 } | 250 } |
| 248 return false; | 251 return false; |
| 249 } | 252 } |
| 250 | 253 |
| 251 | 254 |
| 252 bool HValue::Equals(HValue* other) const { | 255 bool HValue::Equals(HValue* other) { |
| 253 if (other->opcode() != opcode()) return false; | 256 if (other->opcode() != opcode()) return false; |
| 254 if (!other->representation().Equals(representation())) return false; | 257 if (!other->representation().Equals(representation())) return false; |
| 255 if (!other->type_.Equals(type_)) return false; | 258 if (!other->type_.Equals(type_)) return false; |
| 256 if (other->flags() != flags()) return false; | 259 if (other->flags() != flags()) return false; |
| 257 if (OperandCount() != other->OperandCount()) return false; | 260 if (OperandCount() != other->OperandCount()) return false; |
| 258 for (int i = 0; i < OperandCount(); ++i) { | 261 for (int i = 0; i < OperandCount(); ++i) { |
| 259 if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false; | 262 if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false; |
| 260 } | 263 } |
| 261 bool result = DataEquals(other); | 264 bool result = DataEquals(other); |
| 262 ASSERT(!result || Hashcode() == other->Hashcode()); | 265 ASSERT(!result || Hashcode() == other->Hashcode()); |
| 263 return result; | 266 return result; |
| 264 } | 267 } |
| 265 | 268 |
| 266 | 269 |
| 267 intptr_t HValue::Hashcode() const { | 270 intptr_t HValue::Hashcode() { |
| 268 intptr_t result = opcode(); | 271 intptr_t result = opcode(); |
| 269 int count = OperandCount(); | 272 int count = OperandCount(); |
| 270 for (int i = 0; i < count; ++i) { | 273 for (int i = 0; i < count; ++i) { |
| 271 result = result * 19 + OperandAt(i)->id() + (result >> 7); | 274 result = result * 19 + OperandAt(i)->id() + (result >> 7); |
| 272 } | 275 } |
| 273 return result; | 276 return result; |
| 274 } | 277 } |
| 275 | 278 |
| 276 | 279 |
| 277 void HValue::SetOperandAt(int index, HValue* value) { | 280 void HValue::SetOperandAt(int index, HValue* value) { |
| 278 ASSERT(value == NULL || !value->representation().IsNone()); | 281 ASSERT(value == NULL || !value->representation().IsNone()); |
| 279 RegisterUse(index, value); | 282 RegisterUse(index, value); |
| 280 InternalSetOperandAt(index, value); | 283 InternalSetOperandAt(index, value); |
| 281 } | 284 } |
| 282 | 285 |
| 283 | 286 |
| 284 void HValue::ReplaceAndDelete(HValue* other) { | 287 void HValue::ReplaceAndDelete(HValue* other) { |
| 285 ReplaceValue(other); | 288 if (other != NULL) ReplaceValue(other); |
| 286 Delete(); | 289 Delete(); |
| 287 } | 290 } |
| 288 | 291 |
| 289 | 292 |
| 290 void HValue::ReplaceValue(HValue* other) { | 293 void HValue::ReplaceValue(HValue* other) { |
| 291 ZoneList<HValue*> start_uses(2); | |
| 292 for (int i = 0; i < uses_.length(); ++i) { | 294 for (int i = 0; i < uses_.length(); ++i) { |
| 293 HValue* use = uses_.at(i); | 295 HValue* use = uses_[i]; |
| 294 if (!use->block()->IsStartBlock()) { | 296 ASSERT(!use->block()->IsStartBlock()); |
| 295 InternalReplaceAtUse(use, other); | 297 InternalReplaceAtUse(use, other); |
| 296 other->uses_.Add(use); | 298 other->uses_.Add(use); |
| 297 } else { | |
| 298 start_uses.Add(use); | |
| 299 } | |
| 300 } | 299 } |
| 301 uses_.Clear(); | 300 uses_.Rewind(0); |
| 302 uses_.AddAll(start_uses); | |
| 303 } | 301 } |
| 304 | 302 |
| 305 | 303 |
| 306 void HValue::ClearOperands() { | 304 void HValue::ClearOperands() { |
| 307 for (int i = 0; i < OperandCount(); ++i) { | 305 for (int i = 0; i < OperandCount(); ++i) { |
| 308 SetOperandAt(i, NULL); | 306 SetOperandAt(i, NULL); |
| 309 } | 307 } |
| 310 } | 308 } |
| 311 | 309 |
| 312 | 310 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 402 } |
| 405 | 403 |
| 406 | 404 |
| 407 void HValue::ComputeInitialRange() { | 405 void HValue::ComputeInitialRange() { |
| 408 ASSERT(!HasRange()); | 406 ASSERT(!HasRange()); |
| 409 range_ = InferRange(); | 407 range_ = InferRange(); |
| 410 ASSERT(HasRange()); | 408 ASSERT(HasRange()); |
| 411 } | 409 } |
| 412 | 410 |
| 413 | 411 |
| 414 void HInstruction::PrintTo(StringStream* stream) const { | 412 void HInstruction::PrintTo(StringStream* stream) { |
| 415 stream->Add("%s", Mnemonic()); | 413 stream->Add("%s", Mnemonic()); |
| 416 if (HasSideEffects()) stream->Add("*"); | 414 if (HasSideEffects()) stream->Add("*"); |
| 417 stream->Add(" "); | 415 stream->Add(" "); |
| 418 PrintDataTo(stream); | 416 PrintDataTo(stream); |
| 419 | 417 |
| 420 if (range() != NULL) { | 418 if (range() != NULL) { |
| 421 stream->Add(" range[%d,%d,m0=%d]", | 419 stream->Add(" range[%d,%d,m0=%d]", |
| 422 range()->lower(), | 420 range()->lower(), |
| 423 range()->upper(), | 421 range()->upper(), |
| 424 static_cast<int>(range()->CanBeMinusZero())); | 422 static_cast<int>(range()->CanBeMinusZero())); |
| 425 } | 423 } |
| 426 | 424 |
| 427 int changes_flags = (flags() & HValue::ChangesFlagsMask()); | 425 int changes_flags = (flags() & HValue::ChangesFlagsMask()); |
| 428 if (changes_flags != 0) { | 426 if (changes_flags != 0) { |
| 429 stream->Add(" changes[0x%x]", changes_flags); | 427 stream->Add(" changes[0x%x]", changes_flags); |
| 430 } | 428 } |
| 431 | 429 |
| 432 if (representation().IsTagged() && !type().Equals(HType::Tagged())) { | 430 if (representation().IsTagged() && !type().Equals(HType::Tagged())) { |
| 433 stream->Add(" type[%s]", type().ToString()); | 431 stream->Add(" type[%s]", type().ToString()); |
| 434 } | 432 } |
| 435 } | 433 } |
| 436 | 434 |
| 437 | 435 |
| 438 void HInstruction::Unlink() { | 436 void HInstruction::Unlink() { |
| 439 ASSERT(IsLinked()); | 437 ASSERT(IsLinked()); |
| 440 ASSERT(!IsControlInstruction()); // Must never move control instructions. | 438 ASSERT(!IsControlInstruction()); // Must never move control instructions. |
| 439 ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these. |
| 440 ASSERT(previous_ != NULL); |
| 441 previous_->next_ = next_; |
| 442 if (next_ == NULL) { |
| 443 ASSERT(block()->last() == this); |
| 444 block()->set_last(previous_); |
| 445 } else { |
| 446 next_->previous_ = previous_; |
| 447 } |
| 441 clear_block(); | 448 clear_block(); |
| 442 if (previous_ != NULL) previous_->next_ = next_; | |
| 443 if (next_ != NULL) next_->previous_ = previous_; | |
| 444 } | 449 } |
| 445 | 450 |
| 446 | 451 |
| 447 void HInstruction::InsertBefore(HInstruction* next) { | 452 void HInstruction::InsertBefore(HInstruction* next) { |
| 448 ASSERT(!IsLinked()); | 453 ASSERT(!IsLinked()); |
| 449 ASSERT(!next->IsBlockEntry()); | 454 ASSERT(!next->IsBlockEntry()); |
| 450 ASSERT(!IsControlInstruction()); | 455 ASSERT(!IsControlInstruction()); |
| 451 ASSERT(!next->block()->IsStartBlock()); | 456 ASSERT(!next->block()->IsStartBlock()); |
| 452 ASSERT(next->previous_ != NULL); | 457 ASSERT(next->previous_ != NULL); |
| 453 HInstruction* prev = next->previous(); | 458 HInstruction* prev = next->previous(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } | 525 } |
| 521 | 526 |
| 522 // Verify that instructions that can be eliminated by GVN have overridden | 527 // Verify that instructions that can be eliminated by GVN have overridden |
| 523 // HValue::DataEquals. The default implementation is UNREACHABLE. We | 528 // HValue::DataEquals. The default implementation is UNREACHABLE. We |
| 524 // don't actually care whether DataEquals returns true or false here. | 529 // don't actually care whether DataEquals returns true or false here. |
| 525 if (CheckFlag(kUseGVN)) DataEquals(this); | 530 if (CheckFlag(kUseGVN)) DataEquals(this); |
| 526 } | 531 } |
| 527 #endif | 532 #endif |
| 528 | 533 |
| 529 | 534 |
| 530 HCall::HCall(int count) : arguments_(ZONE->NewArray<HValue*>(count), count) { | 535 void HUnaryCall::PrintDataTo(StringStream* stream) { |
| 531 for (int i = 0; i < count; ++i) arguments_[i] = NULL; | 536 value()->PrintNameTo(stream); |
| 532 set_representation(Representation::Tagged()); | 537 stream->Add(" "); |
| 533 SetAllSideEffects(); | 538 stream->Add("#%d", argument_count()); |
| 534 } | 539 } |
| 535 | 540 |
| 536 | 541 |
| 537 void HCall::PrintDataTo(StringStream* stream) const { | 542 void HBinaryCall::PrintDataTo(StringStream* stream) { |
| 538 stream->Add("("); | 543 first()->PrintNameTo(stream); |
| 539 for (int i = 0; i < arguments_.length(); ++i) { | 544 stream->Add(" "); |
| 540 if (i != 0) stream->Add(", "); | 545 second()->PrintNameTo(stream); |
| 541 arguments_.at(i)->PrintNameTo(stream); | 546 stream->Add(" "); |
| 542 } | 547 stream->Add("#%d", argument_count()); |
| 543 stream->Add(")"); | |
| 544 } | 548 } |
| 545 | 549 |
| 546 | 550 |
| 547 void HClassOfTest::PrintDataTo(StringStream* stream) const { | 551 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 552 if (IsApplyFunction()) { |
| 553 stream->Add("optimized apply "); |
| 554 } else { |
| 555 stream->Add("%o ", function()->shared()->DebugName()); |
| 556 } |
| 557 stream->Add("#%d", argument_count()); |
| 558 } |
| 559 |
| 560 |
| 561 void HCallNamed::PrintDataTo(StringStream* stream) { |
| 562 stream->Add("%o ", *name()); |
| 563 HUnaryCall::PrintDataTo(stream); |
| 564 } |
| 565 |
| 566 |
| 567 void HCallGlobal::PrintDataTo(StringStream* stream) { |
| 568 stream->Add("%o ", *name()); |
| 569 HUnaryCall::PrintDataTo(stream); |
| 570 } |
| 571 |
| 572 |
| 573 void HCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 574 stream->Add("o ", target()->shared()->DebugName()); |
| 575 stream->Add("#%d", argument_count()); |
| 576 } |
| 577 |
| 578 |
| 579 void HCallRuntime::PrintDataTo(StringStream* stream) { |
| 580 stream->Add("%o ", *name()); |
| 581 stream->Add("#%d", argument_count()); |
| 582 } |
| 583 |
| 584 |
| 585 void HClassOfTest::PrintDataTo(StringStream* stream) { |
| 548 stream->Add("class_of_test("); | 586 stream->Add("class_of_test("); |
| 549 value()->PrintTo(stream); | 587 value()->PrintNameTo(stream); |
| 550 stream->Add(", \"%o\")", *class_name()); | 588 stream->Add(", \"%o\")", *class_name()); |
| 551 } | 589 } |
| 552 | 590 |
| 553 | 591 |
| 554 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const { | 592 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) { |
| 555 arguments()->PrintNameTo(stream); | 593 arguments()->PrintNameTo(stream); |
| 556 stream->Add("["); | 594 stream->Add("["); |
| 557 index()->PrintNameTo(stream); | 595 index()->PrintNameTo(stream); |
| 558 stream->Add("], length "); | 596 stream->Add("], length "); |
| 559 length()->PrintNameTo(stream); | 597 length()->PrintNameTo(stream); |
| 560 } | 598 } |
| 561 | 599 |
| 562 | 600 |
| 563 void HCall::SetArgumentAt(int index, HPushArgument* push_argument) { | 601 void HControlInstruction::PrintDataTo(StringStream* stream) { |
| 564 push_argument->set_argument_index(index); | |
| 565 SetOperandAt(index, push_argument); | |
| 566 } | |
| 567 | |
| 568 | |
| 569 void HCallConstantFunction::PrintDataTo(StringStream* stream) const { | |
| 570 if (IsApplyFunction()) { | |
| 571 stream->Add("SPECIAL function: apply"); | |
| 572 } else { | |
| 573 stream->Add("%s", *(function()->shared()->DebugName()->ToCString())); | |
| 574 } | |
| 575 HCall::PrintDataTo(stream); | |
| 576 } | |
| 577 | |
| 578 | |
| 579 void HControlInstruction::PrintDataTo(StringStream* stream) const { | |
| 580 if (FirstSuccessor() != NULL) { | 602 if (FirstSuccessor() != NULL) { |
| 581 int first_id = FirstSuccessor()->block_id(); | 603 int first_id = FirstSuccessor()->block_id(); |
| 582 if (SecondSuccessor() == NULL) { | 604 if (SecondSuccessor() == NULL) { |
| 583 stream->Add(" B%d", first_id); | 605 stream->Add(" B%d", first_id); |
| 584 } else { | 606 } else { |
| 585 int second_id = SecondSuccessor()->block_id(); | 607 int second_id = SecondSuccessor()->block_id(); |
| 586 stream->Add(" goto (B%d, B%d)", first_id, second_id); | 608 stream->Add(" goto (B%d, B%d)", first_id, second_id); |
| 587 } | 609 } |
| 588 } | 610 } |
| 589 } | 611 } |
| 590 | 612 |
| 591 | 613 |
| 592 void HUnaryControlInstruction::PrintDataTo(StringStream* stream) const { | 614 void HUnaryControlInstruction::PrintDataTo(StringStream* stream) { |
| 593 value()->PrintNameTo(stream); | 615 value()->PrintNameTo(stream); |
| 594 HControlInstruction::PrintDataTo(stream); | 616 HControlInstruction::PrintDataTo(stream); |
| 595 } | 617 } |
| 596 | 618 |
| 597 | 619 |
| 598 void HCompareMap::PrintDataTo(StringStream* stream) const { | 620 void HCompareMap::PrintDataTo(StringStream* stream) { |
| 599 value()->PrintNameTo(stream); | 621 value()->PrintNameTo(stream); |
| 600 stream->Add(" (%p)", *map()); | 622 stream->Add(" (%p)", *map()); |
| 601 HControlInstruction::PrintDataTo(stream); | 623 HControlInstruction::PrintDataTo(stream); |
| 602 } | 624 } |
| 603 | 625 |
| 604 | 626 |
| 605 const char* HUnaryMathOperation::OpName() const { | 627 const char* HUnaryMathOperation::OpName() const { |
| 606 switch (op()) { | 628 switch (op()) { |
| 607 case kMathFloor: return "floor"; | 629 case kMathFloor: return "floor"; |
| 608 case kMathRound: return "round"; | 630 case kMathRound: return "round"; |
| 609 case kMathCeil: return "ceil"; | 631 case kMathCeil: return "ceil"; |
| 610 case kMathAbs: return "abs"; | 632 case kMathAbs: return "abs"; |
| 611 case kMathLog: return "log"; | 633 case kMathLog: return "log"; |
| 612 case kMathSin: return "sin"; | 634 case kMathSin: return "sin"; |
| 613 case kMathCos: return "cos"; | 635 case kMathCos: return "cos"; |
| 614 case kMathTan: return "tan"; | 636 case kMathTan: return "tan"; |
| 615 case kMathASin: return "asin"; | 637 case kMathASin: return "asin"; |
| 616 case kMathACos: return "acos"; | 638 case kMathACos: return "acos"; |
| 617 case kMathATan: return "atan"; | 639 case kMathATan: return "atan"; |
| 618 case kMathExp: return "exp"; | 640 case kMathExp: return "exp"; |
| 619 case kMathSqrt: return "sqrt"; | 641 case kMathSqrt: return "sqrt"; |
| 620 default: break; | 642 default: break; |
| 621 } | 643 } |
| 622 return "(unknown operation)"; | 644 return "(unknown operation)"; |
| 623 } | 645 } |
| 624 | 646 |
| 625 | 647 |
| 626 void HUnaryMathOperation::PrintDataTo(StringStream* stream) const { | 648 void HUnaryMathOperation::PrintDataTo(StringStream* stream) { |
| 627 const char* name = OpName(); | 649 const char* name = OpName(); |
| 628 stream->Add("%s ", name); | 650 stream->Add("%s ", name); |
| 629 value()->PrintNameTo(stream); | 651 value()->PrintNameTo(stream); |
| 630 } | 652 } |
| 631 | 653 |
| 632 | 654 |
| 633 void HUnaryOperation::PrintDataTo(StringStream* stream) const { | 655 void HUnaryOperation::PrintDataTo(StringStream* stream) { |
| 634 value()->PrintNameTo(stream); | 656 value()->PrintNameTo(stream); |
| 635 } | 657 } |
| 636 | 658 |
| 637 | 659 |
| 638 void HHasInstanceType::PrintDataTo(StringStream* stream) const { | 660 void HHasInstanceType::PrintDataTo(StringStream* stream) { |
| 639 value()->PrintNameTo(stream); | 661 value()->PrintNameTo(stream); |
| 640 switch (from_) { | 662 switch (from_) { |
| 641 case FIRST_JS_OBJECT_TYPE: | 663 case FIRST_JS_OBJECT_TYPE: |
| 642 if (to_ == LAST_TYPE) stream->Add(" spec_object"); | 664 if (to_ == LAST_TYPE) stream->Add(" spec_object"); |
| 643 break; | 665 break; |
| 644 case JS_REGEXP_TYPE: | 666 case JS_REGEXP_TYPE: |
| 645 if (to_ == JS_REGEXP_TYPE) stream->Add(" reg_exp"); | 667 if (to_ == JS_REGEXP_TYPE) stream->Add(" reg_exp"); |
| 646 break; | 668 break; |
| 647 case JS_ARRAY_TYPE: | 669 case JS_ARRAY_TYPE: |
| 648 if (to_ == JS_ARRAY_TYPE) stream->Add(" array"); | 670 if (to_ == JS_ARRAY_TYPE) stream->Add(" array"); |
| 649 break; | 671 break; |
| 650 case JS_FUNCTION_TYPE: | 672 case JS_FUNCTION_TYPE: |
| 651 if (to_ == JS_FUNCTION_TYPE) stream->Add(" function"); | 673 if (to_ == JS_FUNCTION_TYPE) stream->Add(" function"); |
| 652 break; | 674 break; |
| 653 default: | 675 default: |
| 654 break; | 676 break; |
| 655 } | 677 } |
| 656 } | 678 } |
| 657 | 679 |
| 658 | 680 |
| 659 void HTypeofIs::PrintDataTo(StringStream* stream) const { | 681 void HTypeofIs::PrintDataTo(StringStream* stream) { |
| 660 value()->PrintNameTo(stream); | 682 value()->PrintNameTo(stream); |
| 661 stream->Add(" == "); | 683 stream->Add(" == "); |
| 662 stream->Add(type_literal_->ToAsciiVector()); | 684 stream->Add(type_literal_->ToAsciiVector()); |
| 663 } | 685 } |
| 664 | 686 |
| 665 | 687 |
| 666 void HPushArgument::PrintDataTo(StringStream* stream) const { | 688 void HChange::PrintDataTo(StringStream* stream) { |
| 667 HUnaryOperation::PrintDataTo(stream); | |
| 668 if (argument_index() != -1) { | |
| 669 stream->Add(" [%d]", argument_index_); | |
| 670 } | |
| 671 } | |
| 672 | |
| 673 | |
| 674 void HChange::PrintDataTo(StringStream* stream) const { | |
| 675 HUnaryOperation::PrintDataTo(stream); | 689 HUnaryOperation::PrintDataTo(stream); |
| 676 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic()); | 690 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic()); |
| 677 | 691 |
| 678 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); | 692 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); |
| 679 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 693 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
| 680 } | 694 } |
| 681 | 695 |
| 682 | 696 |
| 683 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction( | 697 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction( |
| 684 HValue* value) { | 698 HValue* value) { |
| 685 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE); | 699 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE); |
| 686 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE); | 700 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE); |
| 687 } | 701 } |
| 688 | 702 |
| 689 | 703 |
| 690 void HCheckMap::PrintDataTo(StringStream* stream) const { | 704 void HCheckMap::PrintDataTo(StringStream* stream) { |
| 691 value()->PrintNameTo(stream); | 705 value()->PrintNameTo(stream); |
| 692 stream->Add(" %p", *map()); | 706 stream->Add(" %p", *map()); |
| 693 } | 707 } |
| 694 | 708 |
| 695 | 709 |
| 696 void HCheckFunction::PrintDataTo(StringStream* stream) const { | 710 void HCheckFunction::PrintDataTo(StringStream* stream) { |
| 697 value()->PrintNameTo(stream); | 711 value()->PrintNameTo(stream); |
| 698 stream->Add(" %p", *target()); | 712 stream->Add(" %p", *target()); |
| 699 } | 713 } |
| 700 | 714 |
| 701 | 715 |
| 702 void HCallKeyed::PrintDataTo(StringStream* stream) const { | 716 void HCallStub::PrintDataTo(StringStream* stream) { |
| 703 stream->Add("["); | 717 stream->Add("%s ", |
| 704 key()->PrintNameTo(stream); | 718 CodeStub::MajorName(major_key_, false)); |
| 705 stream->Add("]("); | 719 HUnaryCall::PrintDataTo(stream); |
| 706 for (int i = 1; i < arguments_.length(); ++i) { | |
| 707 if (i != 1) stream->Add(", "); | |
| 708 arguments_.at(i)->PrintNameTo(stream); | |
| 709 } | |
| 710 stream->Add(")"); | |
| 711 } | 720 } |
| 712 | 721 |
| 713 | 722 |
| 714 void HCallNamed::PrintDataTo(StringStream* stream) const { | 723 void HInstanceOf::PrintDataTo(StringStream* stream) { |
| 715 SmartPointer<char> name_string = name()->ToCString(); | 724 left()->PrintNameTo(stream); |
| 716 stream->Add("%s ", *name_string); | 725 stream->Add(" "); |
| 717 HCall::PrintDataTo(stream); | 726 right()->PrintNameTo(stream); |
| 718 } | 727 stream->Add(" "); |
| 719 | 728 context()->PrintNameTo(stream); |
| 720 | |
| 721 void HCallGlobal::PrintDataTo(StringStream* stream) const { | |
| 722 SmartPointer<char> name_string = name()->ToCString(); | |
| 723 stream->Add("%s ", *name_string); | |
| 724 HCall::PrintDataTo(stream); | |
| 725 } | |
| 726 | |
| 727 | |
| 728 void HCallRuntime::PrintDataTo(StringStream* stream) const { | |
| 729 SmartPointer<char> name_string = name()->ToCString(); | |
| 730 stream->Add("%s ", *name_string); | |
| 731 HCall::PrintDataTo(stream); | |
| 732 } | |
| 733 | |
| 734 void HCallStub::PrintDataTo(StringStream* stream) const { | |
| 735 stream->Add("%s(%d)", | |
| 736 CodeStub::MajorName(major_key_, false), | |
| 737 argument_count_); | |
| 738 } | 729 } |
| 739 | 730 |
| 740 | 731 |
| 741 Range* HValue::InferRange() { | 732 Range* HValue::InferRange() { |
| 742 if (representation().IsTagged()) { | 733 if (representation().IsTagged()) { |
| 743 // Tagged values are always in int32 range when converted to integer, | 734 // Tagged values are always in int32 range when converted to integer, |
| 744 // but they can contain -0. | 735 // but they can contain -0. |
| 745 Range* result = new Range(); | 736 Range* result = new Range(); |
| 746 result->set_can_be_minus_zero(true); | 737 result->set_can_be_minus_zero(true); |
| 747 return result; | 738 return result; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 if (!right()->range()->CanBeZero()) { | 858 if (!right()->range()->CanBeZero()) { |
| 868 ClearFlag(HValue::kCanBeDivByZero); | 859 ClearFlag(HValue::kCanBeDivByZero); |
| 869 } | 860 } |
| 870 return result; | 861 return result; |
| 871 } else { | 862 } else { |
| 872 return HArithmeticBinaryOperation::InferRange(); | 863 return HArithmeticBinaryOperation::InferRange(); |
| 873 } | 864 } |
| 874 } | 865 } |
| 875 | 866 |
| 876 | 867 |
| 877 void HPhi::PrintTo(StringStream* stream) const { | 868 void HPhi::PrintTo(StringStream* stream) { |
| 878 stream->Add("["); | 869 stream->Add("["); |
| 879 for (int i = 0; i < OperandCount(); ++i) { | 870 for (int i = 0; i < OperandCount(); ++i) { |
| 880 HValue* value = OperandAt(i); | 871 HValue* value = OperandAt(i); |
| 881 stream->Add(" "); | 872 stream->Add(" "); |
| 882 value->PrintNameTo(stream); | 873 value->PrintNameTo(stream); |
| 883 stream->Add(" "); | 874 stream->Add(" "); |
| 884 } | 875 } |
| 885 stream->Add(" uses%d_%di_%dd_%dt]", | 876 stream->Add(" uses%d_%di_%dd_%dt]", |
| 886 uses()->length(), | 877 uses()->length(), |
| 887 int32_non_phi_uses() + int32_indirect_uses(), | 878 int32_non_phi_uses() + int32_indirect_uses(), |
| 888 double_non_phi_uses() + double_indirect_uses(), | 879 double_non_phi_uses() + double_indirect_uses(), |
| 889 tagged_non_phi_uses() + tagged_indirect_uses()); | 880 tagged_non_phi_uses() + tagged_indirect_uses()); |
| 890 } | 881 } |
| 891 | 882 |
| 892 | 883 |
| 893 void HPhi::AddInput(HValue* value) { | 884 void HPhi::AddInput(HValue* value) { |
| 894 inputs_.Add(NULL); | 885 inputs_.Add(NULL); |
| 895 SetOperandAt(OperandCount() - 1, value); | 886 SetOperandAt(OperandCount() - 1, value); |
| 896 // Mark phis that may have 'arguments' directly or indirectly as an operand. | 887 // Mark phis that may have 'arguments' directly or indirectly as an operand. |
| 897 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { | 888 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { |
| 898 SetFlag(kIsArguments); | 889 SetFlag(kIsArguments); |
| 899 } | 890 } |
| 900 } | 891 } |
| 901 | 892 |
| 902 | 893 |
| 903 HValue* HPhi::GetRedundantReplacement() const { | 894 HValue* HPhi::GetRedundantReplacement() { |
| 904 HValue* candidate = NULL; | 895 HValue* candidate = NULL; |
| 905 int count = OperandCount(); | 896 int count = OperandCount(); |
| 906 int position = 0; | 897 int position = 0; |
| 907 while (position < count && candidate == NULL) { | 898 while (position < count && candidate == NULL) { |
| 908 HValue* current = OperandAt(position++); | 899 HValue* current = OperandAt(position++); |
| 909 if (current != this) candidate = current; | 900 if (current != this) candidate = current; |
| 910 } | 901 } |
| 911 while (position < count) { | 902 while (position < count) { |
| 912 HValue* current = OperandAt(position++); | 903 HValue* current = OperandAt(position++); |
| 913 if (current != this && current != candidate) return NULL; | 904 if (current != this && current != candidate) return NULL; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 936 } |
| 946 | 937 |
| 947 | 938 |
| 948 void HPhi::AddIndirectUsesTo(int* dest) { | 939 void HPhi::AddIndirectUsesTo(int* dest) { |
| 949 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 940 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| 950 dest[i] += indirect_uses_[i]; | 941 dest[i] += indirect_uses_[i]; |
| 951 } | 942 } |
| 952 } | 943 } |
| 953 | 944 |
| 954 | 945 |
| 955 void HSimulate::PrintDataTo(StringStream* stream) const { | 946 void HSimulate::PrintDataTo(StringStream* stream) { |
| 956 stream->Add("id=%d ", ast_id()); | 947 stream->Add("id=%d ", ast_id()); |
| 957 if (pop_count_ > 0) stream->Add("pop %d", pop_count_); | 948 if (pop_count_ > 0) stream->Add("pop %d", pop_count_); |
| 958 if (values_.length() > 0) { | 949 if (values_.length() > 0) { |
| 959 if (pop_count_ > 0) stream->Add(" /"); | 950 if (pop_count_ > 0) stream->Add(" /"); |
| 960 for (int i = 0; i < values_.length(); ++i) { | 951 for (int i = 0; i < values_.length(); ++i) { |
| 961 if (!HasAssignedIndexAt(i)) { | 952 if (!HasAssignedIndexAt(i)) { |
| 962 stream->Add(" push "); | 953 stream->Add(" push "); |
| 963 } else { | 954 } else { |
| 964 stream->Add(" var[%d] = ", GetAssignedIndexAt(i)); | 955 stream->Add(" var[%d] = ", GetAssignedIndexAt(i)); |
| 965 } | 956 } |
| 966 values_[i]->PrintNameTo(stream); | 957 values_[i]->PrintNameTo(stream); |
| 967 } | 958 } |
| 968 } | 959 } |
| 969 } | 960 } |
| 970 | 961 |
| 971 | 962 |
| 972 void HEnterInlined::PrintDataTo(StringStream* stream) const { | 963 void HEnterInlined::PrintDataTo(StringStream* stream) { |
| 973 SmartPointer<char> name = function()->debug_name()->ToCString(); | 964 SmartPointer<char> name = function()->debug_name()->ToCString(); |
| 974 stream->Add("%s, id=%d", *name, function()->id()); | 965 stream->Add("%s, id=%d", *name, function()->id()); |
| 975 } | 966 } |
| 976 | 967 |
| 977 | 968 |
| 978 HConstant::HConstant(Handle<Object> handle, Representation r) | 969 HConstant::HConstant(Handle<Object> handle, Representation r) |
| 979 : handle_(handle), | 970 : handle_(handle), |
| 980 constant_type_(HType::TypeFromValue(handle)), | 971 constant_type_(HType::TypeFromValue(handle)), |
| 981 has_int32_value_(false), | 972 has_int32_value_(false), |
| 982 int32_value_(0), | 973 int32_value_(0), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1003 | 994 |
| 1004 | 995 |
| 1005 HConstant* HConstant::CopyToTruncatedInt32() const { | 996 HConstant* HConstant::CopyToTruncatedInt32() const { |
| 1006 if (!has_double_value_) return NULL; | 997 if (!has_double_value_) return NULL; |
| 1007 int32_t truncated = NumberToInt32(*handle_); | 998 int32_t truncated = NumberToInt32(*handle_); |
| 1008 return new HConstant(FACTORY->NewNumberFromInt(truncated), | 999 return new HConstant(FACTORY->NewNumberFromInt(truncated), |
| 1009 Representation::Integer32()); | 1000 Representation::Integer32()); |
| 1010 } | 1001 } |
| 1011 | 1002 |
| 1012 | 1003 |
| 1013 void HConstant::PrintDataTo(StringStream* stream) const { | 1004 void HConstant::PrintDataTo(StringStream* stream) { |
| 1014 handle()->ShortPrint(stream); | 1005 handle()->ShortPrint(stream); |
| 1015 } | 1006 } |
| 1016 | 1007 |
| 1017 | 1008 |
| 1018 bool HArrayLiteral::IsCopyOnWrite() const { | 1009 bool HArrayLiteral::IsCopyOnWrite() const { |
| 1019 return constant_elements()->map() == HEAP->fixed_cow_array_map(); | 1010 return constant_elements()->map() == HEAP->fixed_cow_array_map(); |
| 1020 } | 1011 } |
| 1021 | 1012 |
| 1022 | 1013 |
| 1023 void HBinaryOperation::PrintDataTo(StringStream* stream) const { | 1014 void HBinaryOperation::PrintDataTo(StringStream* stream) { |
| 1024 left()->PrintNameTo(stream); | 1015 left()->PrintNameTo(stream); |
| 1025 stream->Add(" "); | 1016 stream->Add(" "); |
| 1026 right()->PrintNameTo(stream); | 1017 right()->PrintNameTo(stream); |
| 1027 if (CheckFlag(kCanOverflow)) stream->Add(" !"); | 1018 if (CheckFlag(kCanOverflow)) stream->Add(" !"); |
| 1028 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 1019 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
| 1029 } | 1020 } |
| 1030 | 1021 |
| 1031 | 1022 |
| 1032 Range* HBitAnd::InferRange() { | 1023 Range* HBitAnd::InferRange() { |
| 1033 Range* a = left()->range(); | 1024 Range* a = left()->range(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 result->Shl(val); | 1088 result->Shl(val); |
| 1098 return result; | 1089 return result; |
| 1099 } | 1090 } |
| 1100 } | 1091 } |
| 1101 | 1092 |
| 1102 return HBinaryOperation::InferRange(); | 1093 return HBinaryOperation::InferRange(); |
| 1103 } | 1094 } |
| 1104 | 1095 |
| 1105 | 1096 |
| 1106 | 1097 |
| 1107 void HCompare::PrintDataTo(StringStream* stream) const { | 1098 void HCompare::PrintDataTo(StringStream* stream) { |
| 1108 stream->Add(Token::Name(token())); | 1099 stream->Add(Token::Name(token())); |
| 1109 stream->Add(" "); | 1100 stream->Add(" "); |
| 1110 HBinaryOperation::PrintDataTo(stream); | 1101 HBinaryOperation::PrintDataTo(stream); |
| 1111 } | 1102 } |
| 1112 | 1103 |
| 1113 | 1104 |
| 1114 void HCompare::SetInputRepresentation(Representation r) { | 1105 void HCompare::SetInputRepresentation(Representation r) { |
| 1115 input_representation_ = r; | 1106 input_representation_ = r; |
| 1116 if (r.IsTagged()) { | 1107 if (r.IsTagged()) { |
| 1117 SetAllSideEffects(); | 1108 SetAllSideEffects(); |
| 1118 ClearFlag(kUseGVN); | 1109 ClearFlag(kUseGVN); |
| 1119 } else { | 1110 } else { |
| 1120 ClearAllSideEffects(); | 1111 ClearAllSideEffects(); |
| 1121 SetFlag(kUseGVN); | 1112 SetFlag(kUseGVN); |
| 1122 } | 1113 } |
| 1123 } | 1114 } |
| 1124 | 1115 |
| 1125 | 1116 |
| 1126 void HParameter::PrintDataTo(StringStream* stream) const { | 1117 void HParameter::PrintDataTo(StringStream* stream) { |
| 1127 stream->Add("%u", index()); | 1118 stream->Add("%u", index()); |
| 1128 } | 1119 } |
| 1129 | 1120 |
| 1130 | 1121 |
| 1131 void HLoadNamedField::PrintDataTo(StringStream* stream) const { | 1122 void HLoadNamedField::PrintDataTo(StringStream* stream) { |
| 1132 object()->PrintNameTo(stream); | 1123 object()->PrintNameTo(stream); |
| 1133 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); | 1124 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); |
| 1134 } | 1125 } |
| 1135 | 1126 |
| 1136 | 1127 |
| 1137 void HLoadKeyed::PrintDataTo(StringStream* stream) const { | 1128 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 1138 object()->PrintNameTo(stream); | 1129 object()->PrintNameTo(stream); |
| 1139 stream->Add("["); | 1130 stream->Add("["); |
| 1140 key()->PrintNameTo(stream); | 1131 key()->PrintNameTo(stream); |
| 1141 stream->Add("]"); | 1132 stream->Add("]"); |
| 1142 } | 1133 } |
| 1143 | 1134 |
| 1144 | 1135 |
| 1145 void HStoreNamed::PrintDataTo(StringStream* stream) const { | 1136 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1137 object()->PrintNameTo(stream); |
| 1138 stream->Add("["); |
| 1139 key()->PrintNameTo(stream); |
| 1140 stream->Add("]"); |
| 1141 } |
| 1142 |
| 1143 |
| 1144 void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) { |
| 1145 external_pointer()->PrintNameTo(stream); |
| 1146 stream->Add("["); |
| 1147 key()->PrintNameTo(stream); |
| 1148 stream->Add("]"); |
| 1149 } |
| 1150 |
| 1151 |
| 1152 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
| 1146 object()->PrintNameTo(stream); | 1153 object()->PrintNameTo(stream); |
| 1147 stream->Add("."); | 1154 stream->Add("."); |
| 1148 ASSERT(name()->IsString()); | 1155 ASSERT(name()->IsString()); |
| 1149 stream->Add(*String::cast(*name())->ToCString()); | 1156 stream->Add(*String::cast(*name())->ToCString()); |
| 1150 stream->Add(" = "); | 1157 stream->Add(" = "); |
| 1151 value()->PrintNameTo(stream); | 1158 value()->PrintNameTo(stream); |
| 1152 } | 1159 } |
| 1153 | 1160 |
| 1154 | 1161 |
| 1155 void HStoreNamedField::PrintDataTo(StringStream* stream) const { | 1162 void HStoreNamedField::PrintDataTo(StringStream* stream) { |
| 1156 HStoreNamed::PrintDataTo(stream); | 1163 object()->PrintNameTo(stream); |
| 1164 stream->Add("."); |
| 1165 ASSERT(name()->IsString()); |
| 1166 stream->Add(*String::cast(*name())->ToCString()); |
| 1167 stream->Add(" = "); |
| 1168 value()->PrintNameTo(stream); |
| 1157 if (!transition().is_null()) { | 1169 if (!transition().is_null()) { |
| 1158 stream->Add(" (transition map %p)", *transition()); | 1170 stream->Add(" (transition map %p)", *transition()); |
| 1159 } | 1171 } |
| 1160 } | 1172 } |
| 1161 | 1173 |
| 1162 | 1174 |
| 1163 void HStoreKeyed::PrintDataTo(StringStream* stream) const { | 1175 void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 1164 object()->PrintNameTo(stream); | 1176 object()->PrintNameTo(stream); |
| 1165 stream->Add("["); | 1177 stream->Add("["); |
| 1166 key()->PrintNameTo(stream); | 1178 key()->PrintNameTo(stream); |
| 1167 stream->Add("] = "); | 1179 stream->Add("] = "); |
| 1168 value()->PrintNameTo(stream); | 1180 value()->PrintNameTo(stream); |
| 1169 } | 1181 } |
| 1170 | 1182 |
| 1171 | 1183 |
| 1172 void HLoadGlobal::PrintDataTo(StringStream* stream) const { | 1184 void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1185 object()->PrintNameTo(stream); |
| 1186 stream->Add("["); |
| 1187 key()->PrintNameTo(stream); |
| 1188 stream->Add("] = "); |
| 1189 value()->PrintNameTo(stream); |
| 1190 } |
| 1191 |
| 1192 |
| 1193 void HStorePixelArrayElement::PrintDataTo(StringStream* stream) { |
| 1194 external_pointer()->PrintNameTo(stream); |
| 1195 stream->Add("["); |
| 1196 key()->PrintNameTo(stream); |
| 1197 stream->Add("] = "); |
| 1198 value()->PrintNameTo(stream); |
| 1199 } |
| 1200 |
| 1201 |
| 1202 void HLoadGlobal::PrintDataTo(StringStream* stream) { |
| 1173 stream->Add("[%p]", *cell()); | 1203 stream->Add("[%p]", *cell()); |
| 1174 if (check_hole_value()) stream->Add(" (deleteable/read-only)"); | 1204 if (check_hole_value()) stream->Add(" (deleteable/read-only)"); |
| 1175 } | 1205 } |
| 1176 | 1206 |
| 1177 | 1207 |
| 1178 void HStoreGlobal::PrintDataTo(StringStream* stream) const { | 1208 void HStoreGlobal::PrintDataTo(StringStream* stream) { |
| 1179 stream->Add("[%p] = ", *cell()); | 1209 stream->Add("[%p] = ", *cell()); |
| 1180 value()->PrintNameTo(stream); | 1210 value()->PrintNameTo(stream); |
| 1181 } | 1211 } |
| 1182 | 1212 |
| 1183 | 1213 |
| 1184 void HLoadContextSlot::PrintDataTo(StringStream* stream) const { | 1214 void HLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 1185 value()->PrintNameTo(stream); | 1215 value()->PrintNameTo(stream); |
| 1186 stream->Add("[%d]", slot_index()); | 1216 stream->Add("[%d]", slot_index()); |
| 1187 } | 1217 } |
| 1188 | 1218 |
| 1189 | 1219 |
| 1190 void HStoreContextSlot::PrintDataTo(StringStream* stream) const { | 1220 void HStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 1191 context()->PrintNameTo(stream); | 1221 context()->PrintNameTo(stream); |
| 1192 stream->Add("[%d] = ", slot_index()); | 1222 stream->Add("[%d] = ", slot_index()); |
| 1193 value()->PrintNameTo(stream); | 1223 value()->PrintNameTo(stream); |
| 1194 } | 1224 } |
| 1195 | 1225 |
| 1196 | 1226 |
| 1197 // Implementation of type inference and type conversions. Calculates | 1227 // Implementation of type inference and type conversions. Calculates |
| 1198 // the inferred type of this instruction based on the input operands. | 1228 // the inferred type of this instruction based on the input operands. |
| 1199 | 1229 |
| 1200 HType HValue::CalculateInferredType() const { | 1230 HType HValue::CalculateInferredType() { |
| 1201 return type_; | 1231 return type_; |
| 1202 } | 1232 } |
| 1203 | 1233 |
| 1204 | 1234 |
| 1205 HType HCheckMap::CalculateInferredType() const { | 1235 HType HCheckMap::CalculateInferredType() { |
| 1206 return value()->type(); | 1236 return value()->type(); |
| 1207 } | 1237 } |
| 1208 | 1238 |
| 1209 | 1239 |
| 1210 HType HCheckFunction::CalculateInferredType() const { | 1240 HType HCheckFunction::CalculateInferredType() { |
| 1211 return value()->type(); | 1241 return value()->type(); |
| 1212 } | 1242 } |
| 1213 | 1243 |
| 1214 | 1244 |
| 1215 HType HCheckNonSmi::CalculateInferredType() const { | 1245 HType HCheckNonSmi::CalculateInferredType() { |
| 1216 // TODO(kasperl): Is there any way to signal that this isn't a smi? | 1246 // TODO(kasperl): Is there any way to signal that this isn't a smi? |
| 1217 return HType::Tagged(); | 1247 return HType::Tagged(); |
| 1218 } | 1248 } |
| 1219 | 1249 |
| 1220 | 1250 |
| 1221 HType HCheckSmi::CalculateInferredType() const { | 1251 HType HCheckSmi::CalculateInferredType() { |
| 1222 return HType::Smi(); | 1252 return HType::Smi(); |
| 1223 } | 1253 } |
| 1224 | 1254 |
| 1225 | 1255 |
| 1226 HType HPhi::CalculateInferredType() const { | 1256 HType HPhi::CalculateInferredType() { |
| 1227 HType result = HType::Uninitialized(); | 1257 HType result = HType::Uninitialized(); |
| 1228 for (int i = 0; i < OperandCount(); ++i) { | 1258 for (int i = 0; i < OperandCount(); ++i) { |
| 1229 HType current = OperandAt(i)->type(); | 1259 HType current = OperandAt(i)->type(); |
| 1230 result = result.Combine(current); | 1260 result = result.Combine(current); |
| 1231 } | 1261 } |
| 1232 return result; | 1262 return result; |
| 1233 } | 1263 } |
| 1234 | 1264 |
| 1235 | 1265 |
| 1236 HType HConstant::CalculateInferredType() const { | 1266 HType HConstant::CalculateInferredType() { |
| 1237 return constant_type_; | 1267 return constant_type_; |
| 1238 } | 1268 } |
| 1239 | 1269 |
| 1240 | 1270 |
| 1241 HType HCompare::CalculateInferredType() const { | 1271 HType HCompare::CalculateInferredType() { |
| 1242 return HType::Boolean(); | 1272 return HType::Boolean(); |
| 1243 } | 1273 } |
| 1244 | 1274 |
| 1245 | 1275 |
| 1246 HType HCompareJSObjectEq::CalculateInferredType() const { | 1276 HType HCompareJSObjectEq::CalculateInferredType() { |
| 1247 return HType::Boolean(); | 1277 return HType::Boolean(); |
| 1248 } | 1278 } |
| 1249 | 1279 |
| 1250 | 1280 |
| 1251 HType HUnaryPredicate::CalculateInferredType() const { | 1281 HType HUnaryPredicate::CalculateInferredType() { |
| 1252 return HType::Boolean(); | 1282 return HType::Boolean(); |
| 1253 } | 1283 } |
| 1254 | 1284 |
| 1255 | 1285 |
| 1256 HType HBitwiseBinaryOperation::CalculateInferredType() const { | 1286 HType HBitwiseBinaryOperation::CalculateInferredType() { |
| 1257 return HType::TaggedNumber(); | 1287 return HType::TaggedNumber(); |
| 1258 } | 1288 } |
| 1259 | 1289 |
| 1260 | 1290 |
| 1261 HType HArithmeticBinaryOperation::CalculateInferredType() const { | 1291 HType HArithmeticBinaryOperation::CalculateInferredType() { |
| 1262 return HType::TaggedNumber(); | 1292 return HType::TaggedNumber(); |
| 1263 } | 1293 } |
| 1264 | 1294 |
| 1265 | 1295 |
| 1266 HType HAdd::CalculateInferredType() const { | 1296 HType HAdd::CalculateInferredType() { |
| 1267 return HType::Tagged(); | 1297 return HType::Tagged(); |
| 1268 } | 1298 } |
| 1269 | 1299 |
| 1270 | 1300 |
| 1271 HType HBitAnd::CalculateInferredType() const { | 1301 HType HBitAnd::CalculateInferredType() { |
| 1272 return HType::TaggedNumber(); | 1302 return HType::TaggedNumber(); |
| 1273 } | 1303 } |
| 1274 | 1304 |
| 1275 | 1305 |
| 1276 HType HBitXor::CalculateInferredType() const { | 1306 HType HBitXor::CalculateInferredType() { |
| 1277 return HType::TaggedNumber(); | 1307 return HType::TaggedNumber(); |
| 1278 } | 1308 } |
| 1279 | 1309 |
| 1280 | 1310 |
| 1281 HType HBitOr::CalculateInferredType() const { | 1311 HType HBitOr::CalculateInferredType() { |
| 1282 return HType::TaggedNumber(); | 1312 return HType::TaggedNumber(); |
| 1283 } | 1313 } |
| 1284 | 1314 |
| 1285 | 1315 |
| 1286 HType HBitNot::CalculateInferredType() const { | 1316 HType HBitNot::CalculateInferredType() { |
| 1287 return HType::TaggedNumber(); | 1317 return HType::TaggedNumber(); |
| 1288 } | 1318 } |
| 1289 | 1319 |
| 1290 | 1320 |
| 1291 HType HUnaryMathOperation::CalculateInferredType() const { | 1321 HType HUnaryMathOperation::CalculateInferredType() { |
| 1292 return HType::TaggedNumber(); | 1322 return HType::TaggedNumber(); |
| 1293 } | 1323 } |
| 1294 | 1324 |
| 1295 | 1325 |
| 1296 HType HShl::CalculateInferredType() const { | 1326 HType HShl::CalculateInferredType() { |
| 1297 return HType::TaggedNumber(); | 1327 return HType::TaggedNumber(); |
| 1298 } | 1328 } |
| 1299 | 1329 |
| 1300 | 1330 |
| 1301 HType HShr::CalculateInferredType() const { | 1331 HType HShr::CalculateInferredType() { |
| 1302 return HType::TaggedNumber(); | 1332 return HType::TaggedNumber(); |
| 1303 } | 1333 } |
| 1304 | 1334 |
| 1305 | 1335 |
| 1306 HType HSar::CalculateInferredType() const { | 1336 HType HSar::CalculateInferredType() { |
| 1307 return HType::TaggedNumber(); | 1337 return HType::TaggedNumber(); |
| 1308 } | 1338 } |
| 1309 | 1339 |
| 1310 | 1340 |
| 1311 HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero( | 1341 HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero( |
| 1312 BitVector* visited) { | 1342 BitVector* visited) { |
| 1313 visited->Add(id()); | 1343 visited->Add(id()); |
| 1314 if (representation().IsInteger32() && | 1344 if (representation().IsInteger32() && |
| 1315 !value()->representation().IsInteger32()) { | 1345 !value()->representation().IsInteger32()) { |
| 1316 if (value()->range() == NULL || value()->range()->CanBeMinusZero()) { | 1346 if (value()->range() == NULL || value()->range()->CanBeMinusZero()) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 | 1476 |
| 1447 | 1477 |
| 1448 void HCheckPrototypeMaps::Verify() { | 1478 void HCheckPrototypeMaps::Verify() { |
| 1449 HInstruction::Verify(); | 1479 HInstruction::Verify(); |
| 1450 ASSERT(HasNoUses()); | 1480 ASSERT(HasNoUses()); |
| 1451 } | 1481 } |
| 1452 | 1482 |
| 1453 #endif | 1483 #endif |
| 1454 | 1484 |
| 1455 } } // namespace v8::internal | 1485 } } // namespace v8::internal |
| OLD | NEW |