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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 422 |
423 if (generator.GenerateCode()) { | 423 if (generator.GenerateCode()) { |
424 if (FLAG_trace_codegen) { | 424 if (FLAG_trace_codegen) { |
425 PrintF("Crankshaft Compiler - "); | 425 PrintF("Crankshaft Compiler - "); |
426 } | 426 } |
427 CodeGenerator::MakeCodePrologue(info()); | 427 CodeGenerator::MakeCodePrologue(info()); |
428 Code::Flags flags = Code::ComputeFlags(kind); | 428 Code::Flags flags = Code::ComputeFlags(kind); |
429 Handle<Code> code = | 429 Handle<Code> code = |
430 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); | 430 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
431 generator.FinishCode(code); | 431 generator.FinishCode(code); |
| 432 RegisterDependentCodeForEmbeddedMaps(code); |
432 CodeGenerator::PrintCode(code, info()); | 433 CodeGenerator::PrintCode(code, info()); |
433 return code; | 434 return code; |
434 } | 435 } |
435 return Handle<Code>::null(); | 436 return Handle<Code>::null(); |
436 } | 437 } |
437 | 438 |
438 | 439 |
| 440 void LChunk::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
| 441 ZoneList<Handle<Map> > maps(1, zone()); |
| 442 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 443 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 444 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 445 if (mode == RelocInfo::EMBEDDED_OBJECT && |
| 446 it.rinfo()->target_object()->IsMap()) { |
| 447 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
| 448 if (map->CanTransition()) { |
| 449 maps.Add(map, zone()); |
| 450 } |
| 451 } |
| 452 } |
| 453 for (int i = 0; i < maps.length(); i++) { |
| 454 maps.at(i)->AddDependentCode(code); |
| 455 } |
| 456 } |
| 457 |
439 } } // namespace v8::internal | 458 } } // namespace v8::internal |
OLD | NEW |