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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return entry != NumberDictionary::kNotFound | 74 return entry != NumberDictionary::kNotFound |
75 ? Handle<Object>(dictionary_->ValueAt(entry)) | 75 ? Handle<Object>(dictionary_->ValueAt(entry)) |
76 : Isolate::Current()->factory()->undefined_value(); | 76 : Isolate::Current()->factory()->undefined_value(); |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { | 80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { |
81 Handle<Object> map_or_code(GetInfo(expr->id())); | 81 Handle<Object> map_or_code(GetInfo(expr->id())); |
82 if (map_or_code->IsMap()) return true; | 82 if (map_or_code->IsMap()) return true; |
83 if (map_or_code->IsCode()) { | 83 if (map_or_code->IsCode()) { |
84 Handle<Code> code(Code::cast(*map_or_code)); | 84 Handle<Code> code = Handle<Code>::cast(map_or_code); |
85 return code->is_keyed_load_stub() && | 85 return code->is_keyed_load_stub() && |
86 code->ic_state() == MONOMORPHIC && | 86 code->ic_state() == MONOMORPHIC && |
87 code->FindFirstMap() != NULL; | 87 code->FindFirstMap() != NULL; |
88 } | 88 } |
89 return false; | 89 return false; |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { | 93 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { |
94 Handle<Object> map_or_code(GetInfo(expr->id())); | 94 Handle<Object> map_or_code(GetInfo(expr->id())); |
95 if (map_or_code->IsMap()) return true; | 95 if (map_or_code->IsMap()) return true; |
96 if (map_or_code->IsCode()) { | 96 if (map_or_code->IsCode()) { |
97 Handle<Code> code(Code::cast(*map_or_code)); | 97 Handle<Code> code = Handle<Code>::cast(map_or_code); |
98 return code->is_keyed_store_stub() && | 98 return code->is_keyed_store_stub() && |
99 code->ic_state() == MONOMORPHIC; | 99 code->ic_state() == MONOMORPHIC; |
100 } | 100 } |
101 return false; | 101 return false; |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 105 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
106 Handle<Object> value = GetInfo(expr->id()); | 106 Handle<Object> value = GetInfo(expr->id()); |
107 return value->IsMap() || value->IsSmi(); | 107 return value->IsMap() || value->IsSmi(); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 111 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
112 ASSERT(LoadIsMonomorphic(expr)); | 112 ASSERT(LoadIsMonomorphic(expr)); |
113 Handle<Object> map_or_code( | 113 Handle<Object> map_or_code(GetInfo(expr->id())); |
114 Handle<HeapObject>::cast(GetInfo(expr->id()))); | |
115 if (map_or_code->IsCode()) { | 114 if (map_or_code->IsCode()) { |
116 Handle<Code> code(Code::cast(*map_or_code)); | 115 Handle<Code> code = Handle<Code>::cast(map_or_code); |
117 Map* first_map = code->FindFirstMap(); | 116 Map* first_map = code->FindFirstMap(); |
118 ASSERT(first_map != NULL); | 117 ASSERT(first_map != NULL); |
119 return Handle<Map>(first_map); | 118 return Handle<Map>(first_map); |
120 } | 119 } |
121 return Handle<Map>(Map::cast(*map_or_code)); | 120 return Handle<Map>::cast(map_or_code); |
122 } | 121 } |
123 | 122 |
124 | 123 |
125 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { | 124 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { |
126 ASSERT(StoreIsMonomorphic(expr)); | 125 ASSERT(StoreIsMonomorphic(expr)); |
127 Handle<HeapObject> map_or_code( | 126 Handle<Object> map_or_code(GetInfo(expr->id())); |
128 Handle<HeapObject>::cast(GetInfo(expr->id()))); | |
129 if (map_or_code->IsCode()) { | 127 if (map_or_code->IsCode()) { |
130 Handle<Code> code(Code::cast(*map_or_code)); | 128 Handle<Code> code = Handle<Code>::cast(map_or_code); |
131 return Handle<Map>(code->FindFirstMap()); | 129 return Handle<Map>(code->FindFirstMap()); |
132 } | 130 } |
133 return Handle<Map>(Map::cast(*map_or_code)); | 131 return Handle<Map>::cast(map_or_code); |
134 } | 132 } |
135 | 133 |
136 | 134 |
137 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, | 135 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
138 Handle<String> name) { | 136 Handle<String> name) { |
139 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 137 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
140 return CollectReceiverTypes(expr->id(), name, flags); | 138 return CollectReceiverTypes(expr->id(), name, flags); |
141 } | 139 } |
142 | 140 |
143 | 141 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 static_cast<int>(info->pc() - code->instruction_start())); | 498 static_cast<int>(info->pc() - code->instruction_start())); |
501 ASSERT(ast_ids->length() == 0 || | 499 ASSERT(ast_ids->length() == 0 || |
502 (*ast_ids)[ast_ids->length()-1] != | 500 (*ast_ids)[ast_ids->length()-1] != |
503 static_cast<unsigned>(info->data())); | 501 static_cast<unsigned>(info->data())); |
504 ast_ids->Add(static_cast<unsigned>(info->data())); | 502 ast_ids->Add(static_cast<unsigned>(info->data())); |
505 } | 503 } |
506 } | 504 } |
507 } | 505 } |
508 | 506 |
509 } } // namespace v8::internal | 507 } } // namespace v8::internal |
OLD | NEW |