OLD | NEW |
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/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 Handle<JSFunction> map_iterator_function = InstallFunction( | 2122 Handle<JSFunction> map_iterator_function = InstallFunction( |
2123 builtins, "MapIterator", JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize, | 2123 builtins, "MapIterator", JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize, |
2124 isolate()->initial_object_prototype(), Builtins::kIllegal); | 2124 isolate()->initial_object_prototype(), Builtins::kIllegal); |
2125 native_context()->set_map_iterator_map( | 2125 native_context()->set_map_iterator_map( |
2126 map_iterator_function->initial_map()); | 2126 map_iterator_function->initial_map()); |
2127 } | 2127 } |
2128 | 2128 |
2129 { | 2129 { |
2130 // Create generator meta-objects and install them on the builtins object. | 2130 // Create generator meta-objects and install them on the builtins object. |
2131 Handle<JSObject> builtins(native_context()->builtins()); | 2131 Handle<JSObject> builtins(native_context()->builtins()); |
| 2132 Handle<JSObject> iterator_prototype = |
| 2133 factory()->NewJSObject(isolate()->object_function(), TENURED); |
2132 Handle<JSObject> generator_object_prototype = | 2134 Handle<JSObject> generator_object_prototype = |
2133 factory()->NewJSObject(isolate()->object_function(), TENURED); | 2135 factory()->NewJSObject(isolate()->object_function(), TENURED); |
2134 Handle<JSObject> generator_function_prototype = | 2136 Handle<JSObject> generator_function_prototype = |
2135 factory()->NewJSObject(isolate()->object_function(), TENURED); | 2137 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 2138 SetObjectPrototype(generator_object_prototype, iterator_prototype); |
| 2139 JSObject::AddProperty( |
| 2140 builtins, factory()->InternalizeUtf8String("$iteratorPrototype"), |
| 2141 iterator_prototype, |
| 2142 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); |
2136 JSObject::AddProperty( | 2143 JSObject::AddProperty( |
2137 builtins, | 2144 builtins, |
2138 factory()->InternalizeUtf8String("GeneratorFunctionPrototype"), | 2145 factory()->InternalizeUtf8String("GeneratorFunctionPrototype"), |
2139 generator_function_prototype, | 2146 generator_function_prototype, |
2140 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); | 2147 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); |
2141 | 2148 |
2142 JSObject::AddProperty( | 2149 JSObject::AddProperty( |
2143 generator_function_prototype, | 2150 generator_function_prototype, |
2144 factory()->InternalizeUtf8String("prototype"), | 2151 factory()->InternalizeUtf8String("prototype"), |
2145 generator_object_prototype, | 2152 generator_object_prototype, |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 return from + sizeof(NestingCounterType); | 3029 return from + sizeof(NestingCounterType); |
3023 } | 3030 } |
3024 | 3031 |
3025 | 3032 |
3026 // Called when the top-level V8 mutex is destroyed. | 3033 // Called when the top-level V8 mutex is destroyed. |
3027 void Bootstrapper::FreeThreadResources() { | 3034 void Bootstrapper::FreeThreadResources() { |
3028 DCHECK(!IsActive()); | 3035 DCHECK(!IsActive()); |
3029 } | 3036 } |
3030 | 3037 |
3031 } } // namespace v8::internal | 3038 } } // namespace v8::internal |
OLD | NEW |