Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2260 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, | 2260 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, |
| 2261 Context::BOOLEAN_FUNCTION_INDEX); | 2261 Context::BOOLEAN_FUNCTION_INDEX); |
| 2262 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); | 2262 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); |
| 2263 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); | 2263 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); |
| 2264 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); | 2264 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); |
| 2265 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); | 2265 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); |
| 2266 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); | 2266 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); |
| 2267 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); | 2267 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); |
| 2268 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, stale_register); | 2268 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, stale_register); |
| 2269 | 2269 |
| 2270 ALLOCATE_MAP(JS_PROMISE_CAPABILITY_TYPE, JSPromiseCapability::kSize, | |
| 2271 js_promise_capability); | |
| 2272 | |
| 2270 for (unsigned i = 0; i < arraysize(string_type_table); i++) { | 2273 for (unsigned i = 0; i < arraysize(string_type_table); i++) { |
| 2271 const StringTypeTable& entry = string_type_table[i]; | 2274 const StringTypeTable& entry = string_type_table[i]; |
| 2272 { | 2275 { |
| 2273 AllocationResult allocation = AllocateMap(entry.type, entry.size); | 2276 AllocationResult allocation = AllocateMap(entry.type, entry.size); |
| 2274 if (!allocation.To(&obj)) return false; | 2277 if (!allocation.To(&obj)) return false; |
| 2275 } | 2278 } |
| 2276 Map* map = Map::cast(obj); | 2279 Map* map = Map::cast(obj); |
| 2277 map->SetConstructorFunctionIndex(Context::STRING_FUNCTION_INDEX); | 2280 map->SetConstructorFunctionIndex(Context::STRING_FUNCTION_INDEX); |
| 2278 // Mark cons string maps as unstable, because their objects can change | 2281 // Mark cons string maps as unstable, because their objects can change |
| 2279 // maps during GC. | 2282 // maps during GC. |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2866 set_noscript_shared_function_infos(Smi::kZero); | 2869 set_noscript_shared_function_infos(Smi::kZero); |
| 2867 | 2870 |
| 2868 // Initialize context slot cache. | 2871 // Initialize context slot cache. |
| 2869 isolate_->context_slot_cache()->Clear(); | 2872 isolate_->context_slot_cache()->Clear(); |
| 2870 | 2873 |
| 2871 // Initialize descriptor cache. | 2874 // Initialize descriptor cache. |
| 2872 isolate_->descriptor_lookup_cache()->Clear(); | 2875 isolate_->descriptor_lookup_cache()->Clear(); |
| 2873 | 2876 |
| 2874 // Initialize compilation cache. | 2877 // Initialize compilation cache. |
| 2875 isolate_->compilation_cache()->Clear(); | 2878 isolate_->compilation_cache()->Clear(); |
| 2879 | |
| 2880 // Finish creating JSPromiseCapabilityMap | |
| 2881 { | |
| 2882 // TODO(caitp): This initialization can be removed once PromiseCapability | |
| 2883 // object is no longer used by builtins implemented in javascript. | |
| 2884 Handle<Map> map = factory->js_promise_capability_map(); | |
| 2885 map->set_inobject_properties_or_constructor_function_index(3); | |
| 2886 | |
| 2887 Map::EnsureDescriptorSlack(map, 3); | |
| 2888 | |
| 2889 PropertyAttributes attrs = | |
| 2890 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); | |
| 2891 { // promise | |
| 2892 DataDescriptor d(factory->promise_string(), | |
| 2893 JSPromiseCapability::kPromiseIndex, attrs, | |
| 2894 Representation::Tagged()); | |
| 2895 map->AppendDescriptor(&d); | |
| 2896 } | |
| 2897 | |
| 2898 { // resolve | |
| 2899 DataDescriptor d(factory->resolve_string(), | |
| 2900 JSPromiseCapability::kResolveIndex, attrs, | |
| 2901 Representation::Tagged()); | |
| 2902 map->AppendDescriptor(&d); | |
| 2903 } | |
| 2904 | |
| 2905 { // reject | |
| 2906 DataDescriptor d(factory->reject_string(), | |
| 2907 JSPromiseCapability::kRejectIndex, attrs, | |
| 2908 Representation::Tagged()); | |
| 2909 map->AppendDescriptor(&d); | |
| 2910 } | |
|
gsathya
2016/12/21 01:02:33
Honestly I feel like we could just use runtime cal
caitp
2016/12/21 21:01:13
To me, it seemed simpler to let it use in-object s
| |
| 2911 | |
| 2912 map->set_is_extensible(false); | |
| 2913 set_js_promise_capability_map(*map); | |
| 2914 } | |
| 2876 } | 2915 } |
| 2877 | 2916 |
| 2878 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { | 2917 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |
| 2879 switch (root_index) { | 2918 switch (root_index) { |
| 2880 case kNumberStringCacheRootIndex: | 2919 case kNumberStringCacheRootIndex: |
| 2881 case kInstanceofCacheFunctionRootIndex: | 2920 case kInstanceofCacheFunctionRootIndex: |
| 2882 case kInstanceofCacheMapRootIndex: | 2921 case kInstanceofCacheMapRootIndex: |
| 2883 case kInstanceofCacheAnswerRootIndex: | 2922 case kInstanceofCacheAnswerRootIndex: |
| 2884 case kCodeStubsRootIndex: | 2923 case kCodeStubsRootIndex: |
| 2885 case kEmptyScriptRootIndex: | 2924 case kEmptyScriptRootIndex: |
| (...skipping 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6499 } | 6538 } |
| 6500 | 6539 |
| 6501 | 6540 |
| 6502 // static | 6541 // static |
| 6503 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6542 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6504 return StaticVisitorBase::GetVisitorId(map); | 6543 return StaticVisitorBase::GetVisitorId(map); |
| 6505 } | 6544 } |
| 6506 | 6545 |
| 6507 } // namespace internal | 6546 } // namespace internal |
| 6508 } // namespace v8 | 6547 } // namespace v8 |
| OLD | NEW |