| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // Later the map is replaced with writable prototype map, allocated below. | 671 // Later the map is replaced with writable prototype map, allocated below. |
| 671 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( | 672 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( |
| 672 FUNCTION_WITH_READONLY_PROTOTYPE, empty); | 673 FUNCTION_WITH_READONLY_PROTOTYPE, empty); |
| 673 native_context()->set_strict_function_map(*strict_function_map); | 674 native_context()->set_strict_function_map(*strict_function_map); |
| 674 | 675 |
| 675 // The final map for the strict mode functions. Writeable prototype. | 676 // The final map for the strict mode functions. Writeable prototype. |
| 676 // This map is installed in MakeFunctionInstancePrototypeWritable. | 677 // This map is installed in MakeFunctionInstancePrototypeWritable. |
| 677 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( | 678 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( |
| 678 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); | 679 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); |
| 679 | 680 |
| 681 // Allocate map for classes |
| 682 class_function_map_ = factory()->CreateClassFunctionMap(empty); |
| 683 native_context()->set_class_function_map(*class_function_map_); |
| 684 |
| 680 // Now that the strict mode function map is available, set up the | 685 // Now that the strict mode function map is available, set up the |
| 681 // restricted "arguments" and "caller" getters. | 686 // restricted "arguments" and "caller" getters. |
| 682 AddRestrictedFunctionProperties(empty); | 687 AddRestrictedFunctionProperties(empty); |
| 683 } | 688 } |
| 684 | 689 |
| 685 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { | 690 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { |
| 686 // Create iterator-related meta-objects. | 691 // Create iterator-related meta-objects. |
| 687 Handle<JSObject> iterator_prototype = | 692 Handle<JSObject> iterator_prototype = |
| 688 factory()->NewJSObject(isolate()->object_function(), TENURED); | 693 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 689 | 694 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 | 1258 |
| 1254 // Set the length for the function to satisfy ECMA-262. | 1259 // Set the length for the function to satisfy ECMA-262. |
| 1255 has_instance->shared()->set_length(1); | 1260 has_instance->shared()->set_length(1); |
| 1256 | 1261 |
| 1257 // Install the "constructor" property on the %FunctionPrototype%. | 1262 // Install the "constructor" property on the %FunctionPrototype%. |
| 1258 JSObject::AddProperty(prototype, factory->constructor_string(), | 1263 JSObject::AddProperty(prototype, factory->constructor_string(), |
| 1259 function_fun, DONT_ENUM); | 1264 function_fun, DONT_ENUM); |
| 1260 | 1265 |
| 1261 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); | 1266 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); |
| 1262 strict_function_map_writable_prototype_->SetConstructor(*function_fun); | 1267 strict_function_map_writable_prototype_->SetConstructor(*function_fun); |
| 1268 class_function_map_->SetConstructor(*function_fun); |
| 1263 } | 1269 } |
| 1264 | 1270 |
| 1265 { // --- A r r a y --- | 1271 { // --- A r r a y --- |
| 1266 Handle<JSFunction> array_function = | 1272 Handle<JSFunction> array_function = |
| 1267 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, | 1273 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, |
| 1268 isolate->initial_object_prototype(), | 1274 isolate->initial_object_prototype(), |
| 1269 Builtins::kArrayCode); | 1275 Builtins::kArrayCode); |
| 1270 array_function->shared()->DontAdaptArguments(); | 1276 array_function->shared()->DontAdaptArguments(); |
| 1271 array_function->shared()->set_builtin_function_id(kArrayCode); | 1277 array_function->shared()->set_builtin_function_id(kArrayCode); |
| 1272 | 1278 |
| (...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4579 } | 4585 } |
| 4580 | 4586 |
| 4581 | 4587 |
| 4582 // Called when the top-level V8 mutex is destroyed. | 4588 // Called when the top-level V8 mutex is destroyed. |
| 4583 void Bootstrapper::FreeThreadResources() { | 4589 void Bootstrapper::FreeThreadResources() { |
| 4584 DCHECK(!IsActive()); | 4590 DCHECK(!IsActive()); |
| 4585 } | 4591 } |
| 4586 | 4592 |
| 4587 } // namespace internal | 4593 } // namespace internal |
| 4588 } // namespace v8 | 4594 } // namespace v8 |
| OLD | NEW |