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

Side by Side Diff: src/factory.cc

Issue 2631223002: [modules] Fix NewJSModuleNamespace to avoid GC being able to see incomplete JSModuleNamespace. (Closed)
Patch Set: 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 | « no previous file | src/heap-symbols.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/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 array->set_elements(*elms); 1846 array->set_elements(*elms);
1847 array->set_length(Smi::FromInt(length)); 1847 array->set_length(Smi::FromInt(length));
1848 } 1848 }
1849 1849
1850 Handle<JSModuleNamespace> Factory::NewJSModuleNamespace() { 1850 Handle<JSModuleNamespace> Factory::NewJSModuleNamespace() {
1851 Handle<Map> map = isolate()->js_module_namespace_map(); 1851 Handle<Map> map = isolate()->js_module_namespace_map();
1852 Handle<JSModuleNamespace> module_namespace( 1852 Handle<JSModuleNamespace> module_namespace(
1853 Handle<JSModuleNamespace>::cast(NewJSObjectFromMap(map))); 1853 Handle<JSModuleNamespace>::cast(NewJSObjectFromMap(map)));
1854 FieldIndex index = FieldIndex::ForDescriptor( 1854 FieldIndex index = FieldIndex::ForDescriptor(
1855 *map, JSModuleNamespace::kToStringTagFieldIndex); 1855 *map, JSModuleNamespace::kToStringTagFieldIndex);
1856 Handle<String> to_string_value = NewStringFromAsciiChecked("Module"); 1856 module_namespace->FastPropertyAtPut(index,
1857 module_namespace->FastPropertyAtPut(index, *to_string_value); 1857 isolate()->heap()->Module_string());
1858 return module_namespace; 1858 return module_namespace;
1859 } 1859 }
1860 1860
1861 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( 1861 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1862 Handle<JSFunction> function) { 1862 Handle<JSFunction> function) {
1863 DCHECK(IsResumableFunction(function->shared()->kind())); 1863 DCHECK(IsResumableFunction(function->shared()->kind()));
1864 JSFunction::EnsureHasInitialMap(function); 1864 JSFunction::EnsureHasInitialMap(function);
1865 Handle<Map> map(function->initial_map()); 1865 Handle<Map> map(function->initial_map());
1866 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); 1866 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type());
1867 CALL_HEAP_FUNCTION( 1867 CALL_HEAP_FUNCTION(
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 Handle<AccessorInfo> prototype = 2803 Handle<AccessorInfo> prototype =
2804 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2804 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2805 Descriptor d = Descriptor::AccessorConstant( 2805 Descriptor d = Descriptor::AccessorConstant(
2806 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2806 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2807 map->AppendDescriptor(&d); 2807 map->AppendDescriptor(&d);
2808 } 2808 }
2809 } 2809 }
2810 2810
2811 } // namespace internal 2811 } // namespace internal
2812 } // namespace v8 2812 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698