| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 Cell* cell = Cell::cast(value); | 67 Cell* cell = Cell::cast(value); |
| 68 return Handle<Object>(cell->value(), isolate_); | 68 return Handle<Object>(cell->value(), isolate_); |
| 69 } else { | 69 } else { |
| 70 return Handle<Object>(value, isolate_); | 70 return Handle<Object>(value, isolate_); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 return Handle<Object>::cast(isolate_->factory()->undefined_value()); | 73 return Handle<Object>::cast(isolate_->factory()->undefined_value()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 Handle<Cell> TypeFeedbackOracle::GetInfoCell( | |
| 78 TypeFeedbackId ast_id) { | |
| 79 int entry = dictionary_->FindEntry(IdToKey(ast_id)); | |
| 80 if (entry != UnseededNumberDictionary::kNotFound) { | |
| 81 Cell* cell = Cell::cast(dictionary_->ValueAt(entry)); | |
| 82 return Handle<Cell>(cell, isolate_); | |
| 83 } | |
| 84 return Handle<Cell>::null(); | |
| 85 } | |
| 86 | |
| 87 | |
| 88 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { | 77 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { |
| 89 Handle<Object> maybe_code = GetInfo(id); | 78 Handle<Object> maybe_code = GetInfo(id); |
| 90 if (maybe_code->IsCode()) { | 79 if (maybe_code->IsCode()) { |
| 91 Handle<Code> code = Handle<Code>::cast(maybe_code); | 80 Handle<Code> code = Handle<Code>::cast(maybe_code); |
| 92 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; | 81 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; |
| 93 } | 82 } |
| 94 return false; | 83 return false; |
| 95 } | 84 } |
| 96 | 85 |
| 97 | 86 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(TypeFeedbackId id) { | 196 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(TypeFeedbackId id) { |
| 208 Handle<Object> info = GetInfo(id); | 197 Handle<Object> info = GetInfo(id); |
| 209 if (info->IsAllocationSite()) { | 198 if (info->IsAllocationSite()) { |
| 210 return Handle<JSFunction>(isolate_->global_context()->array_function()); | 199 return Handle<JSFunction>(isolate_->global_context()->array_function()); |
| 211 } else { | 200 } else { |
| 212 return Handle<JSFunction>::cast(info); | 201 return Handle<JSFunction>::cast(info); |
| 213 } | 202 } |
| 214 } | 203 } |
| 215 | 204 |
| 216 | 205 |
| 217 Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell( | 206 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( |
| 218 TypeFeedbackId id) { | 207 TypeFeedbackId id) { |
| 219 return GetInfoCell(id); | 208 Handle<Object> info = GetInfo(id); |
| 209 if (info->IsAllocationSite()) { |
| 210 return Handle<AllocationSite>::cast(info); |
| 211 } |
| 212 return Handle<AllocationSite>::null(); |
| 220 } | 213 } |
| 221 | 214 |
| 222 | 215 |
| 223 bool TypeFeedbackOracle::LoadIsBuiltin( | 216 bool TypeFeedbackOracle::LoadIsBuiltin( |
| 224 TypeFeedbackId id, Builtins::Name builtin) { | 217 TypeFeedbackId id, Builtins::Name builtin) { |
| 225 return *GetInfo(id) == isolate_->builtins()->builtin(builtin); | 218 return *GetInfo(id) == isolate_->builtins()->builtin(builtin); |
| 226 } | 219 } |
| 227 | 220 |
| 228 | 221 |
| 229 bool TypeFeedbackOracle::LoadIsStub(TypeFeedbackId id, ICStub* stub) { | 222 bool TypeFeedbackOracle::LoadIsStub(TypeFeedbackId id, ICStub* stub) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 #ifdef DEBUG | 559 #ifdef DEBUG |
| 567 Object* result = NULL; | 560 Object* result = NULL; |
| 568 // Dictionary has been allocated with sufficient size for all elements. | 561 // Dictionary has been allocated with sufficient size for all elements. |
| 569 ASSERT(maybe_result->ToObject(&result)); | 562 ASSERT(maybe_result->ToObject(&result)); |
| 570 ASSERT(*dictionary_ == result); | 563 ASSERT(*dictionary_ == result); |
| 571 #endif | 564 #endif |
| 572 } | 565 } |
| 573 | 566 |
| 574 | 567 |
| 575 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| OLD | NEW |