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

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: Use private own symbol for [[HomeObject]] 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
« no previous file with comments | « src/heap/heap.h ('k') | src/hydrogen.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/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 2870
2871 set_detailed_stack_trace_symbol(*factory->NewPrivateSymbol()); 2871 set_detailed_stack_trace_symbol(*factory->NewPrivateSymbol());
2872 set_elements_transition_symbol(*factory->NewPrivateSymbol()); 2872 set_elements_transition_symbol(*factory->NewPrivateSymbol());
2873 set_frozen_symbol(*factory->NewPrivateSymbol()); 2873 set_frozen_symbol(*factory->NewPrivateSymbol());
2874 set_megamorphic_symbol(*factory->NewPrivateSymbol()); 2874 set_megamorphic_symbol(*factory->NewPrivateSymbol());
2875 set_nonexistent_symbol(*factory->NewPrivateSymbol()); 2875 set_nonexistent_symbol(*factory->NewPrivateSymbol());
2876 set_normal_ic_symbol(*factory->NewPrivateSymbol()); 2876 set_normal_ic_symbol(*factory->NewPrivateSymbol());
2877 set_observed_symbol(*factory->NewPrivateSymbol()); 2877 set_observed_symbol(*factory->NewPrivateSymbol());
2878 set_stack_trace_symbol(*factory->NewPrivateSymbol()); 2878 set_stack_trace_symbol(*factory->NewPrivateSymbol());
2879 set_uninitialized_symbol(*factory->NewPrivateSymbol()); 2879 set_uninitialized_symbol(*factory->NewPrivateSymbol());
2880 set_home_object_symbol(*factory->NewPrivateOwnSymbol());
2880 2881
2881 Handle<SeededNumberDictionary> slow_element_dictionary = 2882 Handle<SeededNumberDictionary> slow_element_dictionary =
2882 SeededNumberDictionary::New(isolate(), 0, TENURED); 2883 SeededNumberDictionary::New(isolate(), 0, TENURED);
2883 slow_element_dictionary->set_requires_slow_elements(); 2884 slow_element_dictionary->set_requires_slow_elements();
2884 set_empty_slow_element_dictionary(*slow_element_dictionary); 2885 set_empty_slow_element_dictionary(*slow_element_dictionary);
2885 2886
2886 set_materialized_objects(*factory->NewFixedArray(0, TENURED)); 2887 set_materialized_objects(*factory->NewFixedArray(0, TENURED));
2887 2888
2888 // Handling of script id generation is in Factory::NewScript. 2889 // Handling of script id generation is in Factory::NewScript.
2889 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); 2890 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId));
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 HeapObject* obj; 3675 HeapObject* obj;
3675 DCHECK(!allocation.To(&obj) || !obj->IsGlobalObject()); 3676 DCHECK(!allocation.To(&obj) || !obj->IsGlobalObject());
3676 #endif 3677 #endif
3677 return allocation; 3678 return allocation;
3678 } 3679 }
3679 3680
3680 3681
3681 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { 3682 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
3682 // Never used to copy functions. If functions need to be copied we 3683 // Never used to copy functions. If functions need to be copied we
3683 // have to be careful to clear the literals array. 3684 // have to be careful to clear the literals array.
3684 SLOW_DCHECK(!source->IsJSFunction()); 3685 // SLOW_DCHECK(!source->IsJSFunction());
3685 3686
3686 // Make the clone. 3687 // Make the clone.
3687 Map* map = source->map(); 3688 Map* map = source->map();
3688 int object_size = map->instance_size(); 3689 int object_size = map->instance_size();
3689 HeapObject* clone; 3690 HeapObject* clone;
3690 3691
3691 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); 3692 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type()));
3692 3693
3693 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER; 3694 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER;
3694 3695
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 } 3750 }
3750 // Update properties if necessary. 3751 // Update properties if necessary.
3751 if (properties->length() > 0) { 3752 if (properties->length() > 0) {
3752 FixedArray* prop; 3753 FixedArray* prop;
3753 { 3754 {
3754 AllocationResult allocation = CopyFixedArray(properties); 3755 AllocationResult allocation = CopyFixedArray(properties);
3755 if (!allocation.To(&prop)) return allocation; 3756 if (!allocation.To(&prop)) return allocation;
3756 } 3757 }
3757 JSObject::cast(clone)->set_properties(prop, wb_mode); 3758 JSObject::cast(clone)->set_properties(prop, wb_mode);
3758 } 3759 }
3760
3761 if (source->IsJSFunction()) {
3762 SLOW_DCHECK(clone->IsJSFunction());
3763 JSFunction* source_fun = JSFunction::cast(source);
3764 JSFunction* clone_fun = JSFunction::cast(clone);
3765 SharedFunctionInfo* info = source_fun->shared();
3766 if (!info->bound()) {
3767 int num_literals = info->num_literals();
3768 HeapObject* obj;
3769 {
3770 AllocationResult allocation = AllocateFixedArrayWithFiller(
3771 num_literals, NOT_TENURED, undefined_value());
3772 if (!allocation.To(&obj)) return allocation;
3773 }
3774 FixedArray* new_literals = FixedArray::cast(obj);
3775 if (num_literals > 0) {
3776 new_literals->set(JSFunction::kLiteralNativeContextIndex,
3777 JSFunction::NativeContextFromLiterals(source_fun->literals()));
3778 }
3779 clone_fun->set_literals(new_literals);
3780 }
3781 }
3759 // Return the new clone. 3782 // Return the new clone.
3760 return clone; 3783 return clone;
3761 } 3784 }
3762 3785
3763 3786
3764 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars, 3787 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars,
3765 int len) { 3788 int len) {
3766 // Only works for ascii. 3789 // Only works for ascii.
3767 DCHECK(vector.length() == len); 3790 DCHECK(vector.length() == len);
3768 MemCopy(chars, vector.start(), len); 3791 MemCopy(chars, vector.start(), len);
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
6143 static_cast<int>(object_sizes_last_time_[index])); 6166 static_cast<int>(object_sizes_last_time_[index]));
6144 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6167 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6145 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6168 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6146 6169
6147 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6170 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6148 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6171 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6149 ClearObjectStats(); 6172 ClearObjectStats();
6150 } 6173 }
6151 } 6174 }
6152 } // namespace v8::internal 6175 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698