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/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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void SetFunctionInstanceDescriptor(Handle<Map> map, | 280 void SetFunctionInstanceDescriptor(Handle<Map> map, |
281 FunctionMode function_mode); | 281 FunctionMode function_mode); |
282 void MakeFunctionInstancePrototypeWritable(); | 282 void MakeFunctionInstancePrototypeWritable(); |
283 | 283 |
284 Handle<Map> CreateStrictFunctionMap(FunctionMode function_mode, | 284 Handle<Map> CreateStrictFunctionMap(FunctionMode function_mode, |
285 Handle<JSFunction> empty_function); | 285 Handle<JSFunction> empty_function); |
286 | 286 |
287 | 287 |
288 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 288 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
289 FunctionMode function_mode); | 289 FunctionMode function_mode); |
290 void SetStrongFunctionInstanceDescriptor(Handle<Map> map); | |
291 | 290 |
292 static bool CallUtilsFunction(Isolate* isolate, const char* name); | 291 static bool CallUtilsFunction(Isolate* isolate, const char* name); |
293 | 292 |
294 static bool CompileExtension(Isolate* isolate, v8::Extension* extension); | 293 static bool CompileExtension(Isolate* isolate, v8::Extension* extension); |
295 | 294 |
296 Isolate* isolate_; | 295 Isolate* isolate_; |
297 Handle<Context> result_; | 296 Handle<Context> result_; |
298 Handle<Context> native_context_; | 297 Handle<Context> native_context_; |
299 | 298 |
300 // Function maps. Function maps are created initially with a read only | 299 // Function maps. Function maps are created initially with a read only |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 : ro_attribs; | 620 : ro_attribs; |
622 Handle<AccessorInfo> prototype = | 621 Handle<AccessorInfo> prototype = |
623 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 622 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
624 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 623 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
625 prototype, attribs); | 624 prototype, attribs); |
626 map->AppendDescriptor(&d); | 625 map->AppendDescriptor(&d); |
627 } | 626 } |
628 } | 627 } |
629 | 628 |
630 | 629 |
631 void Genesis::SetStrongFunctionInstanceDescriptor(Handle<Map> map) { | |
632 Map::EnsureDescriptorSlack(map, 2); | |
633 | |
634 PropertyAttributes ro_attribs = | |
635 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | |
636 | |
637 Handle<AccessorInfo> length = | |
638 Accessors::FunctionLengthInfo(isolate(), ro_attribs); | |
639 { // Add length. | |
640 AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())), | |
641 length, ro_attribs); | |
642 map->AppendDescriptor(&d); | |
643 } | |
644 Handle<AccessorInfo> name = | |
645 Accessors::FunctionNameInfo(isolate(), ro_attribs); | |
646 { // Add name. | |
647 AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name, | |
648 ro_attribs); | |
649 map->AppendDescriptor(&d); | |
650 } | |
651 } | |
652 | |
653 | |
654 // Creates the %ThrowTypeError% function. | 630 // Creates the %ThrowTypeError% function. |
655 Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic( | 631 Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic( |
656 Builtins::Name builtin_name) { | 632 Builtins::Name builtin_name) { |
657 Handle<String> name = | 633 Handle<String> name = |
658 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); | 634 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); |
659 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); | 635 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); |
660 Handle<JSFunction> function = | 636 Handle<JSFunction> function = |
661 factory()->NewFunctionWithoutPrototype(name, code); | 637 factory()->NewFunctionWithoutPrototype(name, code); |
662 function->shared()->DontAdaptArguments(); | 638 function->shared()->DontAdaptArguments(); |
663 | 639 |
(...skipping 2990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 } | 3630 } |
3655 | 3631 |
3656 | 3632 |
3657 // Called when the top-level V8 mutex is destroyed. | 3633 // Called when the top-level V8 mutex is destroyed. |
3658 void Bootstrapper::FreeThreadResources() { | 3634 void Bootstrapper::FreeThreadResources() { |
3659 DCHECK(!IsActive()); | 3635 DCHECK(!IsActive()); |
3660 } | 3636 } |
3661 | 3637 |
3662 } // namespace internal | 3638 } // namespace internal |
3663 } // namespace v8 | 3639 } // namespace v8 |
OLD | NEW |