| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 if (generator.GenerateCode()) { | 451 if (generator.GenerateCode()) { |
| 452 if (FLAG_trace_codegen) { | 452 if (FLAG_trace_codegen) { |
| 453 PrintF("Crankshaft Compiler - "); | 453 PrintF("Crankshaft Compiler - "); |
| 454 } | 454 } |
| 455 CodeGenerator::MakeCodePrologue(info()); | 455 CodeGenerator::MakeCodePrologue(info()); |
| 456 Code::Flags flags = Code::ComputeFlags(kind); | 456 Code::Flags flags = Code::ComputeFlags(kind); |
| 457 Handle<Code> code = | 457 Handle<Code> code = |
| 458 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); | 458 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
| 459 generator.FinishCode(code); | 459 generator.FinishCode(code); |
| 460 if (FLAG_weak_embedded_maps_in_optimized_code) { | |
| 461 RegisterDependentCodeForEmbeddedMaps(code); | |
| 462 } | |
| 463 CodeGenerator::PrintCode(code, info()); | 460 CodeGenerator::PrintCode(code, info()); |
| 464 return code; | 461 return code; |
| 465 } | 462 } |
| 466 return Handle<Code>::null(); | 463 return Handle<Code>::null(); |
| 467 } | 464 } |
| 468 | 465 |
| 469 | 466 |
| 470 void LChunk::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | |
| 471 ZoneList<Handle<Map> > maps(1, zone()); | |
| 472 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | |
| 473 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | |
| 474 RelocInfo::Mode mode = it.rinfo()->rmode(); | |
| 475 if (mode == RelocInfo::EMBEDDED_OBJECT && | |
| 476 it.rinfo()->target_object()->IsMap()) { | |
| 477 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
| 478 if (map->CanTransition()) { | |
| 479 maps.Add(map, zone()); | |
| 480 } | |
| 481 } | |
| 482 } | |
| 483 #ifdef VERIFY_HEAP | |
| 484 // This disables verification of weak embedded maps after full GC. | |
| 485 // AddDependentCode can cause a GC, which would observe the state where | |
| 486 // this code is not yet in the depended code lists of the embedded maps. | |
| 487 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; | |
| 488 #endif | |
| 489 for (int i = 0; i < maps.length(); i++) { | |
| 490 maps.at(i)->AddDependentCode(code); | |
| 491 } | |
| 492 } | |
| 493 | |
| 494 | |
| 495 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { | 467 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { |
| 496 allocated_double_registers_ = allocated_registers; | 468 allocated_double_registers_ = allocated_registers; |
| 497 BitVector* doubles = allocated_double_registers(); | 469 BitVector* doubles = allocated_double_registers(); |
| 498 BitVector::Iterator iterator(doubles); | 470 BitVector::Iterator iterator(doubles); |
| 499 while (!iterator.Done()) { | 471 while (!iterator.Done()) { |
| 500 if (info()->saves_caller_doubles()) { | 472 if (info()->saves_caller_doubles()) { |
| 501 if (kDoubleSize == kPointerSize * 2) { | 473 if (kDoubleSize == kPointerSize * 2) { |
| 502 spill_slot_count_ += 2; | 474 spill_slot_count_ += 2; |
| 503 } else { | 475 } else { |
| 504 spill_slot_count_++; | 476 spill_slot_count_++; |
| 505 } | 477 } |
| 506 } | 478 } |
| 507 iterator.Advance(); | 479 iterator.Advance(); |
| 508 } | 480 } |
| 509 } | 481 } |
| 510 | 482 |
| 511 | 483 |
| 512 } } // namespace v8::internal | 484 } } // namespace v8::internal |
| OLD | NEW |