| 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 25 matching lines...) Expand all Loading... |
| 36 #include "type-info.h" | 36 #include "type-info.h" |
| 37 | 37 |
| 38 #include "ic-inl.h" | 38 #include "ic-inl.h" |
| 39 #include "objects-inl.h" | 39 #include "objects-inl.h" |
| 40 | 40 |
| 41 namespace v8 { | 41 namespace v8 { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 | 44 |
| 45 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 45 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 46 Handle<FixedArray> feedback_vector, | |
| 47 Handle<Context> native_context, | 46 Handle<Context> native_context, |
| 48 Zone* zone) | 47 Zone* zone) |
| 49 : native_context_(native_context), | 48 : native_context_(native_context), |
| 50 zone_(zone), | 49 zone_(zone) { |
| 51 feedback_vector_(feedback_vector) { | 50 Object* raw_info = code->type_feedback_info(); |
| 51 if (raw_info->IsTypeFeedbackInfo()) { |
| 52 feedback_vector_ = Handle<FixedArray>(TypeFeedbackInfo::cast(raw_info)-> |
| 53 feedback_vector()); |
| 54 } |
| 55 |
| 52 BuildDictionary(code); | 56 BuildDictionary(code); |
| 53 ASSERT(dictionary_->IsDictionary()); | 57 ASSERT(dictionary_->IsDictionary()); |
| 54 } | 58 } |
| 55 | 59 |
| 56 | 60 |
| 57 static uint32_t IdToKey(TypeFeedbackId ast_id) { | 61 static uint32_t IdToKey(TypeFeedbackId ast_id) { |
| 58 return static_cast<uint32_t>(ast_id.ToInt()); | 62 return static_cast<uint32_t>(ast_id.ToInt()); |
| 59 } | 63 } |
| 60 | 64 |
| 61 | 65 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 125 |
| 122 | 126 |
| 123 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) { | 127 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) { |
| 124 Handle<Object> info = GetInfo(slot); | 128 Handle<Object> info = GetInfo(slot); |
| 125 return info->IsAllocationSite() || info->IsJSFunction(); | 129 return info->IsAllocationSite() || info->IsJSFunction(); |
| 126 } | 130 } |
| 127 | 131 |
| 128 | 132 |
| 129 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) { | 133 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) { |
| 130 Handle<Object> value = GetInfo(feedback_vector_slot); | 134 Handle<Object> value = GetInfo(feedback_vector_slot); |
| 131 return value.is_identical_to( | 135 return value->IsSmi() && |
| 132 TypeFeedbackInfo::UninitializedSentinel(isolate())) | 136 Smi::cast(*value)->value() == TypeFeedbackInfo::kForInFastCaseMarker |
| 133 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN; | 137 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN; |
| 134 } | 138 } |
| 135 | 139 |
| 136 | 140 |
| 137 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( | 141 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( |
| 138 TypeFeedbackId ast_id) { | 142 TypeFeedbackId ast_id) { |
| 139 Handle<Object> maybe_code = GetInfo(ast_id); | 143 Handle<Object> maybe_code = GetInfo(ast_id); |
| 140 if (maybe_code->IsCode()) { | 144 if (maybe_code->IsCode()) { |
| 141 Handle<Code> code = Handle<Code>::cast(maybe_code); | 145 Handle<Code> code = Handle<Code>::cast(maybe_code); |
| 142 if (code->kind() == Code::KEYED_STORE_IC) { | 146 if (code->kind() == Code::KEYED_STORE_IC) { |
| 143 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); | 147 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 #ifdef DEBUG | 491 #ifdef DEBUG |
| 488 Object* result = NULL; | 492 Object* result = NULL; |
| 489 // Dictionary has been allocated with sufficient size for all elements. | 493 // Dictionary has been allocated with sufficient size for all elements. |
| 490 ASSERT(maybe_result->ToObject(&result)); | 494 ASSERT(maybe_result->ToObject(&result)); |
| 491 ASSERT(*dictionary_ == result); | 495 ASSERT(*dictionary_ == result); |
| 492 #endif | 496 #endif |
| 493 } | 497 } |
| 494 | 498 |
| 495 | 499 |
| 496 } } // namespace v8::internal | 500 } } // namespace v8::internal |
| OLD | NEW |