Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +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 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 28 | #include "v8.h" |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 29 | |
| 30 | #include "ast.h" |
| 31 | #include "compiler.h" |
| 32 | #include "ic.h" |
| 33 | #include "macro-assembler.h" |
| 34 | #include "stub-cache.h" |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 35 | #include "type-info.h" |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 36 | |
| 37 | #include "ic-inl.h" |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 38 | #include "objects-inl.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 39 | |
| 40 | namespace v8 { |
| 41 | namespace internal { |
| 42 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 43 | |
| 44 | TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) { |
| 45 | TypeInfo info; |
| 46 | if (value->IsSmi()) { |
| 47 | info = TypeInfo::Smi(); |
| 48 | } else if (value->IsHeapNumber()) { |
| 49 | info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value()) |
| 50 | ? TypeInfo::Integer32() |
| 51 | : TypeInfo::Double(); |
| 52 | } else if (value->IsString()) { |
| 53 | info = TypeInfo::String(); |
| 54 | } else { |
| 55 | info = TypeInfo::Unknown(); |
| 56 | } |
| 57 | return info; |
| 58 | } |
| 59 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 60 | |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 61 | STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); |
| 62 | |
| 63 | |
| 64 | TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 65 | Handle<Context> global_context) { |
| 66 | global_context_ = global_context; |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 67 | Initialize(code); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | void TypeFeedbackOracle::Initialize(Handle<Code> code) { |
| 72 | ASSERT(map_.is_null()); // Only initialize once. |
| 73 | map_ = Factory::NewJSObject(Top::object_function()); |
| 74 | PopulateMap(code); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 79 | return GetElement(map_, expr->position())->IsMap(); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | |
| 83 | bool TypeFeedbackOracle:: StoreIsMonomorphic(Assignment* expr) { |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 84 | return GetElement(map_, expr->position())->IsMap(); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | |
| 88 | bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 89 | Handle<Object> value = GetElement(map_, expr->position()); |
| 90 | return value->IsMap() || value->IsSmi(); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | |
| 94 | Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
| 95 | ASSERT(LoadIsMonomorphic(expr)); |
| 96 | return Handle<Map>::cast(GetElement(map_, expr->position())); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Assignment* expr) { |
| 101 | ASSERT(StoreIsMonomorphic(expr)); |
| 102 | return Handle<Map>::cast(GetElement(map_, expr->position())); |
| 103 | } |
| 104 | |
| 105 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 106 | ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
| 107 | Handle<String> name) { |
| 108 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
| 109 | return CollectReceiverTypes(expr->position(), name, flags); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 114 | Handle<String> name) { |
| 115 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
| 116 | return CollectReceiverTypes(expr->position(), name, flags); |
| 117 | } |
| 118 | |
| 119 | |
| 120 | ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
| 121 | Handle<String> name) { |
| 122 | int arity = expr->arguments()->length(); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 123 | // Note: these flags won't let us get maps from stubs with |
| 124 | // non-default extra ic state in the megamorphic case. In the more |
| 125 | // important monomorphic case the map is obtained directly, so it's |
| 126 | // not a problem until we decide to emit more polymorphic code. |
| 127 | Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 128 | NORMAL, |
| 129 | Code::kNoExtraICState, |
| 130 | OWN_MAP, |
| 131 | NOT_IN_LOOP, |
| 132 | arity); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 133 | return CollectReceiverTypes(expr->position(), name, flags); |
| 134 | } |
| 135 | |
| 136 | |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 137 | CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
| 138 | Handle<Object> value = GetElement(map_, expr->position()); |
| 139 | if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
| 140 | CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
| 141 | ASSERT(check != RECEIVER_MAP_CHECK); |
| 142 | return check; |
| 143 | } |
| 144 | |
| 145 | |
| 146 | Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( |
| 147 | CheckType check) { |
| 148 | JSFunction* function = NULL; |
| 149 | switch (check) { |
| 150 | case RECEIVER_MAP_CHECK: |
| 151 | UNREACHABLE(); |
| 152 | break; |
| 153 | case STRING_CHECK: |
| 154 | function = global_context_->string_function(); |
| 155 | break; |
| 156 | case NUMBER_CHECK: |
| 157 | function = global_context_->number_function(); |
| 158 | break; |
| 159 | case BOOLEAN_CHECK: |
| 160 | function = global_context_->boolean_function(); |
| 161 | break; |
| 162 | } |
| 163 | ASSERT(function != NULL); |
| 164 | return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 165 | } |
| 166 | |
| 167 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 168 | bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { |
| 169 | Handle<Object> object = GetElement(map_, expr->position()); |
| 170 | return *object == Builtins::builtin(id); |
| 171 | } |
| 172 | |
| 173 | |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 174 | TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) { |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 175 | Handle<Object> object = GetElement(map_, expr->position()); |
| 176 | TypeInfo unknown = TypeInfo::Unknown(); |
| 177 | if (!object->IsCode()) return unknown; |
| 178 | Handle<Code> code = Handle<Code>::cast(object); |
| 179 | if (!code->is_compare_ic_stub()) return unknown; |
| 180 | |
| 181 | CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
| 182 | switch (state) { |
| 183 | case CompareIC::UNINITIALIZED: |
| 184 | // Uninitialized means never executed. |
| 185 | // TODO(fschneider): Introduce a separate value for never-executed ICs. |
| 186 | return unknown; |
| 187 | case CompareIC::SMIS: |
| 188 | return TypeInfo::Smi(); |
| 189 | case CompareIC::HEAP_NUMBERS: |
| 190 | return TypeInfo::Number(); |
| 191 | case CompareIC::OBJECTS: |
| 192 | // TODO(kasperl): We really need a type for JS objects here. |
| 193 | return TypeInfo::NonPrimitive(); |
| 194 | case CompareIC::GENERIC: |
| 195 | default: |
| 196 | return unknown; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 201 | TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 202 | Handle<Object> object = GetElement(map_, expr->position()); |
| 203 | TypeInfo unknown = TypeInfo::Unknown(); |
| 204 | if (!object->IsCode()) return unknown; |
| 205 | Handle<Code> code = Handle<Code>::cast(object); |
| 206 | if (code->is_binary_op_stub()) { |
| 207 | BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>( |
| 208 | code->binary_op_type()); |
| 209 | switch (type) { |
| 210 | case BinaryOpIC::UNINIT_OR_SMI: |
| 211 | return TypeInfo::Smi(); |
| 212 | case BinaryOpIC::DEFAULT: |
| 213 | return (expr->op() == Token::DIV || expr->op() == Token::MUL) |
| 214 | ? TypeInfo::Double() |
| 215 | : TypeInfo::Integer32(); |
| 216 | case BinaryOpIC::HEAP_NUMBERS: |
| 217 | return TypeInfo::Double(); |
| 218 | default: |
| 219 | return unknown; |
| 220 | } |
| 221 | } else if (code->is_type_recording_binary_op_stub()) { |
| 222 | TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( |
| 223 | code->type_recording_binary_op_type()); |
| 224 | TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( |
| 225 | code->type_recording_binary_op_result_type()); |
| 226 | |
| 227 | switch (type) { |
| 228 | case TRBinaryOpIC::UNINITIALIZED: |
| 229 | // Uninitialized means never executed. |
| 230 | // TODO(fschneider): Introduce a separate value for never-executed ICs |
| 231 | return unknown; |
| 232 | case TRBinaryOpIC::SMI: |
| 233 | switch (result_type) { |
| 234 | case TRBinaryOpIC::UNINITIALIZED: |
| 235 | case TRBinaryOpIC::SMI: |
| 236 | return TypeInfo::Smi(); |
| 237 | case TRBinaryOpIC::INT32: |
| 238 | return TypeInfo::Integer32(); |
| 239 | case TRBinaryOpIC::HEAP_NUMBER: |
| 240 | return TypeInfo::Double(); |
| 241 | default: |
| 242 | return unknown; |
| 243 | } |
| 244 | case TRBinaryOpIC::INT32: |
| 245 | if (expr->op() == Token::DIV || |
| 246 | result_type == TRBinaryOpIC::HEAP_NUMBER) { |
| 247 | return TypeInfo::Double(); |
| 248 | } |
| 249 | return TypeInfo::Integer32(); |
| 250 | case TRBinaryOpIC::HEAP_NUMBER: |
| 251 | return TypeInfo::Double(); |
| 252 | case TRBinaryOpIC::STRING: |
| 253 | case TRBinaryOpIC::GENERIC: |
| 254 | return unknown; |
| 255 | default: |
| 256 | return unknown; |
| 257 | } |
| 258 | } |
| 259 | return unknown; |
| 260 | } |
| 261 | |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 262 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 263 | TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { |
| 264 | Handle<Object> object = GetElement(map_, clause->position()); |
| 265 | TypeInfo unknown = TypeInfo::Unknown(); |
| 266 | if (!object->IsCode()) return unknown; |
| 267 | Handle<Code> code = Handle<Code>::cast(object); |
| 268 | if (!code->is_compare_ic_stub()) return unknown; |
| 269 | |
| 270 | CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
| 271 | switch (state) { |
| 272 | case CompareIC::UNINITIALIZED: |
| 273 | // Uninitialized means never executed. |
| 274 | // TODO(fschneider): Introduce a separate value for never-executed ICs. |
| 275 | return unknown; |
| 276 | case CompareIC::SMIS: |
| 277 | return TypeInfo::Smi(); |
| 278 | case CompareIC::HEAP_NUMBERS: |
| 279 | return TypeInfo::Number(); |
| 280 | case CompareIC::OBJECTS: |
| 281 | // TODO(kasperl): We really need a type for JS objects here. |
| 282 | return TypeInfo::NonPrimitive(); |
| 283 | case CompareIC::GENERIC: |
| 284 | default: |
| 285 | return unknown; |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 290 | ZoneMapList* TypeFeedbackOracle::CollectReceiverTypes(int position, |
| 291 | Handle<String> name, |
| 292 | Code::Flags flags) { |
| 293 | Handle<Object> object = GetElement(map_, position); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 294 | if (object->IsUndefined() || object->IsSmi()) return NULL; |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 295 | |
| 296 | if (*object == Builtins::builtin(Builtins::StoreIC_GlobalProxy)) { |
| 297 | // TODO(fschneider): We could collect the maps and signal that |
| 298 | // we need a generic store (or load) here. |
| 299 | ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC); |
| 300 | return NULL; |
| 301 | } else if (object->IsMap()) { |
| 302 | ZoneMapList* types = new ZoneMapList(1); |
| 303 | types->Add(Handle<Map>::cast(object)); |
| 304 | return types; |
| 305 | } else if (Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { |
| 306 | ZoneMapList* types = new ZoneMapList(4); |
| 307 | ASSERT(object->IsCode()); |
| 308 | StubCache::CollectMatchingMaps(types, *name, flags); |
| 309 | return types->length() > 0 ? types : NULL; |
| 310 | } else { |
| 311 | return NULL; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | |
| 316 | void TypeFeedbackOracle::PopulateMap(Handle<Code> code) { |
| 317 | HandleScope scope; |
| 318 | |
| 319 | const int kInitialCapacity = 16; |
| 320 | List<int> code_positions(kInitialCapacity); |
| 321 | List<int> source_positions(kInitialCapacity); |
| 322 | CollectPositions(*code, &code_positions, &source_positions); |
| 323 | |
| 324 | int length = code_positions.length(); |
| 325 | ASSERT(source_positions.length() == length); |
| 326 | for (int i = 0; i < length; i++) { |
| 327 | RelocInfo info(code->instruction_start() + code_positions[i], |
| 328 | RelocInfo::CODE_TARGET, 0); |
| 329 | Handle<Code> target(Code::GetCodeFromTargetAddress(info.target_address())); |
| 330 | int position = source_positions[i]; |
| 331 | InlineCacheState state = target->ic_state(); |
| 332 | Code::Kind kind = target->kind(); |
| 333 | if (kind == Code::BINARY_OP_IC || |
| 334 | kind == Code::TYPE_RECORDING_BINARY_OP_IC || |
| 335 | kind == Code::COMPARE_IC) { |
| 336 | // TODO(kasperl): Avoid having multiple ICs with the same |
| 337 | // position by making sure that we have position information |
| 338 | // recorded for all binary ICs. |
| 339 | if (GetElement(map_, position)->IsUndefined()) { |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 340 | SetElement(map_, position, target, kNonStrictMode); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 341 | } |
| 342 | } else if (state == MONOMORPHIC) { |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 343 | if (target->kind() != Code::CALL_IC || |
| 344 | target->check_type() == RECEIVER_MAP_CHECK) { |
| 345 | Handle<Map> map = Handle<Map>(target->FindFirstMap()); |
| 346 | if (*map == NULL) { |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 347 | SetElement(map_, position, target, kNonStrictMode); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 348 | } else { |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 349 | SetElement(map_, position, map, kNonStrictMode); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 350 | } |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 351 | } else { |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 352 | ASSERT(target->kind() == Code::CALL_IC); |
| 353 | CheckType check = target->check_type(); |
| 354 | ASSERT(check != RECEIVER_MAP_CHECK); |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 355 | SetElement(map_, position, |
| 356 | Handle<Object>(Smi::FromInt(check)), kNonStrictMode); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 357 | ASSERT(Smi::cast(*GetElement(map_, position))->value() == check); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 358 | } |
| 359 | } else if (state == MEGAMORPHIC) { |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 360 | SetElement(map_, position, target, kNonStrictMode); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | |
| 366 | void TypeFeedbackOracle::CollectPositions(Code* code, |
| 367 | List<int>* code_positions, |
| 368 | List<int>* source_positions) { |
| 369 | AssertNoAllocation no_allocation; |
| 370 | int position = 0; |
| 371 | // Because the ICs we use for global variables access in the full |
| 372 | // code generator do not have any meaningful positions, we avoid |
| 373 | // collecting those by filtering out contextual code targets. |
| 374 | int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
| 375 | RelocInfo::kPositionMask; |
| 376 | for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 377 | RelocInfo* info = it.rinfo(); |
| 378 | RelocInfo::Mode mode = info->rmode(); |
| 379 | if (RelocInfo::IsCodeTarget(mode)) { |
| 380 | Code* target = Code::GetCodeFromTargetAddress(info->target_address()); |
| 381 | if (target->is_inline_cache_stub()) { |
| 382 | InlineCacheState state = target->ic_state(); |
| 383 | Code::Kind kind = target->kind(); |
| 384 | if (kind == Code::BINARY_OP_IC) { |
| 385 | if (target->binary_op_type() == BinaryOpIC::GENERIC) continue; |
| 386 | } else if (kind == Code::TYPE_RECORDING_BINARY_OP_IC) { |
| 387 | if (target->type_recording_binary_op_type() == |
| 388 | TRBinaryOpIC::GENERIC) { |
| 389 | continue; |
| 390 | } |
| 391 | } else if (kind == Code::COMPARE_IC) { |
| 392 | if (target->compare_state() == CompareIC::GENERIC) continue; |
| 393 | } else { |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 394 | if (state != MONOMORPHIC && state != MEGAMORPHIC) continue; |
| 395 | } |
| 396 | code_positions->Add( |
| 397 | static_cast<int>(info->pc() - code->instruction_start())); |
| 398 | source_positions->Add(position); |
| 399 | } |
| 400 | } else { |
| 401 | ASSERT(RelocInfo::IsPosition(mode)); |
| 402 | position = static_cast<int>(info->data()); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 407 | } } // namespace v8::internal |