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

Side by Side Diff: src/type-info.cc

Issue 15358005: Don't create new maps in CurrentMapForDeprecated. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { 98 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
99 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); 99 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
100 if (map_or_code->IsMap()) return true; 100 if (map_or_code->IsMap()) return true;
101 if (map_or_code->IsCode()) { 101 if (map_or_code->IsCode()) {
102 Handle<Code> code = Handle<Code>::cast(map_or_code); 102 Handle<Code> code = Handle<Code>::cast(map_or_code);
103 bool preliminary_checks = code->is_keyed_load_stub() && 103 bool preliminary_checks = code->is_keyed_load_stub() &&
104 code->ic_state() == MONOMORPHIC && 104 code->ic_state() == MONOMORPHIC &&
105 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; 105 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
106 if (!preliminary_checks) return false; 106 if (!preliminary_checks) return false;
107 Map* map = code->FindFirstMap(); 107 Map* map = code->FindFirstMap();
108 if (map == NULL) return false;
109 map = map->CurrentMapForDeprecated();
108 return map != NULL && !CanRetainOtherContext(map, *native_context_); 110 return map != NULL && !CanRetainOtherContext(map, *native_context_);
109 } 111 }
110 return false; 112 return false;
111 } 113 }
112 114
113 115
114 bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) { 116 bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) {
115 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); 117 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
116 if (map_or_code->IsCode()) { 118 if (map_or_code->IsCode()) {
117 Handle<Code> code = Handle<Code>::cast(map_or_code); 119 Handle<Code> code = Handle<Code>::cast(map_or_code);
(...skipping 11 matching lines...) Expand all
129 bool standard_store = FLAG_compiled_keyed_stores || 131 bool standard_store = FLAG_compiled_keyed_stores ||
130 (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == 132 (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) ==
131 STANDARD_STORE); 133 STANDARD_STORE);
132 bool preliminary_checks = 134 bool preliminary_checks =
133 code->is_keyed_store_stub() && 135 code->is_keyed_store_stub() &&
134 standard_store && 136 standard_store &&
135 code->ic_state() == MONOMORPHIC && 137 code->ic_state() == MONOMORPHIC &&
136 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; 138 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
137 if (!preliminary_checks) return false; 139 if (!preliminary_checks) return false;
138 Map* map = code->FindFirstMap(); 140 Map* map = code->FindFirstMap();
141 if (map == NULL) return false;
142 map = map->CurrentMapForDeprecated();
139 return map != NULL && !CanRetainOtherContext(map, *native_context_); 143 return map != NULL && !CanRetainOtherContext(map, *native_context_);
140 } 144 }
141 return false; 145 return false;
142 } 146 }
143 147
144 148
145 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) { 149 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) {
146 Handle<Object> map_or_code = GetInfo(ast_id); 150 Handle<Object> map_or_code = GetInfo(ast_id);
147 if (map_or_code->IsCode()) { 151 if (map_or_code->IsCode()) {
148 Handle<Code> code = Handle<Code>::cast(map_or_code); 152 Handle<Code> code = Handle<Code>::cast(map_or_code);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return value->IsSmi() && 189 return value->IsSmi() &&
186 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker; 190 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker;
187 } 191 }
188 192
189 193
190 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { 194 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
191 ASSERT(LoadIsMonomorphicNormal(expr)); 195 ASSERT(LoadIsMonomorphicNormal(expr));
192 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); 196 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
193 if (map_or_code->IsCode()) { 197 if (map_or_code->IsCode()) {
194 Handle<Code> code = Handle<Code>::cast(map_or_code); 198 Handle<Code> code = Handle<Code>::cast(map_or_code);
195 Handle<Map> first_map(code->FindFirstMap()); 199 Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
196 ASSERT(!first_map.is_null()); 200 return map == NULL || CanRetainOtherContext(map, *native_context_)
197 first_map = Map::CurrentMapForDeprecated(first_map);
198 return CanRetainOtherContext(*first_map, *native_context_)
199 ? Handle<Map>::null() 201 ? Handle<Map>::null()
200 : first_map; 202 : Handle<Map>(map);
201 } 203 }
202 return Map::CurrentMapForDeprecated(Handle<Map>::cast(map_or_code)); 204 return Handle<Map>::cast(map_or_code);
203 } 205 }
204 206
205 207
206 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType( 208 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(
207 TypeFeedbackId ast_id) { 209 TypeFeedbackId ast_id) {
208 ASSERT(StoreIsMonomorphicNormal(ast_id)); 210 ASSERT(StoreIsMonomorphicNormal(ast_id));
209 Handle<Object> map_or_code = GetInfo(ast_id); 211 Handle<Object> map_or_code = GetInfo(ast_id);
210 if (map_or_code->IsCode()) { 212 if (map_or_code->IsCode()) {
211 Handle<Code> code = Handle<Code>::cast(map_or_code); 213 Handle<Code> code = Handle<Code>::cast(map_or_code);
212 Handle<Map> first_map(code->FindFirstMap()); 214 Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
213 ASSERT(!first_map.is_null()); 215 return map == NULL || CanRetainOtherContext(map, *native_context_)
214 first_map = Map::CurrentMapForDeprecated(first_map);
215 return CanRetainOtherContext(*first_map, *native_context_)
216 ? Handle<Map>::null() 216 ? Handle<Map>::null()
217 : first_map; 217 : Handle<Map>(map);
218 } 218 }
219 return Map::CurrentMapForDeprecated(Handle<Map>::cast(map_or_code)); 219 return Handle<Map>::cast(map_or_code);
220 } 220 }
221 221
222 222
223 Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType( 223 Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType(
224 TypeFeedbackId id) { 224 TypeFeedbackId id) {
225 Handle<Object> maybe_code = GetInfo(id); 225 Handle<Object> maybe_code = GetInfo(id);
226 if (maybe_code->IsCode()) { 226 if (maybe_code->IsCode()) {
227 Map* first_map = Handle<Code>::cast(maybe_code)->FindFirstMap(); 227 Map* map = Handle<Code>::cast(maybe_code)->FindFirstMap();
228 if (first_map != NULL) { 228 if (map == NULL) return Handle<Map>();
229 return Map::CurrentMapForDeprecated(Handle<Map>(first_map)); 229 map = map->CurrentMapForDeprecated();
230 } 230 return map == NULL || CanRetainOtherContext(map, *native_context_)
231 ? Handle<Map>()
232 : Handle<Map>(map);
233 } else if (maybe_code->IsMap()) {
234 ASSERT(!Handle<Map>::cast(maybe_code)->is_deprecated());
235 return Handle<Map>::cast(maybe_code);
231 } 236 }
232 return Handle<Map>(); 237 return Handle<Map>();
233 } 238 }
234 239
235 240
236 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( 241 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode(
237 TypeFeedbackId ast_id) { 242 TypeFeedbackId ast_id) {
238 Handle<Object> map_or_code = GetInfo(ast_id); 243 Handle<Object> map_or_code = GetInfo(ast_id);
239 if (map_or_code->IsCode()) { 244 if (map_or_code->IsCode()) {
240 Handle<Code> code = Handle<Code>::cast(map_or_code); 245 Handle<Code> code = Handle<Code>::cast(map_or_code);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return FAST_SMI_ELEMENTS; 349 return FAST_SMI_ELEMENTS;
345 } else { 350 } else {
346 return FAST_HOLEY_SMI_ELEMENTS; 351 return FAST_HOLEY_SMI_ELEMENTS;
347 } 352 }
348 } 353 }
349 } 354 }
350 355
351 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap( 356 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(
352 ObjectLiteral::Property* prop) { 357 ObjectLiteral::Property* prop) {
353 ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); 358 ASSERT(ObjectLiteralStoreIsMonomorphic(prop));
354 return Map::CurrentMapForDeprecated( 359 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId()));
355 Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())));
356 } 360 }
357 361
358 362
359 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { 363 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) {
360 return *GetInfo(expr->PropertyFeedbackId()) == 364 return *GetInfo(expr->PropertyFeedbackId()) ==
361 isolate_->builtins()->builtin(id); 365 isolate_->builtins()->builtin(id);
362 } 366 }
363 367
364 368
365 bool TypeFeedbackOracle::LoadIsStub(Property* expr, ICStub* stub) { 369 bool TypeFeedbackOracle::LoadIsStub(Property* expr, ICStub* stub) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 428
425 Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) { 429 Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
426 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); 430 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId());
427 if (!object->IsCode()) return Handle<Map>::null(); 431 if (!object->IsCode()) return Handle<Map>::null();
428 Handle<Code> code = Handle<Code>::cast(object); 432 Handle<Code> code = Handle<Code>::cast(object);
429 if (!code->is_compare_ic_stub()) return Handle<Map>::null(); 433 if (!code->is_compare_ic_stub()) return Handle<Map>::null();
430 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); 434 CompareIC::State state = ICCompareStub::CompareState(code->stub_info());
431 if (state != CompareIC::KNOWN_OBJECT) { 435 if (state != CompareIC::KNOWN_OBJECT) {
432 return Handle<Map>::null(); 436 return Handle<Map>::null();
433 } 437 }
434 Handle<Map> first_map(code->FindFirstMap()); 438 Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
435 ASSERT(!first_map.is_null()); 439 return map == NULL || CanRetainOtherContext(map, *native_context_)
436 first_map = Map::CurrentMapForDeprecated(first_map);
437 return CanRetainOtherContext(*first_map, *native_context_)
438 ? Handle<Map>::null() 440 ? Handle<Map>::null()
439 : first_map; 441 : Handle<Map>(map);
440 } 442 }
441 443
442 444
443 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { 445 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) {
444 Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId()); 446 Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId());
445 TypeInfo unknown = TypeInfo::Unknown(); 447 TypeInfo unknown = TypeInfo::Unknown();
446 if (!object->IsCode()) return unknown; 448 if (!object->IsCode()) return unknown;
447 Handle<Code> code = Handle<Code>::cast(object); 449 Handle<Code> code = Handle<Code>::cast(object);
448 ASSERT(code->is_unary_op_stub()); 450 ASSERT(code->is_unary_op_stub());
449 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>( 451 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>(
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 if (target->ic_state() == MONOMORPHIC) { 718 if (target->ic_state() == MONOMORPHIC) {
717 if (target->kind() == Code::CALL_IC && 719 if (target->kind() == Code::CALL_IC &&
718 target->check_type() != RECEIVER_MAP_CHECK) { 720 target->check_type() != RECEIVER_MAP_CHECK) {
719 SetInfo(ast_id, Smi::FromInt(target->check_type())); 721 SetInfo(ast_id, Smi::FromInt(target->check_type()));
720 } else { 722 } else {
721 Object* map = target->FindFirstMap(); 723 Object* map = target->FindFirstMap();
722 if (map == NULL) { 724 if (map == NULL) {
723 SetInfo(ast_id, static_cast<Object*>(target)); 725 SetInfo(ast_id, static_cast<Object*>(target));
724 } else if (!CanRetainOtherContext(Map::cast(map), 726 } else if (!CanRetainOtherContext(Map::cast(map),
725 *native_context_)) { 727 *native_context_)) {
726 SetInfo(ast_id, map); 728 Map* feedback = Map::cast(map)->CurrentMapForDeprecated();
729 if (feedback != NULL) SetInfo(ast_id, feedback);
727 } 730 }
728 } 731 }
729 } else { 732 } else {
730 SetInfo(ast_id, target); 733 SetInfo(ast_id, target);
731 } 734 }
732 break; 735 break;
733 736
734 case Code::KEYED_LOAD_IC: 737 case Code::KEYED_LOAD_IC:
735 case Code::KEYED_STORE_IC: 738 case Code::KEYED_STORE_IC:
736 if (target->ic_state() == MONOMORPHIC || 739 if (target->ic_state() == MONOMORPHIC ||
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 USE(maybe_result); 782 USE(maybe_result);
780 #ifdef DEBUG 783 #ifdef DEBUG
781 Object* result = NULL; 784 Object* result = NULL;
782 // Dictionary has been allocated with sufficient size for all elements. 785 // Dictionary has been allocated with sufficient size for all elements.
783 ASSERT(maybe_result->ToObject(&result)); 786 ASSERT(maybe_result->ToObject(&result));
784 ASSERT(*dictionary_ == result); 787 ASSERT(*dictionary_ == result);
785 #endif 788 #endif
786 } 789 }
787 790
788 } } // namespace v8::internal 791 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698