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

Side by Side Diff: src/factory.cc

Issue 1051233002: Reland "Merge old data and pointer space." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/globals.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_POINTER_SPACE); 58 Handle<Oddball> oddball = New<Oddball>(map, OLD_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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 934
935 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) { 935 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) {
936 AllowDeferredHandleDereference convert_to_cell; 936 AllowDeferredHandleDereference convert_to_cell;
937 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateWeakCell(*value), 937 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateWeakCell(*value),
938 WeakCell); 938 WeakCell);
939 } 939 }
940 940
941 941
942 Handle<AllocationSite> Factory::NewAllocationSite() { 942 Handle<AllocationSite> Factory::NewAllocationSite() {
943 Handle<Map> map = allocation_site_map(); 943 Handle<Map> map = allocation_site_map();
944 Handle<AllocationSite> site = New<AllocationSite>(map, OLD_POINTER_SPACE); 944 Handle<AllocationSite> site = New<AllocationSite>(map, OLD_SPACE);
945 site->Initialize(); 945 site->Initialize();
946 946
947 // Link the site 947 // Link the site
948 site->set_weak_next(isolate()->heap()->allocation_sites_list()); 948 site->set_weak_next(isolate()->heap()->allocation_sites_list());
949 isolate()->heap()->set_allocation_sites_list(*site); 949 isolate()->heap()->set_allocation_sites_list(*site);
950 return site; 950 return site;
951 } 951 }
952 952
953 953
954 Handle<Map> Factory::NewMap(InstanceType type, 954 Handle<Map> Factory::NewMap(InstanceType type,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 function->set_prototype_or_initial_map(*the_hole_value()); 1247 function->set_prototype_or_initial_map(*the_hole_value());
1248 function->set_literals_or_bindings(*empty_fixed_array()); 1248 function->set_literals_or_bindings(*empty_fixed_array());
1249 function->set_next_function_link(*undefined_value()); 1249 function->set_next_function_link(*undefined_value());
1250 } 1250 }
1251 1251
1252 1252
1253 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1253 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1254 Handle<SharedFunctionInfo> info, 1254 Handle<SharedFunctionInfo> info,
1255 Handle<Context> context, 1255 Handle<Context> context,
1256 PretenureFlag pretenure) { 1256 PretenureFlag pretenure) {
1257 AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE; 1257 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE;
1258 Handle<JSFunction> result = New<JSFunction>(map, space); 1258 Handle<JSFunction> result = New<JSFunction>(map, space);
1259 InitializeFunction(result, info, context); 1259 InitializeFunction(result, info, context);
1260 return result; 1260 return result;
1261 } 1261 }
1262 1262
1263 1263
1264 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1264 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1265 Handle<String> name, 1265 Handle<String> name,
1266 MaybeHandle<Code> code) { 1266 MaybeHandle<Code> code) {
1267 Handle<Context> context(isolate()->native_context()); 1267 Handle<Context> context(isolate()->native_context());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, 1580 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
1581 PropertyCellType::kMutable); 1581 PropertyCellType::kMutable);
1582 Handle<Name> name(descs->GetKey(i)); 1582 Handle<Name> name(descs->GetKey(i));
1583 Handle<PropertyCell> cell = NewPropertyCell(); 1583 Handle<PropertyCell> cell = NewPropertyCell();
1584 cell->set_value(descs->GetCallbacksObject(i)); 1584 cell->set_value(descs->GetCallbacksObject(i));
1585 // |dictionary| already contains enough space for all properties. 1585 // |dictionary| already contains enough space for all properties.
1586 USE(NameDictionary::Add(dictionary, name, cell, d)); 1586 USE(NameDictionary::Add(dictionary, name, cell, d));
1587 } 1587 }
1588 1588
1589 // Allocate the global object and initialize it with the backing store. 1589 // Allocate the global object and initialize it with the backing store.
1590 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); 1590 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_SPACE);
1591 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); 1591 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map);
1592 1592
1593 // Create a new map for the global object. 1593 // Create a new map for the global object.
1594 Handle<Map> new_map = Map::CopyDropDescriptors(map); 1594 Handle<Map> new_map = Map::CopyDropDescriptors(map);
1595 new_map->set_dictionary_map(true); 1595 new_map->set_dictionary_map(true);
1596 1596
1597 // Set up the global object as a normalized object. 1597 // Set up the global object as a normalized object.
1598 global->set_map(*new_map); 1598 global->set_map(*new_map);
1599 global->set_properties(*dictionary); 1599 global->set_properties(*dictionary);
1600 1600
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 message->set_script(*script); 2068 message->set_script(*script);
2069 message->set_stack_frames(*stack_frames); 2069 message->set_stack_frames(*stack_frames);
2070 return message; 2070 return message;
2071 } 2071 }
2072 2072
2073 2073
2074 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 2074 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
2075 Handle<String> name, 2075 Handle<String> name,
2076 MaybeHandle<Code> maybe_code) { 2076 MaybeHandle<Code> maybe_code) {
2077 Handle<Map> map = shared_function_info_map(); 2077 Handle<Map> map = shared_function_info_map();
2078 Handle<SharedFunctionInfo> share = 2078 Handle<SharedFunctionInfo> share = New<SharedFunctionInfo>(map, OLD_SPACE);
2079 New<SharedFunctionInfo>(map, OLD_POINTER_SPACE);
2080 2079
2081 // Set pointer fields. 2080 // Set pointer fields.
2082 share->set_name(*name); 2081 share->set_name(*name);
2083 Handle<Code> code; 2082 Handle<Code> code;
2084 if (!maybe_code.ToHandle(&code)) { 2083 if (!maybe_code.ToHandle(&code)) {
2085 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal)); 2084 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal));
2086 } 2085 }
2087 share->set_code(*code); 2086 share->set_code(*code);
2088 share->set_optimized_code_map(Smi::FromInt(0)); 2087 share->set_optimized_code_map(Smi::FromInt(0));
2089 share->set_scope_info(ScopeInfo::Empty(isolate())); 2088 share->set_scope_info(ScopeInfo::Empty(isolate()));
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 return Handle<Object>::null(); 2333 return Handle<Object>::null();
2335 } 2334 }
2336 2335
2337 2336
2338 Handle<Object> Factory::ToBoolean(bool value) { 2337 Handle<Object> Factory::ToBoolean(bool value) {
2339 return value ? true_value() : false_value(); 2338 return value ? true_value() : false_value();
2340 } 2339 }
2341 2340
2342 2341
2343 } } // namespace v8::internal 2342 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/extensions/statistics-extension.cc ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698