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 ASSERT(map_.is_null()); // Only initialize once. | 72 ASSERT(map_.is_null()); // Only initialize once. |
70 map_ = Factory::NewJSObject(Top::object_function()); | 73 map_ = Factory::NewJSObject(Top::object_function()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 113 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
111 Handle<String> name) { | 114 Handle<String> name) { |
112 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 115 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
113 return CollectReceiverTypes(expr->position(), name, flags); | 116 return CollectReceiverTypes(expr->position(), name, flags); |
114 } | 117 } |
115 | 118 |
116 | 119 |
117 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 120 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
118 Handle<String> name) { | 121 Handle<String> name) { |
119 int arity = expr->arguments()->length(); | 122 int arity = expr->arguments()->length(); |
120 Code::Flags flags = Code::ComputeMonomorphicFlags( | 123 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
121 Code::CALL_IC, NORMAL, OWN_MAP, NOT_IN_LOOP, arity); | 124 NORMAL, |
125 Code::kNoExtraICState, | |
Mads Ager (chromium)
2011/01/18 12:54:00
This mean that we cannot get type feedback for the
| |
126 OWN_MAP, | |
127 NOT_IN_LOOP, | |
128 arity); | |
122 return CollectReceiverTypes(expr->position(), name, flags); | 129 return CollectReceiverTypes(expr->position(), name, flags); |
123 } | 130 } |
124 | 131 |
125 | 132 |
126 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 133 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
127 Handle<Object> value = GetElement(map_, expr->position()); | 134 Handle<Object> value = GetElement(map_, expr->position()); |
128 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 135 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
129 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); | 136 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
130 ASSERT(check != RECEIVER_MAP_CHECK); | 137 ASSERT(check != RECEIVER_MAP_CHECK); |
131 return check; | 138 return check; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 source_positions->Add(position); | 393 source_positions->Add(position); |
387 } | 394 } |
388 } else { | 395 } else { |
389 ASSERT(RelocInfo::IsPosition(mode)); | 396 ASSERT(RelocInfo::IsPosition(mode)); |
390 position = static_cast<int>(info->data()); | 397 position = static_cast<int>(info->data()); |
391 } | 398 } |
392 } | 399 } |
393 } | 400 } |
394 | 401 |
395 } } // namespace v8::internal | 402 } } // namespace v8::internal |
OLD | NEW |