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

Side by Side Diff: src/types.cc

Issue 1217803004: Add a type for objects with typed properties. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 5 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/types.h ('k') | src/types-inl.h » ('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 #include <iomanip> 5 #include <iomanip>
6 6
7 #include "src/types.h" 7 #include "src/types.h"
8 8
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (type->IsClass()) { 173 if (type->IsClass()) {
174 // Little hack to avoid the need for a region for handlification here... 174 // Little hack to avoid the need for a region for handlification here...
175 return Config::is_class(type) ? Lub(*Config::as_class(type)) : 175 return Config::is_class(type) ? Lub(*Config::as_class(type)) :
176 type->AsClass()->Bound(NULL)->AsBitset(); 176 type->AsClass()->Bound(NULL)->AsBitset();
177 } 177 }
178 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset(); 178 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset();
179 if (type->IsRange()) return type->AsRange()->Bound(); 179 if (type->IsRange()) return type->AsRange()->Bound();
180 if (type->IsContext()) return kInternal & kTaggedPointer; 180 if (type->IsContext()) return kInternal & kTaggedPointer;
181 if (type->IsArray()) return kOtherObject; 181 if (type->IsArray()) return kOtherObject;
182 if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction 182 if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction
183 if (type->IsObject()) return kOtherObject;
183 UNREACHABLE(); 184 UNREACHABLE();
184 return kNone; 185 return kNone;
185 } 186 }
186 187
187 188
188 template<class Config> 189 template<class Config>
189 typename TypeImpl<Config>::bitset 190 typename TypeImpl<Config>::bitset
190 TypeImpl<Config>::BitsetType::Lub(i::Map* map) { 191 TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
191 DisallowHeapAllocation no_allocation; 192 DisallowHeapAllocation no_allocation;
192 switch (map->instance_type()) { 193 switch (map->instance_type()) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (this_fun->Arity() != that_fun->Arity() || 467 if (this_fun->Arity() != that_fun->Arity() ||
467 !this_fun->Result()->Equals(that_fun->Result()) || 468 !this_fun->Result()->Equals(that_fun->Result()) ||
468 !this_fun->Receiver()->Equals(that_fun->Receiver())) { 469 !this_fun->Receiver()->Equals(that_fun->Receiver())) {
469 return false; 470 return false;
470 } 471 }
471 for (int i = 0, n = this_fun->Arity(); i < n; ++i) { 472 for (int i = 0, n = this_fun->Arity(); i < n; ++i) {
472 if (!this_fun->Parameter(i)->Equals(that_fun->Parameter(i))) return false; 473 if (!this_fun->Parameter(i)->Equals(that_fun->Parameter(i))) return false;
473 } 474 }
474 return true; 475 return true;
475 } 476 }
477 if (that->IsObject()) {
478 if (!this->IsObject()) return false;
479 ObjectType* this_obj = this->AsObject();
480 ObjectType* that_obj = that->AsObject();
481 if (this_obj->Width() < that_obj->Width()) return false;
482 for (int i = 0; i < that_obj->Width(); ++i) {
483 if (!this_obj->Name(i)->Equals(*that_obj->Name(i)) ||
484 !this_obj->Property(i)->Equals(that_obj->Property(i)))
485 return false;
486 }
487 return true;
488 }
476 UNREACHABLE(); 489 UNREACHABLE();
477 return false; 490 return false;
478 } 491 }
479 492
480 493
481 template <class Config> 494 template <class Config>
482 typename TypeImpl<Config>::bitset TypeImpl<Config>::Representation() { 495 typename TypeImpl<Config>::bitset TypeImpl<Config>::Representation() {
483 return REPRESENTATION(this->BitsetLub()); 496 return REPRESENTATION(this->BitsetLub());
484 } 497 }
485 498
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1374
1362 template TypeImpl<ZoneTypeConfig>::TypeHandle 1375 template TypeImpl<ZoneTypeConfig>::TypeHandle
1363 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 1376 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
1364 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 1377 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
1365 template TypeImpl<HeapTypeConfig>::TypeHandle 1378 template TypeImpl<HeapTypeConfig>::TypeHandle
1366 TypeImpl<HeapTypeConfig>::Convert<Type>( 1379 TypeImpl<HeapTypeConfig>::Convert<Type>(
1367 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 1380 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
1368 1381
1369 } // namespace internal 1382 } // namespace internal
1370 } // namespace v8 1383 } // namespace v8
OLDNEW
« no previous file with comments | « src/types.h ('k') | src/types-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698