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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 RUNTIME_FUNCTION(Runtime_ThrowIfStaticPrototype) { | 68 RUNTIME_FUNCTION(Runtime_ThrowIfStaticPrototype) { |
69 HandleScope scope(isolate); | 69 HandleScope scope(isolate); |
70 DCHECK(args.length() == 1); | 70 DCHECK(args.length() == 1); |
71 CONVERT_ARG_HANDLE_CHECKED(Name, name, 0); | 71 CONVERT_ARG_HANDLE_CHECKED(Name, name, 0); |
72 if (Name::Equals(name, isolate->factory()->prototype_string())) { | 72 if (Name::Equals(name, isolate->factory()->prototype_string())) { |
73 return ThrowStaticPrototypeError(isolate); | 73 return ThrowStaticPrototypeError(isolate); |
74 } | 74 } |
75 return *name; | 75 return *name; |
76 } | 76 } |
77 | 77 |
| 78 RUNTIME_FUNCTION(Runtime_ThrowIfMissingPrivateField) { |
| 79 HandleScope scope(isolate); |
| 80 DCHECK(args.length() == 2); |
| 81 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 82 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 83 if (!object->IsJSReceiver() || |
| 84 !JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), name) |
| 85 .FromMaybe(false)) { // TODO(bakkot) check this doesn't trigger a |
| 86 // proxy trap |
| 87 THROW_NEW_ERROR_RETURN_FAILURE( |
| 88 isolate, NewTypeError(MessageTemplate::kMissingPrivateField)); |
| 89 } |
| 90 return *object; |
| 91 } |
78 | 92 |
79 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { | 93 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
80 DCHECK(args.length() == 0); | 94 DCHECK(args.length() == 0); |
81 return isolate->heap()->home_object_symbol(); | 95 return isolate->heap()->home_object_symbol(); |
82 } | 96 } |
83 | 97 |
84 static MaybeHandle<Object> DefineClass(Isolate* isolate, | 98 static MaybeHandle<Object> DefineClass(Isolate* isolate, |
85 Handle<Object> super_class, | 99 Handle<Object> super_class, |
86 Handle<JSFunction> constructor, | 100 Handle<JSFunction> constructor, |
87 int start_position, int end_position) { | 101 int start_position, int end_position) { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 404 |
391 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { | 405 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { |
392 SealHandleScope shs(isolate); | 406 SealHandleScope shs(isolate); |
393 DCHECK_EQ(1, args.length()); | 407 DCHECK_EQ(1, args.length()); |
394 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); | 408 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); |
395 return active_function->map()->prototype(); | 409 return active_function->map()->prototype(); |
396 } | 410 } |
397 | 411 |
398 } // namespace internal | 412 } // namespace internal |
399 } // namespace v8 | 413 } // namespace v8 |
OLD | NEW |