Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/lithium.cc

Issue 12256038: Register dependent codes before populating deoptimization data, which can cause GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lithium.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/lithium.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698