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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 | 68 |
69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
70 int entry = dictionary_->FindEntry(ast_id); | 70 int entry = dictionary_->FindEntry(ast_id); |
71 return entry != NumberDictionary::kNotFound | 71 return entry != NumberDictionary::kNotFound |
72 ? Handle<Object>(dictionary_->ValueAt(entry)) | 72 ? Handle<Object>(dictionary_->ValueAt(entry)) |
73 : Isolate::Current()->factory()->undefined_value(); | 73 : Isolate::Current()->factory()->undefined_value(); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { | 77 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { |
Vyacheslav Egorov (Chromium)
2011/06/14 12:45:26
Maybe rename this function to imply that we are lo
| |
78 Handle<Object> map_or_code(GetInfo(expr->id())); | 78 Handle<Object> map_or_code(GetInfo(expr->id())); |
79 if (map_or_code->IsMap()) return true; | 79 if (map_or_code->IsMap()) return true; |
80 if (map_or_code->IsCode()) { | 80 if (map_or_code->IsCode()) { |
81 Handle<Code> code = Handle<Code>::cast(map_or_code); | 81 Handle<Code> code = Handle<Code>::cast(map_or_code); |
82 return code->is_keyed_load_stub() && | 82 return code->is_keyed_load_stub() && |
83 code->ic_state() == MONOMORPHIC && | 83 code->ic_state() == MONOMORPHIC && |
84 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && | |
84 code->FindFirstMap() != NULL; | 85 code->FindFirstMap() != NULL; |
85 } | 86 } |
86 return false; | 87 return false; |
87 } | 88 } |
88 | 89 |
89 | 90 |
90 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { | 91 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { |
91 Handle<Object> map_or_code(GetInfo(expr->id())); | 92 Handle<Object> map_or_code(GetInfo(expr->id())); |
92 if (map_or_code->IsMap()) return true; | 93 if (map_or_code->IsMap()) return true; |
93 if (map_or_code->IsCode()) { | 94 if (map_or_code->IsCode()) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 static_cast<int>(info->pc() - code->instruction_start())); | 483 static_cast<int>(info->pc() - code->instruction_start())); |
483 ASSERT(ast_ids->length() == 0 || | 484 ASSERT(ast_ids->length() == 0 || |
484 (*ast_ids)[ast_ids->length()-1] != | 485 (*ast_ids)[ast_ids->length()-1] != |
485 static_cast<unsigned>(info->data())); | 486 static_cast<unsigned>(info->data())); |
486 ast_ids->Add(static_cast<unsigned>(info->data())); | 487 ast_ids->Add(static_cast<unsigned>(info->data())); |
487 } | 488 } |
488 } | 489 } |
489 } | 490 } |
490 | 491 |
491 } } // namespace v8::internal | 492 } } // namespace v8::internal |
OLD | NEW |