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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 native_context()->set_initial_object_prototype(*object_function_prototype); | 495 native_context()->set_initial_object_prototype(*object_function_prototype); |
496 // For bootstrapping set the array prototype to be the same as the object | 496 // For bootstrapping set the array prototype to be the same as the object |
497 // prototype, otherwise the missing initial_array_prototype will cause | 497 // prototype, otherwise the missing initial_array_prototype will cause |
498 // assertions during startup. | 498 // assertions during startup. |
499 native_context()->set_initial_array_prototype(*object_function_prototype); | 499 native_context()->set_initial_array_prototype(*object_function_prototype); |
500 Accessors::FunctionSetPrototype(object_fun, object_function_prototype) | 500 Accessors::FunctionSetPrototype(object_fun, object_function_prototype) |
501 .Assert(); | 501 .Assert(); |
502 } | 502 } |
503 | 503 |
504 // Allocate the empty function as the prototype for function ECMAScript | 504 // Allocate the empty function as the prototype for function - ES6 19.2.3 |
505 // 262 15.3.4. | |
506 Handle<String> empty_string = | |
507 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty")); | |
508 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); | 505 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); |
509 Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype( | 506 Handle<JSFunction> empty_function = |
510 empty_string, code); | 507 factory->NewFunctionWithoutPrototype(factory->empty_string(), code); |
511 | 508 |
512 // Allocate the function map first and then patch the prototype later | 509 // Allocate the function map first and then patch the prototype later |
513 Handle<Map> empty_function_map = | 510 Handle<Map> empty_function_map = |
514 CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 511 CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); |
515 DCHECK(!empty_function_map->is_dictionary_map()); | 512 DCHECK(!empty_function_map->is_dictionary_map()); |
516 Map::SetPrototype(empty_function_map, object_function_prototype); | 513 Map::SetPrototype(empty_function_map, object_function_prototype); |
517 empty_function_map->set_is_prototype_map(true); | 514 empty_function_map->set_is_prototype_map(true); |
518 | 515 |
519 empty_function->set_map(*empty_function_map); | 516 empty_function->set_map(*empty_function_map); |
520 | 517 |
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 return from + sizeof(NestingCounterType); | 2957 return from + sizeof(NestingCounterType); |
2961 } | 2958 } |
2962 | 2959 |
2963 | 2960 |
2964 // Called when the top-level V8 mutex is destroyed. | 2961 // Called when the top-level V8 mutex is destroyed. |
2965 void Bootstrapper::FreeThreadResources() { | 2962 void Bootstrapper::FreeThreadResources() { |
2966 DCHECK(!IsActive()); | 2963 DCHECK(!IsActive()); |
2967 } | 2964 } |
2968 | 2965 |
2969 } } // namespace v8::internal | 2966 } } // namespace v8::internal |
OLD | NEW |