OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 134 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
135 Handle<Object> value = GetInfo(expr->id()); | 135 Handle<Object> value = GetInfo(expr->id()); |
136 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); | 136 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { | |
141 Handle<Object> value = GetInfo(expr->id()); | |
142 return value->IsJSFunction(); | |
143 } | |
144 | |
145 | |
140 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 146 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
141 ASSERT(LoadIsMonomorphicNormal(expr)); | 147 ASSERT(LoadIsMonomorphicNormal(expr)); |
142 Handle<Object> map_or_code = GetInfo(expr->id()); | 148 Handle<Object> map_or_code = GetInfo(expr->id()); |
143 if (map_or_code->IsCode()) { | 149 if (map_or_code->IsCode()) { |
144 Handle<Code> code = Handle<Code>::cast(map_or_code); | 150 Handle<Code> code = Handle<Code>::cast(map_or_code); |
145 Map* first_map = code->FindFirstMap(); | 151 Map* first_map = code->FindFirstMap(); |
146 ASSERT(first_map != NULL); | 152 ASSERT(first_map != NULL); |
147 return Handle<Map>(first_map); | 153 return Handle<Map>(first_map); |
148 } | 154 } |
149 return Handle<Map>::cast(map_or_code); | 155 return Handle<Map>::cast(map_or_code); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 break; | 561 break; |
556 | 562 |
557 case Code::UNARY_OP_IC: | 563 case Code::UNARY_OP_IC: |
558 case Code::BINARY_OP_IC: | 564 case Code::BINARY_OP_IC: |
559 case Code::COMPARE_IC: | 565 case Code::COMPARE_IC: |
560 case Code::TO_BOOLEAN_IC: | 566 case Code::TO_BOOLEAN_IC: |
561 SetInfo(ast_id, target); | 567 SetInfo(ast_id, target); |
562 break; | 568 break; |
563 | 569 |
564 case Code::STUB: | 570 case Code::STUB: |
565 if (target->major_key() == CodeStub::CallFunction && | 571 if (CallStub::HasCache(target)) { |
Vyacheslav Egorov (Chromium)
2012/01/23 10:39:52
It's a bit confusing that HasCache also verifies w
Michael Starzinger
2012/01/25 11:42:29
Done. No longer needed with new approach.
| |
566 target->has_function_cache()) { | 572 Object* value = CallStub::GetCachedValue(reloc_entry.pc()); |
567 Object* value = CallFunctionStub::GetCachedValue(reloc_entry.pc()); | |
568 if (value->IsJSFunction()) { | 573 if (value->IsJSFunction()) { |
569 SetInfo(ast_id, value); | 574 SetInfo(ast_id, value); |
570 } | 575 } |
571 } | 576 } |
572 break; | 577 break; |
573 | 578 |
574 default: | 579 default: |
575 break; | 580 break; |
576 } | 581 } |
577 } | 582 } |
578 } | 583 } |
579 | 584 |
580 | 585 |
581 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { | 586 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { |
582 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); | 587 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); |
583 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); | 588 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); |
584 USE(maybe_result); | 589 USE(maybe_result); |
585 #ifdef DEBUG | 590 #ifdef DEBUG |
586 Object* result = NULL; | 591 Object* result = NULL; |
587 // Dictionary has been allocated with sufficient size for all elements. | 592 // Dictionary has been allocated with sufficient size for all elements. |
588 ASSERT(maybe_result->ToObject(&result)); | 593 ASSERT(maybe_result->ToObject(&result)); |
589 ASSERT(*dictionary_ == result); | 594 ASSERT(*dictionary_ == result); |
590 #endif | 595 #endif |
591 } | 596 } |
592 | 597 |
593 } } // namespace v8::internal | 598 } } // namespace v8::internal |
OLD | NEW |