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 <stdlib.h> | 7 #include <stdlib.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 DCHECK(args.length() == 4); | 482 DCHECK(args.length() == 4); |
483 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 483 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
484 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); | 484 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); |
485 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); | 485 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); |
486 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3); | 486 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3); |
487 | 487 |
488 return StoreKeyedToSuper(isolate, home_object, receiver, key, value, SLOPPY); | 488 return StoreKeyedToSuper(isolate, home_object, receiver, key, value, SLOPPY); |
489 } | 489 } |
490 | 490 |
491 | 491 |
492 RUNTIME_FUNCTION(Runtime_DefaultConstructorCallSuper) { | |
493 HandleScope scope(isolate); | |
494 DCHECK(args.length() == 2); | |
495 CONVERT_ARG_HANDLE_CHECKED(JSFunction, new_target, 0); | |
496 CONVERT_ARG_HANDLE_CHECKED(JSFunction, super_constructor, 1); | |
497 JavaScriptFrameIterator it(isolate); | |
498 | |
499 // Determine the actual arguments passed to the function. | |
500 int argument_count = 0; | |
501 base::SmartArrayPointer<Handle<Object>> arguments = | |
502 Runtime::GetCallerArguments(isolate, 0, &argument_count); | |
503 | |
504 Handle<Object> result; | |
505 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
506 isolate, result, Execution::New(isolate, super_constructor, new_target, | |
507 argument_count, arguments.get())); | |
508 | |
509 return *result; | |
510 } | |
511 | |
512 | |
513 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { | 492 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { |
514 SealHandleScope shs(isolate); | 493 SealHandleScope shs(isolate); |
515 DCHECK_EQ(1, args.length()); | 494 DCHECK_EQ(1, args.length()); |
516 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); | 495 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); |
517 return active_function->map()->prototype(); | 496 return active_function->map()->prototype(); |
518 } | 497 } |
519 | 498 |
520 } // namespace internal | 499 } // namespace internal |
521 } // namespace v8 | 500 } // namespace v8 |
OLD | NEW |