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

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

Issue 2567333002: [promises] port NewPromiseCapability to TF (Closed)
Patch Set: Make gcmole happy Created 3 years, 11 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/heap/heap.h ('k') | src/heap/objects-visiting.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/heap/heap.h" 5 #include "src/heap/heap.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/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, 2263 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean,
2264 Context::BOOLEAN_FUNCTION_INDEX); 2264 Context::BOOLEAN_FUNCTION_INDEX);
2265 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); 2265 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized);
2266 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); 2266 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker);
2267 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); 2267 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel);
2268 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); 2268 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception);
2269 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); 2269 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception);
2270 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); 2270 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out);
2271 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, stale_register); 2271 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, stale_register);
2272 2272
2273 ALLOCATE_MAP(JS_PROMISE_CAPABILITY_TYPE, JSPromiseCapability::kSize,
2274 js_promise_capability);
2275
2273 for (unsigned i = 0; i < arraysize(string_type_table); i++) { 2276 for (unsigned i = 0; i < arraysize(string_type_table); i++) {
2274 const StringTypeTable& entry = string_type_table[i]; 2277 const StringTypeTable& entry = string_type_table[i];
2275 { 2278 {
2276 AllocationResult allocation = AllocateMap(entry.type, entry.size); 2279 AllocationResult allocation = AllocateMap(entry.type, entry.size);
2277 if (!allocation.To(&obj)) return false; 2280 if (!allocation.To(&obj)) return false;
2278 } 2281 }
2279 Map* map = Map::cast(obj); 2282 Map* map = Map::cast(obj);
2280 map->SetConstructorFunctionIndex(Context::STRING_FUNCTION_INDEX); 2283 map->SetConstructorFunctionIndex(Context::STRING_FUNCTION_INDEX);
2281 // Mark cons string maps as unstable, because their objects can change 2284 // Mark cons string maps as unstable, because their objects can change
2282 // maps during GC. 2285 // maps during GC.
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 set_noscript_shared_function_infos(Smi::kZero); 2872 set_noscript_shared_function_infos(Smi::kZero);
2870 2873
2871 // Initialize context slot cache. 2874 // Initialize context slot cache.
2872 isolate_->context_slot_cache()->Clear(); 2875 isolate_->context_slot_cache()->Clear();
2873 2876
2874 // Initialize descriptor cache. 2877 // Initialize descriptor cache.
2875 isolate_->descriptor_lookup_cache()->Clear(); 2878 isolate_->descriptor_lookup_cache()->Clear();
2876 2879
2877 // Initialize compilation cache. 2880 // Initialize compilation cache.
2878 isolate_->compilation_cache()->Clear(); 2881 isolate_->compilation_cache()->Clear();
2882
2883 // Finish creating JSPromiseCapabilityMap
2884 {
2885 // TODO(caitp): This initialization can be removed once PromiseCapability
2886 // object is no longer used by builtins implemented in javascript.
2887 Handle<Map> map = factory->js_promise_capability_map();
2888 map->set_inobject_properties_or_constructor_function_index(3);
2889
2890 Map::EnsureDescriptorSlack(map, 3);
2891
2892 PropertyAttributes attrs =
2893 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
2894 { // promise
2895 Descriptor d = Descriptor::DataField(factory->promise_string(),
2896 JSPromiseCapability::kPromiseIndex,
2897 attrs, Representation::Tagged());
2898 map->AppendDescriptor(&d);
2899 }
2900
2901 { // resolve
2902 Descriptor d = Descriptor::DataField(factory->resolve_string(),
2903 JSPromiseCapability::kResolveIndex,
2904 attrs, Representation::Tagged());
2905 map->AppendDescriptor(&d);
2906 }
2907
2908 { // reject
2909 Descriptor d = Descriptor::DataField(factory->reject_string(),
2910 JSPromiseCapability::kRejectIndex,
2911 attrs, Representation::Tagged());
2912 map->AppendDescriptor(&d);
2913 }
2914
2915 map->set_is_extensible(false);
2916 set_js_promise_capability_map(*map);
2917 }
2879 } 2918 }
2880 2919
2881 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { 2920 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
2882 switch (root_index) { 2921 switch (root_index) {
2883 case kNumberStringCacheRootIndex: 2922 case kNumberStringCacheRootIndex:
2884 case kInstanceofCacheFunctionRootIndex: 2923 case kInstanceofCacheFunctionRootIndex:
2885 case kInstanceofCacheMapRootIndex: 2924 case kInstanceofCacheMapRootIndex:
2886 case kInstanceofCacheAnswerRootIndex: 2925 case kInstanceofCacheAnswerRootIndex:
2887 case kCodeStubsRootIndex: 2926 case kCodeStubsRootIndex:
2888 case kEmptyScriptRootIndex: 2927 case kEmptyScriptRootIndex:
(...skipping 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after
6504 } 6543 }
6505 6544
6506 6545
6507 // static 6546 // static
6508 int Heap::GetStaticVisitorIdForMap(Map* map) { 6547 int Heap::GetStaticVisitorIdForMap(Map* map) {
6509 return StaticVisitorBase::GetVisitorId(map); 6548 return StaticVisitorBase::GetVisitorId(map);
6510 } 6549 }
6511 6550
6512 } // namespace internal 6551 } // namespace internal
6513 } // namespace v8 6552 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698