| OLD | NEW |
| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 837 |
| 838 | 838 |
| 839 void HUnaryCall::PrintDataTo(StringStream* stream) { | 839 void HUnaryCall::PrintDataTo(StringStream* stream) { |
| 840 value()->PrintNameTo(stream); | 840 value()->PrintNameTo(stream); |
| 841 stream->Add(" "); | 841 stream->Add(" "); |
| 842 stream->Add("#%d", argument_count()); | 842 stream->Add("#%d", argument_count()); |
| 843 } | 843 } |
| 844 | 844 |
| 845 | 845 |
| 846 void HCallJSFunction::PrintDataTo(StringStream* stream) { | 846 void HCallJSFunction::PrintDataTo(StringStream* stream) { |
| 847 OperandAt(0)->PrintNameTo(stream); | 847 function()->PrintNameTo(stream); |
| 848 stream->Add(" "); | |
| 849 OperandAt(1)->PrintNameTo(stream); | |
| 850 stream->Add(" "); | 848 stream->Add(" "); |
| 851 stream->Add("#%d", argument_count()); | 849 stream->Add("#%d", argument_count()); |
| 852 } | 850 } |
| 853 | 851 |
| 854 | 852 |
| 855 HCallJSFunction* HCallJSFunction::New( | 853 HCallJSFunction* HCallJSFunction::New( |
| 856 Zone* zone, | 854 Zone* zone, |
| 857 HValue* context, | 855 HValue* context, |
| 858 HValue* function, | 856 HValue* function, |
| 859 int argument_count, | 857 int argument_count, |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 val, representation(), false, false); | 1437 val, representation(), false, false); |
| 1440 result->InsertBefore(this); | 1438 result->InsertBefore(this); |
| 1441 return result; | 1439 return result; |
| 1442 } | 1440 } |
| 1443 return val; | 1441 return val; |
| 1444 } | 1442 } |
| 1445 } | 1443 } |
| 1446 | 1444 |
| 1447 if (op() == kMathFloor) { | 1445 if (op() == kMathFloor) { |
| 1448 HValue* val = value(); | 1446 HValue* val = value(); |
| 1449 if (val->IsChange()) val = HChange::cast(val)->value(); | |
| 1450 if (val->IsDiv() && (val->UseCount() == 1)) { | 1447 if (val->IsDiv() && (val->UseCount() == 1)) { |
| 1451 HDiv* hdiv = HDiv::cast(val); | 1448 HDiv* hdiv = HDiv::cast(val); |
| 1452 HValue* left = hdiv->left(); | 1449 HValue* left = hdiv->left(); |
| 1453 HValue* right = hdiv->right(); | 1450 HValue* right = hdiv->right(); |
| 1454 // Try to simplify left and right values of the division. | 1451 // Try to simplify left and right values of the division. |
| 1455 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1452 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
| 1456 if (new_left == NULL && | 1453 if (new_left == NULL && |
| 1457 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1454 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
| 1458 new_left = new(block()->zone()) HChange( | 1455 new_left = new(block()->zone()) HChange( |
| 1459 left, Representation::Integer32(), false, false); | 1456 left, Representation::Integer32(), false, false); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1478 if (new_left->IsInstruction() && | 1475 if (new_left->IsInstruction() && |
| 1479 !HInstruction::cast(new_left)->IsLinked()) { | 1476 !HInstruction::cast(new_left)->IsLinked()) { |
| 1480 HInstruction::cast(new_left)->InsertBefore(this); | 1477 HInstruction::cast(new_left)->InsertBefore(this); |
| 1481 } | 1478 } |
| 1482 if (new_right->IsInstruction() && | 1479 if (new_right->IsInstruction() && |
| 1483 !HInstruction::cast(new_right)->IsLinked()) { | 1480 !HInstruction::cast(new_right)->IsLinked()) { |
| 1484 HInstruction::cast(new_right)->InsertBefore(this); | 1481 HInstruction::cast(new_right)->InsertBefore(this); |
| 1485 } | 1482 } |
| 1486 HMathFloorOfDiv* instr = | 1483 HMathFloorOfDiv* instr = |
| 1487 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); | 1484 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); |
| 1488 // Replace this HMathFloor instruction by the new HMathFloorOfDiv. | |
| 1489 instr->InsertBefore(this); | 1485 instr->InsertBefore(this); |
| 1490 ReplaceAllUsesWith(instr); | 1486 return instr; |
| 1491 Kill(); | |
| 1492 // We know the division had no other uses than this HMathFloor. Delete it. | |
| 1493 // Dead code elimination will deal with |left| and |right| if | |
| 1494 // appropriate. | |
| 1495 hdiv->DeleteAndReplaceWith(NULL); | |
| 1496 | |
| 1497 // Return NULL to remove this instruction from the graph. | |
| 1498 return NULL; | |
| 1499 } | 1487 } |
| 1500 } | 1488 } |
| 1501 return this; | 1489 return this; |
| 1502 } | 1490 } |
| 1503 | 1491 |
| 1504 | 1492 |
| 1505 HValue* HCheckInstanceType::Canonicalize() { | 1493 HValue* HCheckInstanceType::Canonicalize() { |
| 1506 if (check_ == IS_STRING && value()->type().IsString()) { | 1494 if (check_ == IS_STRING && value()->type().IsString()) { |
| 1507 return value(); | 1495 return value(); |
| 1508 } | 1496 } |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2528 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); | 2516 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); |
| 2529 is_not_in_new_space_ = !heap->InNewSpace(*handle); | 2517 is_not_in_new_space_ = !heap->InNewSpace(*handle); |
| 2530 } | 2518 } |
| 2531 if (handle->IsNumber()) { | 2519 if (handle->IsNumber()) { |
| 2532 double n = handle->Number(); | 2520 double n = handle->Number(); |
| 2533 has_int32_value_ = IsInteger32(n); | 2521 has_int32_value_ = IsInteger32(n); |
| 2534 int32_value_ = DoubleToInt32(n); | 2522 int32_value_ = DoubleToInt32(n); |
| 2535 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); | 2523 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
| 2536 double_value_ = n; | 2524 double_value_ = n; |
| 2537 has_double_value_ = true; | 2525 has_double_value_ = true; |
| 2526 // TODO(titzer): if this heap number is new space, tenure a new one. |
| 2538 } else { | 2527 } else { |
| 2539 is_internalized_string_ = handle->IsInternalizedString(); | 2528 is_internalized_string_ = handle->IsInternalizedString(); |
| 2540 } | 2529 } |
| 2541 | 2530 |
| 2542 is_cell_ = !handle.is_null() && | 2531 is_cell_ = !handle.is_null() && |
| 2543 (handle->IsCell() || handle->IsPropertyCell()); | 2532 (handle->IsCell() || handle->IsPropertyCell()); |
| 2544 Initialize(r); | 2533 Initialize(r); |
| 2545 } | 2534 } |
| 2546 | 2535 |
| 2547 | 2536 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 if (has_int32_value_) { | 2715 if (has_int32_value_) { |
| 2727 stream->Add("%d ", int32_value_); | 2716 stream->Add("%d ", int32_value_); |
| 2728 } else if (has_double_value_) { | 2717 } else if (has_double_value_) { |
| 2729 stream->Add("%f ", FmtElm(double_value_)); | 2718 stream->Add("%f ", FmtElm(double_value_)); |
| 2730 } else if (has_external_reference_value_) { | 2719 } else if (has_external_reference_value_) { |
| 2731 stream->Add("%p ", reinterpret_cast<void*>( | 2720 stream->Add("%p ", reinterpret_cast<void*>( |
| 2732 external_reference_value_.address())); | 2721 external_reference_value_.address())); |
| 2733 } else { | 2722 } else { |
| 2734 handle(Isolate::Current())->ShortPrint(stream); | 2723 handle(Isolate::Current())->ShortPrint(stream); |
| 2735 } | 2724 } |
| 2725 if (!is_not_in_new_space_) { |
| 2726 stream->Add("[new space] "); |
| 2727 } |
| 2736 } | 2728 } |
| 2737 | 2729 |
| 2738 | 2730 |
| 2739 void HBinaryOperation::PrintDataTo(StringStream* stream) { | 2731 void HBinaryOperation::PrintDataTo(StringStream* stream) { |
| 2740 left()->PrintNameTo(stream); | 2732 left()->PrintNameTo(stream); |
| 2741 stream->Add(" "); | 2733 stream->Add(" "); |
| 2742 right()->PrintNameTo(stream); | 2734 right()->PrintNameTo(stream); |
| 2743 if (CheckFlag(kCanOverflow)) stream->Add(" !"); | 2735 if (CheckFlag(kCanOverflow)) stream->Add(" !"); |
| 2744 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 2736 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
| 2745 } | 2737 } |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3346 | 3338 |
| 3347 | 3339 |
| 3348 void HStoreGlobalCell::PrintDataTo(StringStream* stream) { | 3340 void HStoreGlobalCell::PrintDataTo(StringStream* stream) { |
| 3349 stream->Add("[%p] = ", *cell().handle()); | 3341 stream->Add("[%p] = ", *cell().handle()); |
| 3350 value()->PrintNameTo(stream); | 3342 value()->PrintNameTo(stream); |
| 3351 if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); | 3343 if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); |
| 3352 if (details_.IsReadOnly()) stream->Add(" (read-only)"); | 3344 if (details_.IsReadOnly()) stream->Add(" (read-only)"); |
| 3353 } | 3345 } |
| 3354 | 3346 |
| 3355 | 3347 |
| 3356 void HStoreGlobalGeneric::PrintDataTo(StringStream* stream) { | |
| 3357 stream->Add("%o = ", *name()); | |
| 3358 value()->PrintNameTo(stream); | |
| 3359 } | |
| 3360 | |
| 3361 | |
| 3362 void HLoadContextSlot::PrintDataTo(StringStream* stream) { | 3348 void HLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 3363 value()->PrintNameTo(stream); | 3349 value()->PrintNameTo(stream); |
| 3364 stream->Add("[%d]", slot_index()); | 3350 stream->Add("[%d]", slot_index()); |
| 3365 } | 3351 } |
| 3366 | 3352 |
| 3367 | 3353 |
| 3368 void HStoreContextSlot::PrintDataTo(StringStream* stream) { | 3354 void HStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 3369 context()->PrintNameTo(stream); | 3355 context()->PrintNameTo(stream); |
| 3370 stream->Add("[%d] = ", slot_index()); | 3356 stream->Add("[%d] = ", slot_index()); |
| 3371 value()->PrintNameTo(stream); | 3357 value()->PrintNameTo(stream); |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 break; | 4439 break; |
| 4454 case kExternalMemory: | 4440 case kExternalMemory: |
| 4455 stream->Add("[external-memory]"); | 4441 stream->Add("[external-memory]"); |
| 4456 break; | 4442 break; |
| 4457 } | 4443 } |
| 4458 | 4444 |
| 4459 stream->Add("@%d", offset()); | 4445 stream->Add("@%d", offset()); |
| 4460 } | 4446 } |
| 4461 | 4447 |
| 4462 } } // namespace v8::internal | 4448 } } // namespace v8::internal |
| OLD | NEW |