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

Side by Side Diff: src/heap/heap.cc

Issue 418143007: FYI Implementing 'super' keyword (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: one more test Created 6 years, 4 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
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/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 HeapObject* obj; 3582 HeapObject* obj;
3583 DCHECK(!allocation.To(&obj) || !obj->IsGlobalObject()); 3583 DCHECK(!allocation.To(&obj) || !obj->IsGlobalObject());
3584 #endif 3584 #endif
3585 return allocation; 3585 return allocation;
3586 } 3586 }
3587 3587
3588 3588
3589 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { 3589 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
3590 // Never used to copy functions. If functions need to be copied we 3590 // Never used to copy functions. If functions need to be copied we
3591 // have to be careful to clear the literals array. 3591 // have to be careful to clear the literals array.
3592 SLOW_DCHECK(!source->IsJSFunction()); 3592 // SLOW_DCHECK(!source->IsJSFunction());
3593 3593
3594 // Make the clone. 3594 // Make the clone.
3595 Map* map = source->map(); 3595 Map* map = source->map();
3596 int object_size = map->instance_size(); 3596 int object_size = map->instance_size();
3597 HeapObject* clone; 3597 HeapObject* clone;
3598 3598
3599 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); 3599 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type()));
3600 3600
3601 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER; 3601 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER;
3602 3602
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 } 3657 }
3658 // Update properties if necessary. 3658 // Update properties if necessary.
3659 if (properties->length() > 0) { 3659 if (properties->length() > 0) {
3660 FixedArray* prop; 3660 FixedArray* prop;
3661 { 3661 {
3662 AllocationResult allocation = CopyFixedArray(properties); 3662 AllocationResult allocation = CopyFixedArray(properties);
3663 if (!allocation.To(&prop)) return allocation; 3663 if (!allocation.To(&prop)) return allocation;
3664 } 3664 }
3665 JSObject::cast(clone)->set_properties(prop, wb_mode); 3665 JSObject::cast(clone)->set_properties(prop, wb_mode);
3666 } 3666 }
3667
3668 if (source->IsJSFunction()) {
3669 SLOW_DCHECK(clone->IsJSFunction());
3670 JSFunction* source_fun = JSFunction::cast(source);
3671 JSFunction* clone_fun = JSFunction::cast(clone);
3672 SharedFunctionInfo* info = source_fun->shared();
3673 if (!info->bound()) {
3674 int num_literals = info->num_literals();
3675 HeapObject* obj;
3676 {
3677 AllocationResult allocation = AllocateFixedArrayWithFiller(
3678 num_literals, NOT_TENURED, undefined_value());
3679 if (!allocation.To(&obj)) return allocation;
3680 }
3681 FixedArray* new_literals = FixedArray::cast(obj);
3682 if (num_literals > 0) {
3683 new_literals->set(JSFunction::kLiteralNativeContextIndex,
3684 JSFunction::NativeContextFromLiterals(source_fun->literals()));
3685 }
3686 clone_fun->set_literals(new_literals);
3687 }
3688 }
3667 // Return the new clone. 3689 // Return the new clone.
3668 return clone; 3690 return clone;
3669 } 3691 }
3670 3692
3671 3693
3672 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars, 3694 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars,
3673 int len) { 3695 int len) {
3674 // Only works for ascii. 3696 // Only works for ascii.
3675 DCHECK(vector.length() == len); 3697 DCHECK(vector.length() == len);
3676 MemCopy(chars, vector.start(), len); 3698 MemCopy(chars, vector.start(), len);
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
6051 static_cast<int>(object_sizes_last_time_[index])); 6073 static_cast<int>(object_sizes_last_time_[index]));
6052 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6074 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6053 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6075 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6054 6076
6055 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6077 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6056 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6078 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6057 ClearObjectStats(); 6079 ClearObjectStats();
6058 } 6080 }
6059 } 6081 }
6060 } // namespace v8::internal 6082 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698