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

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: Add TODO contact and bug URL 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(
2065 generator_object_prototype, Builtins::kIllegal); 2065 builtins,
2066 factory()->InternalizeUtf8String("GeneratorFunctionPrototype"),
2067 generator_function_prototype,
2068 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY));
2069
2070 JSObject::AddProperty(
2071 generator_function_prototype,
2072 factory()->InternalizeUtf8String("prototype"),
2073 generator_object_prototype,
2074 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2075
2066 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE, 2076 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE,
2067 JSFunction::kSize, generator_function_prototype, 2077 JSFunction::kSize, generator_function_prototype,
2068 Builtins::kIllegal); 2078 Builtins::kIllegal);
2069 2079
2070 // Create maps for generator functions and their prototypes. Store those 2080 // Create maps for generator functions and their prototypes. Store those
2071 // maps in the native context. 2081 // maps in the native context.
2072 Handle<Map> generator_function_map = 2082 Handle<Map> generator_function_map =
2073 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction"); 2083 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction");
2074 generator_function_map->SetPrototype(generator_function_prototype); 2084 generator_function_map->SetPrototype(generator_function_prototype);
2075 native_context()->set_sloppy_generator_function_map( 2085 native_context()->set_sloppy_generator_function_map(
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2952 return from + sizeof(NestingCounterType); 2962 return from + sizeof(NestingCounterType);
2953 } 2963 }
2954 2964
2955 2965
2956 // Called when the top-level V8 mutex is destroyed. 2966 // Called when the top-level V8 mutex is destroyed.
2957 void Bootstrapper::FreeThreadResources() { 2967 void Bootstrapper::FreeThreadResources() {
2958 DCHECK(!IsActive()); 2968 DCHECK(!IsActive());
2959 } 2969 }
2960 2970
2961 } } // namespace v8::internal 2971 } } // 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