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

Side by Side Diff: src/types.h

Issue 450473002: Revert "Extend some operations to range types." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/types.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_TYPES_H_ 5 #ifndef V8_TYPES_H_
6 #define V8_TYPES_H_ 6 #define V8_TYPES_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/ostreams.h" 10 #include "src/ostreams.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 static TypeHandle type(Region* region) { \ 279 static TypeHandle type(Region* region) { \
280 return BitsetType::New(BitsetType::k##type, region); \ 280 return BitsetType::New(BitsetType::k##type, region); \
281 } 281 }
282 BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR) 282 BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
283 #undef DEFINE_TYPE_CONSTRUCTOR 283 #undef DEFINE_TYPE_CONSTRUCTOR
284 284
285 static TypeHandle Class(i::Handle<i::Map> map, Region* region) { 285 static TypeHandle Class(i::Handle<i::Map> map, Region* region) {
286 return ClassType::New(map, region); 286 return ClassType::New(map, region);
287 } 287 }
288 static TypeHandle Constant(i::Handle<i::Object> value, Region* region) { 288 static TypeHandle Constant(i::Handle<i::Object> value, Region* region) {
289 // TODO(neis): Return RangeType for numerical values. 289 // TODO(neis): return RangeType for numerical values
290 return ConstantType::New(value, region); 290 return ConstantType::New(value, region);
291 } 291 }
292 static TypeHandle Range(double min, double max, Region* region) { 292 static TypeHandle Range(double min, double max, Region* region) {
293 return RangeType::New(min, max, region); 293 return RangeType::New(min, max, region);
294 } 294 }
295 static TypeHandle Context(TypeHandle outer, Region* region) { 295 static TypeHandle Context(TypeHandle outer, Region* region) {
296 return ContextType::New(outer, region); 296 return ContextType::New(outer, region);
297 } 297 }
298 static TypeHandle Array(TypeHandle element, Region* region) { 298 static TypeHandle Array(TypeHandle element, Region* region) {
299 return ArrayType::New(element, region); 299 return ArrayType::New(element, region);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return (bitset1 | bitset2) == bitset2; 511 return (bitset1 | bitset2) == bitset2;
512 } 512 }
513 513
514 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset 514 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset
515 static int Lub(TypeImpl* type); // least upper bound that's a bitset 515 static int Lub(TypeImpl* type); // least upper bound that's a bitset
516 static int Lub(i::Object* value); 516 static int Lub(i::Object* value);
517 static int Lub(double value); 517 static int Lub(double value);
518 static int Lub(int32_t value); 518 static int Lub(int32_t value);
519 static int Lub(uint32_t value); 519 static int Lub(uint32_t value);
520 static int Lub(i::Map* map); 520 static int Lub(i::Map* map);
521 static int Lub(double min, double max);
522 static int InherentLub(TypeImpl* type); 521 static int InherentLub(TypeImpl* type);
523 522
524 static const char* Name(int bitset); 523 static const char* Name(int bitset);
525 static void Print(OStream& os, int bitset); // NOLINT 524 static void Print(OStream& os, int bitset); // NOLINT
526 using TypeImpl::PrintTo; 525 using TypeImpl::PrintTo;
527 }; 526 };
528 527
529 528
530 // ----------------------------------------------------------------------------- 529 // -----------------------------------------------------------------------------
531 // Superclass for non-bitset types (internal). 530 // Superclass for non-bitset types (internal).
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 683
685 template<class Config> 684 template<class Config>
686 class TypeImpl<Config>::RangeType : public StructuralType { 685 class TypeImpl<Config>::RangeType : public StructuralType {
687 public: 686 public:
688 TypeHandle Bound() { return this->Get(0); } 687 TypeHandle Bound() { return this->Get(0); }
689 double Min() { return this->template GetValue<i::HeapNumber>(1)->value(); } 688 double Min() { return this->template GetValue<i::HeapNumber>(1)->value(); }
690 double Max() { return this->template GetValue<i::HeapNumber>(2)->value(); } 689 double Max() { return this->template GetValue<i::HeapNumber>(2)->value(); }
691 690
692 static RangeHandle New( 691 static RangeHandle New(
693 double min, double max, TypeHandle bound, Region* region) { 692 double min, double max, TypeHandle bound, Region* region) {
694 DCHECK(BitsetType::Is(bound->AsBitset(), BitsetType::Lub(min, max))); 693 DCHECK(BitsetType::Is(bound->AsBitset(), BitsetType::kNumber));
694 DCHECK(!std::isnan(min) && !std::isnan(max) && min <= max);
695 RangeHandle type = Config::template cast<RangeType>( 695 RangeHandle type = Config::template cast<RangeType>(
696 StructuralType::New(StructuralType::kRangeTag, 3, region)); 696 StructuralType::New(StructuralType::kRangeTag, 3, region));
697 type->Set(0, bound); 697 type->Set(0, bound);
698 Factory* factory = Config::isolate(region)->factory(); 698 Factory* factory = Config::isolate(region)->factory();
699 Handle<HeapNumber> minV = factory->NewHeapNumber(min); 699 Handle<HeapNumber> minV = factory->NewHeapNumber(min);
700 Handle<HeapNumber> maxV = factory->NewHeapNumber(max); 700 Handle<HeapNumber> maxV = factory->NewHeapNumber(max);
701 type->SetValue(1, minV); 701 type->SetValue(1, minV);
702 type->SetValue(2, maxV); 702 type->SetValue(2, maxV);
703 return type; 703 return type;
704 } 704 }
705 705
706 static RangeHandle New(double min, double max, Region* region) { 706 static RangeHandle New(double min, double max, Region* region) {
707 TypeHandle bound = BitsetType::New(BitsetType::Lub(min, max), region); 707 TypeHandle bound = BitsetType::New(BitsetType::kNumber, region);
708 return New(min, max, bound, region); 708 return New(min, max, bound, region);
709 } 709 }
710 710
711 static RangeType* cast(TypeImpl* type) { 711 static RangeType* cast(TypeImpl* type) {
712 DCHECK(type->IsRange()); 712 DCHECK(type->IsRange());
713 return static_cast<RangeType*>(type); 713 return static_cast<RangeType*>(type);
714 } 714 }
715 }; 715 };
716 716
717 717
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 bool Narrows(BoundsImpl that) { 995 bool Narrows(BoundsImpl that) {
996 return that.lower->Is(this->lower) && this->upper->Is(that.upper); 996 return that.lower->Is(this->lower) && this->upper->Is(that.upper);
997 } 997 }
998 }; 998 };
999 999
1000 typedef BoundsImpl<ZoneTypeConfig> Bounds; 1000 typedef BoundsImpl<ZoneTypeConfig> Bounds;
1001 1001
1002 } } // namespace v8::internal 1002 } } // namespace v8::internal
1003 1003
1004 #endif // V8_TYPES_H_ 1004 #endif // V8_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698