X87: Unify "runtime-style" IC functions with Runtime intrinsics
port bc8041dc2b
(r29811).
original commit message:
Previous to this CL, ICs used a slightly different code idiom
to get to C++ code from generated code than runtime intrinsics,
using an IC_Utility class that in essence provided exactly
the same functionality as Runtime::FunctionForId, but in its
own quirky way.
This CL unifies the two mechanisms, folding IC_Utility
away by making all IC entry points in C++ code, e.g. IC
miss handlers, full-fledged runtime intrinsics. This makes
it possible to eliminate a bunch of ad-hoc declarations and
adapters that the IC system had to needlessly re-invent.
As a bonus and the original reason for this yak-shave:
IC-related C++ runtime functions are now callable from
TurboFan.
BUG=
Review URL: https://codereview.chromium.org/1252903002
Cr-Commit-Position: refs/heads/master@{#29837}
This commit is contained in:
parent
1359017f80
commit
2571c69dcb
@ -294,10 +294,9 @@ static void PushInterceptorArguments(MacroAssembler* masm, Register receiver,
|
||||
|
||||
static void CompileCallLoadPropertyWithInterceptor(
|
||||
MacroAssembler* masm, Register receiver, Register holder, Register name,
|
||||
Handle<JSObject> holder_obj, IC::UtilityId id) {
|
||||
Handle<JSObject> holder_obj, Runtime::FunctionId id) {
|
||||
PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
|
||||
__ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()),
|
||||
NamedLoadHandlerCompiler::kInterceptorArgsLength);
|
||||
__ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
|
||||
}
|
||||
|
||||
|
||||
@ -321,8 +320,7 @@ void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
|
||||
StoreIC_PushArgs(masm);
|
||||
|
||||
// Do tail-call to runtime routine.
|
||||
ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
|
||||
__ TailCallExternalReference(ref, 3, 1);
|
||||
__ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -331,8 +329,7 @@ void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
|
||||
StoreIC_PushArgs(masm);
|
||||
|
||||
// Do tail-call to runtime routine.
|
||||
ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
|
||||
__ TailCallExternalReference(ref, 3, 1);
|
||||
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -678,7 +675,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
|
||||
// of this method.)
|
||||
CompileCallLoadPropertyWithInterceptor(
|
||||
masm(), receiver(), holder_reg, this->name(), holder(),
|
||||
IC::kLoadPropertyWithInterceptorOnly);
|
||||
Runtime::kLoadPropertyWithInterceptorOnly);
|
||||
|
||||
// Check if interceptor provided a value for property. If it's
|
||||
// the case, return immediately.
|
||||
@ -719,10 +716,8 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
|
||||
holder());
|
||||
__ push(scratch2()); // restore old return address
|
||||
|
||||
ExternalReference ref = ExternalReference(
|
||||
IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
|
||||
__ TailCallExternalReference(
|
||||
ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
|
||||
__ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
|
||||
NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -747,9 +742,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
|
||||
__ push(scratch1()); // restore return address
|
||||
|
||||
// Do tail-call to the runtime system.
|
||||
ExternalReference store_callback_property =
|
||||
ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
|
||||
__ TailCallExternalReference(store_callback_property, 5, 1);
|
||||
__ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(kind(), Code::FAST, name);
|
||||
@ -765,9 +758,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
|
||||
__ push(scratch1()); // restore return address
|
||||
|
||||
// Do tail-call to the runtime system.
|
||||
ExternalReference store_ic_property = ExternalReference(
|
||||
IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
|
||||
__ TailCallExternalReference(store_ic_property, 3, 1);
|
||||
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(kind(), Code::FAST, name);
|
||||
|
@ -678,10 +678,8 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
|
||||
LoadIC_PushArgs(masm);
|
||||
|
||||
// Perform tail call to the entry.
|
||||
ExternalReference ref =
|
||||
ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
|
||||
int arg_count = 4;
|
||||
__ TailCallExternalReference(ref, arg_count, 1);
|
||||
__ TailCallRuntime(Runtime::kLoadIC_Miss, arg_count, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -711,10 +709,8 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
|
||||
LoadIC_PushArgs(masm);
|
||||
|
||||
// Perform tail call to the entry.
|
||||
ExternalReference ref =
|
||||
ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
|
||||
int arg_count = 4;
|
||||
__ TailCallExternalReference(ref, arg_count, 1);
|
||||
__ TailCallRuntime(Runtime::kKeyedLoadIC_Miss, arg_count, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -770,9 +766,7 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
|
||||
StoreIC_PushArgs(masm);
|
||||
|
||||
// Perform tail call to the entry.
|
||||
ExternalReference ref =
|
||||
ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
|
||||
__ TailCallExternalReference(ref, 3, 1);
|
||||
__ TailCallRuntime(Runtime::kStoreIC_Miss, 3, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -808,9 +802,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
|
||||
StoreIC_PushArgs(masm);
|
||||
|
||||
// Do tail-call to runtime routine.
|
||||
ExternalReference ref =
|
||||
ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
|
||||
__ TailCallExternalReference(ref, 3, 1);
|
||||
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss, 3, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -368,9 +368,7 @@ void LoadIndexedInterceptorStub::Generate(MacroAssembler* masm) {
|
||||
__ push(scratch); // return address
|
||||
|
||||
// Perform tail call to the entry.
|
||||
ExternalReference ref = ExternalReference(
|
||||
IC_Utility(IC::kLoadElementWithInterceptor), masm->isolate());
|
||||
__ TailCallExternalReference(ref, 2, 1);
|
||||
__ TailCallRuntime(Runtime::kLoadElementWithInterceptor, 2, 1);
|
||||
|
||||
__ bind(&slow);
|
||||
PropertyAccessCompiler::TailCallBuiltin(
|
||||
@ -2152,11 +2150,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) {
|
||||
__ push(edx);
|
||||
|
||||
// Call the entry.
|
||||
IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss
|
||||
: IC::kCallIC_Customization_Miss;
|
||||
|
||||
ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate());
|
||||
__ CallExternalReference(miss, 3);
|
||||
Runtime::FunctionId id = GetICState() == DEFAULT
|
||||
? Runtime::kCallIC_Miss
|
||||
: Runtime::kCallIC_Customization_Miss;
|
||||
__ CallRuntime(id, 3);
|
||||
|
||||
// Move result to edi and exit the internal frame.
|
||||
__ mov(edi, eax);
|
||||
@ -3586,15 +3583,13 @@ void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
|
||||
void CompareICStub::GenerateMiss(MacroAssembler* masm) {
|
||||
{
|
||||
// Call the runtime system in a fresh internal frame.
|
||||
ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss),
|
||||
isolate());
|
||||
FrameScope scope(masm, StackFrame::INTERNAL);
|
||||
__ push(edx); // Preserve edx and eax.
|
||||
__ push(eax);
|
||||
__ push(edx); // And also use them as the arguments.
|
||||
__ push(eax);
|
||||
__ push(Immediate(Smi::FromInt(op())));
|
||||
__ CallExternalReference(miss, 3);
|
||||
__ CallRuntime(Runtime::kCompareIC_Miss, 3);
|
||||
// Compute the entry point of the rewritten stub.
|
||||
__ lea(edi, FieldOperand(eax, Code::kHeaderSize));
|
||||
__ pop(eax);
|
||||
|
@ -70,7 +70,9 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
|
||||
if (mode == SAVE_RESULT_REGISTER) __ push(eax);
|
||||
|
||||
__ Move(eax, Immediate(0)); // No arguments.
|
||||
__ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate())));
|
||||
__ mov(ebx,
|
||||
Immediate(ExternalReference(
|
||||
Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate())));
|
||||
|
||||
CEntryStub ceb(masm->isolate(), 1);
|
||||
__ CallStub(&ceb);
|
||||
|
Loading…
Reference in New Issue
Block a user