| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 Handle<String> name = | 666 Handle<String> name = |
| 667 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); | 667 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); |
| 668 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); | 668 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); |
| 669 Handle<JSFunction> function = | 669 Handle<JSFunction> function = |
| 670 factory()->NewFunctionWithoutPrototype(name, code); | 670 factory()->NewFunctionWithoutPrototype(name, code); |
| 671 function->set_map(native_context()->sloppy_function_map()); | 671 function->set_map(native_context()->sloppy_function_map()); |
| 672 function->shared()->DontAdaptArguments(); | 672 function->shared()->DontAdaptArguments(); |
| 673 | 673 |
| 674 // %ThrowTypeError% must not have a name property. | 674 // %ThrowTypeError% must not have a name property. |
| 675 if (JSReceiver::DeleteProperty(function, factory()->name_string()) | 675 if (JSReceiver::DeleteProperty(function, factory()->name_string()) |
| 676 .IsNothing()) | 676 .IsNothing()) { |
| 677 DCHECK(false); | 677 DCHECK(false); |
| 678 } |
| 678 | 679 |
| 679 // length needs to be non configurable. | 680 // length needs to be non configurable. |
| 680 Handle<Object> value(Smi::FromInt(function->shared()->length()), isolate()); | 681 Handle<Object> value(Smi::FromInt(function->shared()->length()), isolate()); |
| 681 JSObject::SetOwnPropertyIgnoreAttributes( | 682 JSObject::SetOwnPropertyIgnoreAttributes( |
| 682 function, factory()->length_string(), value, | 683 function, factory()->length_string(), value, |
| 683 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)) | 684 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)) |
| 684 .Assert(); | 685 .Assert(); |
| 685 | 686 |
| 686 if (JSObject::PreventExtensions(function, Object::THROW_ON_ERROR).IsNothing()) | 687 if (JSObject::PreventExtensions(function, Object::THROW_ON_ERROR) |
| 688 .IsNothing()) { |
| 687 DCHECK(false); | 689 DCHECK(false); |
| 690 } |
| 688 | 691 |
| 689 return function; | 692 return function; |
| 690 } | 693 } |
| 691 | 694 |
| 692 | 695 |
| 693 // ECMAScript 5th Edition, 13.2.3 | 696 // ECMAScript 5th Edition, 13.2.3 |
| 694 Handle<JSFunction> Genesis::GetRestrictedFunctionPropertiesThrower() { | 697 Handle<JSFunction> Genesis::GetRestrictedFunctionPropertiesThrower() { |
| 695 if (restricted_function_properties_thrower_.is_null()) { | 698 if (restricted_function_properties_thrower_.is_null()) { |
| 696 restricted_function_properties_thrower_ = GetThrowTypeErrorIntrinsic( | 699 restricted_function_properties_thrower_ = GetThrowTypeErrorIntrinsic( |
| 697 Builtins::kRestrictedFunctionPropertiesThrower); | 700 Builtins::kRestrictedFunctionPropertiesThrower); |
| (...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3289 } | 3292 } |
| 3290 | 3293 |
| 3291 | 3294 |
| 3292 // Called when the top-level V8 mutex is destroyed. | 3295 // Called when the top-level V8 mutex is destroyed. |
| 3293 void Bootstrapper::FreeThreadResources() { | 3296 void Bootstrapper::FreeThreadResources() { |
| 3294 DCHECK(!IsActive()); | 3297 DCHECK(!IsActive()); |
| 3295 } | 3298 } |
| 3296 | 3299 |
| 3297 } // namespace internal | 3300 } // namespace internal |
| 3298 } // namespace v8 | 3301 } // namespace v8 |
| OLD | NEW |