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

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

Issue 958053003: Removed funky Maybe constructor and made fields private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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.cc ('k') | src/hydrogen-representation-changes.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/factory.h" 9 #include "src/factory.h"
10 #include "src/hydrogen-infer-representation.h" 10 #include "src/hydrogen-infer-representation.h"
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 Maybe<HConstant*> HConstant::CopyToTruncatedInt32(Zone* zone) { 2939 Maybe<HConstant*> HConstant::CopyToTruncatedInt32(Zone* zone) {
2940 HConstant* res = NULL; 2940 HConstant* res = NULL;
2941 if (HasInteger32Value()) { 2941 if (HasInteger32Value()) {
2942 res = new (zone) HConstant(int32_value_, Representation::Integer32(), 2942 res = new (zone) HConstant(int32_value_, Representation::Integer32(),
2943 NotInNewSpace(), object_); 2943 NotInNewSpace(), object_);
2944 } else if (HasDoubleValue()) { 2944 } else if (HasDoubleValue()) {
2945 res = new (zone) 2945 res = new (zone)
2946 HConstant(DoubleToInt32(double_value_), Representation::Integer32(), 2946 HConstant(DoubleToInt32(double_value_), Representation::Integer32(),
2947 NotInNewSpace(), object_); 2947 NotInNewSpace(), object_);
2948 } 2948 }
2949 return Maybe<HConstant*>(res != NULL, res); 2949 return res != NULL ? Just(res) : Nothing<HConstant*>();
2950 } 2950 }
2951 2951
2952 2952
2953 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Isolate* isolate, 2953 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Isolate* isolate,
2954 Zone* zone) { 2954 Zone* zone) {
2955 HConstant* res = NULL; 2955 HConstant* res = NULL;
2956 Handle<Object> handle = this->handle(isolate); 2956 Handle<Object> handle = this->handle(isolate);
2957 if (handle->IsBoolean()) { 2957 if (handle->IsBoolean()) {
2958 res = handle->BooleanValue() ? 2958 res = handle->BooleanValue() ?
2959 new(zone) HConstant(1) : new(zone) HConstant(0); 2959 new(zone) HConstant(1) : new(zone) HConstant(0);
2960 } else if (handle->IsUndefined()) { 2960 } else if (handle->IsUndefined()) {
2961 res = new (zone) HConstant(std::numeric_limits<double>::quiet_NaN()); 2961 res = new (zone) HConstant(std::numeric_limits<double>::quiet_NaN());
2962 } else if (handle->IsNull()) { 2962 } else if (handle->IsNull()) {
2963 res = new(zone) HConstant(0); 2963 res = new(zone) HConstant(0);
2964 } 2964 }
2965 return Maybe<HConstant*>(res != NULL, res); 2965 return res != NULL ? Just(res) : Nothing<HConstant*>();
2966 } 2966 }
2967 2967
2968 2968
2969 std::ostream& HConstant::PrintDataTo(std::ostream& os) const { // NOLINT 2969 std::ostream& HConstant::PrintDataTo(std::ostream& os) const { // NOLINT
2970 if (HasInteger32Value()) { 2970 if (HasInteger32Value()) {
2971 os << int32_value_ << " "; 2971 os << int32_value_ << " ";
2972 } else if (HasDoubleValue()) { 2972 } else if (HasDoubleValue()) {
2973 os << double_value_ << " "; 2973 os << double_value_ << " ";
2974 } else if (HasExternalReferenceValue()) { 2974 } else if (HasExternalReferenceValue()) {
2975 os << reinterpret_cast<void*>(external_reference_value_.address()) << " "; 2975 os << reinterpret_cast<void*>(external_reference_value_.address()) << " ";
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 break; 4803 break;
4804 case HObjectAccess::kExternalMemory: 4804 case HObjectAccess::kExternalMemory:
4805 os << "[external-memory]"; 4805 os << "[external-memory]";
4806 break; 4806 break;
4807 } 4807 }
4808 4808
4809 return os << "@" << access.offset(); 4809 return os << "@" << access.offset();
4810 } 4810 }
4811 4811
4812 } } // namespace v8::internal 4812 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-representation-changes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698