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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 CHECK(new_target->IsJSFunction()); | 997 CHECK(new_target->IsJSFunction()); |
998 Handle<JSFunction> original_function = Handle<JSFunction>::cast(new_target); | 998 Handle<JSFunction> original_function = Handle<JSFunction>::cast(new_target); |
999 | 999 |
1000 | 1000 |
1001 // Check that function is a constructor. | 1001 // Check that function is a constructor. |
1002 if (!function->IsConstructor()) { | 1002 if (!function->IsConstructor()) { |
1003 THROW_NEW_ERROR_RETURN_FAILURE( | 1003 THROW_NEW_ERROR_RETURN_FAILURE( |
1004 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); | 1004 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor)); |
1005 } | 1005 } |
1006 | 1006 |
1007 Debug* debug = isolate->debug(); | |
1008 // Handle stepping into constructors if step into is active. | |
1009 if (debug->StepInActive()) debug->HandleStepIn(function, true); | |
1010 | |
1011 // The function should be compiled for the optimization hints to be | 1007 // The function should be compiled for the optimization hints to be |
1012 // available. | 1008 // available. |
1013 Compiler::Compile(function, CLEAR_EXCEPTION); | 1009 Compiler::Compile(function, CLEAR_EXCEPTION); |
1014 | 1010 |
1015 JSFunction::EnsureHasInitialMap(function); | 1011 JSFunction::EnsureHasInitialMap(function); |
1016 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { | 1012 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { |
1017 // The 'Function' function ignores the receiver object when | 1013 // The 'Function' function ignores the receiver object when |
1018 // called using 'new' and creates a new JSFunction object that | 1014 // called using 'new' and creates a new JSFunction object that |
1019 // is returned. | 1015 // is returned. |
1020 return isolate->heap()->undefined_value(); | 1016 return isolate->heap()->undefined_value(); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 | 1563 |
1568 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1564 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1569 HandleScope scope(isolate); | 1565 HandleScope scope(isolate); |
1570 DCHECK(args.length() == 2); | 1566 DCHECK(args.length() == 2); |
1571 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1567 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1572 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1568 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1573 return JSReceiver::DefineProperties(isolate, o, properties); | 1569 return JSReceiver::DefineProperties(isolate, o, properties); |
1574 } | 1570 } |
1575 } // namespace internal | 1571 } // namespace internal |
1576 } // namespace v8 | 1572 } // namespace v8 |
OLD | NEW |