| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 : TypeInfo::Double(); | 51 : TypeInfo::Double(); |
| 52 } else if (value->IsString()) { | 52 } else if (value->IsString()) { |
| 53 info = TypeInfo::String(); | 53 info = TypeInfo::String(); |
| 54 } else { | 54 } else { |
| 55 info = TypeInfo::Unknown(); | 55 info = TypeInfo::Unknown(); |
| 56 } | 56 } |
| 57 return info; | 57 return info; |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); |
| 62 |
| 63 |
| 61 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 64 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 62 Handle<Context> global_context) { | 65 Handle<Context> global_context) { |
| 63 global_context_ = global_context; | 66 global_context_ = global_context; |
| 64 Initialize(code); | 67 Initialize(code); |
| 65 } | 68 } |
| 66 | 69 |
| 67 | 70 |
| 68 void TypeFeedbackOracle::Initialize(Handle<Code> code) { | 71 void TypeFeedbackOracle::Initialize(Handle<Code> code) { |
| 69 Isolate* isolate = Isolate::Current(); | 72 Isolate* isolate = Isolate::Current(); |
| 70 ASSERT(map_.is_null()); // Only initialize once. | 73 ASSERT(map_.is_null()); // Only initialize once. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 114 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 112 Handle<String> name) { | 115 Handle<String> name) { |
| 113 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 116 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
| 114 return CollectReceiverTypes(expr->position(), name, flags); | 117 return CollectReceiverTypes(expr->position(), name, flags); |
| 115 } | 118 } |
| 116 | 119 |
| 117 | 120 |
| 118 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 121 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
| 119 Handle<String> name) { | 122 Handle<String> name) { |
| 120 int arity = expr->arguments()->length(); | 123 int arity = expr->arguments()->length(); |
| 121 Code::Flags flags = Code::ComputeMonomorphicFlags( | 124 // Note: these flags won't let us get maps from stubs with |
| 122 Code::CALL_IC, NORMAL, OWN_MAP, NOT_IN_LOOP, arity); | 125 // non-default extra ic state in the megamorphic case. In the more |
| 126 // important monomorphic case the map is obtained directly, so it's |
| 127 // not a problem until we decide to emit more polymorphic code. |
| 128 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 129 NORMAL, |
| 130 Code::kNoExtraICState, |
| 131 OWN_MAP, |
| 132 NOT_IN_LOOP, |
| 133 arity); |
| 123 return CollectReceiverTypes(expr->position(), name, flags); | 134 return CollectReceiverTypes(expr->position(), name, flags); |
| 124 } | 135 } |
| 125 | 136 |
| 126 | 137 |
| 127 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 138 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
| 128 Handle<Object> value = GetElement(map_, expr->position()); | 139 Handle<Object> value = GetElement(map_, expr->position()); |
| 129 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 140 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
| 130 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); | 141 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
| 131 ASSERT(check != RECEIVER_MAP_CHECK); | 142 ASSERT(check != RECEIVER_MAP_CHECK); |
| 132 return check; | 143 return check; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 source_positions->Add(position); | 399 source_positions->Add(position); |
| 389 } | 400 } |
| 390 } else { | 401 } else { |
| 391 ASSERT(RelocInfo::IsPosition(mode)); | 402 ASSERT(RelocInfo::IsPosition(mode)); |
| 392 position = static_cast<int>(info->data()); | 403 position = static_cast<int>(info->data()); |
| 393 } | 404 } |
| 394 } | 405 } |
| 395 } | 406 } |
| 396 | 407 |
| 397 } } // namespace v8::internal | 408 } } // namespace v8::internal |
| OLD | NEW |