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

Side by Side Diff: src/heap.cc

Issue 336483002: remove this == null (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/factory.cc ('k') | src/hydrogen-load-elimination.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 !code_space_->FirstPage()->Contains(result->address())) { 3358 !code_space_->FirstPage()->Contains(result->address())) {
3359 // Discard the first code allocation, which was on a page where it could be 3359 // Discard the first code allocation, which was on a page where it could be
3360 // moved. 3360 // moved.
3361 CreateFillerObjectAt(result->address(), object_size); 3361 CreateFillerObjectAt(result->address(), object_size);
3362 allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE); 3362 allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE);
3363 if (!allocation.To(&result)) return allocation; 3363 if (!allocation.To(&result)) return allocation;
3364 } 3364 }
3365 3365
3366 result->set_map_no_write_barrier(code_map()); 3366 result->set_map_no_write_barrier(code_map());
3367 Code* code = Code::cast(result); 3367 Code* code = Code::cast(result);
3368 ASSERT(!isolate_->code_range()->exists() || 3368 ASSERT(isolate_->code_range() == NULL ||
3369 isolate_->code_range()->contains(code->address())); 3369 !isolate_->code_range()->valid() ||
3370 isolate_->code_range()->contains(code->address()));
3370 code->set_gc_metadata(Smi::FromInt(0)); 3371 code->set_gc_metadata(Smi::FromInt(0));
3371 code->set_ic_age(global_ic_age_); 3372 code->set_ic_age(global_ic_age_);
3372 return code; 3373 return code;
3373 } 3374 }
3374 3375
3375 3376
3376 AllocationResult Heap::CopyCode(Code* code) { 3377 AllocationResult Heap::CopyCode(Code* code) {
3377 AllocationResult allocation; 3378 AllocationResult allocation;
3378 HeapObject* new_constant_pool; 3379 HeapObject* new_constant_pool;
3379 if (FLAG_enable_ool_constant_pool && 3380 if (FLAG_enable_ool_constant_pool &&
(...skipping 20 matching lines...) Expand all
3400 // Copy code object. 3401 // Copy code object.
3401 Address old_addr = code->address(); 3402 Address old_addr = code->address();
3402 Address new_addr = result->address(); 3403 Address new_addr = result->address();
3403 CopyBlock(new_addr, old_addr, obj_size); 3404 CopyBlock(new_addr, old_addr, obj_size);
3404 Code* new_code = Code::cast(result); 3405 Code* new_code = Code::cast(result);
3405 3406
3406 // Update the constant pool. 3407 // Update the constant pool.
3407 new_code->set_constant_pool(new_constant_pool); 3408 new_code->set_constant_pool(new_constant_pool);
3408 3409
3409 // Relocate the copy. 3410 // Relocate the copy.
3410 ASSERT(!isolate_->code_range()->exists() || 3411 ASSERT(isolate_->code_range() == NULL ||
3411 isolate_->code_range()->contains(code->address())); 3412 !isolate_->code_range()->valid() ||
3413 isolate_->code_range()->contains(code->address()));
3412 new_code->Relocate(new_addr - old_addr); 3414 new_code->Relocate(new_addr - old_addr);
3413 return new_code; 3415 return new_code;
3414 } 3416 }
3415 3417
3416 3418
3417 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { 3419 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
3418 // Allocate ByteArray and ConstantPoolArray before the Code object, so that we 3420 // Allocate ByteArray and ConstantPoolArray before the Code object, so that we
3419 // do not risk leaving uninitialized Code object (and breaking the heap). 3421 // do not risk leaving uninitialized Code object (and breaking the heap).
3420 ByteArray* reloc_info_array; 3422 ByteArray* reloc_info_array;
3421 { AllocationResult allocation = 3423 { AllocationResult allocation =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 3466
3465 // Update constant pool. 3467 // Update constant pool.
3466 new_code->set_constant_pool(new_constant_pool); 3468 new_code->set_constant_pool(new_constant_pool);
3467 3469
3468 // Copy patched rinfo. 3470 // Copy patched rinfo.
3469 CopyBytes(new_code->relocation_start(), 3471 CopyBytes(new_code->relocation_start(),
3470 reloc_info.start(), 3472 reloc_info.start(),
3471 static_cast<size_t>(reloc_info.length())); 3473 static_cast<size_t>(reloc_info.length()));
3472 3474
3473 // Relocate the copy. 3475 // Relocate the copy.
3474 ASSERT(!isolate_->code_range()->exists() || 3476 ASSERT(isolate_->code_range() == NULL ||
3475 isolate_->code_range()->contains(code->address())); 3477 !isolate_->code_range()->valid() ||
3478 isolate_->code_range()->contains(code->address()));
3476 new_code->Relocate(new_addr - old_addr); 3479 new_code->Relocate(new_addr - old_addr);
3477 3480
3478 #ifdef VERIFY_HEAP 3481 #ifdef VERIFY_HEAP
3479 if (FLAG_verify_heap) code->ObjectVerify(); 3482 if (FLAG_verify_heap) code->ObjectVerify();
3480 #endif 3483 #endif
3481 return new_code; 3484 return new_code;
3482 } 3485 }
3483 3486
3484 3487
3485 void Heap::InitializeAllocationMemento(AllocationMemento* memento, 3488 void Heap::InitializeAllocationMemento(AllocationMemento* memento,
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after
6430 static_cast<int>(object_sizes_last_time_[index])); 6433 static_cast<int>(object_sizes_last_time_[index]));
6431 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6434 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6432 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6435 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6433 6436
6434 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6437 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6435 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6438 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6436 ClearObjectStats(); 6439 ClearObjectStats();
6437 } 6440 }
6438 6441
6439 } } // namespace v8::internal 6442 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/hydrogen-load-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698