| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); | 1049 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor); | 1052 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor); |
| 1053 | 1053 |
| 1054 CHECK(original_constructor->IsJSFunction()); | 1054 CHECK(original_constructor->IsJSFunction()); |
| 1055 Handle<JSFunction> original_function = | 1055 Handle<JSFunction> original_function = |
| 1056 Handle<JSFunction>::cast(original_constructor); | 1056 Handle<JSFunction>::cast(original_constructor); |
| 1057 | 1057 |
| 1058 | 1058 |
| 1059 // Check that function is a constructor. | 1059 // If function should not have prototype, construction is not allowed. In this |
| 1060 if (!function->IsConstructor()) { | 1060 // case generated code bailouts here, since function has no initial_map. |
| 1061 if (!function->should_have_prototype() && !function->shared()->bound()) { |
| 1061 THROW_NEW_ERROR_RETURN_FAILURE( | 1062 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1062 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); | 1063 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); |
| 1063 } | 1064 } |
| 1064 | 1065 |
| 1065 Debug* debug = isolate->debug(); | 1066 Debug* debug = isolate->debug(); |
| 1066 // Handle stepping into constructors if step into is active. | 1067 // Handle stepping into constructors if step into is active. |
| 1067 if (debug->StepInActive()) debug->HandleStepIn(function, true); | 1068 if (debug->StepInActive()) debug->HandleStepIn(function, true); |
| 1068 | 1069 |
| 1069 if (function->has_initial_map()) { | 1070 if (function->has_initial_map()) { |
| 1070 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { | 1071 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { | 1610 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { |
| 1610 SealHandleScope shs(isolate); | 1611 SealHandleScope shs(isolate); |
| 1611 DCHECK_EQ(1, args.length()); | 1612 DCHECK_EQ(1, args.length()); |
| 1612 CONVERT_ARG_CHECKED(Object, object, 0); | 1613 CONVERT_ARG_CHECKED(Object, object, 0); |
| 1613 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); | 1614 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 | 1617 |
| 1617 } // namespace internal | 1618 } // namespace internal |
| 1618 } // namespace v8 | 1619 } // namespace v8 |
| OLD | NEW |