| 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/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 Handle<Context> result_; | 286 Handle<Context> result_; |
| 287 Handle<Context> native_context_; | 287 Handle<Context> native_context_; |
| 288 Handle<JSGlobalProxy> global_proxy_; | 288 Handle<JSGlobalProxy> global_proxy_; |
| 289 | 289 |
| 290 // Function maps. Function maps are created initially with a read only | 290 // Function maps. Function maps are created initially with a read only |
| 291 // prototype for the processing of JS builtins. Later the function maps are | 291 // prototype for the processing of JS builtins. Later the function maps are |
| 292 // replaced in order to make prototype writable. These are the final, writable | 292 // replaced in order to make prototype writable. These are the final, writable |
| 293 // prototype, maps. | 293 // prototype, maps. |
| 294 Handle<Map> sloppy_function_map_writable_prototype_; | 294 Handle<Map> sloppy_function_map_writable_prototype_; |
| 295 Handle<Map> strict_function_map_writable_prototype_; | 295 Handle<Map> strict_function_map_writable_prototype_; |
| 296 Handle<Map> class_function_map_; |
| 296 Handle<JSFunction> strict_poison_function_; | 297 Handle<JSFunction> strict_poison_function_; |
| 297 Handle<JSFunction> restricted_function_properties_thrower_; | 298 Handle<JSFunction> restricted_function_properties_thrower_; |
| 298 | 299 |
| 299 BootstrapperActive active_; | 300 BootstrapperActive active_; |
| 300 friend class Bootstrapper; | 301 friend class Bootstrapper; |
| 301 }; | 302 }; |
| 302 | 303 |
| 303 | 304 |
| 304 void Bootstrapper::Iterate(ObjectVisitor* v) { | 305 void Bootstrapper::Iterate(ObjectVisitor* v) { |
| 305 extensions_cache_.Iterate(v); | 306 extensions_cache_.Iterate(v); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 // Later the map is replaced with writable prototype map, allocated below. | 645 // Later the map is replaced with writable prototype map, allocated below. |
| 645 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( | 646 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( |
| 646 FUNCTION_WITH_READONLY_PROTOTYPE, empty); | 647 FUNCTION_WITH_READONLY_PROTOTYPE, empty); |
| 647 native_context()->set_strict_function_map(*strict_function_map); | 648 native_context()->set_strict_function_map(*strict_function_map); |
| 648 | 649 |
| 649 // The final map for the strict mode functions. Writeable prototype. | 650 // The final map for the strict mode functions. Writeable prototype. |
| 650 // This map is installed in MakeFunctionInstancePrototypeWritable. | 651 // This map is installed in MakeFunctionInstancePrototypeWritable. |
| 651 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( | 652 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( |
| 652 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); | 653 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); |
| 653 | 654 |
| 655 // Allocate map for classes |
| 656 class_function_map_ = factory()->CreateClassFunctionMap(empty); |
| 657 native_context()->set_class_function_map(*class_function_map_); |
| 658 |
| 654 // Now that the strict mode function map is available, set up the | 659 // Now that the strict mode function map is available, set up the |
| 655 // restricted "arguments" and "caller" getters. | 660 // restricted "arguments" and "caller" getters. |
| 656 AddRestrictedFunctionProperties(empty); | 661 AddRestrictedFunctionProperties(empty); |
| 657 } | 662 } |
| 658 | 663 |
| 659 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { | 664 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { |
| 660 // Create iterator-related meta-objects. | 665 // Create iterator-related meta-objects. |
| 661 Handle<JSObject> iterator_prototype = | 666 Handle<JSObject> iterator_prototype = |
| 662 factory()->NewJSObject(isolate()->object_function(), TENURED); | 667 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 663 | 668 |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 | 1226 |
| 1222 // Set the length for the function to satisfy ECMA-262. | 1227 // Set the length for the function to satisfy ECMA-262. |
| 1223 has_instance->shared()->set_length(1); | 1228 has_instance->shared()->set_length(1); |
| 1224 | 1229 |
| 1225 // Install the "constructor" property on the %FunctionPrototype%. | 1230 // Install the "constructor" property on the %FunctionPrototype%. |
| 1226 JSObject::AddProperty(prototype, factory->constructor_string(), | 1231 JSObject::AddProperty(prototype, factory->constructor_string(), |
| 1227 function_fun, DONT_ENUM); | 1232 function_fun, DONT_ENUM); |
| 1228 | 1233 |
| 1229 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); | 1234 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); |
| 1230 strict_function_map_writable_prototype_->SetConstructor(*function_fun); | 1235 strict_function_map_writable_prototype_->SetConstructor(*function_fun); |
| 1236 class_function_map_->SetConstructor(*function_fun); |
| 1231 } | 1237 } |
| 1232 | 1238 |
| 1233 { // --- A r r a y --- | 1239 { // --- A r r a y --- |
| 1234 Handle<JSFunction> array_function = | 1240 Handle<JSFunction> array_function = |
| 1235 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, | 1241 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, |
| 1236 isolate->initial_object_prototype(), | 1242 isolate->initial_object_prototype(), |
| 1237 Builtins::kArrayCode); | 1243 Builtins::kArrayCode); |
| 1238 array_function->shared()->DontAdaptArguments(); | 1244 array_function->shared()->DontAdaptArguments(); |
| 1239 array_function->shared()->set_builtin_function_id(kArrayCode); | 1245 array_function->shared()->set_builtin_function_id(kArrayCode); |
| 1240 | 1246 |
| (...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4185 } | 4191 } |
| 4186 | 4192 |
| 4187 | 4193 |
| 4188 // Called when the top-level V8 mutex is destroyed. | 4194 // Called when the top-level V8 mutex is destroyed. |
| 4189 void Bootstrapper::FreeThreadResources() { | 4195 void Bootstrapper::FreeThreadResources() { |
| 4190 DCHECK(!IsActive()); | 4196 DCHECK(!IsActive()); |
| 4191 } | 4197 } |
| 4192 | 4198 |
| 4193 } // namespace internal | 4199 } // namespace internal |
| 4194 } // namespace v8 | 4200 } // namespace v8 |
| OLD | NEW |