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

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

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