ulan@chromium.org | 65a89c2 | 2012-02-14 11:46:07 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
ricow@chromium.org | aa1b616 | 2010-03-29 07:44:58 +0000 | [diff] [blame] | 28 | #include "v8.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 29 | |
| 30 | #include "ast.h" |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 31 | #include "code-stubs.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 32 | #include "compiler.h" |
| 33 | #include "ic.h" |
| 34 | #include "macro-assembler.h" |
| 35 | #include "stub-cache.h" |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 36 | #include "type-info.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 37 | |
| 38 | #include "ic-inl.h" |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 39 | #include "objects-inl.h" |
| 40 | |
| 41 | namespace v8 { |
| 42 | namespace internal { |
| 43 | |
| 44 | |
| 45 | TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) { |
| 46 | TypeInfo info; |
| 47 | if (value->IsSmi()) { |
| 48 | info = TypeInfo::Smi(); |
| 49 | } else if (value->IsHeapNumber()) { |
| 50 | info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value()) |
| 51 | ? TypeInfo::Integer32() |
| 52 | : TypeInfo::Double(); |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 53 | } else if (value->IsString()) { |
| 54 | info = TypeInfo::String(); |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 55 | } else { |
| 56 | info = TypeInfo::Unknown(); |
| 57 | } |
| 58 | return info; |
| 59 | } |
| 60 | |
| 61 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 62 | TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 63 | Handle<Context> native_context, |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 64 | Isolate* isolate, |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 65 | Zone* zone) |
| 66 | : native_context_(native_context), |
| 67 | isolate_(isolate), |
| 68 | zone_(zone) { |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 69 | BuildDictionary(code); |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 70 | ASSERT(dictionary_->IsDictionary()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 74 | static uint32_t IdToKey(TypeFeedbackId ast_id) { |
| 75 | return static_cast<uint32_t>(ast_id.ToInt()); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) { |
| 80 | int entry = dictionary_->FindEntry(IdToKey(ast_id)); |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 81 | return entry != UnseededNumberDictionary::kNotFound |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 82 | ? Handle<Object>(dictionary_->ValueAt(entry), isolate_) |
svenpanne@chromium.org | a8bb4d9 | 2011-10-10 13:20:40 +0000 | [diff] [blame] | 83 | : Handle<Object>::cast(isolate_->factory()->undefined_value()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | |
jkummerow@chromium.org | 531dfe8 | 2012-03-20 13:01:16 +0000 | [diff] [blame] | 87 | bool TypeFeedbackOracle::LoadIsUninitialized(Property* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 88 | Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
jkummerow@chromium.org | 531dfe8 | 2012-03-20 13:01:16 +0000 | [diff] [blame] | 89 | if (map_or_code->IsMap()) return false; |
| 90 | if (map_or_code->IsCode()) { |
| 91 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 92 | return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; |
| 93 | } |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 98 | bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 99 | Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 100 | if (map_or_code->IsMap()) return true; |
| 101 | if (map_or_code->IsCode()) { |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 102 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
erik.corry@gmail.com | 8876724 | 2012-08-08 14:43:45 +0000 | [diff] [blame] | 103 | bool preliminary_checks = code->is_keyed_load_stub() && |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 104 | code->ic_state() == MONOMORPHIC && |
erik.corry@gmail.com | 8876724 | 2012-08-08 14:43:45 +0000 | [diff] [blame] | 105 | Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; |
| 106 | if (!preliminary_checks) return false; |
| 107 | Map* map = code->FindFirstMap(); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 108 | return map != NULL && !CanRetainOtherContext(map, *native_context_); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 109 | } |
| 110 | return false; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 114 | bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 115 | Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 116 | if (map_or_code->IsCode()) { |
| 117 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 118 | return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC; |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 119 | } |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 124 | bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { |
| 125 | Handle<Object> map_or_code = GetInfo(ast_id); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 126 | if (map_or_code->IsMap()) return true; |
| 127 | if (map_or_code->IsCode()) { |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 128 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
jkummerow@chromium.org | 7bd87f0 | 2013-03-20 18:06:29 +0000 | [diff] [blame] | 129 | bool standard_store = FLAG_compiled_keyed_stores || |
| 130 | (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == |
| 131 | STANDARD_STORE); |
erik.corry@gmail.com | 8876724 | 2012-08-08 14:43:45 +0000 | [diff] [blame] | 132 | bool preliminary_checks = |
| 133 | code->is_keyed_store_stub() && |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 134 | standard_store && |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 135 | code->ic_state() == MONOMORPHIC && |
erik.corry@gmail.com | 8876724 | 2012-08-08 14:43:45 +0000 | [diff] [blame] | 136 | Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; |
| 137 | if (!preliminary_checks) return false; |
| 138 | Map* map = code->FindFirstMap(); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 139 | return map != NULL && !CanRetainOtherContext(map, *native_context_); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 140 | } |
| 141 | return false; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 145 | bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 146 | Handle<Object> map_or_code = GetInfo(ast_id); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 147 | if (map_or_code->IsCode()) { |
| 148 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
jkummerow@chromium.org | 7bd87f0 | 2013-03-20 18:06:29 +0000 | [diff] [blame] | 149 | bool standard_store = FLAG_compiled_keyed_stores || |
| 150 | (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == |
| 151 | STANDARD_STORE); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 152 | return code->is_keyed_store_stub() && standard_store && |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 153 | code->ic_state() == POLYMORPHIC; |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 154 | } |
| 155 | return false; |
| 156 | } |
| 157 | |
| 158 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 159 | bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 160 | Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 161 | return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 165 | bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 166 | Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 167 | if (info->IsSmi()) { |
| 168 | ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
| 169 | LAST_FAST_ELEMENTS_KIND); |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 170 | return isolate_->global_context()->array_function(); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 171 | } |
| 172 | return info->IsJSFunction(); |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | |
mstarzinger@chromium.org | 3233d2f | 2012-03-14 11:16:03 +0000 | [diff] [blame] | 176 | bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
| 177 | ObjectLiteral::Property* prop) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 178 | Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
mstarzinger@chromium.org | 3233d2f | 2012-03-14 11:16:03 +0000 | [diff] [blame] | 179 | return map_or_code->IsMap(); |
| 180 | } |
| 181 | |
| 182 | |
ulan@chromium.org | 9a21ec4 | 2012-03-06 08:42:24 +0000 | [diff] [blame] | 183 | bool TypeFeedbackOracle::IsForInFastCase(ForInStatement* stmt) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 184 | Handle<Object> value = GetInfo(stmt->ForInFeedbackId()); |
ulan@chromium.org | 9a21ec4 | 2012-03-06 08:42:24 +0000 | [diff] [blame] | 185 | return value->IsSmi() && |
| 186 | Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker; |
| 187 | } |
| 188 | |
| 189 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 190 | Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 191 | ASSERT(LoadIsMonomorphicNormal(expr)); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 192 | Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 193 | if (map_or_code->IsCode()) { |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 194 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 195 | Map* first_map = code->FindFirstMap(); |
| 196 | ASSERT(first_map != NULL); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 197 | return CanRetainOtherContext(first_map, *native_context_) |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 198 | ? Handle<Map>::null() |
| 199 | : Handle<Map>(first_map); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 200 | } |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 201 | return Handle<Map>::cast(map_or_code); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 205 | Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType( |
| 206 | TypeFeedbackId ast_id) { |
| 207 | ASSERT(StoreIsMonomorphicNormal(ast_id)); |
| 208 | Handle<Object> map_or_code = GetInfo(ast_id); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 209 | if (map_or_code->IsCode()) { |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 210 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 211 | Map* first_map = code->FindFirstMap(); |
| 212 | ASSERT(first_map != NULL); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 213 | return CanRetainOtherContext(first_map, *native_context_) |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 214 | ? Handle<Map>::null() |
| 215 | : Handle<Map>(first_map); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 216 | } |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 217 | return Handle<Map>::cast(map_or_code); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 221 | Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType( |
| 222 | TypeFeedbackId id) { |
| 223 | Handle<Object> maybe_code = GetInfo(id); |
| 224 | if (maybe_code->IsCode()) { |
| 225 | Map* first_map = Handle<Code>::cast(maybe_code)->FindFirstMap(); |
| 226 | if (first_map != NULL) return Handle<Map>(first_map); |
| 227 | } |
| 228 | return Handle<Map>(); |
| 229 | } |
| 230 | |
| 231 | |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 232 | KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( |
| 233 | TypeFeedbackId ast_id) { |
| 234 | Handle<Object> map_or_code = GetInfo(ast_id); |
| 235 | if (map_or_code->IsCode()) { |
| 236 | Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 237 | if (code->kind() == Code::KEYED_STORE_IC) { |
| 238 | return Code::GetKeyedAccessStoreMode(code->extra_ic_state()); |
| 239 | } |
| 240 | } |
| 241 | return STANDARD_STORE; |
| 242 | } |
| 243 | |
| 244 | |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 245 | void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
| 246 | Handle<String> name, |
| 247 | SmallMapList* types) { |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 248 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 249 | CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 253 | void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 254 | Handle<String> name, |
| 255 | SmallMapList* types) { |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 256 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 257 | CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 261 | void TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
| 262 | Handle<String> name, |
| 263 | CallKind call_kind, |
| 264 | SmallMapList* types) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 265 | int arity = expr->arguments()->length(); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 266 | |
| 267 | // Note: Currently we do not take string extra ic data into account |
| 268 | // here. |
| 269 | Code::ExtraICState extra_ic_state = |
| 270 | CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION); |
| 271 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 272 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 273 | extra_ic_state, |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 274 | Code::NORMAL, |
| 275 | arity, |
| 276 | OWN_MAP); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 277 | CollectReceiverTypes(expr->CallFeedbackId(), name, flags, types); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 281 | CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 282 | Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 283 | if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
| 284 | CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
| 285 | ASSERT(check != RECEIVER_MAP_CHECK); |
| 286 | return check; |
| 287 | } |
| 288 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 289 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 290 | Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( |
| 291 | CheckType check) { |
| 292 | JSFunction* function = NULL; |
| 293 | switch (check) { |
| 294 | case RECEIVER_MAP_CHECK: |
| 295 | UNREACHABLE(); |
| 296 | break; |
| 297 | case STRING_CHECK: |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 298 | function = native_context_->string_function(); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 299 | break; |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 300 | case SYMBOL_CHECK: |
| 301 | function = native_context_->symbol_function(); |
| 302 | break; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 303 | case NUMBER_CHECK: |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 304 | function = native_context_->number_function(); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 305 | break; |
| 306 | case BOOLEAN_CHECK: |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 307 | function = native_context_->boolean_function(); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 308 | break; |
| 309 | } |
| 310 | ASSERT(function != NULL); |
| 311 | return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 312 | } |
| 313 | |
| 314 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 315 | Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 316 | return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 320 | Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 321 | Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 322 | if (info->IsSmi()) { |
| 323 | ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
| 324 | LAST_FAST_ELEMENTS_KIND); |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 325 | return Handle<JSFunction>(isolate_->global_context()->array_function()); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 326 | } else { |
| 327 | return Handle<JSFunction>::cast(info); |
| 328 | } |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 332 | ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) { |
| 333 | Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 334 | if (info->IsSmi()) { |
| 335 | return static_cast<ElementsKind>(Smi::cast(*info)->value()); |
| 336 | } else { |
| 337 | // TODO(mvstanton): avoided calling GetInitialFastElementsKind() for perf |
| 338 | // reasons. Is there a better fix? |
| 339 | if (FLAG_packed_arrays) { |
| 340 | return FAST_SMI_ELEMENTS; |
| 341 | } else { |
| 342 | return FAST_HOLEY_SMI_ELEMENTS; |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
mstarzinger@chromium.org | 3233d2f | 2012-03-14 11:16:03 +0000 | [diff] [blame] | 347 | Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap( |
| 348 | ObjectLiteral::Property* prop) { |
| 349 | ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 350 | return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); |
mstarzinger@chromium.org | 3233d2f | 2012-03-14 11:16:03 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 354 | bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 355 | return *GetInfo(expr->PropertyFeedbackId()) == |
svenpanne@chromium.org | a8bb4d9 | 2011-10-10 13:20:40 +0000 | [diff] [blame] | 356 | isolate_->builtins()->builtin(id); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | |
mvstanton@chromium.org | 6bec009 | 2013-01-23 13:46:53 +0000 | [diff] [blame] | 360 | bool TypeFeedbackOracle::LoadIsStub(Property* expr, ICStub* stub) { |
| 361 | Handle<Object> object = GetInfo(expr->PropertyFeedbackId()); |
| 362 | if (!object->IsCode()) return false; |
| 363 | Handle<Code> code = Handle<Code>::cast(object); |
| 364 | if (!code->is_load_stub()) return false; |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 365 | if (code->ic_state() != MONOMORPHIC) return false; |
mvstanton@chromium.org | 6bec009 | 2013-01-23 13:46:53 +0000 | [diff] [blame] | 366 | return stub->Describes(*code); |
| 367 | } |
| 368 | |
| 369 | |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 370 | static TypeInfo TypeFromCompareType(CompareIC::State state) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 371 | switch (state) { |
| 372 | case CompareIC::UNINITIALIZED: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 373 | // Uninitialized means never executed. |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 374 | return TypeInfo::Uninitialized(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 375 | case CompareIC::SMI: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 376 | return TypeInfo::Smi(); |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 377 | case CompareIC::NUMBER: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 378 | return TypeInfo::Number(); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 379 | case CompareIC::INTERNALIZED_STRING: |
| 380 | return TypeInfo::InternalizedString(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 381 | case CompareIC::STRING: |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 382 | return TypeInfo::String(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 383 | case CompareIC::OBJECT: |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 384 | case CompareIC::KNOWN_OBJECT: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 385 | // TODO(kasperl): We really need a type for JS objects here. |
| 386 | return TypeInfo::NonPrimitive(); |
| 387 | case CompareIC::GENERIC: |
| 388 | default: |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 389 | return TypeInfo::Unknown(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 390 | } |
| 391 | } |
| 392 | |
| 393 | |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 394 | void TypeFeedbackOracle::CompareType(CompareOperation* expr, |
| 395 | TypeInfo* left_type, |
| 396 | TypeInfo* right_type, |
| 397 | TypeInfo* overall_type) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 398 | Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 399 | TypeInfo unknown = TypeInfo::Unknown(); |
| 400 | if (!object->IsCode()) { |
| 401 | *left_type = *right_type = *overall_type = unknown; |
| 402 | return; |
| 403 | } |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 404 | Handle<Code> code = Handle<Code>::cast(object); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 405 | if (!code->is_compare_ic_stub()) { |
| 406 | *left_type = *right_type = *overall_type = unknown; |
| 407 | return; |
| 408 | } |
| 409 | |
| 410 | int stub_minor_key = code->stub_info(); |
| 411 | CompareIC::State left_state, right_state, handler_state; |
| 412 | ICCompareStub::DecodeMinorKey(stub_minor_key, &left_state, &right_state, |
| 413 | &handler_state, NULL); |
| 414 | *left_type = TypeFromCompareType(left_state); |
| 415 | *right_type = TypeFromCompareType(right_state); |
| 416 | *overall_type = TypeFromCompareType(handler_state); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 420 | Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 421 | Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 422 | if (!object->IsCode()) return Handle<Map>::null(); |
| 423 | Handle<Code> code = Handle<Code>::cast(object); |
| 424 | if (!code->is_compare_ic_stub()) return Handle<Map>::null(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 425 | CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 426 | if (state != CompareIC::KNOWN_OBJECT) { |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 427 | return Handle<Map>::null(); |
| 428 | } |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 429 | Map* first_map = code->FindFirstMap(); |
| 430 | ASSERT(first_map != NULL); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 431 | return CanRetainOtherContext(first_map, *native_context_) |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 432 | ? Handle<Map>::null() |
| 433 | : Handle<Map>(first_map); |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 437 | TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 438 | Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 439 | TypeInfo unknown = TypeInfo::Unknown(); |
| 440 | if (!object->IsCode()) return unknown; |
| 441 | Handle<Code> code = Handle<Code>::cast(object); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 442 | ASSERT(code->is_unary_op_stub()); |
| 443 | UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>( |
| 444 | code->unary_op_type()); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 445 | switch (type) { |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 446 | case UnaryOpIC::SMI: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 447 | return TypeInfo::Smi(); |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 448 | case UnaryOpIC::NUMBER: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 449 | return TypeInfo::Double(); |
| 450 | default: |
| 451 | return unknown; |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 456 | static TypeInfo TypeFromBinaryOpType(BinaryOpIC::TypeInfo binary_type) { |
| 457 | switch (binary_type) { |
| 458 | // Uninitialized means never executed. |
| 459 | case BinaryOpIC::UNINITIALIZED: return TypeInfo::Uninitialized(); |
| 460 | case BinaryOpIC::SMI: return TypeInfo::Smi(); |
| 461 | case BinaryOpIC::INT32: return TypeInfo::Integer32(); |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 462 | case BinaryOpIC::NUMBER: return TypeInfo::Double(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 463 | case BinaryOpIC::ODDBALL: return TypeInfo::Unknown(); |
| 464 | case BinaryOpIC::STRING: return TypeInfo::String(); |
| 465 | case BinaryOpIC::GENERIC: return TypeInfo::Unknown(); |
| 466 | } |
| 467 | UNREACHABLE(); |
| 468 | return TypeInfo::Unknown(); |
| 469 | } |
| 470 | |
| 471 | |
| 472 | void TypeFeedbackOracle::BinaryType(BinaryOperation* expr, |
| 473 | TypeInfo* left, |
| 474 | TypeInfo* right, |
| 475 | TypeInfo* result) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 476 | Handle<Object> object = GetInfo(expr->BinaryOperationFeedbackId()); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 477 | TypeInfo unknown = TypeInfo::Unknown(); |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 478 | if (!object->IsCode()) { |
| 479 | *left = *right = *result = unknown; |
| 480 | return; |
| 481 | } |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 482 | Handle<Code> code = Handle<Code>::cast(object); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 483 | if (code->is_binary_op_stub()) { |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 484 | BinaryOpIC::TypeInfo left_type, right_type, result_type; |
| 485 | BinaryOpStub::decode_types_from_minor_key(code->stub_info(), &left_type, |
| 486 | &right_type, &result_type); |
| 487 | *left = TypeFromBinaryOpType(left_type); |
| 488 | *right = TypeFromBinaryOpType(right_type); |
| 489 | *result = TypeFromBinaryOpType(result_type); |
| 490 | return; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 491 | } |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 492 | // Not a binary op stub. |
| 493 | *left = *right = *result = unknown; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 494 | } |
| 495 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 496 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 497 | TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 498 | Handle<Object> object = GetInfo(clause->CompareId()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 499 | TypeInfo unknown = TypeInfo::Unknown(); |
| 500 | if (!object->IsCode()) return unknown; |
| 501 | Handle<Code> code = Handle<Code>::cast(object); |
| 502 | if (!code->is_compare_ic_stub()) return unknown; |
| 503 | |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 504 | CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); |
| 505 | return TypeFromCompareType(state); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 509 | TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 510 | Handle<Object> object = GetInfo(expr->CountBinOpFeedbackId()); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 511 | TypeInfo unknown = TypeInfo::Unknown(); |
| 512 | if (!object->IsCode()) return unknown; |
| 513 | Handle<Code> code = Handle<Code>::cast(object); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 514 | if (!code->is_binary_op_stub()) return unknown; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 515 | |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 516 | BinaryOpIC::TypeInfo left_type, right_type, unused_result_type; |
| 517 | BinaryOpStub::decode_types_from_minor_key(code->stub_info(), &left_type, |
| 518 | &right_type, &unused_result_type); |
| 519 | // CountOperations should always have +1 or -1 as their right input. |
| 520 | ASSERT(right_type == BinaryOpIC::SMI || |
| 521 | right_type == BinaryOpIC::UNINITIALIZED); |
| 522 | |
| 523 | switch (left_type) { |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 524 | case BinaryOpIC::UNINITIALIZED: |
| 525 | case BinaryOpIC::SMI: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 526 | return TypeInfo::Smi(); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 527 | case BinaryOpIC::INT32: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 528 | return TypeInfo::Integer32(); |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 529 | case BinaryOpIC::NUMBER: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 530 | return TypeInfo::Double(); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 531 | case BinaryOpIC::STRING: |
| 532 | case BinaryOpIC::GENERIC: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 533 | return unknown; |
| 534 | default: |
| 535 | return unknown; |
| 536 | } |
| 537 | UNREACHABLE(); |
| 538 | return unknown; |
| 539 | } |
| 540 | |
| 541 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 542 | void TypeFeedbackOracle::CollectPolymorphicMaps(Handle<Code> code, |
| 543 | SmallMapList* types) { |
| 544 | MapHandleList maps; |
| 545 | code->FindAllMaps(&maps); |
| 546 | types->Reserve(maps.length(), zone()); |
| 547 | for (int i = 0; i < maps.length(); i++) { |
| 548 | Handle<Map> map(maps.at(i)); |
| 549 | if (!CanRetainOtherContext(*map, *native_context_)) { |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 550 | types->AddMapIfMissing(map, zone()); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 551 | } |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 556 | void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 557 | Handle<String> name, |
| 558 | Code::Flags flags, |
| 559 | SmallMapList* types) { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 560 | Handle<Object> object = GetInfo(ast_id); |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 561 | if (object->IsUndefined() || object->IsSmi()) return; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 562 | |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 563 | if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 564 | // TODO(fschneider): We could collect the maps and signal that |
| 565 | // we need a generic store (or load) here. |
yangguo@chromium.org | 46a2a51 | 2013-01-18 16:29:40 +0000 | [diff] [blame] | 566 | ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 567 | } else if (object->IsMap()) { |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 568 | types->AddMapIfMissing(Handle<Map>::cast(object), zone()); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 569 | } else if (Handle<Code>::cast(object)->ic_state() == POLYMORPHIC) { |
| 570 | CollectPolymorphicMaps(Handle<Code>::cast(object), types); |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 571 | } else if (FLAG_collect_megamorphic_maps_from_stub_cache && |
| 572 | Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 573 | types->Reserve(4, zone()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 574 | ASSERT(object->IsCode()); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 575 | isolate_->stub_cache()->CollectMatchingMaps(types, |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 576 | name, |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 577 | flags, |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 578 | native_context_, |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 579 | zone()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 580 | } |
| 581 | } |
| 582 | |
| 583 | |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 584 | // Check if a map originates from a given native context. We use this |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 585 | // information to filter out maps from different context to avoid |
| 586 | // retaining objects from different tabs in Chrome via optimized code. |
| 587 | bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 588 | Context* native_context) { |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 589 | Object* constructor = NULL; |
| 590 | while (!map->prototype()->IsNull()) { |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 591 | constructor = map->constructor(); |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 592 | if (!constructor->IsNull()) { |
| 593 | // If the constructor is not null or a JSFunction, we have to |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 594 | // conservatively assume that it may retain a native context. |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 595 | if (!constructor->IsJSFunction()) return true; |
| 596 | // Check if the constructor directly references a foreign context. |
| 597 | if (CanRetainOtherContext(JSFunction::cast(constructor), |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 598 | native_context)) { |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 599 | return true; |
| 600 | } |
| 601 | } |
| 602 | map = HeapObject::cast(map->prototype())->map(); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 603 | } |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame] | 604 | constructor = map->constructor(); |
| 605 | if (constructor->IsNull()) return false; |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 606 | JSFunction* function = JSFunction::cast(constructor); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 607 | return CanRetainOtherContext(function, native_context); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | |
| 611 | bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 612 | Context* native_context) { |
| 613 | return function->context()->global_object() != native_context->global_object() |
| 614 | && function->context()->global_object() != native_context->builtins(); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 618 | void TypeFeedbackOracle::CollectKeyedReceiverTypes(TypeFeedbackId ast_id, |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 619 | SmallMapList* types) { |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 620 | Handle<Object> object = GetInfo(ast_id); |
| 621 | if (!object->IsCode()) return; |
| 622 | Handle<Code> code = Handle<Code>::cast(object); |
| 623 | if (code->kind() == Code::KEYED_LOAD_IC || |
| 624 | code->kind() == Code::KEYED_STORE_IC) { |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 625 | CollectPolymorphicMaps(code, types); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 626 | } |
| 627 | } |
| 628 | |
| 629 | |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 630 | byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { |
| 631 | Handle<Object> object = GetInfo(id); |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 632 | return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; |
| 633 | } |
| 634 | |
| 635 | |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 636 | byte TypeFeedbackOracle::CompareNilTypes(TypeFeedbackId id) { |
| 637 | Handle<Object> object = GetInfo(id); |
| 638 | if (object->IsCode() && |
| 639 | Handle<Code>::cast(object)->is_compare_nil_ic_stub()) { |
| 640 | return Handle<Code>::cast(object)->compare_nil_state(); |
| 641 | } else { |
| 642 | return CompareNilICStub::kFullCompare; |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 647 | // Things are a bit tricky here: The iterator for the RelocInfos and the infos |
| 648 | // themselves are not GC-safe, so we first get all infos, then we create the |
| 649 | // dictionary (possibly triggering GC), and finally we relocate the collected |
| 650 | // infos before we process them. |
| 651 | void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { |
| 652 | AssertNoAllocation no_allocation; |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 653 | ZoneList<RelocInfo> infos(16, zone()); |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 654 | HandleScope scope(isolate_); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 655 | GetRelocInfos(code, &infos); |
| 656 | CreateDictionary(code, &infos); |
| 657 | ProcessRelocInfos(&infos); |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 658 | ProcessTypeFeedbackCells(code); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 659 | // Allocate handle in the parent scope. |
| 660 | dictionary_ = scope.CloseAndEscape(dictionary_); |
| 661 | } |
| 662 | |
| 663 | |
| 664 | void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code, |
| 665 | ZoneList<RelocInfo>* infos) { |
| 666 | int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); |
| 667 | for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 668 | infos->Add(*it.rinfo(), zone()); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 669 | } |
| 670 | } |
| 671 | |
| 672 | |
| 673 | void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, |
| 674 | ZoneList<RelocInfo>* infos) { |
| 675 | DisableAssertNoAllocation allocation_allowed; |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 676 | int cell_count = code->type_feedback_info()->IsTypeFeedbackInfo() |
| 677 | ? TypeFeedbackInfo::cast(code->type_feedback_info())-> |
| 678 | type_feedback_cells()->CellCount() |
| 679 | : 0; |
| 680 | int length = infos->length() + cell_count; |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 681 | byte* old_start = code->instruction_start(); |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 682 | dictionary_ = FACTORY->NewUnseededNumberDictionary(length); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 683 | byte* new_start = code->instruction_start(); |
| 684 | RelocateRelocInfos(infos, old_start, new_start); |
| 685 | } |
| 686 | |
| 687 | |
| 688 | void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 689 | byte* old_start, |
| 690 | byte* new_start) { |
| 691 | for (int i = 0; i < infos->length(); i++) { |
| 692 | RelocInfo* info = &(*infos)[i]; |
| 693 | info->set_pc(new_start + (info->pc() - old_start)); |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | |
| 698 | void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { |
| 699 | for (int i = 0; i < infos->length(); i++) { |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 700 | RelocInfo reloc_entry = (*infos)[i]; |
| 701 | Address target_address = reloc_entry.target_address(); |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 702 | TypeFeedbackId ast_id = |
| 703 | TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 704 | Code* target = Code::GetCodeFromTargetAddress(target_address); |
| 705 | switch (target->kind()) { |
| 706 | case Code::LOAD_IC: |
| 707 | case Code::STORE_IC: |
| 708 | case Code::CALL_IC: |
| 709 | case Code::KEYED_CALL_IC: |
| 710 | if (target->ic_state() == MONOMORPHIC) { |
| 711 | if (target->kind() == Code::CALL_IC && |
| 712 | target->check_type() != RECEIVER_MAP_CHECK) { |
| 713 | SetInfo(ast_id, Smi::FromInt(target->check_type())); |
| 714 | } else { |
| 715 | Object* map = target->FindFirstMap(); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 716 | if (map == NULL) { |
| 717 | SetInfo(ast_id, static_cast<Object*>(target)); |
| 718 | } else if (!CanRetainOtherContext(Map::cast(map), |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 719 | *native_context_)) { |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 720 | SetInfo(ast_id, map); |
| 721 | } |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 722 | } |
jkummerow@chromium.org | 531dfe8 | 2012-03-20 13:01:16 +0000 | [diff] [blame] | 723 | } else { |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 724 | SetInfo(ast_id, target); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 725 | } |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 726 | break; |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 727 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 728 | case Code::KEYED_LOAD_IC: |
| 729 | case Code::KEYED_STORE_IC: |
| 730 | if (target->ic_state() == MONOMORPHIC || |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 731 | target->ic_state() == POLYMORPHIC) { |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 732 | SetInfo(ast_id, target); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 733 | } |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 734 | break; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 735 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 736 | case Code::UNARY_OP_IC: |
| 737 | case Code::BINARY_OP_IC: |
| 738 | case Code::COMPARE_IC: |
| 739 | case Code::TO_BOOLEAN_IC: |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 740 | case Code::COMPARE_NIL_IC: |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 741 | SetInfo(ast_id, target); |
| 742 | break; |
| 743 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 744 | default: |
| 745 | break; |
| 746 | } |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 747 | } |
| 748 | } |
| 749 | |
| 750 | |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 751 | void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) { |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 752 | Object* raw_info = code->type_feedback_info(); |
| 753 | if (!raw_info->IsTypeFeedbackInfo()) return; |
| 754 | Handle<TypeFeedbackCells> cache( |
| 755 | TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 756 | for (int i = 0; i < cache->CellCount(); i++) { |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 757 | TypeFeedbackId ast_id = cache->AstId(i); |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 758 | Object* value = cache->Cell(i)->value(); |
ulan@chromium.org | 9a21ec4 | 2012-03-06 08:42:24 +0000 | [diff] [blame] | 759 | if (value->IsSmi() || |
| 760 | (value->IsJSFunction() && |
| 761 | !CanRetainOtherContext(JSFunction::cast(value), |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 762 | *native_context_))) { |
danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 763 | SetInfo(ast_id, value); |
| 764 | } |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 769 | void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { |
| 770 | ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) == |
| 771 | UnseededNumberDictionary::kNotFound); |
| 772 | MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target); |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 773 | USE(maybe_result); |
| 774 | #ifdef DEBUG |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 775 | Object* result = NULL; |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 776 | // Dictionary has been allocated with sufficient size for all elements. |
| 777 | ASSERT(maybe_result->ToObject(&result)); |
| 778 | ASSERT(*dictionary_ == result); |
| 779 | #endif |
| 780 | } |
| 781 | |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 782 | } } // namespace v8::internal |