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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 699 |
700 DCHECK(function->context() == isolate->context()); | 700 DCHECK(function->context() == isolate->context()); |
701 int length = function->shared()->scope_info()->ContextLength(); | 701 int length = function->shared()->scope_info()->ContextLength(); |
702 return *isolate->factory()->NewFunctionContext(length, function); | 702 return *isolate->factory()->NewFunctionContext(length, function); |
703 } | 703 } |
704 | 704 |
705 | 705 |
706 RUNTIME_FUNCTION(Runtime_PushWithContext) { | 706 RUNTIME_FUNCTION(Runtime_PushWithContext) { |
707 HandleScope scope(isolate); | 707 HandleScope scope(isolate); |
708 DCHECK_EQ(2, args.length()); | 708 DCHECK_EQ(2, args.length()); |
709 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 709 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, extension_object, 0); |
710 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 1); | 710 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 1); |
711 Handle<JSReceiver> extension_object; | |
712 if (!Object::ToObject(isolate, value).ToHandle(&extension_object)) { | |
713 THROW_NEW_ERROR_RETURN_FAILURE( | |
714 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); | |
715 } | |
716 Handle<Context> current(isolate->context()); | 711 Handle<Context> current(isolate->context()); |
717 Handle<Context> context = | 712 Handle<Context> context = |
718 isolate->factory()->NewWithContext(function, current, extension_object); | 713 isolate->factory()->NewWithContext(function, current, extension_object); |
719 isolate->set_context(*context); | 714 isolate->set_context(*context); |
720 return *context; | 715 return *context; |
721 } | 716 } |
722 | 717 |
723 | 718 |
724 RUNTIME_FUNCTION(Runtime_PushCatchContext) { | 719 RUNTIME_FUNCTION(Runtime_PushCatchContext) { |
725 HandleScope scope(isolate); | 720 HandleScope scope(isolate); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 | 1128 |
1134 // Lookup in the initial Object.prototype object. | 1129 // Lookup in the initial Object.prototype object. |
1135 Handle<Object> result; | 1130 Handle<Object> result; |
1136 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1131 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1137 isolate, result, | 1132 isolate, result, |
1138 Object::GetProperty(isolate->initial_object_prototype(), key)); | 1133 Object::GetProperty(isolate->initial_object_prototype(), key)); |
1139 return *result; | 1134 return *result; |
1140 } | 1135 } |
1141 } // namespace internal | 1136 } // namespace internal |
1142 } // namespace v8 | 1137 } // namespace v8 |
OLD | NEW |