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

Side by Side Diff: src/type-info.cc

Issue 1108013003: Introduce --zap-cpp-pointers (off by default) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes Created 3 years, 7 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
« no previous file with comments | « src/type-info.h ('k') | test/cctest/test-debug.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/type-info.h" 5 #include "src/type-info.h"
6 6
7 #include "src/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ZoneList<RelocInfo>* infos) { 483 ZoneList<RelocInfo>* infos) {
484 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); 484 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
485 for (RelocIterator it(*code, mask); !it.done(); it.next()) { 485 for (RelocIterator it(*code, mask); !it.done(); it.next()) {
486 infos->Add(*it.rinfo(), zone()); 486 infos->Add(*it.rinfo(), zone());
487 } 487 }
488 } 488 }
489 489
490 490
491 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, 491 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code,
492 ZoneList<RelocInfo>* infos) { 492 ZoneList<RelocInfo>* infos) {
493 AllowHeapAllocation allocation_allowed; 493 AllowHeapAllocation will_relocate_manually;
494 Code* old_code = *code; 494 // Store an (aligned) Address, so this doesn't look like a raw heap pointer
495 // to verification tools scanning the stack.
496 Address old_code_address = code->address();
495 dictionary_ = UnseededNumberDictionary::New(isolate(), infos->length()); 497 dictionary_ = UnseededNumberDictionary::New(isolate(), infos->length());
496 RelocateRelocInfos(infos, old_code, *code); 498 RelocateRelocInfos(infos, old_code_address, code->address());
497 } 499 }
498 500
499
500 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, 501 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos,
501 Code* old_code, 502 Address old_code_address,
502 Code* new_code) { 503 Address new_code_address) {
504 intptr_t delta = new_code_address - old_code_address;
505 if (delta == 0) return;
506 Code* new_code = Code::cast(HeapObject::FromAddress(new_code_address));
503 for (int i = 0; i < infos->length(); i++) { 507 for (int i = 0; i < infos->length(); i++) {
504 RelocInfo* info = &(*infos)[i]; 508 RelocInfo* info = &(*infos)[i];
505 info->set_host(new_code); 509 info->set_host(new_code);
506 info->set_pc(new_code->instruction_start() + 510 info->set_pc(info->pc() + delta);
507 (info->pc() - old_code->instruction_start()));
508 } 511 }
509 } 512 }
510 513
511 514
512 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { 515 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
513 for (int i = 0; i < infos->length(); i++) { 516 for (int i = 0; i < infos->length(); i++) {
514 RelocInfo reloc_entry = (*infos)[i]; 517 RelocInfo reloc_entry = (*infos)[i];
515 Address target_address = reloc_entry.target_address(); 518 Address target_address = reloc_entry.target_address();
516 TypeFeedbackId ast_id = 519 TypeFeedbackId ast_id =
517 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); 520 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data()));
(...skipping 22 matching lines...) Expand all
540 // Dictionary has been allocated with sufficient size for all elements. 543 // Dictionary has been allocated with sufficient size for all elements.
541 DisallowHeapAllocation no_need_to_resize_dictionary; 544 DisallowHeapAllocation no_need_to_resize_dictionary;
542 HandleScope scope(isolate()); 545 HandleScope scope(isolate());
543 USE(UnseededNumberDictionary::AtNumberPut( 546 USE(UnseededNumberDictionary::AtNumberPut(
544 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 547 dictionary_, IdToKey(ast_id), handle(target, isolate())));
545 } 548 }
546 549
547 550
548 } // namespace internal 551 } // namespace internal
549 } // namespace v8 552 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698