Chromium Code Reviews| 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 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> global_context, |
| 64 Isolate* isolate) { | |
| 64 global_context_ = global_context; | 65 global_context_ = global_context; |
| 66 isolate_ = isolate; | |
| 65 BuildDictionary(code); | 67 BuildDictionary(code); |
| 66 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); | 68 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); |
| 67 } | 69 } |
| 68 | 70 |
| 69 | 71 |
| 70 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
| 71 int entry = dictionary_->FindEntry(ast_id); | 73 int entry = dictionary_->FindEntry(ast_id); |
| 72 return entry != NumberDictionary::kNotFound | 74 return entry != NumberDictionary::kNotFound |
| 73 ? Handle<Object>(dictionary_->ValueAt(entry)) | 75 ? Handle<Object>(dictionary_->ValueAt(entry)) |
| 74 : Isolate::Current()->factory()->undefined_value(); | 76 : Handle<Object>::cast(Isolate::Current()->factory()->undefined_value()); |
|
Vyacheslav Egorov (Chromium)
2011/10/04 11:00:51
you have isolate_ now
fschneider
2011/10/04 11:28:16
Done. Of course, I totally forgot about that :)
| |
| 75 } | 77 } |
| 76 | 78 |
| 77 | 79 |
| 78 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { | 80 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
| 79 Handle<Object> map_or_code = GetInfo(expr->id()); | 81 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 80 if (map_or_code->IsMap()) return true; | 82 if (map_or_code->IsMap()) return true; |
| 81 if (map_or_code->IsCode()) { | 83 if (map_or_code->IsCode()) { |
| 82 Handle<Code> code = Handle<Code>::cast(map_or_code); | 84 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 83 return code->is_keyed_load_stub() && | 85 return code->is_keyed_load_stub() && |
| 84 code->ic_state() == MONOMORPHIC && | 86 code->ic_state() == MONOMORPHIC && |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 USE(maybe_result); | 561 USE(maybe_result); |
| 560 #ifdef DEBUG | 562 #ifdef DEBUG |
| 561 Object* result = NULL; | 563 Object* result = NULL; |
| 562 // Dictionary has been allocated with sufficient size for all elements. | 564 // Dictionary has been allocated with sufficient size for all elements. |
| 563 ASSERT(maybe_result->ToObject(&result)); | 565 ASSERT(maybe_result->ToObject(&result)); |
| 564 ASSERT(*dictionary_ == result); | 566 ASSERT(*dictionary_ == result); |
| 565 #endif | 567 #endif |
| 566 } | 568 } |
| 567 | 569 |
| 568 } } // namespace v8::internal | 570 } } // namespace v8::internal |
| OLD | NEW |