Reviewers: Weiliang,
Message:
PTAL
Description:
X87: Unify "runtime-style" IC functions with Runtime intrinsics
port bc8041dc2b4c8431c5c2476496acd3b7b8b3f61e (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=
Please review this at https://codereview.chromium.org/1252903002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+22, -42 lines):
M src/ic/x87/handler-compiler-x87.cc
M src/ic/x87/ic-x87.cc
M src/x87/code-stubs-x87.cc
M src/x87/debug-x87.cc
Index: src/ic/x87/handler-compiler-x87.cc
diff --git a/src/ic/x87/handler-compiler-x87.cc
b/src/ic/x87/handler-compiler-x87.cc
index
056bd952c7d105e4d52872964f5f24dde3c60452..fb09fd9c23c58ebc0e8eaeda84cad5f6c9b5a011
100644
--- a/src/ic/x87/handler-compiler-x87.cc
+++ b/src/ic/x87/handler-compiler-x87.cc
@@ -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);
}
@@ -669,7 +666,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.
@@ -710,10 +707,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);
}
@@ -738,9 +733,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);
@@ -756,9 +749,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);
Index: src/ic/x87/ic-x87.cc
diff --git a/src/ic/x87/ic-x87.cc b/src/ic/x87/ic-x87.cc
index
1725992ef2865976b56b244ab08e148ba106f0a4..3f4cf190381c46b56c001d4883bcb29c7b209489
100644
--- a/src/ic/x87/ic-x87.cc
+++ b/src/ic/x87/ic-x87.cc
@@ -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);
}
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index
1ca2a918709056d85f9126bf72cecc9b3a0bd1cc..176f7ff488ee655539ed35e6078b62df02c698a2
100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -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);
Index: src/x87/debug-x87.cc
diff --git a/src/x87/debug-x87.cc b/src/x87/debug-x87.cc
index
a9961beca69965fe11e21a58cd765a87f9f9a8ba..aa9ed3e6afd0ab72eba28aa192e764c94809d4d0
100644
--- a/src/x87/debug-x87.cc
+++ b/src/x87/debug-x87.cc
@@ -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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.