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

Side by Side Diff: src/objects.cc

Issue 107933005: Templatise type representation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10542 matching lines...) Expand 10 before | Expand all | Expand 10 after
10553 Object* object = info->target_object(); 10553 Object* object = info->target_object();
10554 if (object->IsMap()) maps->Add(handle(Map::cast(object))); 10554 if (object->IsMap()) maps->Add(handle(Map::cast(object)));
10555 } 10555 }
10556 } 10556 }
10557 10557
10558 10558
10559 void Code::FindAllTypes(TypeHandleList* types) { 10559 void Code::FindAllTypes(TypeHandleList* types) {
10560 ASSERT(is_inline_cache_stub()); 10560 ASSERT(is_inline_cache_stub());
10561 DisallowHeapAllocation no_allocation; 10561 DisallowHeapAllocation no_allocation;
10562 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 10562 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
10563 Isolate* isolate = GetIsolate();
10564 for (RelocIterator it(this, mask); !it.done(); it.next()) { 10563 for (RelocIterator it(this, mask); !it.done(); it.next()) {
10565 RelocInfo* info = it.rinfo(); 10564 RelocInfo* info = it.rinfo();
10566 Object* object = info->target_object(); 10565 Object* object = info->target_object();
10567 if (object->IsMap()) { 10566 if (object->IsMap()) {
10568 Handle<Map> map(Map::cast(object)); 10567 Handle<Map> map(Map::cast(object));
10569 types->Add(handle(IC::MapToType(map), isolate)); 10568 types->Add(IC::MapToType(map));
10570 } 10569 }
10571 } 10570 }
10572 } 10571 }
10573 10572
10574 10573
10575 void Code::ReplaceFirstMap(Map* replace_with) { 10574 void Code::ReplaceFirstMap(Map* replace_with) {
10576 ReplaceNthObject(1, GetHeap()->meta_map(), replace_with); 10575 ReplaceNthObject(1, GetHeap()->meta_map(), replace_with);
10577 } 10576 }
10578 10577
10579 10578
(...skipping 6011 matching lines...) Expand 10 before | Expand all | Expand 10 after
16591 set_type_raw(type, ignored); 16590 set_type_raw(type, ignored);
16592 } 16591 }
16593 16592
16594 16593
16595 Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell, 16594 Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell,
16596 Handle<Object> value) { 16595 Handle<Object> value) {
16597 Isolate* isolate = cell->GetIsolate(); 16596 Isolate* isolate = cell->GetIsolate();
16598 Handle<Type> old_type(cell->type(), isolate); 16597 Handle<Type> old_type(cell->type(), isolate);
16599 // TODO(2803): Do not track ConsString as constant because they cannot be 16598 // TODO(2803): Do not track ConsString as constant because they cannot be
16600 // embedded into code. 16599 // embedded into code.
16601 Handle<Type> new_type(value->IsConsString() || value->IsTheHole() 16600 Handle<Type> new_type = value->IsConsString() || value->IsTheHole()
16602 ? Type::Any() 16601 ? Type::Any(isolate) : Type::Constant(value, isolate);
16603 : Type::Constant(value, isolate), isolate);
16604 16602
16605 if (new_type->Is(old_type)) { 16603 if (new_type->Is(old_type)) {
16606 return old_type; 16604 return old_type;
16607 } 16605 }
16608 16606
16609 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16607 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16610 isolate, DependentCode::kPropertyCellChangedGroup); 16608 isolate, DependentCode::kPropertyCellChangedGroup);
16611 16609
16612 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) { 16610 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
16613 return new_type; 16611 return new_type;
16614 } 16612 }
16615 16613
16616 return handle(Type::Any(), isolate); 16614 return Type::Any(isolate);
16617 } 16615 }
16618 16616
16619 16617
16620 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, 16618 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
16621 Handle<Object> value) { 16619 Handle<Object> value) {
16622 cell->set_value(*value); 16620 cell->set_value(*value);
16623 if (!Type::Any()->Is(cell->type())) { 16621 if (!Type::Any()->Is(cell->type())) {
16624 Handle<Type> new_type = UpdatedType(cell, value); 16622 Handle<Type> new_type = UpdatedType(cell, value);
16625 cell->set_type(*new_type); 16623 cell->set_type(*new_type);
16626 } 16624 }
(...skipping 24 matching lines...) Expand all
16651 #define ERROR_MESSAGES_TEXTS(C, T) T, 16649 #define ERROR_MESSAGES_TEXTS(C, T) T,
16652 static const char* error_messages_[] = { 16650 static const char* error_messages_[] = {
16653 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16651 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16654 }; 16652 };
16655 #undef ERROR_MESSAGES_TEXTS 16653 #undef ERROR_MESSAGES_TEXTS
16656 return error_messages_[reason]; 16654 return error_messages_[reason];
16657 } 16655 }
16658 16656
16659 16657
16660 } } // namespace v8::internal 16658 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698