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

Side by Side Diff: src/bootstrapper.cc

Issue 1062633002: Re-implement %Generator% intrinsic as an object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Correct code style inconsistencies Created 5 years, 8 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/generator.js » ('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/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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 isolate()->initial_object_prototype(), Builtins::kIllegal); 2052 isolate()->initial_object_prototype(), Builtins::kIllegal);
2053 native_context()->set_map_iterator_map( 2053 native_context()->set_map_iterator_map(
2054 map_iterator_function->initial_map()); 2054 map_iterator_function->initial_map());
2055 } 2055 }
2056 2056
2057 { 2057 {
2058 // Create generator meta-objects and install them on the builtins object. 2058 // Create generator meta-objects and install them on the builtins object.
2059 Handle<JSObject> builtins(native_context()->builtins()); 2059 Handle<JSObject> builtins(native_context()->builtins());
2060 Handle<JSObject> generator_object_prototype = 2060 Handle<JSObject> generator_object_prototype =
2061 factory()->NewJSObject(isolate()->object_function(), TENURED); 2061 factory()->NewJSObject(isolate()->object_function(), TENURED);
2062 Handle<JSFunction> generator_function_prototype = 2062 Handle<JSObject> generator_function_prototype =
2063 InstallFunction(builtins, "GeneratorFunctionPrototype", 2063 factory()->NewJSObject(isolate()->object_function(), TENURED);
2064 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 2064 JSObject::AddProperty(builtins,
2065 generator_object_prototype, Builtins::kIllegal); 2065 factory()->InternalizeUtf8String("GeneratorFunctionPrototype"),
caitp (gmail) 2015/04/06 16:31:24 I think clang-format will complain about this inde
2066 generator_function_prototype,
2067 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY));
2068
2069 JSObject::AddProperty(generator_function_prototype,
2070 factory()->InternalizeUtf8String("prototype"),
2071 generator_object_prototype,
2072 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2073
2066 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE, 2074 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE,
2067 JSFunction::kSize, generator_function_prototype, 2075 JSFunction::kSize, generator_function_prototype,
2068 Builtins::kIllegal); 2076 Builtins::kIllegal);
2069 2077
2070 // Create maps for generator functions and their prototypes. Store those 2078 // Create maps for generator functions and their prototypes. Store those
2071 // maps in the native context. 2079 // maps in the native context.
2072 Handle<Map> generator_function_map = 2080 Handle<Map> generator_function_map =
2073 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction"); 2081 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction");
2074 generator_function_map->SetPrototype(generator_function_prototype); 2082 generator_function_map->SetPrototype(generator_function_prototype);
2075 native_context()->set_sloppy_generator_function_map( 2083 native_context()->set_sloppy_generator_function_map(
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2952 return from + sizeof(NestingCounterType); 2960 return from + sizeof(NestingCounterType);
2953 } 2961 }
2954 2962
2955 2963
2956 // Called when the top-level V8 mutex is destroyed. 2964 // Called when the top-level V8 mutex is destroyed.
2957 void Bootstrapper::FreeThreadResources() { 2965 void Bootstrapper::FreeThreadResources() {
2958 DCHECK(!IsActive()); 2966 DCHECK(!IsActive());
2959 } 2967 }
2960 2968
2961 } } // namespace v8::internal 2969 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698