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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 1262583002: Reland of "Remove ExternalArray, derived types, and element kinds" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-uint32-analysis.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/double.h" 8 #include "src/double.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 } 3200 }
3201 if (access().IsStringLength()) { 3201 if (access().IsStringLength()) {
3202 return new(zone) Range(0, String::kMaxLength); 3202 return new(zone) Range(0, String::kMaxLength);
3203 } 3203 }
3204 return HValue::InferRange(zone); 3204 return HValue::InferRange(zone);
3205 } 3205 }
3206 3206
3207 3207
3208 Range* HLoadKeyed::InferRange(Zone* zone) { 3208 Range* HLoadKeyed::InferRange(Zone* zone) {
3209 switch (elements_kind()) { 3209 switch (elements_kind()) {
3210 case EXTERNAL_INT8_ELEMENTS:
3211 case INT8_ELEMENTS: 3210 case INT8_ELEMENTS:
3212 return new(zone) Range(kMinInt8, kMaxInt8); 3211 return new(zone) Range(kMinInt8, kMaxInt8);
3213 case EXTERNAL_UINT8_ELEMENTS:
3214 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3215 case UINT8_ELEMENTS: 3212 case UINT8_ELEMENTS:
3216 case UINT8_CLAMPED_ELEMENTS: 3213 case UINT8_CLAMPED_ELEMENTS:
3217 return new(zone) Range(kMinUInt8, kMaxUInt8); 3214 return new(zone) Range(kMinUInt8, kMaxUInt8);
3218 case EXTERNAL_INT16_ELEMENTS:
3219 case INT16_ELEMENTS: 3215 case INT16_ELEMENTS:
3220 return new(zone) Range(kMinInt16, kMaxInt16); 3216 return new(zone) Range(kMinInt16, kMaxInt16);
3221 case EXTERNAL_UINT16_ELEMENTS:
3222 case UINT16_ELEMENTS: 3217 case UINT16_ELEMENTS:
3223 return new(zone) Range(kMinUInt16, kMaxUInt16); 3218 return new(zone) Range(kMinUInt16, kMaxUInt16);
3224 default: 3219 default:
3225 return HValue::InferRange(zone); 3220 return HValue::InferRange(zone);
3226 } 3221 }
3227 } 3222 }
3228 3223
3229 3224
3230 std::ostream& HCompareGeneric::PrintDataTo(std::ostream& os) const { // NOLINT 3225 std::ostream& HCompareGeneric::PrintDataTo(std::ostream& os) const { // NOLINT
3231 os << Token::Name(token()) << " "; 3226 os << Token::Name(token()) << " ";
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3454 3449
3455 3450
3456 std::ostream& HLoadNamedGeneric::PrintDataTo( 3451 std::ostream& HLoadNamedGeneric::PrintDataTo(
3457 std::ostream& os) const { // NOLINT 3452 std::ostream& os) const { // NOLINT
3458 Handle<String> n = Handle<String>::cast(name()); 3453 Handle<String> n = Handle<String>::cast(name());
3459 return os << NameOf(object()) << "." << n->ToCString().get(); 3454 return os << NameOf(object()) << "." << n->ToCString().get();
3460 } 3455 }
3461 3456
3462 3457
3463 std::ostream& HLoadKeyed::PrintDataTo(std::ostream& os) const { // NOLINT 3458 std::ostream& HLoadKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
3464 if (!is_external()) { 3459 if (!is_fixed_typed_array()) {
3465 os << NameOf(elements()); 3460 os << NameOf(elements());
3466 } else { 3461 } else {
3467 DCHECK(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && 3462 DCHECK(elements_kind() >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
3468 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); 3463 elements_kind() <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND);
3469 os << NameOf(elements()) << "." << ElementsKindToString(elements_kind()); 3464 os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
3470 } 3465 }
3471 3466
3472 os << "[" << NameOf(key()); 3467 os << "[" << NameOf(key());
3473 if (IsDehoisted()) os << " + " << base_offset(); 3468 if (IsDehoisted()) os << " + " << base_offset();
3474 os << "]"; 3469 os << "]";
3475 3470
3476 if (HasDependency()) os << " " << NameOf(dependency()); 3471 if (HasDependency()) os << " " << NameOf(dependency());
3477 if (RequiresHoleCheck()) os << " check_hole"; 3472 if (RequiresHoleCheck()) os << " check_hole";
3478 return os; 3473 return os;
(...skipping 14 matching lines...) Expand all
3493 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); 3488 bit_field_ = BaseOffsetField::update(bit_field_, base_offset);
3494 return true; 3489 return true;
3495 } 3490 }
3496 3491
3497 3492
3498 bool HLoadKeyed::UsesMustHandleHole() const { 3493 bool HLoadKeyed::UsesMustHandleHole() const {
3499 if (IsFastPackedElementsKind(elements_kind())) { 3494 if (IsFastPackedElementsKind(elements_kind())) {
3500 return false; 3495 return false;
3501 } 3496 }
3502 3497
3503 if (IsExternalArrayElementsKind(elements_kind())) { 3498 if (IsFixedTypedArrayElementsKind(elements_kind())) {
3504 return false; 3499 return false;
3505 } 3500 }
3506 3501
3507 if (hole_mode() == ALLOW_RETURN_HOLE) { 3502 if (hole_mode() == ALLOW_RETURN_HOLE) {
3508 if (IsFastDoubleElementsKind(elements_kind())) { 3503 if (IsFastDoubleElementsKind(elements_kind())) {
3509 return AllUsesCanTreatHoleAsNaN(); 3504 return AllUsesCanTreatHoleAsNaN();
3510 } 3505 }
3511 return true; 3506 return true;
3512 } 3507 }
3513 3508
(...skipping 19 matching lines...) Expand all
3533 return IsFastDoubleElementsKind(elements_kind()) && 3528 return IsFastDoubleElementsKind(elements_kind()) &&
3534 CheckUsesForFlag(HValue::kAllowUndefinedAsNaN); 3529 CheckUsesForFlag(HValue::kAllowUndefinedAsNaN);
3535 } 3530 }
3536 3531
3537 3532
3538 bool HLoadKeyed::RequiresHoleCheck() const { 3533 bool HLoadKeyed::RequiresHoleCheck() const {
3539 if (IsFastPackedElementsKind(elements_kind())) { 3534 if (IsFastPackedElementsKind(elements_kind())) {
3540 return false; 3535 return false;
3541 } 3536 }
3542 3537
3543 if (IsExternalArrayElementsKind(elements_kind())) { 3538 if (IsFixedTypedArrayElementsKind(elements_kind())) {
3544 return false; 3539 return false;
3545 } 3540 }
3546 3541
3547 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { 3542 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) {
3548 return false; 3543 return false;
3549 } 3544 }
3550 3545
3551 return !UsesMustHandleHole(); 3546 return !UsesMustHandleHole();
3552 } 3547 }
3553 3548
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 3603
3609 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT 3604 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT
3610 os << NameOf(object()) << access_ << " = " << NameOf(value()); 3605 os << NameOf(object()) << access_ << " = " << NameOf(value());
3611 if (NeedsWriteBarrier()) os << " (write-barrier)"; 3606 if (NeedsWriteBarrier()) os << " (write-barrier)";
3612 if (has_transition()) os << " (transition map " << *transition_map() << ")"; 3607 if (has_transition()) os << " (transition map " << *transition_map() << ")";
3613 return os; 3608 return os;
3614 } 3609 }
3615 3610
3616 3611
3617 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT 3612 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
3618 if (!is_external()) { 3613 if (!is_fixed_typed_array()) {
3619 os << NameOf(elements()); 3614 os << NameOf(elements());
3620 } else { 3615 } else {
3621 DCHECK(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && 3616 DCHECK(elements_kind() >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
3622 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); 3617 elements_kind() <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND);
3623 os << NameOf(elements()) << "." << ElementsKindToString(elements_kind()); 3618 os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
3624 } 3619 }
3625 3620
3626 os << "[" << NameOf(key()); 3621 os << "[" << NameOf(key());
3627 if (IsDehoisted()) os << " + " << base_offset(); 3622 if (IsDehoisted()) os << " + " << base_offset();
3628 return os << "] = " << NameOf(value()); 3623 return os << "] = " << NameOf(value());
3629 } 3624 }
3630 3625
3631 3626
3632 std::ostream& HStoreKeyedGeneric::PrintDataTo( 3627 std::ostream& HStoreKeyedGeneric::PrintDataTo(
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 if (!addition_result.IsValid()) return false; 3970 if (!addition_result.IsValid()) return false;
3976 base_offset_ = addition_result.ValueOrDie(); 3971 base_offset_ = addition_result.ValueOrDie();
3977 return true; 3972 return true;
3978 } 3973 }
3979 3974
3980 3975
3981 bool HStoreKeyed::NeedsCanonicalization() { 3976 bool HStoreKeyed::NeedsCanonicalization() {
3982 switch (value()->opcode()) { 3977 switch (value()->opcode()) {
3983 case kLoadKeyed: { 3978 case kLoadKeyed: {
3984 ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind(); 3979 ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind();
3985 return IsExternalFloatOrDoubleElementsKind(load_kind) || 3980 return IsFixedFloatElementsKind(load_kind);
3986 IsFixedFloatElementsKind(load_kind);
3987 } 3981 }
3988 case kChange: { 3982 case kChange: {
3989 Representation from = HChange::cast(value())->from(); 3983 Representation from = HChange::cast(value())->from();
3990 return from.IsTagged() || from.IsHeapObject(); 3984 return from.IsTagged() || from.IsHeapObject();
3991 } 3985 }
3992 case kLoadNamedField: 3986 case kLoadNamedField:
3993 case kPhi: { 3987 case kPhi: {
3994 // Better safe than sorry... 3988 // Better safe than sorry...
3995 return true; 3989 return true;
3996 } 3990 }
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4741 case HObjectAccess::kExternalMemory: 4735 case HObjectAccess::kExternalMemory:
4742 os << "[external-memory]"; 4736 os << "[external-memory]";
4743 break; 4737 break;
4744 } 4738 }
4745 4739
4746 return os << "@" << access.offset(); 4740 return os << "@" << access.offset();
4747 } 4741 }
4748 4742
4749 } // namespace internal 4743 } // namespace internal
4750 } // namespace v8 4744 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-uint32-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698