| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 return unknown; | 237 return unknown; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { | 242 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { |
| 243 Handle<Object> object = GetInfo(expr->position()); | 243 Handle<Object> object = GetInfo(expr->position()); |
| 244 TypeInfo unknown = TypeInfo::Unknown(); | 244 TypeInfo unknown = TypeInfo::Unknown(); |
| 245 if (!object->IsCode()) return unknown; | 245 if (!object->IsCode()) return unknown; |
| 246 Handle<Code> code = Handle<Code>::cast(object); | 246 Handle<Code> code = Handle<Code>::cast(object); |
| 247 if (code->is_binary_op_stub()) { | 247 if (code->is_type_recording_binary_op_stub()) { |
| 248 BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>( | |
| 249 code->binary_op_type()); | |
| 250 switch (type) { | |
| 251 case BinaryOpIC::UNINIT_OR_SMI: | |
| 252 return TypeInfo::Smi(); | |
| 253 case BinaryOpIC::DEFAULT: | |
| 254 return (expr->op() == Token::DIV || expr->op() == Token::MUL) | |
| 255 ? TypeInfo::Double() | |
| 256 : TypeInfo::Integer32(); | |
| 257 case BinaryOpIC::HEAP_NUMBERS: | |
| 258 return TypeInfo::Double(); | |
| 259 default: | |
| 260 return unknown; | |
| 261 } | |
| 262 } else if (code->is_type_recording_binary_op_stub()) { | |
| 263 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( | 248 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( |
| 264 code->type_recording_binary_op_type()); | 249 code->type_recording_binary_op_type()); |
| 265 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( | 250 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( |
| 266 code->type_recording_binary_op_result_type()); | 251 code->type_recording_binary_op_result_type()); |
| 267 | 252 |
| 268 switch (type) { | 253 switch (type) { |
| 269 case TRBinaryOpIC::UNINITIALIZED: | 254 case TRBinaryOpIC::UNINITIALIZED: |
| 270 // Uninitialized means never executed. | 255 // Uninitialized means never executed. |
| 271 // TODO(fschneider): Introduce a separate value for never-executed ICs | 256 // TODO(fschneider): Introduce a separate value for never-executed ICs |
| 272 return unknown; | 257 return unknown; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 ASSERT(source_positions.length() == length); | 369 ASSERT(source_positions.length() == length); |
| 385 for (int i = 0; i < length; i++) { | 370 for (int i = 0; i < length; i++) { |
| 386 AssertNoAllocation no_allocation; | 371 AssertNoAllocation no_allocation; |
| 387 RelocInfo info(code->instruction_start() + code_positions[i], | 372 RelocInfo info(code->instruction_start() + code_positions[i], |
| 388 RelocInfo::CODE_TARGET, 0); | 373 RelocInfo::CODE_TARGET, 0); |
| 389 Code* target = Code::GetCodeFromTargetAddress(info.target_address()); | 374 Code* target = Code::GetCodeFromTargetAddress(info.target_address()); |
| 390 int position = source_positions[i]; | 375 int position = source_positions[i]; |
| 391 InlineCacheState state = target->ic_state(); | 376 InlineCacheState state = target->ic_state(); |
| 392 Code::Kind kind = target->kind(); | 377 Code::Kind kind = target->kind(); |
| 393 | 378 |
| 394 if (kind == Code::BINARY_OP_IC || | 379 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC || |
| 395 kind == Code::TYPE_RECORDING_BINARY_OP_IC || | |
| 396 kind == Code::COMPARE_IC) { | 380 kind == Code::COMPARE_IC) { |
| 397 // TODO(kasperl): Avoid having multiple ICs with the same | 381 // TODO(kasperl): Avoid having multiple ICs with the same |
| 398 // position by making sure that we have position information | 382 // position by making sure that we have position information |
| 399 // recorded for all binary ICs. | 383 // recorded for all binary ICs. |
| 400 int entry = dictionary_->FindEntry(position); | 384 int entry = dictionary_->FindEntry(position); |
| 401 if (entry == NumberDictionary::kNotFound) { | 385 if (entry == NumberDictionary::kNotFound) { |
| 402 SetInfo(position, target); | 386 SetInfo(position, target); |
| 403 } | 387 } |
| 404 } else if (state == MONOMORPHIC) { | 388 } else if (state == MONOMORPHIC) { |
| 405 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC || | 389 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC || |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | | 423 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
| 440 RelocInfo::kPositionMask; | 424 RelocInfo::kPositionMask; |
| 441 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 425 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 442 RelocInfo* info = it.rinfo(); | 426 RelocInfo* info = it.rinfo(); |
| 443 RelocInfo::Mode mode = info->rmode(); | 427 RelocInfo::Mode mode = info->rmode(); |
| 444 if (RelocInfo::IsCodeTarget(mode)) { | 428 if (RelocInfo::IsCodeTarget(mode)) { |
| 445 Code* target = Code::GetCodeFromTargetAddress(info->target_address()); | 429 Code* target = Code::GetCodeFromTargetAddress(info->target_address()); |
| 446 if (target->is_inline_cache_stub()) { | 430 if (target->is_inline_cache_stub()) { |
| 447 InlineCacheState state = target->ic_state(); | 431 InlineCacheState state = target->ic_state(); |
| 448 Code::Kind kind = target->kind(); | 432 Code::Kind kind = target->kind(); |
| 449 if (kind == Code::BINARY_OP_IC) { | 433 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC) { |
| 450 if (target->binary_op_type() == BinaryOpIC::GENERIC) continue; | |
| 451 } else if (kind == Code::TYPE_RECORDING_BINARY_OP_IC) { | |
| 452 if (target->type_recording_binary_op_type() == | 434 if (target->type_recording_binary_op_type() == |
| 453 TRBinaryOpIC::GENERIC) { | 435 TRBinaryOpIC::GENERIC) { |
| 454 continue; | 436 continue; |
| 455 } | 437 } |
| 456 } else if (kind == Code::COMPARE_IC) { | 438 } else if (kind == Code::COMPARE_IC) { |
| 457 if (target->compare_state() == CompareIC::GENERIC) continue; | 439 if (target->compare_state() == CompareIC::GENERIC) continue; |
| 458 } else { | 440 } else { |
| 459 if (state != MONOMORPHIC && state != MEGAMORPHIC) continue; | 441 if (state != MONOMORPHIC && state != MEGAMORPHIC) continue; |
| 460 } | 442 } |
| 461 code_positions->Add( | 443 code_positions->Add( |
| 462 static_cast<int>(info->pc() - code->instruction_start())); | 444 static_cast<int>(info->pc() - code->instruction_start())); |
| 463 source_positions->Add(position); | 445 source_positions->Add(position); |
| 464 } | 446 } |
| 465 } else { | 447 } else { |
| 466 ASSERT(RelocInfo::IsPosition(mode)); | 448 ASSERT(RelocInfo::IsPosition(mode)); |
| 467 position = static_cast<int>(info->data()); | 449 position = static_cast<int>(info->data()); |
| 468 } | 450 } |
| 469 } | 451 } |
| 470 } | 452 } |
| 471 | 453 |
| 472 } } // namespace v8::internal | 454 } } // namespace v8::internal |
| OLD | NEW |