Revision f230a1cf deps/v8/src/hydrogen-instructions.cc
deps/v8/src/hydrogen-instructions.cc | ||
---|---|---|
509 | 509 |
} |
510 | 510 |
|
511 | 511 |
|
512 |
bool HValue::CanReplaceWithDummyUses() { |
|
513 |
return FLAG_unreachable_code_elimination && |
|
514 |
!(block()->IsReachable() || |
|
515 |
IsBlockEntry() || |
|
516 |
IsControlInstruction() || |
|
517 |
IsSimulate() || |
|
518 |
IsEnterInlined() || |
|
519 |
IsLeaveInlined()); |
|
520 |
} |
|
521 |
|
|
522 |
|
|
512 | 523 |
bool HValue::IsInteger32Constant() { |
513 | 524 |
return IsConstant() && HConstant::cast(this)->HasInteger32Value(); |
514 | 525 |
} |
... | ... | |
730 | 741 |
next_ = next; |
731 | 742 |
previous_ = prev; |
732 | 743 |
SetBlock(next->block()); |
744 |
if (position() == RelocInfo::kNoPosition && |
|
745 |
next->position() != RelocInfo::kNoPosition) { |
|
746 |
set_position(next->position()); |
|
747 |
} |
|
733 | 748 |
} |
734 | 749 |
|
735 | 750 |
|
... | ... | |
764 | 779 |
if (block->last() == previous) { |
765 | 780 |
block->set_last(this); |
766 | 781 |
} |
782 |
if (position() == RelocInfo::kNoPosition && |
|
783 |
previous->position() != RelocInfo::kNoPosition) { |
|
784 |
set_position(previous->position()); |
|
785 |
} |
|
767 | 786 |
} |
768 | 787 |
|
769 | 788 |
|
... | ... | |
973 | 992 |
|
974 | 993 |
void HCallRuntime::PrintDataTo(StringStream* stream) { |
975 | 994 |
stream->Add("%o ", *name()); |
995 |
if (save_doubles() == kSaveFPRegs) { |
|
996 |
stream->Add("[save doubles] "); |
|
997 |
} |
|
976 | 998 |
stream->Add("#%d", argument_count()); |
977 | 999 |
} |
978 | 1000 |
|
... | ... | |
1050 | 1072 |
} |
1051 | 1073 |
|
1052 | 1074 |
|
1075 |
bool HBranch::KnownSuccessorBlock(HBasicBlock** block) { |
|
1076 |
HValue* value = this->value(); |
|
1077 |
if (value->EmitAtUses()) { |
|
1078 |
ASSERT(value->IsConstant()); |
|
1079 |
ASSERT(!value->representation().IsDouble()); |
|
1080 |
*block = HConstant::cast(value)->BooleanValue() |
|
1081 |
? FirstSuccessor() |
|
1082 |
: SecondSuccessor(); |
|
1083 |
return true; |
|
1084 |
} |
|
1085 |
*block = NULL; |
|
1086 |
return false; |
|
1087 |
} |
|
1088 |
|
|
1089 |
|
|
1053 | 1090 |
void HCompareMap::PrintDataTo(StringStream* stream) { |
1054 | 1091 |
value()->PrintNameTo(stream); |
1055 |
stream->Add(" (%p)", *map()); |
|
1092 |
stream->Add(" (%p)", *map().handle());
|
|
1056 | 1093 |
HControlInstruction::PrintDataTo(stream); |
1057 | 1094 |
} |
1058 | 1095 |
|
... | ... | |
1218 | 1255 |
|
1219 | 1256 |
|
1220 | 1257 |
HValue* HAdd::Canonicalize() { |
1221 |
if (IsIdentityOperation(left(), right(), 0)) return left(); |
|
1222 |
if (IsIdentityOperation(right(), left(), 0)) return right(); |
|
1258 |
// Adding 0 is an identity operation except in case of -0: -0 + 0 = +0 |
|
1259 |
if (IsIdentityOperation(left(), right(), 0) && |
|
1260 |
!left()->representation().IsDouble()) { // Left could be -0. |
|
1261 |
return left(); |
|
1262 |
} |
|
1263 |
if (IsIdentityOperation(right(), left(), 0) && |
|
1264 |
!left()->representation().IsDouble()) { // Right could be -0. |
|
1265 |
return right(); |
|
1266 |
} |
|
1223 | 1267 |
return this; |
1224 | 1268 |
} |
1225 | 1269 |
|
... | ... | |
1237 | 1281 |
} |
1238 | 1282 |
|
1239 | 1283 |
|
1284 |
bool HMul::MulMinusOne() { |
|
1285 |
if (left()->EqualsInteger32Constant(-1) || |
|
1286 |
right()->EqualsInteger32Constant(-1)) { |
|
1287 |
return true; |
|
1288 |
} |
|
1289 |
|
|
1290 |
return false; |
|
1291 |
} |
|
1292 |
|
|
1293 |
|
|
1240 | 1294 |
HValue* HMod::Canonicalize() { |
1241 | 1295 |
return this; |
1242 | 1296 |
} |
... | ... | |
1431 | 1485 |
HStoreNamedField* store = HStoreNamedField::cast(dominator); |
1432 | 1486 |
if (!store->has_transition() || store->object() != value()) return; |
1433 | 1487 |
HConstant* transition = HConstant::cast(store->transition()); |
1434 |
for (int i = 0; i < map_set()->length(); i++) { |
|
1435 |
if (transition->UniqueValueIdsMatch(map_unique_ids_.at(i))) { |
|
1436 |
DeleteAndReplaceWith(NULL); |
|
1437 |
return; |
|
1438 |
} |
|
1488 |
if (map_set_.Contains(transition->GetUnique())) { |
|
1489 |
DeleteAndReplaceWith(NULL); |
|
1490 |
return; |
|
1439 | 1491 |
} |
1440 | 1492 |
} |
1441 | 1493 |
} |
... | ... | |
1443 | 1495 |
|
1444 | 1496 |
void HCheckMaps::PrintDataTo(StringStream* stream) { |
1445 | 1497 |
value()->PrintNameTo(stream); |
1446 |
stream->Add(" [%p", *map_set()->first());
|
|
1447 |
for (int i = 1; i < map_set()->length(); ++i) {
|
|
1448 |
stream->Add(",%p", *map_set()->at(i));
|
|
1498 |
stream->Add(" [%p", *map_set_.at(0).handle());
|
|
1499 |
for (int i = 1; i < map_set_.size(); ++i) {
|
|
1500 |
stream->Add(",%p", *map_set_.at(i).handle());
|
|
1449 | 1501 |
} |
1450 | 1502 |
stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : ""); |
1451 | 1503 |
} |
... | ... | |
1454 | 1506 |
void HCheckValue::PrintDataTo(StringStream* stream) { |
1455 | 1507 |
value()->PrintNameTo(stream); |
1456 | 1508 |
stream->Add(" "); |
1457 |
object()->ShortPrint(stream); |
|
1509 |
object().handle()->ShortPrint(stream);
|
|
1458 | 1510 |
} |
1459 | 1511 |
|
1460 | 1512 |
|
1461 | 1513 |
HValue* HCheckValue::Canonicalize() { |
1462 | 1514 |
return (value()->IsConstant() && |
1463 |
HConstant::cast(value())->UniqueValueIdsMatch(object_unique_id_))
|
|
1515 |
HConstant::cast(value())->GetUnique() == object_)
|
|
1464 | 1516 |
? NULL |
1465 | 1517 |
: this; |
1466 | 1518 |
} |
... | ... | |
1555 | 1607 |
} |
1556 | 1608 |
|
1557 | 1609 |
|
1610 |
int HPhi::position() const { |
|
1611 |
return block()->first()->position(); |
|
1612 |
} |
|
1613 |
|
|
1614 |
|
|
1558 | 1615 |
Range* HPhi::InferRange(Zone* zone) { |
1559 | 1616 |
Representation r = representation(); |
1560 | 1617 |
if (r.IsSmiOrInteger32()) { |
... | ... | |
1624 | 1681 |
Range* a = left()->range(); |
1625 | 1682 |
Range* b = right()->range(); |
1626 | 1683 |
Range* res = a->Copy(zone); |
1627 |
if (!res->MulAndCheckOverflow(r, b)) { |
|
1628 |
// Clearing the kCanOverflow flag when kAllUsesAreTruncatingToInt32 |
|
1629 |
// would be wrong, because truncated integer multiplication is too |
|
1630 |
// precise and therefore not the same as converting to Double and back. |
|
1684 |
if (!res->MulAndCheckOverflow(r, b) || |
|
1685 |
(((r.IsInteger32() && CheckFlag(kAllUsesTruncatingToInt32)) || |
|
1686 |
(r.IsSmi() && CheckFlag(kAllUsesTruncatingToSmi))) && |
|
1687 |
MulMinusOne())) { |
|
1688 |
// Truncated int multiplication is too precise and therefore not the |
|
1689 |
// same as converting to Double and back. |
|
1690 |
// Handle truncated integer multiplication by -1 special. |
|
1631 | 1691 |
ClearFlag(kCanOverflow); |
1632 | 1692 |
} |
1633 | 1693 |
res->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToSmi) && |
... | ... | |
1649 | 1709 |
result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && |
1650 | 1710 |
(a->CanBeMinusZero() || |
1651 | 1711 |
(a->CanBeZero() && b->CanBeNegative()))); |
1652 |
if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
|
1712 |
if (!a->Includes(kMinInt) || |
|
1713 |
!b->Includes(-1) || |
|
1714 |
CheckFlag(kAllUsesTruncatingToInt32)) { |
|
1715 |
// It is safe to clear kCanOverflow when kAllUsesTruncatingToInt32. |
|
1653 | 1716 |
ClearFlag(HValue::kCanOverflow); |
1654 | 1717 |
} |
1655 | 1718 |
|
... | ... | |
2327 | 2390 |
} |
2328 | 2391 |
|
2329 | 2392 |
|
2393 |
static void ReplayEnvironmentNested(const ZoneList<HValue*>* values, |
|
2394 |
HCapturedObject* other) { |
|
2395 |
for (int i = 0; i < values->length(); ++i) { |
|
2396 |
HValue* value = values->at(i); |
|
2397 |
if (value->IsCapturedObject()) { |
|
2398 |
if (HCapturedObject::cast(value)->capture_id() == other->capture_id()) { |
|
2399 |
values->at(i) = other; |
|
2400 |
} else { |
|
2401 |
ReplayEnvironmentNested(HCapturedObject::cast(value)->values(), other); |
|
2402 |
} |
|
2403 |
} |
|
2404 |
} |
|
2405 |
} |
|
2406 |
|
|
2407 |
|
|
2330 | 2408 |
// Replay captured objects by replacing all captured objects with the |
2331 | 2409 |
// same capture id in the current and all outer environments. |
2332 | 2410 |
void HCapturedObject::ReplayEnvironment(HEnvironment* env) { |
2333 | 2411 |
ASSERT(env != NULL); |
2334 | 2412 |
while (env != NULL) { |
2335 |
for (int i = 0; i < env->length(); ++i) { |
|
2336 |
HValue* value = env->values()->at(i); |
|
2337 |
if (value->IsCapturedObject() && |
|
2338 |
HCapturedObject::cast(value)->capture_id() == this->capture_id()) { |
|
2339 |
env->SetValueAt(i, this); |
|
2340 |
} |
|
2341 |
} |
|
2413 |
ReplayEnvironmentNested(env->values(), this); |
|
2342 | 2414 |
env = env->outer(); |
2343 | 2415 |
} |
2344 | 2416 |
} |
2345 | 2417 |
|
2346 | 2418 |
|
2419 |
void HCapturedObject::PrintDataTo(StringStream* stream) { |
|
2420 |
stream->Add("#%d ", capture_id()); |
|
2421 |
HDematerializedObject::PrintDataTo(stream); |
|
2422 |
} |
|
2423 |
|
|
2424 |
|
|
2347 | 2425 |
void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
2348 | 2426 |
Zone* zone) { |
2349 | 2427 |
ASSERT(return_target->IsInlineReturnTarget()); |
... | ... | |
2365 | 2443 |
|
2366 | 2444 |
HConstant::HConstant(Handle<Object> handle, Representation r) |
2367 | 2445 |
: HTemplateInstruction<0>(HType::TypeFromValue(handle)), |
2368 |
handle_(handle), |
|
2369 |
unique_id_(), |
|
2446 |
object_(Unique<Object>::CreateUninitialized(handle)), |
|
2370 | 2447 |
has_smi_value_(false), |
2371 | 2448 |
has_int32_value_(false), |
2372 | 2449 |
has_double_value_(false), |
... | ... | |
2375 | 2452 |
is_not_in_new_space_(true), |
2376 | 2453 |
is_cell_(false), |
2377 | 2454 |
boolean_value_(handle->BooleanValue()) { |
2378 |
if (handle_->IsHeapObject()) {
|
|
2455 |
if (handle->IsHeapObject()) { |
|
2379 | 2456 |
Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); |
2380 | 2457 |
is_not_in_new_space_ = !heap->InNewSpace(*handle); |
2381 | 2458 |
} |
2382 |
if (handle_->IsNumber()) {
|
|
2383 |
double n = handle_->Number();
|
|
2459 |
if (handle->IsNumber()) { |
|
2460 |
double n = handle->Number(); |
|
2384 | 2461 |
has_int32_value_ = IsInteger32(n); |
2385 | 2462 |
int32_value_ = DoubleToInt32(n); |
2386 | 2463 |
has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
2387 | 2464 |
double_value_ = n; |
2388 | 2465 |
has_double_value_ = true; |
2389 | 2466 |
} else { |
2390 |
is_internalized_string_ = handle_->IsInternalizedString();
|
|
2467 |
is_internalized_string_ = handle->IsInternalizedString(); |
|
2391 | 2468 |
} |
2392 | 2469 |
|
2393 |
is_cell_ = !handle_.is_null() &&
|
|
2394 |
(handle_->IsCell() || handle_->IsPropertyCell());
|
|
2470 |
is_cell_ = !handle.is_null() && |
|
2471 |
(handle->IsCell() || handle->IsPropertyCell());
|
|
2395 | 2472 |
Initialize(r); |
2396 | 2473 |
} |
2397 | 2474 |
|
2398 | 2475 |
|
2399 |
HConstant::HConstant(Handle<Object> handle, |
|
2400 |
UniqueValueId unique_id, |
|
2476 |
HConstant::HConstant(Unique<Object> unique, |
|
2401 | 2477 |
Representation r, |
2402 | 2478 |
HType type, |
2403 | 2479 |
bool is_internalize_string, |
... | ... | |
2405 | 2481 |
bool is_cell, |
2406 | 2482 |
bool boolean_value) |
2407 | 2483 |
: HTemplateInstruction<0>(type), |
2408 |
handle_(handle), |
|
2409 |
unique_id_(unique_id), |
|
2484 |
object_(unique), |
|
2410 | 2485 |
has_smi_value_(false), |
2411 | 2486 |
has_int32_value_(false), |
2412 | 2487 |
has_double_value_(false), |
... | ... | |
2415 | 2490 |
is_not_in_new_space_(is_not_in_new_space), |
2416 | 2491 |
is_cell_(is_cell), |
2417 | 2492 |
boolean_value_(boolean_value) { |
2418 |
ASSERT(!handle.is_null());
|
|
2493 |
ASSERT(!unique.handle().is_null());
|
|
2419 | 2494 |
ASSERT(!type.IsTaggedNumber()); |
2420 | 2495 |
Initialize(r); |
2421 | 2496 |
} |
2422 | 2497 |
|
2423 | 2498 |
|
2424 |
HConstant::HConstant(Handle<Map> handle, |
|
2425 |
UniqueValueId unique_id) |
|
2426 |
: HTemplateInstruction<0>(HType::Tagged()), |
|
2427 |
handle_(handle), |
|
2428 |
unique_id_(unique_id), |
|
2429 |
has_smi_value_(false), |
|
2430 |
has_int32_value_(false), |
|
2431 |
has_double_value_(false), |
|
2432 |
has_external_reference_value_(false), |
|
2433 |
is_internalized_string_(false), |
|
2434 |
is_not_in_new_space_(true), |
|
2435 |
is_cell_(false), |
|
2436 |
boolean_value_(false) { |
|
2437 |
ASSERT(!handle.is_null()); |
|
2438 |
Initialize(Representation::Tagged()); |
|
2439 |
} |
|
2440 |
|
|
2441 |
|
|
2442 | 2499 |
HConstant::HConstant(int32_t integer_value, |
2443 | 2500 |
Representation r, |
2444 | 2501 |
bool is_not_in_new_space, |
2445 |
Handle<Object> optional_handle) |
|
2446 |
: handle_(optional_handle), |
|
2447 |
unique_id_(), |
|
2502 |
Unique<Object> object) |
|
2503 |
: object_(object), |
|
2448 | 2504 |
has_smi_value_(Smi::IsValid(integer_value)), |
2449 | 2505 |
has_int32_value_(true), |
2450 | 2506 |
has_double_value_(true), |
... | ... | |
2463 | 2519 |
HConstant::HConstant(double double_value, |
2464 | 2520 |
Representation r, |
2465 | 2521 |
bool is_not_in_new_space, |
2466 |
Handle<Object> optional_handle) |
|
2467 |
: handle_(optional_handle), |
|
2468 |
unique_id_(), |
|
2522 |
Unique<Object> object) |
|
2523 |
: object_(object), |
|
2469 | 2524 |
has_int32_value_(IsInteger32(double_value)), |
2470 | 2525 |
has_double_value_(true), |
2471 | 2526 |
has_external_reference_value_(false), |
... | ... | |
2483 | 2538 |
|
2484 | 2539 |
HConstant::HConstant(ExternalReference reference) |
2485 | 2540 |
: HTemplateInstruction<0>(HType::None()), |
2541 |
object_(Unique<Object>(Handle<Object>::null())), |
|
2486 | 2542 |
has_smi_value_(false), |
2487 | 2543 |
has_int32_value_(false), |
2488 | 2544 |
has_double_value_(false), |
... | ... | |
2496 | 2552 |
} |
2497 | 2553 |
|
2498 | 2554 |
|
2499 |
static void PrepareConstant(Handle<Object> object) { |
|
2500 |
if (!object->IsJSObject()) return; |
|
2501 |
Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
|
2502 |
if (!js_object->map()->is_deprecated()) return; |
|
2503 |
JSObject::TryMigrateInstance(js_object); |
|
2504 |
} |
|
2505 |
|
|
2506 |
|
|
2507 | 2555 |
void HConstant::Initialize(Representation r) { |
2508 | 2556 |
if (r.IsNone()) { |
2509 | 2557 |
if (has_smi_value_ && SmiValuesAre31Bits()) { |
... | ... | |
2515 | 2563 |
} else if (has_external_reference_value_) { |
2516 | 2564 |
r = Representation::External(); |
2517 | 2565 |
} else { |
2518 |
PrepareConstant(handle_); |
|
2566 |
Handle<Object> object = object_.handle(); |
|
2567 |
if (object->IsJSObject()) { |
|
2568 |
// Try to eagerly migrate JSObjects that have deprecated maps. |
|
2569 |
Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
|
2570 |
if (js_object->map()->is_deprecated()) { |
|
2571 |
JSObject::TryMigrateInstance(js_object); |
|
2572 |
} |
|
2573 |
} |
|
2519 | 2574 |
r = Representation::Tagged(); |
2520 | 2575 |
} |
2521 | 2576 |
} |
... | ... | |
2526 | 2581 |
|
2527 | 2582 |
bool HConstant::EmitAtUses() { |
2528 | 2583 |
ASSERT(IsLinked()); |
2529 |
if (block()->graph()->has_osr()) { |
|
2530 |
return block()->graph()->IsStandardConstant(this); |
|
2584 |
if (block()->graph()->has_osr() && |
|
2585 |
block()->graph()->IsStandardConstant(this)) { |
|
2586 |
// TODO(titzer): this seems like a hack that should be fixed by custom OSR. |
|
2587 |
return true; |
|
2531 | 2588 |
} |
2589 |
if (UseCount() == 0) return true; |
|
2532 | 2590 |
if (IsCell()) return false; |
2533 | 2591 |
if (representation().IsDouble()) return false; |
2534 | 2592 |
return true; |
... | ... | |
2541 | 2599 |
if (r.IsDouble() && !has_double_value_) return NULL; |
2542 | 2600 |
if (r.IsExternal() && !has_external_reference_value_) return NULL; |
2543 | 2601 |
if (has_int32_value_) { |
2544 |
return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_);
|
|
2602 |
return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, object_);
|
|
2545 | 2603 |
} |
2546 | 2604 |
if (has_double_value_) { |
2547 |
return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_);
|
|
2605 |
return new(zone) HConstant(double_value_, r, is_not_in_new_space_, object_);
|
|
2548 | 2606 |
} |
2549 | 2607 |
if (has_external_reference_value_) { |
2550 | 2608 |
return new(zone) HConstant(external_reference_value_); |
2551 | 2609 |
} |
2552 |
ASSERT(!handle_.is_null()); |
|
2553 |
return new(zone) HConstant(handle_, |
|
2554 |
unique_id_, |
|
2610 |
ASSERT(!object_.handle().is_null()); |
|
2611 |
return new(zone) HConstant(object_, |
|
2555 | 2612 |
r, |
2556 | 2613 |
type_, |
2557 | 2614 |
is_internalized_string_, |
... | ... | |
2567 | 2624 |
res = new(zone) HConstant(int32_value_, |
2568 | 2625 |
Representation::Integer32(), |
2569 | 2626 |
is_not_in_new_space_, |
2570 |
handle_);
|
|
2627 |
object_);
|
|
2571 | 2628 |
} else if (has_double_value_) { |
2572 | 2629 |
res = new(zone) HConstant(DoubleToInt32(double_value_), |
2573 | 2630 |
Representation::Integer32(), |
2574 | 2631 |
is_not_in_new_space_, |
2575 |
handle_); |
|
2576 |
} else { |
|
2577 |
ASSERT(!HasNumberValue()); |
|
2578 |
Maybe<HConstant*> number = CopyToTruncatedNumber(zone); |
|
2579 |
if (number.has_value) return number.value->CopyToTruncatedInt32(zone); |
|
2632 |
object_); |
|
2580 | 2633 |
} |
2581 | 2634 |
return Maybe<HConstant*>(res != NULL, res); |
2582 | 2635 |
} |
... | ... | |
2624 | 2677 |
ASSERT(CheckFlag(kFlexibleRepresentation)); |
2625 | 2678 |
Representation new_rep = RepresentationFromInputs(); |
2626 | 2679 |
UpdateRepresentation(new_rep, h_infer, "inputs"); |
2680 |
|
|
2681 |
if (representation().IsSmi() && HasNonSmiUse()) { |
|
2682 |
UpdateRepresentation( |
|
2683 |
Representation::Integer32(), h_infer, "use requirements"); |
|
2684 |
} |
|
2685 |
|
|
2627 | 2686 |
if (observed_output_representation_.IsNone()) { |
2628 | 2687 |
new_rep = RepresentationFromUses(); |
2629 | 2688 |
UpdateRepresentation(new_rep, h_infer, "uses"); |
... | ... | |
2631 | 2690 |
new_rep = RepresentationFromOutput(); |
2632 | 2691 |
UpdateRepresentation(new_rep, h_infer, "output"); |
2633 | 2692 |
} |
2634 |
|
|
2635 |
if (representation().IsSmi() && HasNonSmiUse()) { |
|
2636 |
UpdateRepresentation( |
|
2637 |
Representation::Integer32(), h_infer, "use requirements"); |
|
2638 |
} |
|
2639 | 2693 |
} |
2640 | 2694 |
|
2641 | 2695 |
|
... | ... | |
2662 | 2716 |
return ((current_rep.IsInteger32() && CheckUsesForFlag(kTruncatingToInt32)) || |
2663 | 2717 |
(current_rep.IsSmi() && CheckUsesForFlag(kTruncatingToSmi))) && |
2664 | 2718 |
// Mul in Integer32 mode would be too precise. |
2665 |
!this->IsMul();
|
|
2719 |
(!this->IsMul() || HMul::cast(this)->MulMinusOne());
|
|
2666 | 2720 |
} |
2667 | 2721 |
|
2668 | 2722 |
|
... | ... | |
2802 | 2856 |
|
2803 | 2857 |
|
2804 | 2858 |
Range* HLoadNamedField::InferRange(Zone* zone) { |
2859 |
if (access().representation().IsByte()) { |
|
2860 |
return new(zone) Range(0, 255); |
|
2861 |
} |
|
2805 | 2862 |
if (access().IsStringLength()) { |
2806 | 2863 |
return new(zone) Range(0, String::kMaxLength); |
2807 | 2864 |
} |
... | ... | |
2859 | 2916 |
} |
2860 | 2917 |
|
2861 | 2918 |
|
2862 |
void HCompareHoleAndBranch::PrintDataTo(StringStream* stream) { |
|
2863 |
object()->PrintNameTo(stream); |
|
2864 |
HControlInstruction::PrintDataTo(stream); |
|
2919 |
bool HCompareObjectEqAndBranch::KnownSuccessorBlock(HBasicBlock** block) { |
|
2920 |
if (left()->IsConstant() && right()->IsConstant()) { |
|
2921 |
bool comparison_result = |
|
2922 |
HConstant::cast(left())->Equals(HConstant::cast(right())); |
|
2923 |
*block = comparison_result |
|
2924 |
? FirstSuccessor() |
|
2925 |
: SecondSuccessor(); |
|
2926 |
return true; |
|
2927 |
} |
|
2928 |
*block = NULL; |
|
2929 |
return false; |
|
2865 | 2930 |
} |
2866 | 2931 |
|
2867 | 2932 |
|
2868 | 2933 |
void HCompareHoleAndBranch::InferRepresentation( |
2869 | 2934 |
HInferRepresentationPhase* h_infer) { |
2870 |
ChangeRepresentation(object()->representation());
|
|
2935 |
ChangeRepresentation(value()->representation());
|
|
2871 | 2936 |
} |
2872 | 2937 |
|
2873 | 2938 |
|
... | ... | |
2937 | 3002 |
if (map->CanOmitMapChecks() && |
2938 | 3003 |
value->IsConstant() && |
2939 | 3004 |
HConstant::cast(value)->HasMap(map)) { |
2940 |
check_map->omit(info); |
|
3005 |
// TODO(titzer): collect dependent map checks into a list. |
|
3006 |
check_map->omit_ = true; |
|
3007 |
if (map->CanTransition()) { |
|
3008 |
map->AddDependentCompilationInfo( |
|
3009 |
DependentCode::kPrototypeCheckGroup, info); |
|
3010 |
} |
|
2941 | 3011 |
} |
2942 | 3012 |
return check_map; |
2943 | 3013 |
} |
2944 | 3014 |
|
2945 | 3015 |
|
2946 |
void HCheckMaps::FinalizeUniqueValueId() { |
|
2947 |
if (!map_unique_ids_.is_empty()) return; |
|
2948 |
Zone* zone = block()->zone(); |
|
2949 |
map_unique_ids_.Initialize(map_set_.length(), zone); |
|
2950 |
for (int i = 0; i < map_set_.length(); i++) { |
|
2951 |
map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); |
|
2952 |
} |
|
2953 |
} |
|
2954 |
|
|
2955 |
|
|
2956 | 3016 |
void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { |
2957 | 3017 |
object()->PrintNameTo(stream); |
2958 | 3018 |
stream->Add("."); |
... | ... | |
3148 | 3208 |
|
3149 | 3209 |
void HTransitionElementsKind::PrintDataTo(StringStream* stream) { |
3150 | 3210 |
object()->PrintNameTo(stream); |
3151 |
ElementsKind from_kind = original_map()->elements_kind(); |
|
3152 |
ElementsKind to_kind = transitioned_map()->elements_kind(); |
|
3211 |
ElementsKind from_kind = original_map().handle()->elements_kind();
|
|
3212 |
ElementsKind to_kind = transitioned_map().handle()->elements_kind();
|
|
3153 | 3213 |
stream->Add(" %p [%s] -> %p [%s]", |
3154 |
*original_map(), |
|
3214 |
*original_map().handle(),
|
|
3155 | 3215 |
ElementsAccessor::ForKind(from_kind)->name(), |
3156 |
*transitioned_map(), |
|
3216 |
*transitioned_map().handle(),
|
|
3157 | 3217 |
ElementsAccessor::ForKind(to_kind)->name()); |
3158 | 3218 |
if (IsSimpleMapChangeTransition(from_kind, to_kind)) stream->Add(" (simple)"); |
3159 | 3219 |
} |
3160 | 3220 |
|
3161 | 3221 |
|
3162 | 3222 |
void HLoadGlobalCell::PrintDataTo(StringStream* stream) { |
3163 |
stream->Add("[%p]", *cell()); |
|
3223 |
stream->Add("[%p]", *cell().handle());
|
|
3164 | 3224 |
if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); |
3165 | 3225 |
if (details_.IsReadOnly()) stream->Add(" (read-only)"); |
3166 | 3226 |
} |
... | ... | |
3188 | 3248 |
|
3189 | 3249 |
|
3190 | 3250 |
void HStoreGlobalCell::PrintDataTo(StringStream* stream) { |
3191 |
stream->Add("[%p] = ", *cell()); |
|
3251 |
stream->Add("[%p] = ", *cell().handle());
|
|
3192 | 3252 |
value()->PrintNameTo(stream); |
3193 | 3253 |
if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); |
3194 | 3254 |
if (details_.IsReadOnly()) stream->Add(" (read-only)"); |
... | ... | |
3454 | 3514 |
HConstant* filler_map = HConstant::New( |
3455 | 3515 |
zone, |
3456 | 3516 |
context(), |
3457 |
isolate()->factory()->free_space_map(),
|
|
3458 |
UniqueValueId::free_space_map(isolate()->heap()));
|
|
3517 |
isolate()->factory()->free_space_map());
|
|
3518 |
filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready
|
|
3459 | 3519 |
filler_map->InsertAfter(free_space_instr); |
3460 | 3520 |
HInstruction* store_map = HStoreNamedField::New(zone, context(), |
3461 | 3521 |
free_space_instr, HObjectAccess::ForMap(), filler_map); |
... | ... | |
4004 | 4064 |
Representation rep = Representation::None(); |
4005 | 4065 |
for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
4006 | 4066 |
// Ignore the use requirement from never run code |
4007 |
if (it.value()->block()->IsDeoptimizing()) continue;
|
|
4067 |
if (it.value()->block()->IsUnreachable()) continue;
|
|
4008 | 4068 |
|
4009 | 4069 |
// We check for observed_input_representation elsewhere. |
4010 | 4070 |
Representation use_rep = |
Also available in: Unified diff