sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
| 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" |
| 31 | #include "compiler.h" |
| 32 | #include "ic.h" |
| 33 | #include "macro-assembler.h" |
| 34 | #include "stub-cache.h" |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 35 | #include "type-info.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 36 | |
| 37 | #include "ic-inl.h" |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 38 | #include "objects-inl.h" |
| 39 | |
| 40 | namespace v8 { |
| 41 | namespace internal { |
| 42 | |
| 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(); |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 52 | } else if (value->IsString()) { |
| 53 | info = TypeInfo::String(); |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 54 | } else { |
| 55 | info = TypeInfo::Unknown(); |
| 56 | } |
| 57 | return info; |
| 58 | } |
| 59 | |
| 60 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 61 | STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); |
| 62 | |
| 63 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 64 | TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 65 | Handle<Context> global_context) { |
| 66 | global_context_ = global_context; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 79 | return GetElement(map_, expr->position())->IsMap(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | |
| 83 | bool TypeFeedbackOracle:: StoreIsMonomorphic(Assignment* expr) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 84 | return GetElement(map_, expr->position())->IsMap(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | |
| 88 | bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 89 | Handle<Object> value = GetElement(map_, expr->position()); |
| 90 | return value->IsMap() || value->IsSmi(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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(); |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [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); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 133 | return CollectReceiverTypes(expr->position(), name, flags); |
| 134 | } |
| 135 | |
| 136 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [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 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 174 | TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 184 | // Uninitialized means never executed. |
| 185 | // TODO(fschneider): Introduce a separate value for never-executed ICs. |
| 186 | return unknown; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 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 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 201 | TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 229 | // Uninitialized means never executed. |
| 230 | // TODO(fschneider): Introduce a separate value for never-executed ICs |
| 231 | return unknown; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 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 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 262 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 273 | // Uninitialized means never executed. |
| 274 | // TODO(fschneider): Introduce a separate value for never-executed ICs. |
| 275 | return unknown; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 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 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 290 | ZoneMapList* TypeFeedbackOracle::CollectReceiverTypes(int position, |
| 291 | Handle<String> name, |
| 292 | Code::Flags flags) { |
| 293 | Handle<Object> object = GetElement(map_, position); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 294 | if (object->IsUndefined() || object->IsSmi()) return NULL; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [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()) { |
| 340 | SetElement(map_, position, target); |
| 341 | } |
| 342 | } else if (state == MONOMORPHIC) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [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) { |
| 347 | SetElement(map_, position, target); |
| 348 | } else { |
| 349 | SetElement(map_, position, map); |
| 350 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 351 | } else { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 352 | ASSERT(target->kind() == Code::CALL_IC); |
| 353 | CheckType check = target->check_type(); |
| 354 | ASSERT(check != RECEIVER_MAP_CHECK); |
| 355 | SetElement(map_, position, Handle<Object>(Smi::FromInt(check))); |
| 356 | ASSERT(Smi::cast(*GetElement(map_, position))->value() == check); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 357 | } |
| 358 | } else if (state == MEGAMORPHIC) { |
| 359 | SetElement(map_, position, target); |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | |
| 365 | void TypeFeedbackOracle::CollectPositions(Code* code, |
| 366 | List<int>* code_positions, |
| 367 | List<int>* source_positions) { |
| 368 | AssertNoAllocation no_allocation; |
| 369 | int position = 0; |
| 370 | // Because the ICs we use for global variables access in the full |
| 371 | // code generator do not have any meaningful positions, we avoid |
| 372 | // collecting those by filtering out contextual code targets. |
| 373 | int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
| 374 | RelocInfo::kPositionMask; |
| 375 | for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 376 | RelocInfo* info = it.rinfo(); |
| 377 | RelocInfo::Mode mode = info->rmode(); |
| 378 | if (RelocInfo::IsCodeTarget(mode)) { |
| 379 | Code* target = Code::GetCodeFromTargetAddress(info->target_address()); |
| 380 | if (target->is_inline_cache_stub()) { |
| 381 | InlineCacheState state = target->ic_state(); |
| 382 | Code::Kind kind = target->kind(); |
| 383 | if (kind == Code::BINARY_OP_IC) { |
| 384 | if (target->binary_op_type() == BinaryOpIC::GENERIC) continue; |
| 385 | } else if (kind == Code::TYPE_RECORDING_BINARY_OP_IC) { |
| 386 | if (target->type_recording_binary_op_type() == |
| 387 | TRBinaryOpIC::GENERIC) { |
| 388 | continue; |
| 389 | } |
| 390 | } else if (kind == Code::COMPARE_IC) { |
| 391 | if (target->compare_state() == CompareIC::GENERIC) continue; |
| 392 | } else { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 393 | if (state != MONOMORPHIC && state != MEGAMORPHIC) continue; |
| 394 | } |
| 395 | code_positions->Add( |
| 396 | static_cast<int>(info->pc() - code->instruction_start())); |
| 397 | source_positions->Add(position); |
| 398 | } |
| 399 | } else { |
| 400 | ASSERT(RelocInfo::IsPosition(mode)); |
| 401 | position = static_cast<int>(info->data()); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 406 | } } // namespace v8::internal |