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

Side by Side Diff: src/factory.cc

Issue 2625093005: [modules] Define @@toStringTag on namespace object as a field. (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 | « src/bootstrapper.cc ('k') | src/objects.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 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 elms = NewFixedArrayWithHoles(capacity); 1877 elms = NewFixedArrayWithHoles(capacity);
1878 } 1878 }
1879 } 1879 }
1880 1880
1881 array->set_elements(*elms); 1881 array->set_elements(*elms);
1882 array->set_length(Smi::FromInt(length)); 1882 array->set_length(Smi::FromInt(length));
1883 } 1883 }
1884 1884
1885 Handle<JSModuleNamespace> Factory::NewJSModuleNamespace() { 1885 Handle<JSModuleNamespace> Factory::NewJSModuleNamespace() {
1886 Handle<Map> map = isolate()->js_module_namespace_map(); 1886 Handle<Map> map = isolate()->js_module_namespace_map();
1887 return Handle<JSModuleNamespace>::cast(NewJSObjectFromMap(map)); 1887 Handle<JSModuleNamespace> module_namespace(
1888 Handle<JSModuleNamespace>::cast(NewJSObjectFromMap(map)));
1889 FieldIndex index = FieldIndex::ForDescriptor(
1890 *map, JSModuleNamespace::kToStringTagFieldIndex);
1891 Handle<String> to_string_value = NewStringFromAsciiChecked("Module");
1892 module_namespace->FastPropertyAtPut(index, *to_string_value);
1893 return module_namespace;
1888 } 1894 }
1889 1895
1890 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( 1896 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1891 Handle<JSFunction> function) { 1897 Handle<JSFunction> function) {
1892 DCHECK(IsResumableFunction(function->shared()->kind())); 1898 DCHECK(IsResumableFunction(function->shared()->kind()));
1893 JSFunction::EnsureHasInitialMap(function); 1899 JSFunction::EnsureHasInitialMap(function);
1894 Handle<Map> map(function->initial_map()); 1900 Handle<Map> map(function->initial_map());
1895 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); 1901 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type());
1896 CALL_HEAP_FUNCTION( 1902 CALL_HEAP_FUNCTION(
1897 isolate(), 1903 isolate(),
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 Handle<AccessorInfo> prototype = 2838 Handle<AccessorInfo> prototype =
2833 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2839 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2834 Descriptor d = Descriptor::AccessorConstant( 2840 Descriptor d = Descriptor::AccessorConstant(
2835 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2841 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2836 map->AppendDescriptor(&d); 2842 map->AppendDescriptor(&d);
2837 } 2843 }
2838 } 2844 }
2839 2845
2840 } // namespace internal 2846 } // namespace internal
2841 } // namespace v8 2847 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698