OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } else if (value->IsString()) { | 53 } else if (value->IsString()) { |
54 info = TypeInfo::String(); | 54 info = TypeInfo::String(); |
55 } else { | 55 } else { |
56 info = TypeInfo::Unknown(); | 56 info = TypeInfo::Unknown(); |
57 } | 57 } |
58 return info; | 58 return info; |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 62 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
63 Handle<Context> global_context, | 63 Handle<Context> native_context, |
64 Isolate* isolate, | 64 Isolate* isolate, |
65 Zone* zone) { | 65 Zone* zone) { |
66 global_context_ = global_context; | 66 native_context_ = native_context; |
67 isolate_ = isolate; | 67 isolate_ = isolate; |
68 zone_ = zone; | 68 zone_ = zone; |
69 BuildDictionary(code); | 69 BuildDictionary(code); |
70 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); | 70 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 static uint32_t IdToKey(TypeFeedbackId ast_id) { | 74 static uint32_t IdToKey(TypeFeedbackId ast_id) { |
75 return static_cast<uint32_t>(ast_id.ToInt()); | 75 return static_cast<uint32_t>(ast_id.ToInt()); |
76 } | 76 } |
(...skipping 21 matching lines...) Expand all Loading... |
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 return map != NULL && !CanRetainOtherContext(map, *global_context_); | 108 return map != NULL && !CanRetainOtherContext(map, *native_context_); |
109 } | 109 } |
110 return false; | 110 return false; |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { | 114 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { |
115 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); | 115 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
116 if (map_or_code->IsCode()) { | 116 if (map_or_code->IsCode()) { |
117 Handle<Code> code = Handle<Code>::cast(map_or_code); | 117 Handle<Code> code = Handle<Code>::cast(map_or_code); |
118 Builtins* builtins = isolate_->builtins(); | 118 Builtins* builtins = isolate_->builtins(); |
(...skipping 13 matching lines...) Expand all Loading... |
132 bool allow_growth = | 132 bool allow_growth = |
133 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == | 133 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == |
134 ALLOW_JSARRAY_GROWTH; | 134 ALLOW_JSARRAY_GROWTH; |
135 bool preliminary_checks = | 135 bool preliminary_checks = |
136 code->is_keyed_store_stub() && | 136 code->is_keyed_store_stub() && |
137 !allow_growth && | 137 !allow_growth && |
138 code->ic_state() == MONOMORPHIC && | 138 code->ic_state() == MONOMORPHIC && |
139 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; | 139 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; |
140 if (!preliminary_checks) return false; | 140 if (!preliminary_checks) return false; |
141 Map* map = code->FindFirstMap(); | 141 Map* map = code->FindFirstMap(); |
142 return map != NULL && !CanRetainOtherContext(map, *global_context_); | 142 return map != NULL && !CanRetainOtherContext(map, *native_context_); |
143 } | 143 } |
144 return false; | 144 return false; |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id) { | 148 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id) { |
149 Handle<Object> map_or_code = GetInfo(ast_id); | 149 Handle<Object> map_or_code = GetInfo(ast_id); |
150 if (map_or_code->IsCode()) { | 150 if (map_or_code->IsCode()) { |
151 Handle<Code> code = Handle<Code>::cast(map_or_code); | 151 Handle<Code> code = Handle<Code>::cast(map_or_code); |
152 Builtins* builtins = isolate_->builtins(); | 152 Builtins* builtins = isolate_->builtins(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 192 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
193 ASSERT(LoadIsMonomorphicNormal(expr)); | 193 ASSERT(LoadIsMonomorphicNormal(expr)); |
194 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); | 194 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
195 if (map_or_code->IsCode()) { | 195 if (map_or_code->IsCode()) { |
196 Handle<Code> code = Handle<Code>::cast(map_or_code); | 196 Handle<Code> code = Handle<Code>::cast(map_or_code); |
197 Map* first_map = code->FindFirstMap(); | 197 Map* first_map = code->FindFirstMap(); |
198 ASSERT(first_map != NULL); | 198 ASSERT(first_map != NULL); |
199 return CanRetainOtherContext(first_map, *global_context_) | 199 return CanRetainOtherContext(first_map, *native_context_) |
200 ? Handle<Map>::null() | 200 ? Handle<Map>::null() |
201 : Handle<Map>(first_map); | 201 : Handle<Map>(first_map); |
202 } | 202 } |
203 return Handle<Map>::cast(map_or_code); | 203 return Handle<Map>::cast(map_or_code); |
204 } | 204 } |
205 | 205 |
206 | 206 |
207 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType( | 207 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType( |
208 TypeFeedbackId ast_id) { | 208 TypeFeedbackId ast_id) { |
209 ASSERT(StoreIsMonomorphicNormal(ast_id)); | 209 ASSERT(StoreIsMonomorphicNormal(ast_id)); |
210 Handle<Object> map_or_code = GetInfo(ast_id); | 210 Handle<Object> map_or_code = GetInfo(ast_id); |
211 if (map_or_code->IsCode()) { | 211 if (map_or_code->IsCode()) { |
212 Handle<Code> code = Handle<Code>::cast(map_or_code); | 212 Handle<Code> code = Handle<Code>::cast(map_or_code); |
213 Map* first_map = code->FindFirstMap(); | 213 Map* first_map = code->FindFirstMap(); |
214 ASSERT(first_map != NULL); | 214 ASSERT(first_map != NULL); |
215 return CanRetainOtherContext(first_map, *global_context_) | 215 return CanRetainOtherContext(first_map, *native_context_) |
216 ? Handle<Map>::null() | 216 ? Handle<Map>::null() |
217 : Handle<Map>(first_map); | 217 : Handle<Map>(first_map); |
218 } | 218 } |
219 return Handle<Map>::cast(map_or_code); | 219 return Handle<Map>::cast(map_or_code); |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, | 223 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
224 Handle<String> name, | 224 Handle<String> name, |
225 SmallMapList* types) { | 225 SmallMapList* types) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 | 269 |
270 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( | 270 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( |
271 CheckType check) { | 271 CheckType check) { |
272 JSFunction* function = NULL; | 272 JSFunction* function = NULL; |
273 switch (check) { | 273 switch (check) { |
274 case RECEIVER_MAP_CHECK: | 274 case RECEIVER_MAP_CHECK: |
275 UNREACHABLE(); | 275 UNREACHABLE(); |
276 break; | 276 break; |
277 case STRING_CHECK: | 277 case STRING_CHECK: |
278 function = global_context_->string_function(); | 278 function = native_context_->string_function(); |
279 break; | 279 break; |
280 case NUMBER_CHECK: | 280 case NUMBER_CHECK: |
281 function = global_context_->number_function(); | 281 function = native_context_->number_function(); |
282 break; | 282 break; |
283 case BOOLEAN_CHECK: | 283 case BOOLEAN_CHECK: |
284 function = global_context_->boolean_function(); | 284 function = native_context_->boolean_function(); |
285 break; | 285 break; |
286 } | 286 } |
287 ASSERT(function != NULL); | 287 ASSERT(function != NULL); |
288 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 288 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
289 } | 289 } |
290 | 290 |
291 | 291 |
292 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { | 292 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
293 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); | 293 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); |
294 } | 294 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); | 356 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); |
357 if (!object->IsCode()) return Handle<Map>::null(); | 357 if (!object->IsCode()) return Handle<Map>::null(); |
358 Handle<Code> code = Handle<Code>::cast(object); | 358 Handle<Code> code = Handle<Code>::cast(object); |
359 if (!code->is_compare_ic_stub()) return Handle<Map>::null(); | 359 if (!code->is_compare_ic_stub()) return Handle<Map>::null(); |
360 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 360 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
361 if (state != CompareIC::KNOWN_OBJECTS) { | 361 if (state != CompareIC::KNOWN_OBJECTS) { |
362 return Handle<Map>::null(); | 362 return Handle<Map>::null(); |
363 } | 363 } |
364 Map* first_map = code->FindFirstMap(); | 364 Map* first_map = code->FindFirstMap(); |
365 ASSERT(first_map != NULL); | 365 ASSERT(first_map != NULL); |
366 return CanRetainOtherContext(first_map, *global_context_) | 366 return CanRetainOtherContext(first_map, *native_context_) |
367 ? Handle<Map>::null() | 367 ? Handle<Map>::null() |
368 : Handle<Map>(first_map); | 368 : Handle<Map>(first_map); |
369 } | 369 } |
370 | 370 |
371 | 371 |
372 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { | 372 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { |
373 Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId()); | 373 Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId()); |
374 TypeInfo unknown = TypeInfo::Unknown(); | 374 TypeInfo unknown = TypeInfo::Unknown(); |
375 if (!object->IsCode()) return unknown; | 375 if (!object->IsCode()) return unknown; |
376 Handle<Code> code = Handle<Code>::cast(object); | 376 Handle<Code> code = Handle<Code>::cast(object); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC); | 515 ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC); |
516 } else if (object->IsMap()) { | 516 } else if (object->IsMap()) { |
517 types->Add(Handle<Map>::cast(object), zone()); | 517 types->Add(Handle<Map>::cast(object), zone()); |
518 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && | 518 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && |
519 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { | 519 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { |
520 types->Reserve(4, zone()); | 520 types->Reserve(4, zone()); |
521 ASSERT(object->IsCode()); | 521 ASSERT(object->IsCode()); |
522 isolate_->stub_cache()->CollectMatchingMaps(types, | 522 isolate_->stub_cache()->CollectMatchingMaps(types, |
523 *name, | 523 *name, |
524 flags, | 524 flags, |
525 global_context_, | 525 native_context_, |
526 zone()); | 526 zone()); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 | 530 |
531 // Check if a map originates from a given global context. We use this | 531 // Check if a map originates from a given native context. We use this |
532 // information to filter out maps from different context to avoid | 532 // information to filter out maps from different context to avoid |
533 // retaining objects from different tabs in Chrome via optimized code. | 533 // retaining objects from different tabs in Chrome via optimized code. |
534 bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, | 534 bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, |
535 Context* global_context) { | 535 Context* native_context) { |
536 Object* constructor = NULL; | 536 Object* constructor = NULL; |
537 while (!map->prototype()->IsNull()) { | 537 while (!map->prototype()->IsNull()) { |
538 constructor = map->constructor(); | 538 constructor = map->constructor(); |
539 if (!constructor->IsNull()) { | 539 if (!constructor->IsNull()) { |
540 // If the constructor is not null or a JSFunction, we have to | 540 // If the constructor is not null or a JSFunction, we have to |
541 // conservatively assume that it may retain a global context. | 541 // conservatively assume that it may retain a native context. |
542 if (!constructor->IsJSFunction()) return true; | 542 if (!constructor->IsJSFunction()) return true; |
543 // Check if the constructor directly references a foreign context. | 543 // Check if the constructor directly references a foreign context. |
544 if (CanRetainOtherContext(JSFunction::cast(constructor), | 544 if (CanRetainOtherContext(JSFunction::cast(constructor), |
545 global_context)) { | 545 native_context)) { |
546 return true; | 546 return true; |
547 } | 547 } |
548 } | 548 } |
549 map = HeapObject::cast(map->prototype())->map(); | 549 map = HeapObject::cast(map->prototype())->map(); |
550 } | 550 } |
551 constructor = map->constructor(); | 551 constructor = map->constructor(); |
552 if (constructor->IsNull()) return false; | 552 if (constructor->IsNull()) return false; |
553 JSFunction* function = JSFunction::cast(constructor); | 553 JSFunction* function = JSFunction::cast(constructor); |
554 return CanRetainOtherContext(function, global_context); | 554 return CanRetainOtherContext(function, native_context); |
555 } | 555 } |
556 | 556 |
557 | 557 |
558 bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, | 558 bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, |
559 Context* global_context) { | 559 Context* native_context) { |
560 return function->context()->global() != global_context->global() | 560 return function->context()->global() != native_context->global() |
561 && function->context()->global() != global_context->builtins(); | 561 && function->context()->global() != native_context->builtins(); |
562 } | 562 } |
563 | 563 |
564 | 564 |
565 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, | 565 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, |
566 Zone* zone) { | 566 Zone* zone) { |
567 for (int i = 0; i < list->length(); ++i) { | 567 for (int i = 0; i < list->length(); ++i) { |
568 if (list->at(i).is_identical_to(map)) return; | 568 if (list->at(i).is_identical_to(map)) return; |
569 } | 569 } |
570 list->Add(map, zone); | 570 list->Add(map, zone); |
571 } | 571 } |
572 | 572 |
573 | 573 |
574 void TypeFeedbackOracle::CollectKeyedReceiverTypes(TypeFeedbackId ast_id, | 574 void TypeFeedbackOracle::CollectKeyedReceiverTypes(TypeFeedbackId ast_id, |
575 SmallMapList* types) { | 575 SmallMapList* types) { |
576 Handle<Object> object = GetInfo(ast_id); | 576 Handle<Object> object = GetInfo(ast_id); |
577 if (!object->IsCode()) return; | 577 if (!object->IsCode()) return; |
578 Handle<Code> code = Handle<Code>::cast(object); | 578 Handle<Code> code = Handle<Code>::cast(object); |
579 if (code->kind() == Code::KEYED_LOAD_IC || | 579 if (code->kind() == Code::KEYED_LOAD_IC || |
580 code->kind() == Code::KEYED_STORE_IC) { | 580 code->kind() == Code::KEYED_STORE_IC) { |
581 AssertNoAllocation no_allocation; | 581 AssertNoAllocation no_allocation; |
582 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 582 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
583 for (RelocIterator it(*code, mask); !it.done(); it.next()) { | 583 for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
584 RelocInfo* info = it.rinfo(); | 584 RelocInfo* info = it.rinfo(); |
585 Object* object = info->target_object(); | 585 Object* object = info->target_object(); |
586 if (object->IsMap()) { | 586 if (object->IsMap()) { |
587 Map* map = Map::cast(object); | 587 Map* map = Map::cast(object); |
588 if (!CanRetainOtherContext(map, *global_context_)) { | 588 if (!CanRetainOtherContext(map, *native_context_)) { |
589 AddMapIfMissing(Handle<Map>(map), types, zone()); | 589 AddMapIfMissing(Handle<Map>(map), types, zone()); |
590 } | 590 } |
591 } | 591 } |
592 } | 592 } |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 | 596 |
597 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId ast_id) { | 597 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId ast_id) { |
598 Handle<Object> object = GetInfo(ast_id); | 598 Handle<Object> object = GetInfo(ast_id); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 case Code::KEYED_CALL_IC: | 665 case Code::KEYED_CALL_IC: |
666 if (target->ic_state() == MONOMORPHIC) { | 666 if (target->ic_state() == MONOMORPHIC) { |
667 if (target->kind() == Code::CALL_IC && | 667 if (target->kind() == Code::CALL_IC && |
668 target->check_type() != RECEIVER_MAP_CHECK) { | 668 target->check_type() != RECEIVER_MAP_CHECK) { |
669 SetInfo(ast_id, Smi::FromInt(target->check_type())); | 669 SetInfo(ast_id, Smi::FromInt(target->check_type())); |
670 } else { | 670 } else { |
671 Object* map = target->FindFirstMap(); | 671 Object* map = target->FindFirstMap(); |
672 if (map == NULL) { | 672 if (map == NULL) { |
673 SetInfo(ast_id, static_cast<Object*>(target)); | 673 SetInfo(ast_id, static_cast<Object*>(target)); |
674 } else if (!CanRetainOtherContext(Map::cast(map), | 674 } else if (!CanRetainOtherContext(Map::cast(map), |
675 *global_context_)) { | 675 *native_context_)) { |
676 SetInfo(ast_id, map); | 676 SetInfo(ast_id, map); |
677 } | 677 } |
678 } | 678 } |
679 } else { | 679 } else { |
680 SetInfo(ast_id, target); | 680 SetInfo(ast_id, target); |
681 } | 681 } |
682 break; | 682 break; |
683 | 683 |
684 case Code::KEYED_LOAD_IC: | 684 case Code::KEYED_LOAD_IC: |
685 case Code::KEYED_STORE_IC: | 685 case Code::KEYED_STORE_IC: |
(...skipping 21 matching lines...) Expand all Loading... |
707 Object* raw_info = code->type_feedback_info(); | 707 Object* raw_info = code->type_feedback_info(); |
708 if (!raw_info->IsTypeFeedbackInfo()) return; | 708 if (!raw_info->IsTypeFeedbackInfo()) return; |
709 Handle<TypeFeedbackCells> cache( | 709 Handle<TypeFeedbackCells> cache( |
710 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); | 710 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); |
711 for (int i = 0; i < cache->CellCount(); i++) { | 711 for (int i = 0; i < cache->CellCount(); i++) { |
712 TypeFeedbackId ast_id = cache->AstId(i); | 712 TypeFeedbackId ast_id = cache->AstId(i); |
713 Object* value = cache->Cell(i)->value(); | 713 Object* value = cache->Cell(i)->value(); |
714 if (value->IsSmi() || | 714 if (value->IsSmi() || |
715 (value->IsJSFunction() && | 715 (value->IsJSFunction() && |
716 !CanRetainOtherContext(JSFunction::cast(value), | 716 !CanRetainOtherContext(JSFunction::cast(value), |
717 *global_context_))) { | 717 *native_context_))) { |
718 SetInfo(ast_id, value); | 718 SetInfo(ast_id, value); |
719 } | 719 } |
720 } | 720 } |
721 } | 721 } |
722 | 722 |
723 | 723 |
724 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { | 724 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { |
725 ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) == | 725 ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) == |
726 UnseededNumberDictionary::kNotFound); | 726 UnseededNumberDictionary::kNotFound); |
727 MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target); | 727 MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target); |
728 USE(maybe_result); | 728 USE(maybe_result); |
729 #ifdef DEBUG | 729 #ifdef DEBUG |
730 Object* result = NULL; | 730 Object* result = NULL; |
731 // Dictionary has been allocated with sufficient size for all elements. | 731 // Dictionary has been allocated with sufficient size for all elements. |
732 ASSERT(maybe_result->ToObject(&result)); | 732 ASSERT(maybe_result->ToObject(&result)); |
733 ASSERT(*dictionary_ == result); | 733 ASSERT(*dictionary_ == result); |
734 #endif | 734 #endif |
735 } | 735 } |
736 | 736 |
737 } } // namespace v8::internal | 737 } } // namespace v8::internal |
OLD | NEW |