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

Side by Side Diff: src/factory.cc

Issue 1027463002: Revert "Merge old data and pointer space." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/extensions/statistics-extension.cc ('k') | src/flag-definitions.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); 48 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE));
49 result->set_value(*value); 49 result->set_value(*value);
50 return result; 50 return result;
51 } 51 }
52 52
53 53
54 Handle<Oddball> Factory::NewOddball(Handle<Map> map, 54 Handle<Oddball> Factory::NewOddball(Handle<Map> map,
55 const char* to_string, 55 const char* to_string,
56 Handle<Object> to_number, 56 Handle<Object> to_number,
57 byte kind) { 57 byte kind) {
58 Handle<Oddball> oddball = New<Oddball>(map, OLD_SPACE); 58 Handle<Oddball> oddball = New<Oddball>(map, OLD_POINTER_SPACE);
59 Oddball::Initialize(isolate(), oddball, to_string, to_number, kind); 59 Oddball::Initialize(isolate(), oddball, to_string, to_number, kind);
60 return oddball; 60 return oddball;
61 } 61 }
62 62
63 63
64 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { 64 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) {
65 DCHECK(0 <= size); 65 DCHECK(0 <= size);
66 CALL_HEAP_FUNCTION( 66 CALL_HEAP_FUNCTION(
67 isolate(), 67 isolate(),
68 isolate()->heap()->AllocateFixedArray(size, pretenure), 68 isolate()->heap()->AllocateFixedArray(size, pretenure),
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 919
920 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) { 920 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) {
921 AllowDeferredHandleDereference convert_to_cell; 921 AllowDeferredHandleDereference convert_to_cell;
922 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateWeakCell(*value), 922 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateWeakCell(*value),
923 WeakCell); 923 WeakCell);
924 } 924 }
925 925
926 926
927 Handle<AllocationSite> Factory::NewAllocationSite() { 927 Handle<AllocationSite> Factory::NewAllocationSite() {
928 Handle<Map> map = allocation_site_map(); 928 Handle<Map> map = allocation_site_map();
929 Handle<AllocationSite> site = New<AllocationSite>(map, OLD_SPACE); 929 Handle<AllocationSite> site = New<AllocationSite>(map, OLD_POINTER_SPACE);
930 site->Initialize(); 930 site->Initialize();
931 931
932 // Link the site 932 // Link the site
933 site->set_weak_next(isolate()->heap()->allocation_sites_list()); 933 site->set_weak_next(isolate()->heap()->allocation_sites_list());
934 isolate()->heap()->set_allocation_sites_list(*site); 934 isolate()->heap()->set_allocation_sites_list(*site);
935 return site; 935 return site;
936 } 936 }
937 937
938 938
939 Handle<Map> Factory::NewMap(InstanceType type, 939 Handle<Map> Factory::NewMap(InstanceType type,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 function->set_prototype_or_initial_map(*the_hole_value()); 1232 function->set_prototype_or_initial_map(*the_hole_value());
1233 function->set_literals_or_bindings(*empty_fixed_array()); 1233 function->set_literals_or_bindings(*empty_fixed_array());
1234 function->set_next_function_link(*undefined_value()); 1234 function->set_next_function_link(*undefined_value());
1235 } 1235 }
1236 1236
1237 1237
1238 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1238 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1239 Handle<SharedFunctionInfo> info, 1239 Handle<SharedFunctionInfo> info,
1240 Handle<Context> context, 1240 Handle<Context> context,
1241 PretenureFlag pretenure) { 1241 PretenureFlag pretenure) {
1242 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; 1242 AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE;
1243 Handle<JSFunction> result = New<JSFunction>(map, space); 1243 Handle<JSFunction> result = New<JSFunction>(map, space);
1244 InitializeFunction(result, info, context); 1244 InitializeFunction(result, info, context);
1245 return result; 1245 return result;
1246 } 1246 }
1247 1247
1248 1248
1249 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1249 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1250 Handle<String> name, 1250 Handle<String> name,
1251 MaybeHandle<Code> code) { 1251 MaybeHandle<Code> code) {
1252 Handle<Context> context(isolate()->native_context()); 1252 Handle<Context> context(isolate()->native_context());
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, 1567 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
1568 PropertyCellType::kMutable); 1568 PropertyCellType::kMutable);
1569 Handle<Name> name(descs->GetKey(i)); 1569 Handle<Name> name(descs->GetKey(i));
1570 Handle<PropertyCell> cell = NewPropertyCell(); 1570 Handle<PropertyCell> cell = NewPropertyCell();
1571 cell->set_value(descs->GetCallbacksObject(i)); 1571 cell->set_value(descs->GetCallbacksObject(i));
1572 // |dictionary| already contains enough space for all properties. 1572 // |dictionary| already contains enough space for all properties.
1573 USE(NameDictionary::Add(dictionary, name, cell, d)); 1573 USE(NameDictionary::Add(dictionary, name, cell, d));
1574 } 1574 }
1575 1575
1576 // Allocate the global object and initialize it with the backing store. 1576 // Allocate the global object and initialize it with the backing store.
1577 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_SPACE); 1577 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE);
1578 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); 1578 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map);
1579 1579
1580 // Create a new map for the global object. 1580 // Create a new map for the global object.
1581 Handle<Map> new_map = Map::CopyDropDescriptors(map); 1581 Handle<Map> new_map = Map::CopyDropDescriptors(map);
1582 new_map->set_dictionary_map(true); 1582 new_map->set_dictionary_map(true);
1583 1583
1584 // Set up the global object as a normalized object. 1584 // Set up the global object as a normalized object.
1585 global->set_map(*new_map); 1585 global->set_map(*new_map);
1586 global->set_properties(*dictionary); 1586 global->set_properties(*dictionary);
1587 1587
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 message->set_script(*script); 2055 message->set_script(*script);
2056 message->set_stack_frames(*stack_frames); 2056 message->set_stack_frames(*stack_frames);
2057 return message; 2057 return message;
2058 } 2058 }
2059 2059
2060 2060
2061 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 2061 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
2062 Handle<String> name, 2062 Handle<String> name,
2063 MaybeHandle<Code> maybe_code) { 2063 MaybeHandle<Code> maybe_code) {
2064 Handle<Map> map = shared_function_info_map(); 2064 Handle<Map> map = shared_function_info_map();
2065 Handle<SharedFunctionInfo> share = New<SharedFunctionInfo>(map, OLD_SPACE); 2065 Handle<SharedFunctionInfo> share =
2066 New<SharedFunctionInfo>(map, OLD_POINTER_SPACE);
2066 2067
2067 // Set pointer fields. 2068 // Set pointer fields.
2068 share->set_name(*name); 2069 share->set_name(*name);
2069 Handle<Code> code; 2070 Handle<Code> code;
2070 if (!maybe_code.ToHandle(&code)) { 2071 if (!maybe_code.ToHandle(&code)) {
2071 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal)); 2072 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal));
2072 } 2073 }
2073 share->set_code(*code); 2074 share->set_code(*code);
2074 share->set_optimized_code_map(Smi::FromInt(0)); 2075 share->set_optimized_code_map(Smi::FromInt(0));
2075 share->set_scope_info(ScopeInfo::Empty(isolate())); 2076 share->set_scope_info(ScopeInfo::Empty(isolate()));
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 return Handle<Object>::null(); 2321 return Handle<Object>::null();
2321 } 2322 }
2322 2323
2323 2324
2324 Handle<Object> Factory::ToBoolean(bool value) { 2325 Handle<Object> Factory::ToBoolean(bool value) {
2325 return value ? true_value() : false_value(); 2326 return value ? true_value() : false_value();
2326 } 2327 }
2327 2328
2328 2329
2329 } } // namespace v8::internal 2330 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/extensions/statistics-extension.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698