| OLD | NEW | 
|      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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|     56 #ifdef ENABLE_DISASSEMBLER |     56 #ifdef ENABLE_DISASSEMBLER | 
|     57 #include "disasm.h" |     57 #include "disasm.h" | 
|     58 #include "disassembler.h" |     58 #include "disassembler.h" | 
|     59 #endif |     59 #endif | 
|     60  |     60  | 
|     61 namespace v8 { |     61 namespace v8 { | 
|     62 namespace internal { |     62 namespace internal { | 
|     63  |     63  | 
|     64 Handle<HeapType> Object::OptimalType(Isolate* isolate, |     64 Handle<HeapType> Object::OptimalType(Isolate* isolate, | 
|     65                                      Representation representation) { |     65                                      Representation representation) { | 
|     66   if (!FLAG_track_field_types) return HeapType::Any(isolate); |     66   if (FLAG_track_field_types) { | 
|     67   if (representation.IsNone()) return HeapType::None(isolate); |     67     if (representation.IsNone()) return HeapType::None(isolate); | 
|     68   if (representation.IsHeapObject() && IsHeapObject()) { |     68     if (representation.IsHeapObject() && IsHeapObject()) { | 
|     69     // We can track only JavaScript objects with stable maps. |     69       // We can track only JavaScript objects with stable maps. | 
|     70     Handle<Map> map(HeapObject::cast(this)->map(), isolate); |     70       Handle<Map> map(HeapObject::cast(this)->map(), isolate); | 
|     71     if (map->is_stable() && |     71       if (map->is_stable() && | 
|     72         map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE && |     72           map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE && | 
|     73         map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) { |     73           map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) { | 
|     74       return HeapType::Class(map, isolate); |     74         return HeapType::Class(map, isolate); | 
 |     75       } | 
|     75     } |     76     } | 
|     76   } |     77   } | 
|     77   return HeapType::Any(isolate); |     78   return HeapType::Any(isolate); | 
|     78 } |     79 } | 
|     79  |     80  | 
|     80  |     81  | 
|     81 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate, |     82 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate, | 
|     82                                          Handle<Object> object, |     83                                          Handle<Object> object, | 
|     83                                          Handle<Context> native_context) { |     84                                          Handle<Context> native_context) { | 
|     84   if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); |     85   if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); | 
| (...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   2519     TransitionArray* transitions = this->transitions(); |   2520     TransitionArray* transitions = this->transitions(); | 
|   2520     for (int i = 0; i < transitions->number_of_transitions(); ++i) { |   2521     for (int i = 0; i < transitions->number_of_transitions(); ++i) { | 
|   2521       transitions->GetTarget(i)->UpdateDescriptor(descriptor_number, desc); |   2522       transitions->GetTarget(i)->UpdateDescriptor(descriptor_number, desc); | 
|   2522     } |   2523     } | 
|   2523   } |   2524   } | 
|   2524   instance_descriptors()->Replace(descriptor_number, desc);; |   2525   instance_descriptors()->Replace(descriptor_number, desc);; | 
|   2525 } |   2526 } | 
|   2526  |   2527  | 
|   2527  |   2528  | 
|   2528 // static |   2529 // static | 
|   2529 Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> old_field_type, |   2530 Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> type1, | 
|   2530                                           Handle<HeapType> new_field_type, |   2531                                           Handle<HeapType> type2, | 
|   2531                                           Isolate* isolate) { |   2532                                           Isolate* isolate) { | 
|   2532   if (new_field_type->NowIs(old_field_type)) return old_field_type; |   2533   static const int kMaxClassesPerFieldType = 5; | 
|   2533   if (old_field_type->NowIs(new_field_type)) return new_field_type; |   2534   if (type1->NowIs(type2)) return type2; | 
 |   2535   if (type2->NowIs(type1)) return type1; | 
 |   2536   if (type1->NowStable() && type2->NowStable()) { | 
 |   2537     Handle<HeapType> type = HeapType::Union(type1, type2, isolate); | 
 |   2538     if (type->NumClasses() <= kMaxClassesPerFieldType) { | 
 |   2539       ASSERT(type->NowStable()); | 
 |   2540       ASSERT(type1->NowIs(type)); | 
 |   2541       ASSERT(type2->NowIs(type)); | 
 |   2542       return type; | 
 |   2543     } | 
 |   2544   } | 
|   2534   return HeapType::Any(isolate); |   2545   return HeapType::Any(isolate); | 
|   2535 } |   2546 } | 
|   2536  |   2547  | 
|   2537  |   2548  | 
|   2538 // static |   2549 // static | 
|   2539 void Map::GeneralizeFieldType(Handle<Map> map, |   2550 void Map::GeneralizeFieldType(Handle<Map> map, | 
|   2540                               int modify_index, |   2551                               int modify_index, | 
|   2541                               Handle<HeapType> new_field_type) { |   2552                               Handle<HeapType> new_field_type) { | 
|   2542   Isolate* isolate = map->GetIsolate(); |   2553   Isolate* isolate = map->GetIsolate(); | 
|   2543   Handle<Map> field_owner(map->FindFieldOwner(modify_index), isolate); |   2554   Handle<Map> field_owner(map->FindFieldOwner(modify_index), isolate); | 
| (...skipping 14567 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  17111 #define ERROR_MESSAGES_TEXTS(C, T) T, |  17122 #define ERROR_MESSAGES_TEXTS(C, T) T, | 
|  17112   static const char* error_messages_[] = { |  17123   static const char* error_messages_[] = { | 
|  17113       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |  17124       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 
|  17114   }; |  17125   }; | 
|  17115 #undef ERROR_MESSAGES_TEXTS |  17126 #undef ERROR_MESSAGES_TEXTS | 
|  17116   return error_messages_[reason]; |  17127   return error_messages_[reason]; | 
|  17117 } |  17128 } | 
|  17118  |  17129  | 
|  17119  |  17130  | 
|  17120 } }  // namespace v8::internal |  17131 } }  // namespace v8::internal | 
| OLD | NEW |