[ia32,root] Make more builtins isolate-independent

This bundles a bunch of miscellaneous things to make more builtins
isolate-independent (e.g.: using tasm::Move instead of asm::mov
methods).

Drive-by: The isolate-independence whitelist was changed to a blacklist.

Bug: v8:6666
Change-Id: I7e0fbe8bb2ca3dc751ad070f1a92aebb88b43125
Reviewed-on: https://chromium-review.googlesource.com/c/1286331
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56728}
This commit is contained in:
Jakob Gruber 2018-10-17 09:38:34 +02:00 committed by Commit Bot
parent 6f21893444
commit 1849b47ce1
5 changed files with 71 additions and 517 deletions

View File

@ -351,485 +351,23 @@ bool Builtins::IsIsolateIndependent(int index) {
// ia32 is a work-in-progress. This will let us make builtins
// isolate-independent one-by-one.
switch (index) {
#ifdef V8_INTL_SUPPORT
case kCollatorConstructor:
case kCollatorInternalCompare:
case kCollatorPrototypeCompare:
case kCollatorPrototypeResolvedOptions:
case kCollatorSupportedLocalesOf:
case kDatePrototypeToLocaleDateString:
case kDatePrototypeToLocaleString:
case kDatePrototypeToLocaleTimeString:
case kDateTimeFormatConstructor:
case kDateTimeFormatInternalFormat:
case kDateTimeFormatPrototypeFormat:
case kDateTimeFormatPrototypeFormatToParts:
case kDateTimeFormatPrototypeResolvedOptions:
case kDateTimeFormatSupportedLocalesOf:
case kListFormatConstructor:
case kListFormatPrototypeResolvedOptions:
case kListFormatSupportedLocalesOf:
case kLocaleConstructor:
case kLocalePrototypeBaseName:
case kLocalePrototypeCalendar:
case kLocalePrototypeCaseFirst:
case kLocalePrototypeCollation:
case kLocalePrototypeHourCycle:
case kLocalePrototypeLanguage:
case kLocalePrototypeMaximize:
case kLocalePrototypeMinimize:
case kLocalePrototypeNumberingSystem:
case kLocalePrototypeNumeric:
case kLocalePrototypeRegion:
case kLocalePrototypeScript:
case kLocalePrototypeToString:
case kNumberFormatConstructor:
case kNumberFormatInternalFormatNumber:
case kNumberFormatPrototypeFormatNumber:
case kNumberFormatPrototypeFormatToParts:
case kNumberFormatPrototypeResolvedOptions:
case kNumberFormatSupportedLocalesOf:
case kPluralRulesConstructor:
case kPluralRulesPrototypeResolvedOptions:
case kPluralRulesPrototypeSelect:
case kPluralRulesSupportedLocalesOf:
case kRelativeTimeFormatConstructor:
case kRelativeTimeFormatPrototypeFormat:
case kRelativeTimeFormatPrototypeFormatToParts:
case kRelativeTimeFormatPrototypeResolvedOptions:
case kRelativeTimeFormatSupportedLocalesOf:
case kSegmenterConstructor:
case kSegmenterPrototypeResolvedOptions:
case kSegmenterSupportedLocalesOf:
case kStringPrototypeNormalizeIntl:
case kStringPrototypeToUpperCaseIntl:
case kV8BreakIteratorConstructor:
case kV8BreakIteratorInternalAdoptText:
case kV8BreakIteratorInternalBreakType:
case kV8BreakIteratorInternalCurrent:
case kV8BreakIteratorInternalFirst:
case kV8BreakIteratorInternalNext:
case kV8BreakIteratorPrototypeAdoptText:
case kV8BreakIteratorPrototypeBreakType:
case kV8BreakIteratorPrototypeCurrent:
case kV8BreakIteratorPrototypeFirst:
case kV8BreakIteratorPrototypeNext:
case kV8BreakIteratorPrototypeResolvedOptions:
case kV8BreakIteratorSupportedLocalesOf:
#endif // V8_INTL_SUPPORT
case kArrayBufferConstructor:
case kArrayBufferConstructor_DoNotInitialize:
case kArrayBufferIsView:
case kArrayBufferPrototypeGetByteLength:
case kArrayBufferPrototypeSlice:
case kArrayConcat:
case kArrayIncludesHoleyDoubles:
case kArrayIncludesPackedDoubles:
case kArrayIndexOfHoleyDoubles:
case kArrayIndexOfPackedDoubles:
case kArrayPop:
case kArrayPrototypeFill:
case kArrayPush:
case kArrayShift:
case kArrayUnshift:
case kAsyncFunctionConstructor:
case kAsyncFunctionLazyDeoptContinuation:
case kAsyncGeneratorFunctionConstructor:
case kAtomicsIsLockFree:
case kAtomicsNotify:
case kAtomicsWait:
case kAtomicsWake:
case kBigIntAsIntN:
case kBigIntAsUintN:
case kBigIntConstructor:
case kBigIntPrototypeToLocaleString:
case kBigIntPrototypeToString:
case kBigIntPrototypeValueOf:
case kBooleanConstructor:
case kCallBoundFunction:
case kCallForwardVarargs:
case kCallFunctionForwardVarargs:
case kCallSitePrototypeGetColumnNumber:
case kCallSitePrototypeGetEvalOrigin:
case kCallSitePrototypeGetFileName:
case kCallSitePrototypeGetFunction:
case kCallSitePrototypeGetFunctionName:
case kCallSitePrototypeGetLineNumber:
case kCallSitePrototypeGetMethodName:
case kCallSitePrototypeGetPosition:
case kCallSitePrototypeGetScriptNameOrSourceURL:
case kCallSitePrototypeGetThis:
case kCallSitePrototypeGetTypeName:
case kCallSitePrototypeIsAsync:
case kCallSitePrototypeIsConstructor:
case kCallSitePrototypeIsEval:
case kCallSitePrototypeIsNative:
case kCallSitePrototypeIsToplevel:
case kCallSitePrototypeToString:
case kCallVarargs:
case kCanUseSameAccessor20ATDictionaryElements:
case kCanUseSameAccessor25ATGenericElementsAccessor:
case kConsoleAssert:
case kConsoleClear:
case kConsoleContext:
case kConsoleCount:
case kConsoleCountReset:
case kConsoleDebug:
case kConsoleDir:
case kConsoleDirXml:
case kConsoleError:
case kConsoleGroup:
case kConsoleGroupCollapsed:
case kConsoleGroupEnd:
case kConsoleInfo:
case kConsoleLog:
case kConsoleProfile:
case kConsoleProfileEnd:
case kConsoleTable:
case kConsoleTime:
case kConsoleTimeEnd:
case kConsoleTimeLog:
case kConsoleTimeStamp:
case kConsoleTrace:
case kConsoleWarn:
case kConstructBoundFunction:
case kConstructedNonConstructable:
case kConstructForwardVarargs:
case kConstructFunction:
case kConstructFunctionForwardVarargs:
case kConstructVarargs:
case kContinueToCodeStubBuiltin:
case kContinueToCodeStubBuiltinWithResult:
case kContinueToJavaScriptBuiltin:
case kContinueToJavaScriptBuiltinWithResult:
case kDataViewConstructor:
case kDateConstructor:
case kDateNow:
case kDateParse:
case kDatePrototypeGetYear:
case kDatePrototypeSetDate:
case kDatePrototypeSetFullYear:
case kDatePrototypeSetHours:
case kDatePrototypeSetMilliseconds:
case kDatePrototypeSetMinutes:
case kDatePrototypeSetMonth:
case kDatePrototypeSetSeconds:
case kDatePrototypeSetTime:
case kDatePrototypeSetUTCDate:
case kDatePrototypeSetUTCFullYear:
case kDatePrototypeSetUTCHours:
case kDatePrototypeSetUTCMilliseconds:
case kDatePrototypeSetUTCMinutes:
case kDatePrototypeSetUTCMonth:
case kDatePrototypeSetUTCSeconds:
case kDatePrototypeSetYear:
case kDatePrototypeToDateString:
case kDatePrototypeToISOString:
case kDatePrototypeToJson:
case kDatePrototypeToString:
case kDatePrototypeToTimeString:
case kDatePrototypeToUTCString:
case kDateUTC:
case kDoubleToI:
case kEmptyFunction:
case kErrorCaptureStackTrace:
case kErrorConstructor:
case kErrorPrototypeToString:
case kExtraWideHandler:
case kForInContinueExtraWideHandler:
case kForInContinueHandler:
case kForInContinueWideHandler:
case kForInPrepareExtraWideHandler:
case kForInPrepareHandler:
case kForInPrepareWideHandler:
case kForInStepExtraWideHandler:
case kForInStepHandler:
case kForInStepWideHandler:
case kFunctionConstructor:
case kFunctionPrototypeApply:
case kFunctionPrototypeBind:
case kFunctionPrototypeCall:
case kFunctionPrototypeToString:
case kGeneratorFunctionConstructor:
case kGenericBuiltinTest22UT12ATHeapObject5ATSmi:
case kGenericBuiltinTest5ATSmi:
case kGlobalDecodeURI:
case kGlobalDecodeURIComponent:
case kGlobalEncodeURI:
case kGlobalEncodeURIComponent:
case kGlobalEscape:
case kGlobalEval:
case kGlobalUnescape:
case kHandleApiCall:
case kHandleApiCallAsConstructor:
case kHandleApiCallAsFunction:
case kIllegal:
case kInstantiateAsmJs:
case kInternalArrayConstructor:
case kInterpreterOnStackReplacement:
case kInterpreterPushArgsThenCall:
case kInterpreterPushArgsThenCallWithFinalSpread:
case kInterpreterPushArgsThenConstruct:
case kInterpreterPushArgsThenConstructWithFinalSpread:
case kInterpreterPushUndefinedAndArgsThenCall:
case kInterruptCheck:
case kIsPromise:
case kIsTraceCategoryEnabled:
case kJSConstructEntryTrampoline:
case kJSEntryTrampoline:
case kJsonParse:
case kJsonStringify:
case kJumpConstantExtraWideHandler:
case kJumpConstantHandler:
case kJumpConstantWideHandler:
case kJumpExtraWideHandler:
case kJumpHandler:
case kJumpIfFalseConstantExtraWideHandler:
case kJumpIfFalseConstantHandler:
case kJumpIfFalseConstantWideHandler:
case kJumpIfFalseExtraWideHandler:
case kJumpIfFalseHandler:
case kJumpIfFalseWideHandler:
case kJumpIfJSReceiverConstantExtraWideHandler:
case kJumpIfJSReceiverConstantHandler:
case kJumpIfJSReceiverConstantWideHandler:
case kJumpIfJSReceiverExtraWideHandler:
case kJumpIfJSReceiverHandler:
case kJumpIfJSReceiverWideHandler:
case kJumpIfNotNullConstantExtraWideHandler:
case kJumpIfNotNullConstantHandler:
case kJumpIfNotNullConstantWideHandler:
case kJumpIfNotNullExtraWideHandler:
case kJumpIfNotNullHandler:
case kJumpIfNotNullWideHandler:
case kJumpIfNotUndefinedConstantExtraWideHandler:
case kJumpIfNotUndefinedConstantHandler:
case kJumpIfNotUndefinedConstantWideHandler:
case kJumpIfNotUndefinedExtraWideHandler:
case kJumpIfNotUndefinedHandler:
case kJumpIfNotUndefinedWideHandler:
case kJumpIfNullConstantExtraWideHandler:
case kJumpIfNullConstantHandler:
case kJumpIfNullConstantWideHandler:
case kJumpIfNullExtraWideHandler:
case kJumpIfNullHandler:
case kJumpIfNullWideHandler:
case kJumpIfTrueConstantExtraWideHandler:
case kJumpIfTrueConstantHandler:
case kJumpIfTrueConstantWideHandler:
case kJumpIfTrueExtraWideHandler:
case kJumpIfTrueHandler:
case kJumpIfTrueWideHandler:
case kJumpIfUndefinedConstantExtraWideHandler:
case kJumpIfUndefinedConstantHandler:
case kJumpIfUndefinedConstantWideHandler:
case kJumpIfUndefinedExtraWideHandler:
case kJumpIfUndefinedHandler:
case kJumpIfUndefinedWideHandler:
case kJumpWideHandler:
case kLdaConstantExtraWideHandler:
case kLdaConstantHandler:
case kLdaConstantWideHandler:
case kLdaContextSlotExtraWideHandler:
case kLdaContextSlotHandler:
case kLdaContextSlotWideHandler:
case kLdaCurrentContextSlotExtraWideHandler:
case kLdaCurrentContextSlotHandler:
case kLdaCurrentContextSlotWideHandler:
case kLdaFalseHandler:
case kLdaImmutableContextSlotExtraWideHandler:
case kLdaImmutableContextSlotHandler:
case kLdaImmutableContextSlotWideHandler:
case kLdaImmutableCurrentContextSlotExtraWideHandler:
case kLdaImmutableCurrentContextSlotHandler:
case kLdaImmutableCurrentContextSlotWideHandler:
case kLdaModuleVariableExtraWideHandler:
case kLdaModuleVariableHandler:
case kLdaModuleVariableWideHandler:
case kLdaNullHandler:
case kLdarExtraWideHandler:
case kLdarHandler:
case kLdarWideHandler:
case kLdaSmiExtraWideHandler:
case kLdaSmiHandler:
case kLdaSmiWideHandler:
case kLdaTheHoleHandler:
case kLdaTrueHandler:
case kLdaUndefinedHandler:
case kLdaZeroHandler:
case kLoad20ATDictionaryElements:
case kLoad23ATFastPackedSmiElements:
case kLoad25ATFastSmiOrObjectElements:
case kLoadFixedElement16ATFixedInt8Array:
case kLoadFixedElement17ATFixedInt16Array:
case kLoadFixedElement17ATFixedUint8Array:
case kLoadFixedElement18ATFixedUint16Array:
case kLoadFixedElement24ATFixedUint8ClampedArray:
case kLoadIC_StringLength:
case kLoadIC_StringWrapperLength:
case kLogicalNotHandler:
case kMakeError:
case kMakeRangeError:
case kMakeSyntaxError:
case kMakeTypeError:
case kMakeURIError:
case kMapPrototypeClear:
case kMathHypot:
case kMathPowInternal:
case kMovExtraWideHandler:
case kMovHandler:
case kMovWideHandler:
case kNotifyDeoptimized:
case kNumberPrototypeToExponential:
case kNumberPrototypeToFixed:
case kNumberPrototypeToLocaleString:
case kNumberPrototypeToPrecision:
case kNumberPrototypeToString:
case kObjectDefineGetter:
case kObjectDefineProperties:
case kObjectDefineProperty:
case kObjectDefineSetter:
case kObjectFreeze:
case kObjectGetOwnPropertyDescriptors:
case kObjectGetOwnPropertySymbols:
case kObjectGetPrototypeOf:
case kObjectIsExtensible:
case kObjectIsFrozen:
case kObjectIsSealed:
case kObjectLookupGetter:
case kObjectLookupSetter:
case kObjectPreventExtensions:
case kObjectPrototypeGetProto:
case kObjectPrototypePropertyIsEnumerable:
case kObjectPrototypeSetProto:
case kObjectSeal:
case kObjectSetPrototypeOf:
case kOrderedHashTableHealIndex:
case kPopContextExtraWideHandler:
case kPopContextHandler:
case kPopContextWideHandler:
case kPushContextExtraWideHandler:
case kPushContextHandler:
case kPushContextWideHandler:
case kRecordWrite:
case kReflectApply:
case kReflectConstruct:
case kReflectDefineProperty:
case kReflectDeleteProperty:
case kReflectGet:
case kReflectGetOwnPropertyDescriptor:
case kReflectGetPrototypeOf:
case kReflectIsExtensible:
case kReflectOwnKeys:
case kReflectPreventExtensions:
case kReflectSet:
case kReflectSetPrototypeOf:
case kRegExpCapture1Getter:
case kRegExpCapture2Getter:
case kRegExpCapture3Getter:
case kRegExpCapture4Getter:
case kRegExpCapture5Getter:
case kRegExpCapture6Getter:
case kRegExpCapture7Getter:
case kRegExpCapture8Getter:
case kRegExpCapture9Getter:
case kRegExpInputGetter:
case kRegExpInputSetter:
case kRegExpLastMatchGetter:
case kRegExpLastParenGetter:
case kRegExpLeftContextGetter:
case kRegExpPrototypeToString:
case kRegExpRightContextGetter:
case kResumeGeneratorTrampoline:
case kSetPendingMessageHandler:
case kSetPrototypeClear:
case kSharedArrayBufferPrototypeGetByteLength:
case kSharedArrayBufferPrototypeSlice:
case kStackCheck:
case kStaContextSlotExtraWideHandler:
case kStaContextSlotHandler:
case kStaContextSlotWideHandler:
case kStaCurrentContextSlotExtraWideHandler:
case kStaCurrentContextSlotHandler:
case kStaCurrentContextSlotWideHandler:
case kStarExtraWideHandler:
case kStarHandler:
case kStarWideHandler:
case kStore19ATTempArrayElements:
case kStore20ATFastDoubleElements:
case kStore23ATFastPackedSmiElements:
case kStore25ATFastSmiOrObjectElements:
case kStoreFixedElement16ATFixedInt8Array:
case kStoreFixedElement17ATFixedInt16Array:
case kStoreFixedElement17ATFixedUint8Array:
case kStoreFixedElement18ATFixedUint16Array:
case kStoreFixedElement19ATFixedFloat32Array:
case kStoreFixedElement19ATFixedFloat64Array:
case kStoreFixedElement20ATFixedBigInt64Array:
case kStoreFixedElement21ATFixedBigUint64Array:
case kStoreFixedElement24ATFixedUint8ClampedArray:
case kStrictPoisonPillThrower:
case kStringFromCodePoint:
case kStringPrototypeEndsWith:
case kStringPrototypeLastIndexOf:
case kStringPrototypeLocaleCompare:
case kStringPrototypeStartsWith:
case kStringPrototypeToLocaleLowerCase:
case kStringPrototypeToLocaleUpperCase:
case kStringRaw:
case kSwitchOnGeneratorStateExtraWideHandler:
case kSwitchOnGeneratorStateHandler:
case kSwitchOnGeneratorStateWideHandler:
case kSwitchOnSmiNoFeedbackExtraWideHandler:
case kSwitchOnSmiNoFeedbackHandler:
case kSwitchOnSmiNoFeedbackWideHandler:
case kSymbolConstructor:
case kSymbolFor:
case kSymbolKeyFor:
case kTestHelperPlus1:
case kTestHelperPlus2:
case kTestNullHandler:
case kTestReferenceEqualExtraWideHandler:
case kTestReferenceEqualHandler:
case kTestReferenceEqualWideHandler:
case kTestTypeOfHandler:
case kTestUndefinedHandler:
case kTestUndetectableHandler:
case kThrowWasmTrapDivByZero:
case kThrowWasmTrapDivUnrepresentable:
case kThrowWasmTrapFloatUnrepresentable:
case kThrowWasmTrapFuncInvalid:
case kThrowWasmTrapFuncSigMismatch:
case kThrowWasmTrapMemOutOfBounds:
case kThrowWasmTrapRemByZero:
case kThrowWasmTrapUnalignedAccess:
case kThrowWasmTrapUnreachable:
case kTrace:
case kTypedArrayPrototypeBuffer:
case kTypedArrayPrototypeCopyWithin:
case kTypedArrayPrototypeFill:
case kTypedArrayPrototypeIncludes:
case kTypedArrayPrototypeIndexOf:
case kTypedArrayPrototypeLastIndexOf:
case kTypedArrayPrototypeReverse:
case kTypeof:
case kTypeOfHandler:
case kUnsupportedThrower:
case kWasmAllocateHeapNumber:
case kWasmCallJavaScript:
case kWasmCompileLazy:
case kWasmGrowMemory:
case kWasmStackGuard:
case kWasmThrow:
case kWasmToNumber:
case kWeakFactoryCleanupIteratorNext:
case kWeakFactoryConstructor:
case kWeakFactoryMakeCell:
case kWeakMapLookupHashIndex:
case kWideHandler:
return true;
default:
case kCallApiCallback_Argc0:
case kCallApiCallback_Argc1:
case kCallApiGetter:
case kCEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit:
case kCEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit:
case kCEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit:
case kCEntry_Return1_SaveFPRegs_ArgvOnStack_BuiltinExit:
case kCEntry_Return1_SaveFPRegs_ArgvOnStack_NoBuiltinExit:
case kCEntry_Return2_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit:
case kCEntry_Return2_DontSaveFPRegs_ArgvOnStack_BuiltinExit:
case kCEntry_Return2_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit:
case kCEntry_Return2_SaveFPRegs_ArgvOnStack_BuiltinExit:
case kCEntry_Return2_SaveFPRegs_ArgvOnStack_NoBuiltinExit:
case kInterpreterEntryTrampoline:
return false;
default:
return true;
}
#endif // V8_TARGET_ARCH_IA32
UNREACHABLE();

View File

@ -883,7 +883,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// If ok, push undefined as the initial value for all register file entries.
Label loop_header;
Label loop_check;
__ mov(eax, Immediate(masm->isolate()->factory()->undefined_value()));
__ Move(eax, masm->isolate()->factory()->undefined_value());
__ jmp(&loop_check);
__ bind(&loop_header);
// TODO(rmcilroy): Consider doing more than one push per loop iteration.
@ -914,9 +914,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// handler at the current bytecode offset.
Label do_dispatch;
__ bind(&do_dispatch);
__ mov(kInterpreterDispatchTableRegister,
Immediate(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
__ Move(kInterpreterDispatchTableRegister,
Immediate(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
__ movzx_b(ecx, Operand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister, times_1, 0));
__ mov(
@ -1140,10 +1140,11 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ Pop(kJavaScriptCallNewTargetRegister);
__ Pop(kJavaScriptCallTargetRegister);
__ PushReturnAddressFrom(eax);
__ movd(eax, xmm0); // Reload number of arguments.
__ AssertFunction(kJavaScriptCallTargetRegister);
__ AssertUndefinedOrAllocationSite(kJavaScriptCallExtraArg1Register);
__ AssertUndefinedOrAllocationSite(kJavaScriptCallExtraArg1Register, eax);
__ movd(eax, xmm0); // Reload number of arguments.
__ Jump(BUILTIN_CODE(masm->isolate(), ArrayConstructorImpl),
RelocInfo::CODE_TARGET);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
@ -1209,9 +1210,9 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
__ push(scratch);
// Initialize the dispatch table register.
__ mov(kInterpreterDispatchTableRegister,
Immediate(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
__ Move(kInterpreterDispatchTableRegister,
Immediate(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ mov(kInterpreterBytecodeArrayRegister,
@ -2154,17 +2155,23 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
// -- edi : the target to call (can be any Object).
// -----------------------------------
Label non_callable, non_function, non_smi;
Label non_callable, non_function, non_smi, non_jsfunction,
non_jsboundfunction;
__ JumpIfSmi(edi, &non_callable);
__ bind(&non_smi);
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
__ j(equal, masm->isolate()->builtins()->CallFunction(mode),
RelocInfo::CODE_TARGET);
__ j(not_equal, &non_jsfunction);
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
RelocInfo::CODE_TARGET);
__ bind(&non_jsfunction);
__ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE);
__ j(equal, BUILTIN_CODE(masm->isolate(), CallBoundFunction),
RelocInfo::CODE_TARGET);
__ j(not_equal, &non_jsboundfunction);
__ Jump(BUILTIN_CODE(masm->isolate(), CallBoundFunction),
RelocInfo::CODE_TARGET);
// Check if target is a proxy and call CallProxy external builtin
__ bind(&non_jsboundfunction);
__ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
Immediate(Map::IsCallableBit::kMask));
__ j(zero, &non_callable);
@ -2265,27 +2272,31 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
// -----------------------------------
// Check if target is a Smi.
Label non_constructor, non_proxy;
__ JumpIfSmi(edi, &non_constructor, Label::kNear);
Label non_constructor, non_proxy, non_jsfunction, non_jsboundfunction;
__ JumpIfSmi(edi, &non_constructor);
// Check if target has a [[Construct]] internal method.
__ mov(ecx, FieldOperand(edi, HeapObject::kMapOffset));
__ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
Immediate(Map::IsConstructorBit::kMask));
__ j(zero, &non_constructor, Label::kNear);
__ j(zero, &non_constructor);
// Dispatch based on instance type.
__ CmpInstanceType(ecx, JS_FUNCTION_TYPE);
__ j(equal, BUILTIN_CODE(masm->isolate(), ConstructFunction),
RelocInfo::CODE_TARGET);
__ j(not_equal, &non_jsfunction);
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructFunction),
RelocInfo::CODE_TARGET);
// Only dispatch to bound functions after checking whether they are
// constructors.
__ bind(&non_jsfunction);
__ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE);
__ j(equal, BUILTIN_CODE(masm->isolate(), ConstructBoundFunction),
RelocInfo::CODE_TARGET);
__ j(not_equal, &non_jsboundfunction);
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructBoundFunction),
RelocInfo::CODE_TARGET);
// Only dispatch to proxies after checking whether they are constructors.
__ bind(&non_jsboundfunction);
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
__ j(not_equal, &non_proxy);
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructProxy),
@ -2383,7 +2394,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
Label fill;
__ bind(&fill);
__ inc(eax);
__ push(Immediate(masm->isolate()->factory()->undefined_value()));
__ Push(Immediate(masm->isolate()->factory()->undefined_value()));
__ cmp(eax, kExpectedNumberOfArgumentsRegister);
__ j(less, &fill);
@ -2602,7 +2613,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
// Call C function.
__ mov(Operand(esp, 0 * kPointerSize), edi); // argc.
__ mov(Operand(esp, 1 * kPointerSize), esi); // argv.
__ mov(ecx, Immediate(ExternalReference::isolate_address(masm->isolate())));
__ Move(ecx, Immediate(ExternalReference::isolate_address(masm->isolate())));
__ mov(Operand(esp, 2 * kPointerSize), ecx);
__ call(kRuntimeCallFunctionRegister);
@ -2610,14 +2621,14 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
// Check result for exception sentinel.
Label exception_returned;
__ cmp(eax, masm->isolate()->factory()->exception());
__ CompareRoot(eax, RootIndex::kException);
__ j(equal, &exception_returned);
// Check that there is no pending exception, otherwise we
// should have returned the exception sentinel.
if (FLAG_debug_code) {
__ push(edx);
__ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value()));
__ LoadRoot(edx, RootIndex::kTheHoleValue);
Label okay;
ExternalReference pending_exception_address = ExternalReference::Create(
IsolateAddressId::kPendingExceptionAddress, masm->isolate());
@ -2655,8 +2666,9 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
__ PrepareCallCFunction(3, eax);
__ mov(Operand(esp, 0 * kPointerSize), Immediate(0)); // argc.
__ mov(Operand(esp, 1 * kPointerSize), Immediate(0)); // argv.
__ mov(Operand(esp, 2 * kPointerSize),
Immediate(ExternalReference::isolate_address(masm->isolate())));
__ Move(esi,
Immediate(ExternalReference::isolate_address(masm->isolate())));
__ mov(Operand(esp, 2 * kPointerSize), esi);
__ CallCFunction(find_handler, 3);
}
@ -2959,8 +2971,7 @@ void GenerateInternalArrayConstructorCase(MacroAssembler* masm,
__ bind(&not_one_case);
// Load undefined into the allocation site parameter as required by
// ArrayNArgumentsConstructor.
__ mov(kJavaScriptCallExtraArg1Register,
masm->isolate()->factory()->undefined_value());
__ LoadRoot(kJavaScriptCallExtraArg1Register, RootIndex::kUndefinedValue);
Handle<Code> code = BUILTIN_CODE(masm->isolate(), ArrayNArgumentsConstructor);
__ Jump(code, RelocInfo::CODE_TARGET);
}

View File

@ -678,7 +678,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
MoveOperandIfAliasedWithPoisonRegister(instr, this);
if (HasImmediateInput(instr, 0)) {
Handle<Code> code = i.InputCode(0);
__ call(code, RelocInfo::CODE_TARGET);
__ Call(code, RelocInfo::CODE_TARGET);
} else {
Register reg = i.InputRegister(0);
DCHECK_IMPLIES(
@ -730,7 +730,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
if (HasImmediateInput(instr, 0)) {
Handle<Code> code = i.InputCode(0);
__ jmp(code, RelocInfo::CODE_TARGET);
__ Jump(code, RelocInfo::CODE_TARGET);
} else {
Register reg = i.InputRegister(0);
DCHECK_IMPLIES(

View File

@ -539,12 +539,15 @@ void MacroAssembler::RecordWrite(Register object, Register address,
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
Label dont_drop;
ExternalReference restart_fp =
ExternalReference::debug_restart_fp_address(isolate());
mov(eax, ExternalReferenceAsOperand(restart_fp, eax));
test(eax, eax);
j(not_zero, BUILTIN_CODE(isolate(), FrameDropperTrampoline),
RelocInfo::CODE_TARGET);
j(zero, &dont_drop, Label::kNear);
Jump(BUILTIN_CODE(isolate(), FrameDropperTrampoline), RelocInfo::CODE_TARGET);
bind(&dont_drop);
}
void TurboAssembler::Cvtsi2ss(XMMRegister dst, Operand src) {
@ -760,14 +763,15 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
Check(equal, AbortReason::kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
Label done_checking;
AssertNotSmi(object);
cmp(object, isolate()->factory()->undefined_value());
CompareRoot(object, scratch, RootIndex::kUndefinedValue);
j(equal, &done_checking);
cmp(FieldOperand(object, 0),
Immediate(isolate()->factory()->allocation_site_map()));
LoadRoot(scratch, RootIndex::kAllocationSiteWithWeakNextMap);
cmp(FieldOperand(object, 0), scratch);
Assert(equal, AbortReason::kExpectedUndefinedOrCell);
bind(&done_checking);
}
@ -1304,7 +1308,7 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
// Clear the new.target register if not given.
if (!new_target.is_valid()) {
mov(edx, isolate()->factory()->undefined_value());
Move(edx, isolate()->factory()->undefined_value());
}
Label done;
@ -1380,6 +1384,7 @@ void TurboAssembler::Ret(int bytes_dropped, Register scratch) {
void TurboAssembler::Push(Immediate value) {
#ifdef V8_EMBEDDED_BUILTINS
if (root_array_available_ && ShouldGenerateIsolateIndependentCode()) {
Assembler::AllowExplicitEbxAccessScope read_only_access(this);
if (value.is_embedded_object()) {
Push(HeapObjectAsOperand(value.embedded_object()));
return;

View File

@ -660,7 +660,7 @@ class MacroAssembler : public TurboAssembler {
// Abort execution if argument is not undefined or an AllocationSite, enabled
// via --debug-code.
void AssertUndefinedOrAllocationSite(Register object);
void AssertUndefinedOrAllocationSite(Register object, Register scratch);
// ---------------------------------------------------------------------------
// Exception handling