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

Side by Side Diff: src/bootstrapper.cc

Issue 1530213002: Make generators non-constructable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove broken tests Created 5 years 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/globals.h » ('j') | test/mjsunit/es6/generators-iteration.js » ('J')
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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 814 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
815 815
816 // Create maps for generator functions and their prototypes. Store those 816 // Create maps for generator functions and their prototypes. Store those
817 // maps in the native context. The "prototype" property descriptor is 817 // maps in the native context. The "prototype" property descriptor is
818 // writable, non-enumerable, and non-configurable (as per ES6 draft 818 // writable, non-enumerable, and non-configurable (as per ES6 draft
819 // 04-14-15, section 25.2.4.3). 819 // 04-14-15, section 25.2.4.3).
820 Handle<Map> strict_function_map(strict_function_map_writable_prototype_); 820 Handle<Map> strict_function_map(strict_function_map_writable_prototype_);
821 // Generator functions do not have "caller" or "arguments" accessors. 821 // Generator functions do not have "caller" or "arguments" accessors.
822 Handle<Map> sloppy_generator_function_map = 822 Handle<Map> sloppy_generator_function_map =
823 Map::Copy(strict_function_map, "SloppyGeneratorFunction"); 823 Map::Copy(strict_function_map, "SloppyGeneratorFunction");
824 sloppy_generator_function_map->set_is_constructor(false);
824 Map::SetPrototype(sloppy_generator_function_map, 825 Map::SetPrototype(sloppy_generator_function_map,
825 generator_function_prototype); 826 generator_function_prototype);
826 native_context()->set_sloppy_generator_function_map( 827 native_context()->set_sloppy_generator_function_map(
827 *sloppy_generator_function_map); 828 *sloppy_generator_function_map);
828 829
829 Handle<Map> strict_generator_function_map = 830 Handle<Map> strict_generator_function_map =
830 Map::Copy(strict_function_map, "StrictGeneratorFunction"); 831 Map::Copy(strict_function_map, "StrictGeneratorFunction");
832 strict_generator_function_map->set_is_constructor(false);
831 Map::SetPrototype(strict_generator_function_map, 833 Map::SetPrototype(strict_generator_function_map,
832 generator_function_prototype); 834 generator_function_prototype);
833 native_context()->set_strict_generator_function_map( 835 native_context()->set_strict_generator_function_map(
834 *strict_generator_function_map); 836 *strict_generator_function_map);
835 837
836 Handle<Map> strong_function_map(native_context()->strong_function_map()); 838 Handle<Map> strong_function_map(native_context()->strong_function_map());
837 Handle<Map> strong_generator_function_map = 839 Handle<Map> strong_generator_function_map =
838 Map::Copy(strong_function_map, "StrongGeneratorFunction"); 840 Map::Copy(strong_function_map, "StrongGeneratorFunction");
841 strong_generator_function_map->set_is_constructor(false);
839 Map::SetPrototype(strong_generator_function_map, 842 Map::SetPrototype(strong_generator_function_map,
840 generator_function_prototype); 843 generator_function_prototype);
841 native_context()->set_strong_generator_function_map( 844 native_context()->set_strong_generator_function_map(
842 *strong_generator_function_map); 845 *strong_generator_function_map);
843 846
844 Handle<JSFunction> object_function(native_context()->object_function()); 847 Handle<JSFunction> object_function(native_context()->object_function());
845 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); 848 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0);
846 Map::SetPrototype(generator_object_prototype_map, generator_object_prototype); 849 Map::SetPrototype(generator_object_prototype_map, generator_object_prototype);
847 native_context()->set_generator_object_prototype_map( 850 native_context()->set_generator_object_prototype_map(
848 *generator_object_prototype_map); 851 *generator_object_prototype_map);
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 } 3366 }
3364 3367
3365 3368
3366 // Called when the top-level V8 mutex is destroyed. 3369 // Called when the top-level V8 mutex is destroyed.
3367 void Bootstrapper::FreeThreadResources() { 3370 void Bootstrapper::FreeThreadResources() {
3368 DCHECK(!IsActive()); 3371 DCHECK(!IsActive());
3369 } 3372 }
3370 3373
3371 } // namespace internal 3374 } // namespace internal
3372 } // namespace v8 3375 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/globals.h » ('j') | test/mjsunit/es6/generators-iteration.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698