Lines Matching refs:isolate

21 #include "src/execution/isolate-inl.h"
53 V8_WARN_UNUSED_RESULT Object CrashUnlessFuzzing(Isolate* isolate) {
55 return ReadOnlyRoots(isolate).undefined_value();
58 V8_WARN_UNUSED_RESULT bool CrashUnlessFuzzingReturnFalse(Isolate* isolate) {
65 V8_WARN_UNUSED_RESULT Object ReturnFuzzSafe(Object value, Isolate* isolate) {
67 ? ReadOnlyRoots(isolate).undefined_value()
75 if (!args[index].IsNumber()) return CrashUnlessFuzzing(isolate); \
77 if (!args[index].ToInt32(&name)) return CrashUnlessFuzzing(isolate);
83 if (!args[index].IsBoolean()) return CrashUnlessFuzzing(isolate); \
84 bool name = args[index].IsTrue(isolate);
86 bool IsAsmWasmFunction(Isolate* isolate, JSFunction function) {
101 HandleScope scope(isolate);
103 isolate->load_stub_cache()->Clear();
104 isolate->store_stub_cache()->Clear();
105 return ReadOnlyRoots(isolate).undefined_value();
109 HandleScope scope(isolate);
114 return *isolate->factory()->NewNumber(base::uint64_to_double(result));
118 HandleScope scope(isolate);
128 return *isolate->factory()->NewConsString(left, right, length, kIsOneByte);
132 HandleScope scope(isolate);
141 isolate->factory()->NewSubString(string, index, string->length());
147 HandleScope scope(isolate);
151 if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
158 return ReadOnlyRoots(isolate).undefined_value();
162 HandleScope scope(isolate);
168 JavaScriptFrameIterator it(isolate);
169 if (!it.done()) function = handle(it.frame()->function(), isolate);
170 if (function.is_null()) return CrashUnlessFuzzing(isolate);
176 return ReadOnlyRoots(isolate).undefined_value();
180 SealHandleScope shs(isolate);
183 return ReadOnlyRoots(isolate).true_value();
185 return ReadOnlyRoots(isolate).false_value();
190 HandleScope scope(isolate);
195 isolate, result,
196 DebugEvaluate::Global(isolate, source,
204 SealHandleScope shs(isolate);
206 return isolate->heap()->ToBoolean(FLAG_use_ic);
210 SealHandleScope shs(isolate);
212 return isolate->heap()->ToBoolean(
213 isolate->concurrent_recompilation_enabled());
217 SealHandleScope shs(isolate);
219 return isolate->heap()->ToBoolean(isolate->allow_atomics_wait());
225 bool CanOptimizeFunction(Handle<JSFunction> function, Isolate* isolate,
230 Handle<JSFunction> function, Isolate* isolate,
236 return CrashUnlessFuzzingReturnFalse(isolate);
241 !Compiler::Compile(isolate, function, Compiler::CLEAR_EXCEPTION,
243 return CrashUnlessFuzzingReturnFalse(isolate);
251 return CrashUnlessFuzzingReturnFalse(isolate);
254 if (IsAsmWasmFunction(isolate, *function)) {
255 return CrashUnlessFuzzingReturnFalse(isolate);
259 PendingOptimizationTable::MarkedForOptimization(isolate, function);
268 PendingOptimizationTable::FunctionWasOptimized(isolate, function);
279 Isolate* isolate,
283 CHECK(!IsAsmWasmFunction(isolate, *function));
292 Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate) {
294 return CrashUnlessFuzzing(isolate);
298 if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
304 function->shared().is_compiled_scope(isolate));
305 if (!CanOptimizeFunction<kCodeKind>(function, isolate, &is_compiled_scope)) {
306 return ReadOnlyRoots(isolate).undefined_value();
312 if (!type->IsString()) return CrashUnlessFuzzing(isolate);
315 isolate->concurrent_recompilation_enabled()) {
324 CodeT codet = *BUILTIN_CODE(isolate, InterpreterEntryTrampoline);
332 JSFunction::EnsureFeedbackVector(isolate, function, &is_compiled_scope);
333 function->MarkForOptimization(isolate, CodeKind::TURBOFAN, concurrency_mode);
335 return ReadOnlyRoots(isolate).undefined_value();
338 bool EnsureFeedbackVector(Isolate* isolate, Handle<JSFunction> function) {
354 !Compiler::Compile(isolate, function, Compiler::CLEAR_EXCEPTION,
361 JSFunction::EnsureFeedbackVector(isolate, function, &is_compiled_scope);
368 HandleScope scope(isolate);
370 return CrashUnlessFuzzing(isolate);
373 if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
377 function->shared(isolate).is_compiled_scope(isolate);
379 if (!function->shared(isolate).IsUserJavaScript()) {
380 return CrashUnlessFuzzing(isolate);
385 !Compiler::Compile(isolate, function, Compiler::CLEAR_EXCEPTION,
387 return CrashUnlessFuzzing(isolate);
390 if (!Compiler::CompileBaseline(isolate, function, Compiler::CLEAR_EXCEPTION,
392 return CrashUnlessFuzzing(isolate);
403 HandleScope scope(isolate);
411 codet = Maglev::Compile(isolate, function).ToHandleChecked();
413 HandleScope handle_scope(isolate);
414 Maglev::Compile(isolate, function);
421 return ReadOnlyRoots(isolate).undefined_value();
426 return ReadOnlyRoots(isolate).undefined_value();
431 HandleScope scope(isolate);
434 return isolate->heap()->ToBoolean(function->ActiveTierIsMaglev());
439 HandleScope scope(isolate);
446 function->shared().is_compiled_scope(isolate));
447 if (!CanOptimizeFunction<kCodeKind>(function, isolate, &is_compiled_scope)) {
448 return ReadOnlyRoots(isolate).undefined_value();
457 JSFunction::EnsureFeedbackVector(isolate, function, &is_compiled_scope);
458 function->MarkForOptimization(isolate, kCodeKind, concurrency_mode);
460 return ReadOnlyRoots(isolate).undefined_value();
465 return ReadOnlyRoots(isolate).undefined_value();
471 HandleScope scope(isolate);
472 return OptimizeFunctionOnNextCall(args, isolate);
476 HandleScope scope(isolate);
479 EnsureFeedbackVector(isolate, function);
480 return ReadOnlyRoots(isolate).undefined_value();
484 HandleScope scope(isolate);
486 return CrashUnlessFuzzing(isolate);
493 if (!sync_object->IsString()) return CrashUnlessFuzzing(isolate);
501 if (!EnsureFeedbackVector(isolate, function)) {
502 return CrashUnlessFuzzing(isolate);
510 return CrashUnlessFuzzing(isolate);
513 if (IsAsmWasmFunction(isolate, *function)) return CrashUnlessFuzzing(isolate);
519 isolate, function, allow_heuristic_optimization);
522 return ReadOnlyRoots(isolate).undefined_value();
527 void FinalizeOptimization(Isolate* isolate) {
528 DCHECK(isolate->concurrent_recompilation_enabled());
529 isolate->optimizing_compile_dispatcher()->AwaitCompileTasks();
530 isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
531 isolate->optimizing_compile_dispatcher()->set_finalize(true);
534 BytecodeOffset OffsetOfNextJumpLoop(Isolate* isolate, UnoptimizedFrame* frame) {
535 Handle<BytecodeArray> bytecode_array(frame->GetBytecodeArray(), isolate);
567 HandleScope handle_scope(isolate);
575 if (!args[0].IsSmi()) return CrashUnlessFuzzing(isolate);
580 JavaScriptFrameIterator it(isolate);
582 if (!it.done()) function = handle(it.frame()->function(), isolate);
583 if (function.is_null()) return CrashUnlessFuzzing(isolate);
586 return ReadOnlyRoots(isolate).undefined_value();
590 return CrashUnlessFuzzing(isolate);
596 return CrashUnlessFuzzing(isolate);
600 PendingOptimizationTable::MarkedForOptimization(isolate, function);
609 PendingOptimizationTable::FunctionWasOptimized(isolate, function);
611 return ReadOnlyRoots(isolate).undefined_value();
616 return ReadOnlyRoots(isolate).undefined_value();
622 CodeTracer::Scope scope(isolate->GetCodeTracer());
628 function->shared().is_compiled_scope(isolate));
629 JSFunction::EnsureFeedbackVector(isolate, function, &is_compiled_scope);
630 function->MarkForOptimization(isolate, CodeKind::TURBOFAN,
633 isolate->tiering_manager()->RequestOsrAtNextOpportunity(*function);
645 if (isolate->concurrent_recompilation_enabled() && FLAG_concurrent_osr) {
647 OffsetOfNextJumpLoop(isolate, UnoptimizedFrame::cast(it.frame()));
651 return ReadOnlyRoots(isolate).undefined_value();
656 FinalizeOptimization(isolate);
660 isolate, function, osr_offset, UnoptimizedFrame::cast(it.frame()),
666 FinalizeOptimization(isolate);
669 return ReadOnlyRoots(isolate).undefined_value();
673 HandleScope scope(isolate);
677 JavaScriptFrameIterator it(isolate);
678 Handle<JSFunction> function = handle(it.frame()->function(), isolate);
679 if (function.is_null()) return CrashUnlessFuzzing(isolate);
681 return ReadOnlyRoots(isolate).undefined_value();
684 return ReadOnlyRoots(isolate).undefined_value();
688 function->shared().is_compiled_scope(isolate));
689 Compiler::CompileBaseline(isolate, function, Compiler::CLEAR_EXCEPTION,
692 return ReadOnlyRoots(isolate).undefined_value();
696 HandleScope scope(isolate);
699 if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
701 Handle<SharedFunctionInfo> sfi(function->shared(), isolate);
702 if (sfi->abstract_code(isolate).kind() != CodeKind::INTERPRETED_FUNCTION &&
703 sfi->abstract_code(isolate).kind() != CodeKind::BUILTIN) {
704 return CrashUnlessFuzzing(isolate);
709 if (isolate->lazy_compile_dispatcher() &&
710 isolate->lazy_compile_dispatcher()->IsEnqueued(sfi)) {
711 isolate->lazy_compile_dispatcher()->FinishNow(sfi);
715 return ReadOnlyRoots(isolate).undefined_value();
719 HandleScope scope(isolate);
728 if (!isolate->use_optimizer()) {
740 if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
786 JavaScriptFrameIterator it(isolate);
812 if (isolate->concurrent_recompilation_enabled()) {
813 isolate->optimizing_compile_dispatcher()->AwaitCompileTasks();
814 isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
815 isolate->stack_guard()->ClearInstallCode();
816 isolate->optimizing_compile_dispatcher()->set_finalize(false);
818 return ReadOnlyRoots(isolate).undefined_value();
823 if (isolate->concurrent_recompilation_enabled()) {
824 isolate->optimizing_compile_dispatcher()->AwaitCompileTasks();
826 return ReadOnlyRoots(isolate).undefined_value();
831 if (isolate->concurrent_recompilation_enabled()) {
832 FinalizeOptimization(isolate);
834 return ReadOnlyRoots(isolate).undefined_value();
842 HandleScope scope(isolate);
844 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
864 HandleScope scope(isolate);
866 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
880 HandleScope scope(isolate);
884 return ReadOnlyRoots(isolate).undefined_value();
888 HandleScope scope(isolate);
890 isolate->heap()->NotifyContextDisposed(true);
891 return ReadOnlyRoots(isolate).undefined_value();
895 SealHandleScope shs(isolate);
899 isolate->heap()->set_allocation_timeout(timeout);
908 isolate->heap()->EnableInlineAllocation();
910 isolate->heap()->DisableInlineAllocation();
914 return ReadOnlyRoots(isolate).undefined_value();
924 void FillUpOneNewSpacePage(Isolate* isolate, Heap* heap) {
939 isolate->factory()->NewFixedArray(length, AllocationType::kYoung);
954 HandleScope scope(isolate);
955 Heap* heap = isolate->heap();
959 FillUpOneNewSpacePage(isolate, heap);
962 return ReadOnlyRoots(isolate).undefined_value();
966 SealHandleScope shs(isolate);
968 isolate->RequestInterrupt(
969 [](v8::Isolate* isolate, void*) {
970 isolate->RequestGarbageCollectionForTesting(
974 return ReadOnlyRoots(isolate).undefined_value();
996 return ReadOnlyRoots(isolate).undefined_value();
1002 HandleScope hs(isolate);
1008 HeapProfiler* heap_profiler = isolate->heap_profiler();
1018 return ReadOnlyRoots(isolate).undefined_value();
1046 SealHandleScope shs(isolate);
1055 SealHandleScope shs(isolate);
1073 SealHandleScope shs(isolate);
1088 return ReadOnlyRoots(isolate).undefined_value();
1092 SealHandleScope shs(isolate);
1094 isolate->PrintStack(stdout);
1095 return ReadOnlyRoots(isolate).undefined_value();
1099 HandleScope scope(isolate);
1114 isolate->heap()->AddRetainingPathTarget(object, option);
1115 return ReadOnlyRoots(isolate).undefined_value();
1121 SealHandleScope shs(isolate);
1136 HandleScope scope(isolate);
1139 return ReadOnlyRoots(isolate).undefined_value();
1143 SealHandleScope shs(isolate);
1146 if (arg.IsTrue(isolate)) {
1147 isolate->set_force_slow_path(true);
1149 DCHECK(arg.IsFalse(isolate));
1150 isolate->set_force_slow_path(false);
1152 return ReadOnlyRoots(isolate).undefined_value();
1156 SealHandleScope shs(isolate);
1161 isolate->PrintStack(stderr);
1167 HandleScope scope(isolate);
1175 isolate->PrintStack(stderr);
1181 HandleScope scope(isolate);
1186 isolate->PrintStack(stderr);
1192 HandleScope scope(isolate);
1202 Compiler::Compile(isolate, func, Compiler::KEEP_EXCEPTION,
1208 return ReadOnlyRoots(isolate).undefined_value();
1213 int StackSize(Isolate* isolate) {
1215 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;
1231 SealHandleScope shs(isolate);
1233 PrintIndentation(StackSize(isolate));
1234 JavaScriptFrame::PrintTop(isolate, stdout, true, false);
1236 return ReadOnlyRoots(isolate).undefined_value();
1240 SealHandleScope shs(isolate);
1243 PrintIndentation(StackSize(isolate));
1251 SealHandleScope shs(isolate);
1255 return isolate->heap()->ToBoolean(obj1.map() == obj2.map());
1259 SealHandleScope shs(isolate);
1262 return isolate->heap()->ToBoolean(
1263 isolate->heap()->new_lo_space()->Contains(obj) ||
1264 isolate->heap()->code_lo_space()->Contains(obj) ||
1265 isolate->heap()->lo_space()->Contains(obj));
1269 SealHandleScope shs(isolate);
1273 return isolate->heap()->ToBoolean(
1274 isolate->heap()->new_lo_space()->Contains(elements) ||
1275 isolate->heap()->lo_space()->Contains(elements));
1279 SealHandleScope shs(isolate);
1282 return isolate->heap()->ToBoolean(ObjectInYoungGeneration(obj));
1289 if (args.length() != 1) return CrashUnlessFuzzing(isolate);
1291 if (!arg.IsJSObject()) return CrashUnlessFuzzing(isolate);
1297 return ReturnFuzzSafe(ReadOnlyRoots(isolate).false_value(), isolate);
1303 return ReturnFuzzSafe(ReadOnlyRoots(isolate).false_value(), isolate);
1306 return ReturnFuzzSafe(ReadOnlyRoots(isolate).true_value(), isolate);
1320 SealHandleScope shs(isolate);
1322 bool flag = Oddball::cast(args[0]).ToBool(isolate);
1323 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
1326 return ReadOnlyRoots(isolate).undefined_value();
1330 SealHandleScope shs(isolate);
1333 bool is_latin1 = Oddball::cast(args[1]).ToBool(isolate);
1340 return isolate->heap()->ToBoolean(result);
1344 SealHandleScope shs(isolate);
1347 bool is_latin1 = Oddball::cast(args[1]).ToBool(isolate);
1354 return isolate->heap()->ToBoolean(result);
1358 HandleScope shs(isolate);
1376 return *isolate->factory()->NewStringFromAsciiChecked(type_str);
1380 HandleScope shs(isolate);
1383 return isolate->heap()->ToBoolean(
1384 RegExp::IsUnmodifiedRegExp(isolate, regexp));
1390 return isolate->heap()->ToBoolean(obj.Name()); \
1410 return isolate->heap()->ToBoolean(obj.HasFixed##Type##Elements()); \
1418 SealHandleScope shs(isolate);
1420 return isolate->heap()->ToBoolean(
1421 Protectors::IsIsConcatSpreadableLookupChainIntact(isolate));
1425 SealHandleScope shs(isolate);
1427 return isolate->heap()->ToBoolean(
1428 Protectors::IsTypedArraySpeciesLookupChainIntact(isolate));
1432 SealHandleScope shs(isolate);
1434 return isolate->heap()->ToBoolean(
1435 Protectors::IsRegExpSpeciesLookupChainIntact(isolate));
1439 SealHandleScope shs(isolate);
1441 return isolate->heap()->ToBoolean(
1442 Protectors::IsPromiseSpeciesLookupChainIntact(isolate));
1446 SealHandleScope shs(isolate);
1448 return isolate->heap()->ToBoolean(
1449 Protectors::IsArraySpeciesLookupChainIntact(isolate));
1453 SealHandleScope shs(isolate);
1455 return isolate->heap()->ToBoolean(
1456 Protectors::IsMapIteratorLookupChainIntact(isolate));
1460 SealHandleScope shs(isolate);
1462 return isolate->heap()->ToBoolean(
1463 Protectors::IsSetIteratorLookupChainIntact(isolate));
1467 SealHandleScope shs(isolate);
1469 return isolate->heap()->ToBoolean(
1470 Protectors::IsStringIteratorLookupChainIntact(isolate));
1474 SealHandleScope shs(isolate);
1476 return isolate->heap()->ToBoolean(
1477 Protectors::IsArrayIteratorLookupChainIntact(isolate));
1481 // 1. serializes a snapshot of the current isolate,
1483 // 3. and runs VerifyHeap on the resulting isolate.
1485 // The current isolate should not be modified by this call and can keep running
1488 HandleScope scope(isolate);
1490 Snapshot::SerializeDeserializeAndVerifyForTesting(isolate,
1491 isolate->native_context());
1492 return ReadOnlyRoots(isolate).undefined_value();
1496 HandleScope shs(isolate);
1500 object->ObjectVerify(isolate);
1509 return isolate->heap()->ToBoolean(true);
1513 HandleScope shs(isolate);
1515 return *isolate->factory()->NewNumber(JSArrayBuffer::kMaxByteLength);
1519 HandleScope shs(isolate);
1521 return *isolate->factory()->NewNumber(JSTypedArray::kMaxLength);
1525 HandleScope scope(isolate);
1529 MapUpdater::CompleteInobjectSlackTracking(isolate, object->map());
1531 return ReadOnlyRoots(isolate).undefined_value();
1535 SealHandleScope shs(isolate);
1538 return ReadOnlyRoots(isolate).undefined_value();
1542 SealHandleScope shs(isolate);
1544 return ReadOnlyRoots(isolate).true_value();
1591 wasm::GetWasmEngine()->EnableCodeLogging(isolate);
1593 isolate->code_event_dispatcher()->AddListener(noop_listener.get());
1594 return ReadOnlyRoots(isolate).undefined_value();
1598 HandleScope scope(isolate);
1606 JSRegExp::FlagsFromString(isolate, flags_string).value();
1609 isolate, JSRegExp::New(isolate, pattern, flags, backtrack_limit));
1613 SealHandleScope shs(isolate);
1615 return isolate->heap()->ToBoolean(kSystemPointerSize == 8);
1619 HandleScope scope(isolate);
1621 return *isolate->factory()->NewNumber(BigInt::kMaxLengthBits);
1625 HandleScope scope(isolate);
1629 return isolate->heap()->ToBoolean(obj1->address() == obj2->address());
1633 HandleScope scope(isolate);
1636 return isolate->heap()->ToBoolean(obj->IsString() &&
1642 return ReadOnlyRoots(isolate).undefined_value();
1644 HandleScope scope(isolate);
1647 isolate, NewTypeError(MessageTemplate::kRuntimeWrongNumArgs));
1650 Handle<FixedArray> block_list = isolate->factory()->empty_fixed_array();
1655 isolate, NewTypeError(MessageTemplate::kInvalidArgument));
1659 isolate, block_list,
1665 WebSnapshotSerializer serializer(isolate);
1667 DCHECK(isolate->has_pending_exception());
1668 return ReadOnlyRoots(isolate).exception();
1681 isolate, snapshot_data->buffer_size, snapshot_data);
1687 return ReadOnlyRoots(isolate).undefined_value();
1689 HandleScope scope(isolate);
1692 isolate, NewTypeError(MessageTemplate::kRuntimeWrongNumArgs));
1696 isolate, NewTypeError(MessageTemplate::kInvalidArgument));
1700 isolate->factory()->empty_fixed_array();
1704 isolate, NewTypeError(MessageTemplate::kInvalidArgument));
1708 isolate, injected_references,
1713 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
1717 DCHECK(isolate->has_pending_exception());
1718 return ReadOnlyRoots(isolate).exception();
1723 isolate, NewTypeError(MessageTemplate::kWebSnapshotError));
1729 SealHandleScope scope(isolate);
1730 isolate->heap()->CollectSharedGarbage(GarbageCollectionReason::kTesting);
1731 return ReadOnlyRoots(isolate).undefined_value();
1735 HandleScope scope(isolate);