File: | out/../deps/v8/src/runtime/runtime-internal.cc |
Warning: | line 428, column 23 Value stored to 'alignment' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
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 |
3 | // found in the LICENSE file. |
4 | |
5 | #include <memory> |
6 | |
7 | #include "src/api/api-inl.h" |
8 | #include "src/api/api.h" |
9 | #include "src/ast/ast-traversal-visitor.h" |
10 | #include "src/ast/prettyprinter.h" |
11 | #include "src/builtins/builtins.h" |
12 | #include "src/common/message-template.h" |
13 | #include "src/debug/debug.h" |
14 | #include "src/execution/arguments-inl.h" |
15 | #include "src/execution/frames-inl.h" |
16 | #include "src/execution/isolate-inl.h" |
17 | #include "src/execution/messages.h" |
18 | #include "src/execution/tiering-manager.h" |
19 | #include "src/handles/maybe-handles.h" |
20 | #include "src/init/bootstrapper.h" |
21 | #include "src/logging/counters.h" |
22 | #include "src/numbers/conversions.h" |
23 | #include "src/objects/feedback-vector-inl.h" |
24 | #include "src/objects/js-array-inl.h" |
25 | #include "src/objects/template-objects-inl.h" |
26 | #include "src/parsing/parse-info.h" |
27 | #include "src/parsing/parsing.h" |
28 | #include "src/runtime/runtime-utils.h" |
29 | #include "src/snapshot/snapshot.h" |
30 | #include "src/strings/string-builder-inl.h" |
31 | #include "src/utils/ostreams.h" |
32 | |
33 | #if V8_ENABLE_WEBASSEMBLY1 |
34 | // TODO(jkummerow): Drop this when the "SaveAndClearThreadInWasmFlag" |
35 | // short-term mitigation is no longer needed. |
36 | #include "src/trap-handler/trap-handler.h" |
37 | #endif // V8_ENABLE_WEBASSEMBLY |
38 | |
39 | namespace v8 { |
40 | namespace internal { |
41 | |
42 | RUNTIME_FUNCTION(Runtime_AccessCheck)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AccessCheck (RuntimeArguments args, Isolate* isolate); Address Runtime_AccessCheck (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AccessCheck(args, isolate)).ptr(); } static Object __RT_impl_Runtime_AccessCheck(RuntimeArguments args, Isolate* isolate) { |
43 | HandleScope scope(isolate); |
44 | DCHECK_EQ(1, args.length())((void) 0); |
45 | Handle<JSObject> object = args.at<JSObject>(0); |
46 | if (!isolate->MayAccess(handle(isolate->context(), isolate), object)) { |
47 | isolate->ReportFailedAccessCheck(object); |
48 | RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate)do { Isolate* __isolate__ = (isolate); ((void) 0); if (__isolate__ ->has_scheduled_exception()) { return __isolate__->PromoteScheduledException (); } } while (false); |
49 | } |
50 | return ReadOnlyRoots(isolate).undefined_value(); |
51 | } |
52 | |
53 | RUNTIME_FUNCTION(Runtime_FatalProcessOutOfMemoryInAllocateRaw)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_FatalProcessOutOfMemoryInAllocateRaw (RuntimeArguments args, Isolate* isolate); Address Runtime_FatalProcessOutOfMemoryInAllocateRaw (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_FatalProcessOutOfMemoryInAllocateRaw (args, isolate)).ptr(); } static Object __RT_impl_Runtime_FatalProcessOutOfMemoryInAllocateRaw (RuntimeArguments args, Isolate* isolate) { |
54 | HandleScope scope(isolate); |
55 | DCHECK_EQ(0, args.length())((void) 0); |
56 | isolate->heap()->FatalProcessOutOfMemory("CodeStubAssembler::AllocateRaw"); |
57 | UNREACHABLE()V8_Fatal("unreachable code"); |
58 | } |
59 | |
60 | RUNTIME_FUNCTION(Runtime_FatalProcessOutOfMemoryInvalidArrayLength)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_FatalProcessOutOfMemoryInvalidArrayLength (RuntimeArguments args, Isolate* isolate); Address Runtime_FatalProcessOutOfMemoryInvalidArrayLength (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_FatalProcessOutOfMemoryInvalidArrayLength (args, isolate)).ptr(); } static Object __RT_impl_Runtime_FatalProcessOutOfMemoryInvalidArrayLength (RuntimeArguments args, Isolate* isolate) { |
61 | HandleScope scope(isolate); |
62 | DCHECK_EQ(0, args.length())((void) 0); |
63 | isolate->heap()->FatalProcessOutOfMemory("invalid array length"); |
64 | UNREACHABLE()V8_Fatal("unreachable code"); |
65 | } |
66 | |
67 | RUNTIME_FUNCTION(Runtime_Throw)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_Throw (RuntimeArguments args, Isolate* isolate); Address Runtime_Throw (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_Throw(args, isolate)).ptr(); } static Object __RT_impl_Runtime_Throw(RuntimeArguments args, Isolate * isolate) { |
68 | HandleScope scope(isolate); |
69 | DCHECK_EQ(1, args.length())((void) 0); |
70 | return isolate->Throw(args[0]); |
71 | } |
72 | |
73 | RUNTIME_FUNCTION(Runtime_ReThrow)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ReThrow (RuntimeArguments args, Isolate* isolate); Address Runtime_ReThrow (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ReThrow(args, isolate)).ptr(); } static Object __RT_impl_Runtime_ReThrow(RuntimeArguments args, Isolate * isolate) { |
74 | HandleScope scope(isolate); |
75 | DCHECK_EQ(1, args.length())((void) 0); |
76 | return isolate->ReThrow(args[0]); |
77 | } |
78 | |
79 | RUNTIME_FUNCTION(Runtime_ReThrowWithMessage)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ReThrowWithMessage (RuntimeArguments args, Isolate* isolate); Address Runtime_ReThrowWithMessage (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ReThrowWithMessage(args, isolate)) .ptr(); } static Object __RT_impl_Runtime_ReThrowWithMessage( RuntimeArguments args, Isolate* isolate) { |
80 | HandleScope scope(isolate); |
81 | DCHECK_EQ(2, args.length())((void) 0); |
82 | return isolate->ReThrow(args[0], args[1]); |
83 | } |
84 | |
85 | RUNTIME_FUNCTION(Runtime_ThrowStackOverflow)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowStackOverflow (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowStackOverflow (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowStackOverflow(args, isolate)) .ptr(); } static Object __RT_impl_Runtime_ThrowStackOverflow( RuntimeArguments args, Isolate* isolate) { |
86 | SealHandleScope shs(isolate); |
87 | DCHECK_LE(0, args.length())((void) 0); |
88 | return isolate->StackOverflow(); |
89 | } |
90 | |
91 | RUNTIME_FUNCTION(Runtime_ThrowSymbolAsyncIteratorInvalid)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowSymbolAsyncIteratorInvalid (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowSymbolAsyncIteratorInvalid (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowSymbolAsyncIteratorInvalid(args , isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowSymbolAsyncIteratorInvalid (RuntimeArguments args, Isolate* isolate) { |
92 | HandleScope scope(isolate); |
93 | DCHECK_EQ(0, args.length())((void) 0); |
94 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolAsyncIteratorInvalid)); } while (false) |
95 | isolate, NewTypeError(MessageTemplate::kSymbolAsyncIteratorInvalid))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolAsyncIteratorInvalid)); } while (false); |
96 | } |
97 | |
98 | #define THROW_ERROR(isolate, args, call) \ |
99 | HandleScope scope(isolate); \ |
100 | DCHECK_LE(1, args.length())((void) 0); \ |
101 | int message_id_smi = args.smi_value_at(0); \ |
102 | \ |
103 | Handle<Object> undefined = isolate->factory()->undefined_value(); \ |
104 | Handle<Object> arg0 = (args.length() > 1) ? args.at(1) : undefined; \ |
105 | Handle<Object> arg1 = (args.length() > 2) ? args.at(2) : undefined; \ |
106 | Handle<Object> arg2 = (args.length() > 3) ? args.at(3) : undefined; \ |
107 | \ |
108 | MessageTemplate message_id = MessageTemplateFromInt(message_id_smi); \ |
109 | \ |
110 | THROW_NEW_ERROR_RETURN_FAILURE(isolate, call(message_id, arg0, arg1, arg2))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->call(message_id, arg0, arg1, arg2 )); } while (false); |
111 | |
112 | RUNTIME_FUNCTION(Runtime_ThrowRangeError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowRangeError (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowRangeError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowRangeError(args, isolate)).ptr (); } static Object __RT_impl_Runtime_ThrowRangeError(RuntimeArguments args, Isolate* isolate) { |
113 | if (FLAG_correctness_fuzzer_suppressions) { |
114 | DCHECK_LE(1, args.length())((void) 0); |
115 | int message_id_smi = args.smi_value_at(0); |
116 | |
117 | // If the result of a BigInt computation is truncated to 64 bit, Turbofan |
118 | // can sometimes truncate intermediate results already, which can prevent |
119 | // those from exceeding the maximum length, effectively preventing a |
120 | // RangeError from being thrown. As this is a performance optimization, this |
121 | // behavior is accepted. To prevent the correctness fuzzer from detecting |
122 | // this difference, we crash the program. |
123 | if (MessageTemplateFromInt(message_id_smi) == |
124 | MessageTemplate::kBigIntTooBig) { |
125 | FATAL("Aborting on invalid BigInt length")V8_Fatal("Aborting on invalid BigInt length"); |
126 | } |
127 | } |
128 | |
129 | THROW_ERROR(isolate, args, NewRangeError); |
130 | } |
131 | |
132 | RUNTIME_FUNCTION(Runtime_ThrowTypeError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowTypeError (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowTypeError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowTypeError(args, isolate)).ptr (); } static Object __RT_impl_Runtime_ThrowTypeError(RuntimeArguments args, Isolate* isolate) { |
133 | THROW_ERROR(isolate, args, NewTypeError); |
134 | } |
135 | |
136 | RUNTIME_FUNCTION(Runtime_ThrowTypeErrorIfStrict)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowTypeErrorIfStrict (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowTypeErrorIfStrict (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowTypeErrorIfStrict(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowTypeErrorIfStrict (RuntimeArguments args, Isolate* isolate) { |
137 | if (GetShouldThrow(isolate, Nothing<ShouldThrow>()) == |
138 | ShouldThrow::kDontThrow) |
139 | return ReadOnlyRoots(isolate).undefined_value(); |
140 | THROW_ERROR(isolate, args, NewTypeError); |
141 | } |
142 | |
143 | #undef THROW_ERROR |
144 | |
145 | namespace { |
146 | |
147 | const char* ElementsKindToType(ElementsKind fixed_elements_kind) { |
148 | switch (fixed_elements_kind) { |
149 | #define ELEMENTS_KIND_CASE(Type, type, TYPE, ctype) \ |
150 | case TYPE##_ELEMENTS: \ |
151 | return #Type "Array"; |
152 | |
153 | TYPED_ARRAYS(ELEMENTS_KIND_CASE)ELEMENTS_KIND_CASE(Uint8, uint8, UINT8, uint8_t) ELEMENTS_KIND_CASE (Int8, int8, INT8, int8_t) ELEMENTS_KIND_CASE(Uint16, uint16, UINT16, uint16_t) ELEMENTS_KIND_CASE(Int16, int16, INT16, int16_t ) ELEMENTS_KIND_CASE(Uint32, uint32, UINT32, uint32_t) ELEMENTS_KIND_CASE (Int32, int32, INT32, int32_t) ELEMENTS_KIND_CASE(Float32, float32 , FLOAT32, float) ELEMENTS_KIND_CASE(Float64, float64, FLOAT64 , double) ELEMENTS_KIND_CASE(Uint8Clamped, uint8_clamped, UINT8_CLAMPED , uint8_t) ELEMENTS_KIND_CASE(BigUint64, biguint64, BIGUINT64 , uint64_t) ELEMENTS_KIND_CASE(BigInt64, bigint64, BIGINT64, int64_t ) |
154 | RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE(ELEMENTS_KIND_CASE)ELEMENTS_KIND_CASE(Uint8, rab_gsab_uint8, RAB_GSAB_UINT8, uint8_t ) ELEMENTS_KIND_CASE(Int8, rab_gsab_int8, RAB_GSAB_INT8, int8_t ) ELEMENTS_KIND_CASE(Uint16, rab_gsab_uint16, RAB_GSAB_UINT16 , uint16_t) ELEMENTS_KIND_CASE(Int16, rab_gsab_int16, RAB_GSAB_INT16 , int16_t) ELEMENTS_KIND_CASE(Uint32, rab_gsab_uint32, RAB_GSAB_UINT32 , uint32_t) ELEMENTS_KIND_CASE(Int32, rab_gsab_int32, RAB_GSAB_INT32 , int32_t) ELEMENTS_KIND_CASE(Float32, rab_gsab_float32, RAB_GSAB_FLOAT32 , float) ELEMENTS_KIND_CASE(Float64, rab_gsab_float64, RAB_GSAB_FLOAT64 , double) ELEMENTS_KIND_CASE(Uint8Clamped, rab_gsab_uint8_clamped , RAB_GSAB_UINT8_CLAMPED, uint8_t) ELEMENTS_KIND_CASE(BigUint64 , rab_gsab_biguint64, RAB_GSAB_BIGUINT64, uint64_t) ELEMENTS_KIND_CASE (BigInt64, rab_gsab_bigint64, RAB_GSAB_BIGINT64, int64_t) |
155 | #undef ELEMENTS_KIND_CASE |
156 | |
157 | default: |
158 | UNREACHABLE()V8_Fatal("unreachable code"); |
159 | } |
160 | } |
161 | |
162 | } // namespace |
163 | |
164 | RUNTIME_FUNCTION(Runtime_ThrowInvalidTypedArrayAlignment)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowInvalidTypedArrayAlignment (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowInvalidTypedArrayAlignment (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowInvalidTypedArrayAlignment(args , isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowInvalidTypedArrayAlignment (RuntimeArguments args, Isolate* isolate) { |
165 | HandleScope scope(isolate); |
166 | DCHECK_EQ(2, args.length())((void) 0); |
167 | Handle<Map> map = args.at<Map>(0); |
168 | Handle<String> problem_string = args.at<String>(1); |
169 | |
170 | ElementsKind kind = map->elements_kind(); |
171 | |
172 | Handle<String> type = |
173 | isolate->factory()->NewStringFromAsciiChecked(ElementsKindToType(kind)); |
174 | |
175 | ExternalArrayType external_type; |
176 | size_t size; |
177 | Factory::TypeAndSizeForElementsKind(kind, &external_type, &size); |
178 | Handle<Object> element_size = |
179 | handle(Smi::FromInt(static_cast<int>(size)), isolate); |
180 | |
181 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewRangeError(MessageTemplate ::kInvalidTypedArrayAlignment, problem_string, type, element_size )); } while (false) |
182 | isolate, NewRangeError(MessageTemplate::kInvalidTypedArrayAlignment,do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewRangeError(MessageTemplate ::kInvalidTypedArrayAlignment, problem_string, type, element_size )); } while (false) |
183 | problem_string, type, element_size))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewRangeError(MessageTemplate ::kInvalidTypedArrayAlignment, problem_string, type, element_size )); } while (false); |
184 | } |
185 | |
186 | RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_UnwindAndFindExceptionHandler (RuntimeArguments args, Isolate* isolate); Address Runtime_UnwindAndFindExceptionHandler (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_UnwindAndFindExceptionHandler(args , isolate)).ptr(); } static Object __RT_impl_Runtime_UnwindAndFindExceptionHandler (RuntimeArguments args, Isolate* isolate) { |
187 | SealHandleScope shs(isolate); |
188 | DCHECK_EQ(0, args.length())((void) 0); |
189 | return isolate->UnwindAndFindHandler(); |
190 | } |
191 | |
192 | RUNTIME_FUNCTION(Runtime_PromoteScheduledException)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_PromoteScheduledException (RuntimeArguments args, Isolate* isolate); Address Runtime_PromoteScheduledException (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_PromoteScheduledException(args, isolate )).ptr(); } static Object __RT_impl_Runtime_PromoteScheduledException (RuntimeArguments args, Isolate* isolate) { |
193 | SealHandleScope shs(isolate); |
194 | DCHECK_EQ(0, args.length())((void) 0); |
195 | return isolate->PromoteScheduledException(); |
196 | } |
197 | |
198 | RUNTIME_FUNCTION(Runtime_ThrowReferenceError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowReferenceError (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowReferenceError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowReferenceError(args, isolate) ).ptr(); } static Object __RT_impl_Runtime_ThrowReferenceError (RuntimeArguments args, Isolate* isolate) { |
199 | HandleScope scope(isolate); |
200 | DCHECK_EQ(1, args.length())((void) 0); |
201 | Handle<Object> name = args.at(0); |
202 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewReferenceError(MessageTemplate ::kNotDefined, name)); } while (false) |
203 | isolate, NewReferenceError(MessageTemplate::kNotDefined, name))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewReferenceError(MessageTemplate ::kNotDefined, name)); } while (false); |
204 | } |
205 | |
206 | RUNTIME_FUNCTION(Runtime_ThrowAccessedUninitializedVariable)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowAccessedUninitializedVariable (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowAccessedUninitializedVariable (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowAccessedUninitializedVariable (args, isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowAccessedUninitializedVariable (RuntimeArguments args, Isolate* isolate) { |
207 | HandleScope scope(isolate); |
208 | DCHECK_EQ(1, args.length())((void) 0); |
209 | Handle<Object> name = args.at(0); |
210 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewReferenceError(MessageTemplate ::kAccessedUninitializedVariable, name)); } while (false) |
211 | isolate,do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewReferenceError(MessageTemplate ::kAccessedUninitializedVariable, name)); } while (false) |
212 | NewReferenceError(MessageTemplate::kAccessedUninitializedVariable, name))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewReferenceError(MessageTemplate ::kAccessedUninitializedVariable, name)); } while (false); |
213 | } |
214 | |
215 | RUNTIME_FUNCTION(Runtime_NewError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_NewError (RuntimeArguments args, Isolate* isolate); Address Runtime_NewError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_NewError(args, isolate)).ptr(); } static Object __RT_impl_Runtime_NewError(RuntimeArguments args, Isolate * isolate) { |
216 | HandleScope scope(isolate); |
217 | DCHECK_EQ(2, args.length())((void) 0); |
218 | int template_index = args.smi_value_at(0); |
219 | Handle<Object> arg0 = args.at(1); |
220 | MessageTemplate message_template = MessageTemplateFromInt(template_index); |
221 | return *isolate->factory()->NewError(message_template, arg0); |
222 | } |
223 | |
224 | RUNTIME_FUNCTION(Runtime_NewForeign)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_NewForeign (RuntimeArguments args, Isolate* isolate); Address Runtime_NewForeign (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_NewForeign(args, isolate)).ptr(); } static Object __RT_impl_Runtime_NewForeign(RuntimeArguments args , Isolate* isolate) { |
225 | HandleScope scope(isolate); |
226 | DCHECK_EQ(0, args.length())((void) 0); |
227 | return *isolate->factory()->NewForeign(kNullAddress); |
228 | } |
229 | |
230 | RUNTIME_FUNCTION(Runtime_NewTypeError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_NewTypeError (RuntimeArguments args, Isolate* isolate); Address Runtime_NewTypeError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_NewTypeError(args, isolate)).ptr() ; } static Object __RT_impl_Runtime_NewTypeError(RuntimeArguments args, Isolate* isolate) { |
231 | HandleScope scope(isolate); |
232 | DCHECK_LE(args.length(), 4)((void) 0); |
233 | DCHECK_GE(args.length(), 1)((void) 0); |
234 | int template_index = args.smi_value_at(0); |
235 | MessageTemplate message_template = MessageTemplateFromInt(template_index); |
236 | |
237 | Handle<Object> arg0; |
238 | if (args.length() >= 2) { |
239 | arg0 = args.at<Object>(1); |
240 | } |
241 | |
242 | Handle<Object> arg1; |
243 | if (args.length() >= 3) { |
244 | arg1 = args.at<Object>(2); |
245 | } |
246 | Handle<Object> arg2; |
247 | if (args.length() >= 4) { |
248 | arg2 = args.at<Object>(3); |
249 | } |
250 | |
251 | return *isolate->factory()->NewTypeError(message_template, arg0, arg1, arg2); |
252 | } |
253 | |
254 | RUNTIME_FUNCTION(Runtime_NewReferenceError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_NewReferenceError (RuntimeArguments args, Isolate* isolate); Address Runtime_NewReferenceError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_NewReferenceError(args, isolate)). ptr(); } static Object __RT_impl_Runtime_NewReferenceError(RuntimeArguments args, Isolate* isolate) { |
255 | HandleScope scope(isolate); |
256 | DCHECK_EQ(2, args.length())((void) 0); |
257 | int template_index = args.smi_value_at(0); |
258 | Handle<Object> arg0 = args.at(1); |
259 | MessageTemplate message_template = MessageTemplateFromInt(template_index); |
260 | return *isolate->factory()->NewReferenceError(message_template, arg0); |
261 | } |
262 | |
263 | RUNTIME_FUNCTION(Runtime_NewSyntaxError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_NewSyntaxError (RuntimeArguments args, Isolate* isolate); Address Runtime_NewSyntaxError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_NewSyntaxError(args, isolate)).ptr (); } static Object __RT_impl_Runtime_NewSyntaxError(RuntimeArguments args, Isolate* isolate) { |
264 | HandleScope scope(isolate); |
265 | DCHECK_EQ(2, args.length())((void) 0); |
266 | int template_index = args.smi_value_at(0); |
267 | Handle<Object> arg0 = args.at(1); |
268 | MessageTemplate message_template = MessageTemplateFromInt(template_index); |
269 | return *isolate->factory()->NewSyntaxError(message_template, arg0); |
270 | } |
271 | |
272 | RUNTIME_FUNCTION(Runtime_ThrowInvalidStringLength)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowInvalidStringLength (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowInvalidStringLength (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowInvalidStringLength(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowInvalidStringLength (RuntimeArguments args, Isolate* isolate) { |
273 | HandleScope scope(isolate); |
274 | THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError())do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewInvalidStringLengthError() ); } while (false); |
275 | } |
276 | |
277 | RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowIteratorResultNotAnObject (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowIteratorResultNotAnObject (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowIteratorResultNotAnObject(args , isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowIteratorResultNotAnObject (RuntimeArguments args, Isolate* isolate) { |
278 | HandleScope scope(isolate); |
279 | DCHECK_EQ(1, args.length())((void) 0); |
280 | Handle<Object> value = args.at(0); |
281 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kIteratorResultNotAnObject, value)); } while (false) |
282 | isolate,do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kIteratorResultNotAnObject, value)); } while (false) |
283 | NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kIteratorResultNotAnObject, value)); } while (false); |
284 | } |
285 | |
286 | RUNTIME_FUNCTION(Runtime_ThrowThrowMethodMissing)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowThrowMethodMissing (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowThrowMethodMissing (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowThrowMethodMissing(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowThrowMethodMissing (RuntimeArguments args, Isolate* isolate) { |
287 | HandleScope scope(isolate); |
288 | DCHECK_EQ(0, args.length())((void) 0); |
289 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kThrowMethodMissing)); } while (false) |
290 | isolate, NewTypeError(MessageTemplate::kThrowMethodMissing))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kThrowMethodMissing)); } while (false); |
291 | } |
292 | |
293 | RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowSymbolIteratorInvalid (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowSymbolIteratorInvalid (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowSymbolIteratorInvalid(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowSymbolIteratorInvalid (RuntimeArguments args, Isolate* isolate) { |
294 | HandleScope scope(isolate); |
295 | DCHECK_EQ(0, args.length())((void) 0); |
296 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolIteratorInvalid)); } while (false) |
297 | isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolIteratorInvalid)); } while (false); |
298 | } |
299 | |
300 | RUNTIME_FUNCTION(Runtime_ThrowNoAccess)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowNoAccess (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowNoAccess (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowNoAccess(args, isolate)).ptr( ); } static Object __RT_impl_Runtime_ThrowNoAccess(RuntimeArguments args, Isolate* isolate) { |
301 | HandleScope scope(isolate); |
302 | DCHECK_EQ(0, args.length())((void) 0); |
303 | |
304 | // TODO(verwaest): We would like to throw using the calling context instead |
305 | // of the entered context but we don't currently have access to that. |
306 | HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
307 | SaveAndSwitchContext save( |
308 | isolate, impl->LastEnteredOrMicrotaskContext()->native_context()); |
309 | THROW_NEW_ERROR_RETURN_FAILURE(isolate,do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kNoAccess)); } while (false) |
310 | NewTypeError(MessageTemplate::kNoAccess))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kNoAccess)); } while (false); |
311 | } |
312 | |
313 | RUNTIME_FUNCTION(Runtime_ThrowNotConstructor)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowNotConstructor (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowNotConstructor (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowNotConstructor(args, isolate) ).ptr(); } static Object __RT_impl_Runtime_ThrowNotConstructor (RuntimeArguments args, Isolate* isolate) { |
314 | HandleScope scope(isolate); |
315 | DCHECK_EQ(1, args.length())((void) 0); |
316 | Handle<Object> object = args.at(0); |
317 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kNotConstructor, object)); } while (false) |
318 | isolate, NewTypeError(MessageTemplate::kNotConstructor, object))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kNotConstructor, object)); } while (false); |
319 | } |
320 | |
321 | RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowApplyNonFunction (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowApplyNonFunction (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowApplyNonFunction(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowApplyNonFunction (RuntimeArguments args, Isolate* isolate) { |
322 | HandleScope scope(isolate); |
323 | DCHECK_EQ(1, args.length())((void) 0); |
324 | Handle<Object> object = args.at(0); |
325 | Handle<String> type = Object::TypeOf(isolate, object); |
326 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kApplyNonFunction, object, type)); } while (false) |
327 | isolate, NewTypeError(MessageTemplate::kApplyNonFunction, object, type))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kApplyNonFunction, object, type)); } while (false); |
328 | } |
329 | |
330 | RUNTIME_FUNCTION(Runtime_StackGuard)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_StackGuard (RuntimeArguments args, Isolate* isolate); Address Runtime_StackGuard (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_StackGuard(args, isolate)).ptr(); } static Object __RT_impl_Runtime_StackGuard(RuntimeArguments args , Isolate* isolate) { |
331 | SealHandleScope shs(isolate); |
332 | DCHECK_EQ(0, args.length())((void) 0); |
333 | TRACE_EVENT0("v8.execute", "V8.StackGuard")static v8::base::AtomicWord trace_event_unique_atomic333 = 0; const uint8_t* trace_event_unique_category_group_enabled333; trace_event_unique_category_group_enabled333 = reinterpret_cast <const uint8_t*>(v8::base::Relaxed_Load(&(trace_event_unique_atomic333 ))); if (!trace_event_unique_category_group_enabled333) { trace_event_unique_category_group_enabled333 = v8::internal::tracing::TraceEventHelper::GetTracingController () ->GetCategoryGroupEnabled("v8.execute"); v8::base::Relaxed_Store (&(trace_event_unique_atomic333), (reinterpret_cast<v8 ::base::AtomicWord>( trace_event_unique_category_group_enabled333 ))); };; v8::internal::tracing::ScopedTracer trace_event_unique_tracer333 ; if (v8::base::Relaxed_Load(reinterpret_cast<const v8::base ::Atomic8*>( trace_event_unique_category_group_enabled333) ) & (kEnabledForRecording_CategoryGroupEnabledFlags | kEnabledForEventCallback_CategoryGroupEnabledFlags )) { uint64_t h = v8::internal::tracing::AddTraceEvent( ('X') , trace_event_unique_category_group_enabled333, "V8.StackGuard" , v8::internal::tracing::kGlobalScope, v8::internal::tracing:: kNoId, v8::internal::tracing::kNoId, (static_cast<unsigned int>(0))); trace_event_unique_tracer333 .Initialize(trace_event_unique_category_group_enabled333 , "V8.StackGuard", h); }; |
334 | |
335 | // First check if this is a real stack overflow. |
336 | StackLimitCheck check(isolate); |
337 | if (check.JsHasOverflowed()) { |
338 | return isolate->StackOverflow(); |
339 | } |
340 | |
341 | return isolate->stack_guard()->HandleInterrupts(); |
342 | } |
343 | |
344 | RUNTIME_FUNCTION(Runtime_StackGuardWithGap)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_StackGuardWithGap (RuntimeArguments args, Isolate* isolate); Address Runtime_StackGuardWithGap (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_StackGuardWithGap(args, isolate)). ptr(); } static Object __RT_impl_Runtime_StackGuardWithGap(RuntimeArguments args, Isolate* isolate) { |
345 | SealHandleScope shs(isolate); |
346 | DCHECK_EQ(args.length(), 1)((void) 0); |
347 | uint32_t gap = args.positive_smi_value_at(0); |
348 | TRACE_EVENT0("v8.execute", "V8.StackGuard")static v8::base::AtomicWord trace_event_unique_atomic348 = 0; const uint8_t* trace_event_unique_category_group_enabled348; trace_event_unique_category_group_enabled348 = reinterpret_cast <const uint8_t*>(v8::base::Relaxed_Load(&(trace_event_unique_atomic348 ))); if (!trace_event_unique_category_group_enabled348) { trace_event_unique_category_group_enabled348 = v8::internal::tracing::TraceEventHelper::GetTracingController () ->GetCategoryGroupEnabled("v8.execute"); v8::base::Relaxed_Store (&(trace_event_unique_atomic348), (reinterpret_cast<v8 ::base::AtomicWord>( trace_event_unique_category_group_enabled348 ))); };; v8::internal::tracing::ScopedTracer trace_event_unique_tracer348 ; if (v8::base::Relaxed_Load(reinterpret_cast<const v8::base ::Atomic8*>( trace_event_unique_category_group_enabled348) ) & (kEnabledForRecording_CategoryGroupEnabledFlags | kEnabledForEventCallback_CategoryGroupEnabledFlags )) { uint64_t h = v8::internal::tracing::AddTraceEvent( ('X') , trace_event_unique_category_group_enabled348, "V8.StackGuard" , v8::internal::tracing::kGlobalScope, v8::internal::tracing:: kNoId, v8::internal::tracing::kNoId, (static_cast<unsigned int>(0))); trace_event_unique_tracer348 .Initialize(trace_event_unique_category_group_enabled348 , "V8.StackGuard", h); }; |
349 | |
350 | // First check if this is a real stack overflow. |
351 | StackLimitCheck check(isolate); |
352 | if (check.JsHasOverflowed(gap)) { |
353 | return isolate->StackOverflow(); |
354 | } |
355 | |
356 | return isolate->stack_guard()->HandleInterrupts(); |
357 | } |
358 | |
359 | RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterruptWithStackCheck)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_BytecodeBudgetInterruptWithStackCheck (RuntimeArguments args, Isolate* isolate); Address Runtime_BytecodeBudgetInterruptWithStackCheck (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_BytecodeBudgetInterruptWithStackCheck (args, isolate)).ptr(); } static Object __RT_impl_Runtime_BytecodeBudgetInterruptWithStackCheck (RuntimeArguments args, Isolate* isolate) { |
360 | HandleScope scope(isolate); |
361 | DCHECK_EQ(1, args.length())((void) 0); |
362 | Handle<JSFunction> function = args.at<JSFunction>(0); |
363 | TRACE_EVENT0("v8.execute", "V8.BytecodeBudgetInterruptWithStackCheck")static v8::base::AtomicWord trace_event_unique_atomic363 = 0; const uint8_t* trace_event_unique_category_group_enabled363; trace_event_unique_category_group_enabled363 = reinterpret_cast <const uint8_t*>(v8::base::Relaxed_Load(&(trace_event_unique_atomic363 ))); if (!trace_event_unique_category_group_enabled363) { trace_event_unique_category_group_enabled363 = v8::internal::tracing::TraceEventHelper::GetTracingController () ->GetCategoryGroupEnabled("v8.execute"); v8::base::Relaxed_Store (&(trace_event_unique_atomic363), (reinterpret_cast<v8 ::base::AtomicWord>( trace_event_unique_category_group_enabled363 ))); };; v8::internal::tracing::ScopedTracer trace_event_unique_tracer363 ; if (v8::base::Relaxed_Load(reinterpret_cast<const v8::base ::Atomic8*>( trace_event_unique_category_group_enabled363) ) & (kEnabledForRecording_CategoryGroupEnabledFlags | kEnabledForEventCallback_CategoryGroupEnabledFlags )) { uint64_t h = v8::internal::tracing::AddTraceEvent( ('X') , trace_event_unique_category_group_enabled363, "V8.BytecodeBudgetInterruptWithStackCheck" , v8::internal::tracing::kGlobalScope, v8::internal::tracing:: kNoId, v8::internal::tracing::kNoId, (static_cast<unsigned int>(0))); trace_event_unique_tracer363 .Initialize(trace_event_unique_category_group_enabled363 , "V8.BytecodeBudgetInterruptWithStackCheck", h); }; |
364 | |
365 | // Check for stack interrupts here so that we can fold the interrupt check |
366 | // into bytecode budget interrupts. |
367 | StackLimitCheck check(isolate); |
368 | if (check.JsHasOverflowed()) { |
369 | // We ideally wouldn't actually get StackOverflows here, since we stack |
370 | // check on bytecode entry, but it's possible that this check fires due to |
371 | // the runtime function call being what overflows the stack. |
372 | // if our function entry |
373 | return isolate->StackOverflow(); |
374 | } else if (check.InterruptRequested()) { |
375 | Object return_value = isolate->stack_guard()->HandleInterrupts(); |
376 | if (!return_value.IsUndefined(isolate)) { |
377 | return return_value; |
378 | } |
379 | } |
380 | |
381 | isolate->tiering_manager()->OnInterruptTick(function); |
382 | return ReadOnlyRoots(isolate).undefined_value(); |
383 | } |
384 | |
385 | RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterrupt)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_BytecodeBudgetInterrupt (RuntimeArguments args, Isolate* isolate); Address Runtime_BytecodeBudgetInterrupt (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_BytecodeBudgetInterrupt(args, isolate )).ptr(); } static Object __RT_impl_Runtime_BytecodeBudgetInterrupt (RuntimeArguments args, Isolate* isolate) { |
386 | HandleScope scope(isolate); |
387 | DCHECK_EQ(1, args.length())((void) 0); |
388 | Handle<JSFunction> function = args.at<JSFunction>(0); |
389 | TRACE_EVENT0("v8.execute", "V8.BytecodeBudgetInterrupt")static v8::base::AtomicWord trace_event_unique_atomic389 = 0; const uint8_t* trace_event_unique_category_group_enabled389; trace_event_unique_category_group_enabled389 = reinterpret_cast <const uint8_t*>(v8::base::Relaxed_Load(&(trace_event_unique_atomic389 ))); if (!trace_event_unique_category_group_enabled389) { trace_event_unique_category_group_enabled389 = v8::internal::tracing::TraceEventHelper::GetTracingController () ->GetCategoryGroupEnabled("v8.execute"); v8::base::Relaxed_Store (&(trace_event_unique_atomic389), (reinterpret_cast<v8 ::base::AtomicWord>( trace_event_unique_category_group_enabled389 ))); };; v8::internal::tracing::ScopedTracer trace_event_unique_tracer389 ; if (v8::base::Relaxed_Load(reinterpret_cast<const v8::base ::Atomic8*>( trace_event_unique_category_group_enabled389) ) & (kEnabledForRecording_CategoryGroupEnabledFlags | kEnabledForEventCallback_CategoryGroupEnabledFlags )) { uint64_t h = v8::internal::tracing::AddTraceEvent( ('X') , trace_event_unique_category_group_enabled389, "V8.BytecodeBudgetInterrupt" , v8::internal::tracing::kGlobalScope, v8::internal::tracing:: kNoId, v8::internal::tracing::kNoId, (static_cast<unsigned int>(0))); trace_event_unique_tracer389 .Initialize(trace_event_unique_category_group_enabled389 , "V8.BytecodeBudgetInterrupt", h); }; |
390 | |
391 | isolate->tiering_manager()->OnInterruptTick(function); |
392 | return ReadOnlyRoots(isolate).undefined_value(); |
393 | } |
394 | |
395 | namespace { |
396 | |
397 | #if V8_ENABLE_WEBASSEMBLY1 |
398 | class SaveAndClearThreadInWasmFlag { |
399 | public: |
400 | SaveAndClearThreadInWasmFlag() { |
401 | if (trap_handler::IsTrapHandlerEnabled()) { |
402 | if (trap_handler::IsThreadInWasm()) { |
403 | thread_was_in_wasm_ = true; |
404 | trap_handler::ClearThreadInWasm(); |
405 | } |
406 | } |
407 | } |
408 | ~SaveAndClearThreadInWasmFlag() { |
409 | if (thread_was_in_wasm_) { |
410 | trap_handler::SetThreadInWasm(); |
411 | } |
412 | } |
413 | |
414 | private: |
415 | bool thread_was_in_wasm_{false}; |
416 | }; |
417 | #else |
418 | class SaveAndClearThreadInWasmFlag {}; |
419 | #endif // V8_ENABLE_WEBASSEMBLY |
420 | |
421 | } // namespace |
422 | |
423 | RUNTIME_FUNCTION(Runtime_AllocateInYoungGeneration)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllocateInYoungGeneration (RuntimeArguments args, Isolate* isolate); Address Runtime_AllocateInYoungGeneration (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllocateInYoungGeneration(args, isolate )).ptr(); } static Object __RT_impl_Runtime_AllocateInYoungGeneration (RuntimeArguments args, Isolate* isolate) { |
424 | HandleScope scope(isolate); |
425 | DCHECK_EQ(2, args.length())((void) 0); |
426 | int size = args.smi_value_at(0); |
427 | int flags = args.smi_value_at(1); |
428 | AllocationAlignment alignment = |
Value stored to 'alignment' during its initialization is never read | |
429 | AllocateDoubleAlignFlag::decode(flags) ? kDoubleAligned : kTaggedAligned; |
430 | bool allow_large_object_allocation = |
431 | AllowLargeObjectAllocationFlag::decode(flags); |
432 | CHECK(IsAligned(size, kTaggedSize))do { if ((__builtin_expect(!!(!(IsAligned(size, kTaggedSize)) ), 0))) { V8_Fatal("Check failed: %s.", "IsAligned(size, kTaggedSize)" ); } } while (false); |
433 | CHECK_GT(size, 0)do { bool _cmp = ::v8::base::CmpGTImpl< typename ::v8::base ::pass_value_or_ref<decltype(size)>::type, typename ::v8 ::base::pass_value_or_ref<decltype(0)>::type>((size) , (0)); do { if ((__builtin_expect(!!(!(_cmp)), 0))) { V8_Fatal ("Check failed: %s.", "size" " " ">" " " "0"); } } while ( false); } while (false); |
434 | if (!allow_large_object_allocation) { |
435 | CHECK(size <= kMaxRegularHeapObjectSize)do { if ((__builtin_expect(!!(!(size <= kMaxRegularHeapObjectSize )), 0))) { V8_Fatal("Check failed: %s.", "size <= kMaxRegularHeapObjectSize" ); } } while (false); |
436 | } |
437 | |
438 | #if V8_ENABLE_WEBASSEMBLY1 |
439 | // Short-term mitigation for crbug.com/1236668. When this is called from |
440 | // WasmGC code, clear the "thread in wasm" flag, which is important in case |
441 | // any GC needs to happen. |
442 | // TODO(jkummerow): Find a better fix, likely by replacing the global flag. |
443 | SaveAndClearThreadInWasmFlag clear_wasm_flag; |
444 | #endif // V8_ENABLE_WEBASSEMBLY |
445 | |
446 | // TODO(v8:9472): Until double-aligned allocation is fixed for new-space |
447 | // allocations, don't request it. |
448 | alignment = kTaggedAligned; |
449 | |
450 | return *isolate->factory()->NewFillerObject(size, alignment, |
451 | AllocationType::kYoung, |
452 | AllocationOrigin::kGeneratedCode); |
453 | } |
454 | |
455 | RUNTIME_FUNCTION(Runtime_AllocateInOldGeneration)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllocateInOldGeneration (RuntimeArguments args, Isolate* isolate); Address Runtime_AllocateInOldGeneration (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllocateInOldGeneration(args, isolate )).ptr(); } static Object __RT_impl_Runtime_AllocateInOldGeneration (RuntimeArguments args, Isolate* isolate) { |
456 | HandleScope scope(isolate); |
457 | DCHECK_EQ(2, args.length())((void) 0); |
458 | int size = args.smi_value_at(0); |
459 | int flags = args.smi_value_at(1); |
460 | AllocationAlignment alignment = |
461 | AllocateDoubleAlignFlag::decode(flags) ? kDoubleAligned : kTaggedAligned; |
462 | bool allow_large_object_allocation = |
463 | AllowLargeObjectAllocationFlag::decode(flags); |
464 | CHECK(IsAligned(size, kTaggedSize))do { if ((__builtin_expect(!!(!(IsAligned(size, kTaggedSize)) ), 0))) { V8_Fatal("Check failed: %s.", "IsAligned(size, kTaggedSize)" ); } } while (false); |
465 | CHECK_GT(size, 0)do { bool _cmp = ::v8::base::CmpGTImpl< typename ::v8::base ::pass_value_or_ref<decltype(size)>::type, typename ::v8 ::base::pass_value_or_ref<decltype(0)>::type>((size) , (0)); do { if ((__builtin_expect(!!(!(_cmp)), 0))) { V8_Fatal ("Check failed: %s.", "size" " " ">" " " "0"); } } while ( false); } while (false); |
466 | if (!allow_large_object_allocation) { |
467 | CHECK(size <= kMaxRegularHeapObjectSize)do { if ((__builtin_expect(!!(!(size <= kMaxRegularHeapObjectSize )), 0))) { V8_Fatal("Check failed: %s.", "size <= kMaxRegularHeapObjectSize" ); } } while (false); |
468 | } |
469 | return *isolate->factory()->NewFillerObject( |
470 | size, alignment, AllocationType::kOld, AllocationOrigin::kGeneratedCode); |
471 | } |
472 | |
473 | RUNTIME_FUNCTION(Runtime_AllocateByteArray)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllocateByteArray (RuntimeArguments args, Isolate* isolate); Address Runtime_AllocateByteArray (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllocateByteArray(args, isolate)). ptr(); } static Object __RT_impl_Runtime_AllocateByteArray(RuntimeArguments args, Isolate* isolate) { |
474 | HandleScope scope(isolate); |
475 | DCHECK_EQ(1, args.length())((void) 0); |
476 | int length = args.smi_value_at(0); |
477 | DCHECK_LT(0, length)((void) 0); |
478 | return *isolate->factory()->NewByteArray(length); |
479 | } |
480 | |
481 | RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllocateSeqOneByteString (RuntimeArguments args, Isolate* isolate); Address Runtime_AllocateSeqOneByteString (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllocateSeqOneByteString(args, isolate )).ptr(); } static Object __RT_impl_Runtime_AllocateSeqOneByteString (RuntimeArguments args, Isolate* isolate) { |
482 | HandleScope scope(isolate); |
483 | DCHECK_EQ(1, args.length())((void) 0); |
484 | int length = args.smi_value_at(0); |
485 | if (length == 0) return ReadOnlyRoots(isolate).empty_string(); |
486 | Handle<SeqOneByteString> result; |
487 | ASSIGN_RETURN_FAILURE_ON_EXCEPTION(do { auto* __isolate__ = (isolate); do { if (!(isolate->factory ()->NewRawOneByteString(length)).ToHandle(&result)) { ( (void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false) |
488 | isolate, result, isolate->factory()->NewRawOneByteString(length))do { auto* __isolate__ = (isolate); do { if (!(isolate->factory ()->NewRawOneByteString(length)).ToHandle(&result)) { ( (void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false); |
489 | return *result; |
490 | } |
491 | |
492 | RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllocateSeqTwoByteString (RuntimeArguments args, Isolate* isolate); Address Runtime_AllocateSeqTwoByteString (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllocateSeqTwoByteString(args, isolate )).ptr(); } static Object __RT_impl_Runtime_AllocateSeqTwoByteString (RuntimeArguments args, Isolate* isolate) { |
493 | HandleScope scope(isolate); |
494 | DCHECK_EQ(1, args.length())((void) 0); |
495 | int length = args.smi_value_at(0); |
496 | if (length == 0) return ReadOnlyRoots(isolate).empty_string(); |
497 | Handle<SeqTwoByteString> result; |
498 | ASSIGN_RETURN_FAILURE_ON_EXCEPTION(do { auto* __isolate__ = (isolate); do { if (!(isolate->factory ()->NewRawTwoByteString(length)).ToHandle(&result)) { ( (void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false) |
499 | isolate, result, isolate->factory()->NewRawTwoByteString(length))do { auto* __isolate__ = (isolate); do { if (!(isolate->factory ()->NewRawTwoByteString(length)).ToHandle(&result)) { ( (void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false); |
500 | return *result; |
501 | } |
502 | |
503 | RUNTIME_FUNCTION(Runtime_ThrowIteratorError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowIteratorError (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowIteratorError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowIteratorError(args, isolate)) .ptr(); } static Object __RT_impl_Runtime_ThrowIteratorError( RuntimeArguments args, Isolate* isolate) { |
504 | HandleScope scope(isolate); |
505 | DCHECK_EQ(1, args.length())((void) 0); |
506 | Handle<Object> object = args.at(0); |
507 | return isolate->Throw(*ErrorUtils::NewIteratorError(isolate, object)); |
508 | } |
509 | |
510 | RUNTIME_FUNCTION(Runtime_ThrowSpreadArgError)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowSpreadArgError (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowSpreadArgError (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowSpreadArgError(args, isolate) ).ptr(); } static Object __RT_impl_Runtime_ThrowSpreadArgError (RuntimeArguments args, Isolate* isolate) { |
511 | HandleScope scope(isolate); |
512 | DCHECK_EQ(2, args.length())((void) 0); |
513 | int message_id_smi = args.smi_value_at(0); |
514 | MessageTemplate message_id = MessageTemplateFromInt(message_id_smi); |
515 | Handle<Object> object = args.at(1); |
516 | return ErrorUtils::ThrowSpreadArgError(isolate, message_id, object); |
517 | } |
518 | |
519 | RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowCalledNonCallable (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowCalledNonCallable (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowCalledNonCallable(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ThrowCalledNonCallable (RuntimeArguments args, Isolate* isolate) { |
520 | HandleScope scope(isolate); |
521 | DCHECK_EQ(1, args.length())((void) 0); |
522 | Handle<Object> object = args.at(0); |
523 | return isolate->Throw( |
524 | *ErrorUtils::NewCalledNonCallableError(isolate, object)); |
525 | } |
526 | |
527 | RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowConstructedNonConstructable (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowConstructedNonConstructable (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowConstructedNonConstructable(args , isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowConstructedNonConstructable (RuntimeArguments args, Isolate* isolate) { |
528 | HandleScope scope(isolate); |
529 | DCHECK_EQ(1, args.length())((void) 0); |
530 | Handle<Object> object = args.at(0); |
531 | return isolate->Throw( |
532 | *ErrorUtils::NewConstructedNonConstructable(isolate, object)); |
533 | } |
534 | |
535 | RUNTIME_FUNCTION(Runtime_ThrowPatternAssignmentNonCoercible)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowPatternAssignmentNonCoercible (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowPatternAssignmentNonCoercible (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowPatternAssignmentNonCoercible (args, isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowPatternAssignmentNonCoercible (RuntimeArguments args, Isolate* isolate) { |
536 | HandleScope scope(isolate); |
537 | DCHECK_EQ(1, args.length())((void) 0); |
538 | Handle<Object> object = args.at(0); |
539 | return ErrorUtils::ThrowLoadFromNullOrUndefined(isolate, object, |
540 | MaybeHandle<Object>()); |
541 | } |
542 | |
543 | RUNTIME_FUNCTION(Runtime_ThrowConstructorReturnedNonObject)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ThrowConstructorReturnedNonObject (RuntimeArguments args, Isolate* isolate); Address Runtime_ThrowConstructorReturnedNonObject (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ThrowConstructorReturnedNonObject( args, isolate)).ptr(); } static Object __RT_impl_Runtime_ThrowConstructorReturnedNonObject (RuntimeArguments args, Isolate* isolate) { |
544 | HandleScope scope(isolate); |
545 | DCHECK_EQ(0, args.length())((void) 0); |
546 | |
547 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kDerivedConstructorReturnedNonObject)); } while (false) |
548 | isolate,do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kDerivedConstructorReturnedNonObject)); } while (false) |
549 | NewTypeError(MessageTemplate::kDerivedConstructorReturnedNonObject))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kDerivedConstructorReturnedNonObject)); } while (false); |
550 | } |
551 | |
552 | // ES6 section 7.3.17 CreateListFromArrayLike (obj) |
553 | RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_CreateListFromArrayLike (RuntimeArguments args, Isolate* isolate); Address Runtime_CreateListFromArrayLike (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_CreateListFromArrayLike(args, isolate )).ptr(); } static Object __RT_impl_Runtime_CreateListFromArrayLike (RuntimeArguments args, Isolate* isolate) { |
554 | HandleScope scope(isolate); |
555 | DCHECK_EQ(1, args.length())((void) 0); |
556 | Handle<Object> object = args.at(0); |
557 | RETURN_RESULT_OR_FAILURE(isolate, Object::CreateListFromArrayLike(do { Handle<Object> __result__; Isolate* __isolate__ = ( isolate); if (!(Object::CreateListFromArrayLike( isolate, object , ElementTypes::kAll)).ToHandle(&__result__)) { ((void) 0 ); return ReadOnlyRoots(__isolate__).exception(); } ((void) 0 ); return *__result__; } while (false) |
558 | isolate, object, ElementTypes::kAll))do { Handle<Object> __result__; Isolate* __isolate__ = ( isolate); if (!(Object::CreateListFromArrayLike( isolate, object , ElementTypes::kAll)).ToHandle(&__result__)) { ((void) 0 ); return ReadOnlyRoots(__isolate__).exception(); } ((void) 0 ); return *__result__; } while (false); |
559 | } |
560 | |
561 | RUNTIME_FUNCTION(Runtime_IncrementUseCounter)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_IncrementUseCounter (RuntimeArguments args, Isolate* isolate); Address Runtime_IncrementUseCounter (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_IncrementUseCounter(args, isolate) ).ptr(); } static Object __RT_impl_Runtime_IncrementUseCounter (RuntimeArguments args, Isolate* isolate) { |
562 | HandleScope scope(isolate); |
563 | DCHECK_EQ(1, args.length())((void) 0); |
564 | int counter = args.smi_value_at(0); |
565 | isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter)); |
566 | return ReadOnlyRoots(isolate).undefined_value(); |
567 | } |
568 | |
569 | RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_GetAndResetRuntimeCallStats (RuntimeArguments args, Isolate* isolate); Address Runtime_GetAndResetRuntimeCallStats (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_GetAndResetRuntimeCallStats(args, isolate )).ptr(); } static Object __RT_impl_Runtime_GetAndResetRuntimeCallStats (RuntimeArguments args, Isolate* isolate) { |
570 | HandleScope scope(isolate); |
571 | DCHECK_LE(args.length(), 2)((void) 0); |
572 | #ifdef V8_RUNTIME_CALL_STATS |
573 | // Append any worker thread runtime call stats to the main table before |
574 | // printing. |
575 | isolate->counters()->worker_thread_runtime_call_stats()->AddToMainTable( |
576 | isolate->counters()->runtime_call_stats()); |
577 | |
578 | if (args.length() == 0) { |
579 | // Without arguments, the result is returned as a string. |
580 | std::stringstream stats_stream; |
581 | isolate->counters()->runtime_call_stats()->Print(stats_stream); |
582 | Handle<String> result = isolate->factory()->NewStringFromAsciiChecked( |
583 | stats_stream.str().c_str()); |
584 | isolate->counters()->runtime_call_stats()->Reset(); |
585 | return *result; |
586 | } |
587 | |
588 | std::FILE* f; |
589 | if (args[0].IsString()) { |
590 | // With a string argument, the results are appended to that file. |
591 | Handle<String> filename = args.at<String>(0); |
592 | f = std::fopen(filename->ToCString().get(), "a"); |
593 | DCHECK_NOT_NULL(f)((void) 0); |
594 | } else { |
595 | // With an integer argument, the results are written to stdout/stderr. |
596 | int fd = args.smi_value_at(0); |
597 | DCHECK(fd == 1 || fd == 2)((void) 0); |
598 | f = fd == 1 ? stdoutstdout : stderrstderr; |
599 | } |
600 | // The second argument (if any) is a message header to be printed. |
601 | if (args.length() >= 2) { |
602 | Handle<String> message = args.at<String>(1); |
603 | message->PrintOn(f); |
604 | std::fputc('\n', f); |
605 | std::fflush(f); |
606 | } |
607 | OFStream stats_stream(f); |
608 | isolate->counters()->runtime_call_stats()->Print(stats_stream); |
609 | isolate->counters()->runtime_call_stats()->Reset(); |
610 | if (args[0].IsString()) { |
611 | std::fclose(f); |
612 | } else { |
613 | std::fflush(f); |
614 | } |
615 | #endif // V8_RUNTIME_CALL_STATS |
616 | return ReadOnlyRoots(isolate).undefined_value(); |
617 | } |
618 | |
619 | RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_OrdinaryHasInstance (RuntimeArguments args, Isolate* isolate); Address Runtime_OrdinaryHasInstance (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_OrdinaryHasInstance(args, isolate) ).ptr(); } static Object __RT_impl_Runtime_OrdinaryHasInstance (RuntimeArguments args, Isolate* isolate) { |
620 | HandleScope scope(isolate); |
621 | DCHECK_EQ(2, args.length())((void) 0); |
622 | Handle<Object> callable = args.at(0); |
623 | Handle<Object> object = args.at(1); |
624 | RETURN_RESULT_OR_FAILURE(do { Handle<Object> __result__; Isolate* __isolate__ = ( isolate); if (!(Object::OrdinaryHasInstance(isolate, callable , object)).ToHandle(&__result__)) { ((void) 0); return ReadOnlyRoots (__isolate__).exception(); } ((void) 0); return *__result__; } while (false) |
625 | isolate, Object::OrdinaryHasInstance(isolate, callable, object))do { Handle<Object> __result__; Isolate* __isolate__ = ( isolate); if (!(Object::OrdinaryHasInstance(isolate, callable , object)).ToHandle(&__result__)) { ((void) 0); return ReadOnlyRoots (__isolate__).exception(); } ((void) 0); return *__result__; } while (false); |
626 | } |
627 | |
628 | RUNTIME_FUNCTION(Runtime_Typeof)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_Typeof (RuntimeArguments args, Isolate* isolate); Address Runtime_Typeof (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_Typeof(args, isolate)).ptr(); } static Object __RT_impl_Runtime_Typeof(RuntimeArguments args, Isolate * isolate) { |
629 | HandleScope scope(isolate); |
630 | DCHECK_EQ(1, args.length())((void) 0); |
631 | Handle<Object> object = args.at(0); |
632 | return *Object::TypeOf(isolate, object); |
633 | } |
634 | |
635 | RUNTIME_FUNCTION(Runtime_AllowDynamicFunction)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_AllowDynamicFunction (RuntimeArguments args, Isolate* isolate); Address Runtime_AllowDynamicFunction (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_AllowDynamicFunction(args, isolate )).ptr(); } static Object __RT_impl_Runtime_AllowDynamicFunction (RuntimeArguments args, Isolate* isolate) { |
636 | HandleScope scope(isolate); |
637 | DCHECK_EQ(1, args.length())((void) 0); |
638 | Handle<JSFunction> target = args.at<JSFunction>(0); |
639 | Handle<JSObject> global_proxy(target->global_proxy(), isolate); |
640 | return *isolate->factory()->ToBoolean( |
641 | Builtins::AllowDynamicFunction(isolate, target, global_proxy)); |
642 | } |
643 | |
644 | RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_CreateAsyncFromSyncIterator (RuntimeArguments args, Isolate* isolate); Address Runtime_CreateAsyncFromSyncIterator (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_CreateAsyncFromSyncIterator(args, isolate )).ptr(); } static Object __RT_impl_Runtime_CreateAsyncFromSyncIterator (RuntimeArguments args, Isolate* isolate) { |
645 | HandleScope scope(isolate); |
646 | DCHECK_EQ(1, args.length())((void) 0); |
647 | |
648 | Handle<Object> sync_iterator = args.at(0); |
649 | |
650 | if (!sync_iterator->IsJSReceiver()) { |
651 | THROW_NEW_ERROR_RETURN_FAILURE(do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolIteratorInvalid)); } while (false) |
652 | isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid))do { auto* __isolate__ = (isolate); return __isolate__->Throw (*__isolate__->factory()->NewTypeError(MessageTemplate:: kSymbolIteratorInvalid)); } while (false); |
653 | } |
654 | |
655 | Handle<Object> next; |
656 | ASSIGN_RETURN_FAILURE_ON_EXCEPTION(do { auto* __isolate__ = (isolate); do { if (!(Object::GetProperty (isolate, sync_iterator, isolate->factory()->next_string ())).ToHandle(&next)) { ((void) 0); return ReadOnlyRoots( __isolate__).exception(); } } while (false); } while (false) |
657 | isolate, next,do { auto* __isolate__ = (isolate); do { if (!(Object::GetProperty (isolate, sync_iterator, isolate->factory()->next_string ())).ToHandle(&next)) { ((void) 0); return ReadOnlyRoots( __isolate__).exception(); } } while (false); } while (false) |
658 | Object::GetProperty(isolate, sync_iterator,do { auto* __isolate__ = (isolate); do { if (!(Object::GetProperty (isolate, sync_iterator, isolate->factory()->next_string ())).ToHandle(&next)) { ((void) 0); return ReadOnlyRoots( __isolate__).exception(); } } while (false); } while (false) |
659 | isolate->factory()->next_string()))do { auto* __isolate__ = (isolate); do { if (!(Object::GetProperty (isolate, sync_iterator, isolate->factory()->next_string ())).ToHandle(&next)) { ((void) 0); return ReadOnlyRoots( __isolate__).exception(); } } while (false); } while (false); |
660 | |
661 | return *isolate->factory()->NewJSAsyncFromSyncIterator( |
662 | Handle<JSReceiver>::cast(sync_iterator), next); |
663 | } |
664 | |
665 | RUNTIME_FUNCTION(Runtime_GetTemplateObject)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_GetTemplateObject (RuntimeArguments args, Isolate* isolate); Address Runtime_GetTemplateObject (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_GetTemplateObject(args, isolate)). ptr(); } static Object __RT_impl_Runtime_GetTemplateObject(RuntimeArguments args, Isolate* isolate) { |
666 | HandleScope scope(isolate); |
667 | DCHECK_EQ(3, args.length())((void) 0); |
668 | Handle<TemplateObjectDescription> description = |
669 | args.at<TemplateObjectDescription>(0); |
670 | Handle<SharedFunctionInfo> shared_info = args.at<SharedFunctionInfo>(1); |
671 | int slot_id = args.smi_value_at(2); |
672 | |
673 | Handle<NativeContext> native_context(isolate->context().native_context(), |
674 | isolate); |
675 | return *TemplateObjectDescription::GetTemplateObject( |
676 | isolate, native_context, description, shared_info, slot_id); |
677 | } |
678 | |
679 | RUNTIME_FUNCTION(Runtime_ReportMessageFromMicrotask)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_ReportMessageFromMicrotask (RuntimeArguments args, Isolate* isolate); Address Runtime_ReportMessageFromMicrotask (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_ReportMessageFromMicrotask(args, isolate )).ptr(); } static Object __RT_impl_Runtime_ReportMessageFromMicrotask (RuntimeArguments args, Isolate* isolate) { |
680 | // Helper to report messages and continue JS execution. This is intended to |
681 | // behave similarly to reporting exceptions which reach the top-level, but |
682 | // allow the JS code to continue. |
683 | HandleScope scope(isolate); |
684 | DCHECK_EQ(1, args.length())((void) 0); |
685 | |
686 | Handle<Object> exception = args.at(0); |
687 | |
688 | DCHECK(!isolate->has_pending_exception())((void) 0); |
689 | isolate->set_pending_exception(*exception); |
690 | MessageLocation* no_location = nullptr; |
691 | Handle<JSMessageObject> message = |
692 | isolate->CreateMessageOrAbort(exception, no_location); |
693 | MessageHandler::ReportMessage(isolate, no_location, message); |
694 | isolate->clear_pending_exception(); |
695 | return ReadOnlyRoots(isolate).undefined_value(); |
696 | } |
697 | |
698 | RUNTIME_FUNCTION(Runtime_GetInitializerFunction)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_GetInitializerFunction (RuntimeArguments args, Isolate* isolate); Address Runtime_GetInitializerFunction (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_GetInitializerFunction(args, isolate )).ptr(); } static Object __RT_impl_Runtime_GetInitializerFunction (RuntimeArguments args, Isolate* isolate) { |
699 | HandleScope scope(isolate); |
700 | DCHECK_EQ(1, args.length())((void) 0); |
701 | |
702 | Handle<JSReceiver> constructor = args.at<JSReceiver>(0); |
703 | Handle<Symbol> key = isolate->factory()->class_fields_symbol(); |
704 | Handle<Object> initializer = |
705 | JSReceiver::GetDataProperty(isolate, constructor, key); |
706 | return *initializer; |
707 | } |
708 | |
709 | RUNTIME_FUNCTION(Runtime_DoubleToStringWithRadix)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_DoubleToStringWithRadix (RuntimeArguments args, Isolate* isolate); Address Runtime_DoubleToStringWithRadix (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_DoubleToStringWithRadix(args, isolate )).ptr(); } static Object __RT_impl_Runtime_DoubleToStringWithRadix (RuntimeArguments args, Isolate* isolate) { |
710 | HandleScope scope(isolate); |
711 | DCHECK_EQ(2, args.length())((void) 0); |
712 | double number = args.number_value_at(0); |
713 | int32_t radix = 0; |
714 | CHECK(args[1].ToInt32(&radix))do { if ((__builtin_expect(!!(!(args[1].ToInt32(&radix))) , 0))) { V8_Fatal("Check failed: %s.", "args[1].ToInt32(&radix)" ); } } while (false); |
715 | |
716 | char* const str = DoubleToRadixCString(number, radix); |
717 | Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(str); |
718 | DeleteArray(str); |
719 | return *result; |
720 | } |
721 | |
722 | RUNTIME_FUNCTION(Runtime_SharedValueBarrierSlow)static inline __attribute__((always_inline)) Object __RT_impl_Runtime_SharedValueBarrierSlow (RuntimeArguments args, Isolate* isolate); Address Runtime_SharedValueBarrierSlow (int args_length, Address* args_object, Isolate* isolate) { ( (void) 0); ; RuntimeArguments args(args_length, args_object); return (__RT_impl_Runtime_SharedValueBarrierSlow(args, isolate )).ptr(); } static Object __RT_impl_Runtime_SharedValueBarrierSlow (RuntimeArguments args, Isolate* isolate) { |
723 | HandleScope scope(isolate); |
724 | DCHECK_EQ(1, args.length())((void) 0); |
725 | Handle<HeapObject> value = args.at<HeapObject>(0); |
726 | Handle<Object> shared_value; |
727 | ASSIGN_RETURN_FAILURE_ON_EXCEPTION(do { auto* __isolate__ = (isolate); do { if (!(Object::ShareSlow (isolate, value, kThrowOnError)).ToHandle(&shared_value)) { ((void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false) |
728 | isolate, shared_value, Object::ShareSlow(isolate, value, kThrowOnError))do { auto* __isolate__ = (isolate); do { if (!(Object::ShareSlow (isolate, value, kThrowOnError)).ToHandle(&shared_value)) { ((void) 0); return ReadOnlyRoots(__isolate__).exception(); } } while (false); } while (false); |
729 | return *shared_value; |
730 | } |
731 | |
732 | } // namespace internal |
733 | } // namespace v8 |