Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: src/arm64/stub-cache-arm64.cc

Issue 411973002: Restructure the IC / Handler compilers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/arm64/stub-cache-arm64.cc
diff --git a/src/arm64/stub-cache-arm64.cc b/src/arm64/stub-cache-arm64.cc
index a466b6bcab83e0fdf284f6bb5c3462efd6c94b6c..5e394c5dfec816cd697c0fb0297b95c6aad6f71c 100644
--- a/src/arm64/stub-cache-arm64.cc
+++ b/src/arm64/stub-cache-arm64.cc
@@ -17,12 +17,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
-void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
- Label* miss_label,
- Register receiver,
- Handle<Name> name,
- Register scratch0,
- Register scratch1) {
+void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
+ MacroAssembler* masm, Label* miss_label, Register receiver,
+ Handle<Name> name, Register scratch0, Register scratch1) {
ASSERT(!AreAliased(receiver, scratch0, scratch1));
ASSERT(name->IsUniqueName());
Counters* counters = masm->isolate()->counters();
@@ -201,29 +198,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm,
}
-void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
- int index,
- Register prototype) {
- // Load the global or builtins object from the current context.
- __ Ldr(prototype, GlobalObjectMemOperand());
- // Load the native context from the global or builtins object.
- __ Ldr(prototype,
- FieldMemOperand(prototype, GlobalObject::kNativeContextOffset));
- // Load the function from the native context.
- __ Ldr(prototype, ContextMemOperand(prototype, index));
- // Load the initial map. The global functions all have initial maps.
- __ Ldr(prototype,
- FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset));
- // Load the prototype from the initial map.
- __ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
-}
-
-
-void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
- MacroAssembler* masm,
- int index,
- Register prototype,
- Label* miss) {
+void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
+ MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
@@ -244,50 +220,9 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
}
-void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
- Register dst,
- Register src,
- bool inobject,
- int index,
- Representation representation) {
- ASSERT(!representation.IsDouble());
- USE(representation);
- if (inobject) {
- int offset = index * kPointerSize;
- __ Ldr(dst, FieldMemOperand(src, offset));
- } else {
- // Calculate the offset into the properties array.
- int offset = index * kPointerSize + FixedArray::kHeaderSize;
- __ Ldr(dst, FieldMemOperand(src, JSObject::kPropertiesOffset));
- __ Ldr(dst, FieldMemOperand(dst, offset));
- }
-}
-
-
-void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
- Register receiver,
- Register scratch,
- Label* miss_label) {
- ASSERT(!AreAliased(receiver, scratch));
-
- // Check that the receiver isn't a smi.
- __ JumpIfSmi(receiver, miss_label);
-
- // Check that the object is a JS array.
- __ JumpIfNotObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE,
- miss_label);
-
- // Load length directly from the JS array.
- __ Ldr(x0, FieldMemOperand(receiver, JSArray::kLengthOffset));
- __ Ret();
-}
-
-
-void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
- Register receiver,
- Register scratch1,
- Register scratch2,
- Label* miss_label) {
+void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
+ MacroAssembler* masm, Register receiver, Register scratch1,
+ Register scratch2, Label* miss_label) {
__ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
// TryGetFunctionPrototype can't put the result directly in x0 because the
// 3 inputs registers can't alias and we call this function from
@@ -301,11 +236,9 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
// Generate code to check that a global property cell is empty. Create
// the property cell at compilation time if no cell exists for the
// property.
-void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
- Handle<JSGlobalObject> global,
- Handle<Name> name,
- Register scratch,
- Label* miss) {
+void PropertyHandlerCompiler::GenerateCheckPropertyCell(
+ MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
+ Register scratch, Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
ASSERT(cell->value()->IsTheHole());
__ Mov(scratch, Operand(cell));
@@ -314,12 +247,9 @@ void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
}
-void StoreStubCompiler::GenerateNegativeHolderLookup(
- MacroAssembler* masm,
- Handle<JSObject> holder,
- Register holder_reg,
- Handle<Name> name,
- Label* miss) {
+void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
+ MacroAssembler* masm, Handle<JSObject> holder, Register holder_reg,
+ Handle<Name> name, Label* miss) {
if (holder->IsJSGlobalObject()) {
GenerateCheckPropertyCell(
masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
@@ -334,19 +264,11 @@ void StoreStubCompiler::GenerateNegativeHolderLookup(
// When leaving generated code after success, the receiver_reg and storage_reg
// may be clobbered. Upon branch to miss_label, the receiver and name registers
// have their original values.
-void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
- Handle<JSObject> object,
- LookupResult* lookup,
- Handle<Map> transition,
- Handle<Name> name,
- Register receiver_reg,
- Register storage_reg,
- Register value_reg,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Label* miss_label,
- Label* slow) {
+void NamedStoreHandlerCompiler::GenerateStoreTransition(
+ MacroAssembler* masm, Handle<JSObject> object, LookupResult* lookup,
+ Handle<Map> transition, Handle<Name> name, Register receiver_reg,
+ Register storage_reg, Register value_reg, Register scratch1,
+ Register scratch2, Register scratch3, Label* miss_label, Label* slow) {
Label exit;
ASSERT(!AreAliased(receiver_reg, storage_reg, value_reg,
@@ -507,15 +429,10 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
// When leaving generated code after success, the receiver_reg and name_reg may
// be clobbered. Upon branch to miss_label, the receiver and name registers have
// their original values.
-void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
- Handle<JSObject> object,
- LookupResult* lookup,
- Register receiver_reg,
- Register name_reg,
- Register value_reg,
- Register scratch1,
- Register scratch2,
- Label* miss_label) {
+void NamedStoreHandlerCompiler::GenerateStoreField(
+ MacroAssembler* masm, Handle<JSObject> object, LookupResult* lookup,
+ Register receiver_reg, Register name_reg, Register value_reg,
+ Register scratch1, Register scratch2, Label* miss_label) {
// x0 : value
Label exit;
@@ -635,9 +552,9 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
}
-void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm,
- Label* label,
- Handle<Name> name) {
+void NamedStoreHandlerCompiler::GenerateRestoreName(MacroAssembler* masm,
+ Label* label,
+ Handle<Name> name) {
if (!label->is_unused()) {
__ Bind(label);
__ Mov(this->name(), Operand(name));
@@ -681,14 +598,10 @@ static void CompileCallLoadPropertyWithInterceptor(
// Generate call to api function.
-void StubCompiler::GenerateFastApiCall(MacroAssembler* masm,
- const CallOptimization& optimization,
- Handle<Map> receiver_map,
- Register receiver,
- Register scratch,
- bool is_store,
- int argc,
- Register* values) {
+void PropertyHandlerCompiler::GenerateFastApiCall(
+ MacroAssembler* masm, const CallOptimization& optimization,
+ Handle<Map> receiver_map, Register receiver, Register scratch,
+ bool is_store, int argc, Register* values) {
ASSERT(!AreAliased(receiver, scratch));
MacroAssembler::PushPopQueue queue(masm);
@@ -759,7 +672,8 @@ void StubCompiler::GenerateFastApiCall(MacroAssembler* masm,
}
-void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
+void PropertyAccessCompiler::GenerateTailCall(MacroAssembler* masm,
+ Handle<Code> code) {
__ Jump(code, RelocInfo::CODE_TARGET);
}
@@ -768,15 +682,10 @@ void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
- Register object_reg,
- Handle<JSObject> holder,
- Register holder_reg,
- Register scratch1,
- Register scratch2,
- Handle<Name> name,
- Label* miss,
- PrototypeCheckType check) {
+Register PropertyHandlerCompiler::CheckPrototypes(
+ Handle<HeapType> type, Register object_reg, Handle<JSObject> holder,
+ Register holder_reg, Register scratch1, Register scratch2,
+ Handle<Name> name, Label* miss, PrototypeCheckType check) {
Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
// object_reg and holder_reg registers can alias.
@@ -883,7 +792,7 @@ Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
}
-void LoadStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
+void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
if (!miss->is_unused()) {
Label success;
__ B(&success);
@@ -896,7 +805,7 @@ void LoadStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
}
-void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
+void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
if (!miss->is_unused()) {
Label success;
__ B(&success);
@@ -909,15 +818,15 @@ void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
}
-Register LoadStubCompiler::CallbackHandlerFrontend(Handle<HeapType> type,
- Register object_reg,
- Handle<JSObject> holder,
- Handle<Name> name,
- Handle<Object> callback) {
+Register NamedLoadHandlerCompiler::CallbackFrontend(Handle<HeapType> type,
+ Register object_reg,
+ Handle<JSObject> holder,
+ Handle<Name> name,
+ Handle<Object> callback) {
Label miss;
- Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
- // HandlerFrontendHeader can return its result into scratch1() so do not
+ Register reg = FrontendHeader(type, object_reg, holder, name, &miss);
+ // FrontendHeader can return its result into scratch1() so do not
// use it.
Register scratch2 = this->scratch2();
Register scratch3 = this->scratch3();
@@ -950,31 +859,29 @@ Register LoadStubCompiler::CallbackHandlerFrontend(Handle<HeapType> type,
__ B(ne, &miss);
}
- HandlerFrontendFooter(name, &miss);
+ FrontendFooter(name, &miss);
return reg;
}
-void LoadStubCompiler::GenerateLoadField(Register reg,
- Handle<JSObject> holder,
- FieldIndex field,
- Representation representation) {
+void NamedLoadHandlerCompiler::GenerateLoadField(
+ Register reg, Handle<JSObject> holder, FieldIndex field,
+ Representation representation) {
__ Mov(receiver(), reg);
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
-void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
+void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
// Return the constant value.
__ LoadObject(x0, value);
__ Ret();
}
-void LoadStubCompiler::GenerateLoadCallback(
- Register reg,
- Handle<ExecutableAccessorInfo> callback) {
+void NamedLoadHandlerCompiler::GenerateLoadCallback(
+ Register reg, Handle<ExecutableAccessorInfo> callback) {
ASSERT(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
// Build ExecutableAccessorInfo::args_ list on the stack and push property
@@ -1027,11 +934,9 @@ void LoadStubCompiler::GenerateLoadCallback(
}
-void LoadStubCompiler::GenerateLoadInterceptor(
- Register holder_reg,
- Handle<Object> object,
- Handle<JSObject> interceptor_holder,
- LookupResult* lookup,
+void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
+ Register holder_reg, Handle<Object> object,
+ Handle<JSObject> interceptor_holder, LookupResult* lookup,
Handle<Name> name) {
ASSERT(!AreAliased(receiver(), this->name(),
scratch1(), scratch2(), scratch3()));
@@ -1115,14 +1020,12 @@ void LoadStubCompiler::GenerateLoadInterceptor(
}
-Handle<Code> StoreStubCompiler::CompileStoreCallback(
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
+Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
+ Handle<JSObject> object, Handle<JSObject> holder, Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
- ASM_LOCATION("StoreStubCompiler::CompileStoreCallback");
- Register holder_reg = HandlerFrontend(
- IC::CurrentTypeOf(object, isolate()), receiver(), holder, name);
+ ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback");
+ Register holder_reg =
+ Frontend(IC::CurrentTypeOf(object, isolate()), receiver(), holder, name);
// Stub never generated for non-global objects that require access checks.
ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
@@ -1148,10 +1051,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
#define __ ACCESS_MASM(masm)
-void StoreStubCompiler::GenerateStoreViaSetter(
- MacroAssembler* masm,
- Handle<HeapType> type,
- Register receiver,
+void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
+ MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Handle<JSFunction> setter) {
// ----------- S t a t e -------------
// -- lr : return address
@@ -1196,12 +1097,11 @@ void StoreStubCompiler::GenerateStoreViaSetter(
#define __ ACCESS_MASM(masm())
-Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
- Handle<JSObject> object,
- Handle<Name> name) {
+Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
+ Handle<JSObject> object, Handle<Name> name) {
Label miss;
- ASM_LOCATION("StoreStubCompiler::CompileStoreInterceptor");
+ ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor");
__ Push(receiver(), this->name(), value());
@@ -1215,10 +1115,9 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
- Handle<JSObject> last,
- Handle<Name> name) {
- NonexistentHandlerFrontend(type, last, name);
+Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
+ Handle<HeapType> type, Handle<JSObject> last, Handle<Name> name) {
+ NonexistentFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
@@ -1231,12 +1130,13 @@ Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
// TODO(all): The so-called scratch registers are significant in some cases. For
-// example, KeyedStoreStubCompiler::registers()[3] (x3) is actually used for
-// KeyedStoreCompiler::transition_map(). We should verify which registers are
-// actually scratch registers, and which are important. For now, we use the same
-// assignments as ARM to remain on the safe side.
+// example, PropertyAccessCompiler::keyed_store_calling_convention()[3] (x3) is
+// actually
+// used for KeyedStoreCompiler::transition_map(). We should verify which
+// registers are actually scratch registers, and which are important. For now,
+// we use the same assignments as ARM to remain on the safe side.
-Register* LoadStubCompiler::registers() {
+Register* PropertyAccessCompiler::load_calling_convention() {
// receiver, name, scratch1, scratch2, scratch3, scratch4.
Register receiver = LoadIC::ReceiverRegister();
Register name = LoadIC::NameRegister();
@@ -1245,21 +1145,7 @@ Register* LoadStubCompiler::registers() {
}
-Register* KeyedLoadStubCompiler::registers() {
- // receiver, name, scratch1, scratch2, scratch3, scratch4.
- Register receiver = LoadIC::ReceiverRegister();
- Register name = LoadIC::NameRegister();
- static Register registers[] = { receiver, name, x3, x0, x4, x5 };
- return registers;
-}
-
-
-Register StoreStubCompiler::value() {
- return StoreIC::ValueRegister();
-}
-
-
-Register* StoreStubCompiler::registers() {
+Register* PropertyAccessCompiler::store_calling_convention() {
// receiver, value, scratch1, scratch2, scratch3.
Register receiver = StoreIC::ReceiverRegister();
Register name = StoreIC::NameRegister();
@@ -1268,7 +1154,7 @@ Register* StoreStubCompiler::registers() {
}
-Register* KeyedStoreStubCompiler::registers() {
+Register* PropertyAccessCompiler::keyed_store_calling_convention() {
// receiver, name, scratch1/map, scratch2, scratch3.
Register receiver = KeyedStoreIC::ReceiverRegister();
Register name = KeyedStoreIC::NameRegister();
@@ -1278,13 +1164,15 @@ Register* KeyedStoreStubCompiler::registers() {
}
+Register NamedStoreHandlerCompiler::value() { return StoreIC::ValueRegister(); }
+
+
#undef __
#define __ ACCESS_MASM(masm)
-void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
- Handle<HeapType> type,
- Register receiver,
- Handle<JSFunction> getter) {
+void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
+ MacroAssembler* masm, Handle<HeapType> type, Register receiver,
+ Handle<JSFunction> getter) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -1317,14 +1205,11 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
#define __ ACCESS_MASM(masm())
-Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<HeapType> type,
- Handle<GlobalObject> global,
- Handle<PropertyCell> cell,
- Handle<Name> name,
- bool is_dont_delete) {
+Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
+ Handle<HeapType> type, Handle<GlobalObject> global,
+ Handle<PropertyCell> cell, Handle<Name> name, bool is_dont_delete) {
Label miss;
- HandlerFrontendHeader(type, receiver(), global, name, &miss);
+ FrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ Mov(x3, Operand(cell));
@@ -1340,19 +1225,18 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
__ Mov(x0, x4);
__ Ret();
- HandlerFrontendFooter(name, &miss);
+ FrontendFooter(name, &miss);
// Return the generated code.
return GetCode(kind(), Code::NORMAL, name);
}
-Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
- TypeHandleList* types,
- CodeHandleList* handlers,
- Handle<Name> name,
- Code::StubType type,
- IcCheckType check) {
+Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types,
+ CodeHandleList* handlers,
+ Handle<Name> name,
+ Code::StubType type,
+ IcCheckType check) {
Label miss;
if (check == PROPERTY &&
@@ -1395,11 +1279,11 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
// Return the generated code.
InlineCacheState state =
(number_of_handled_maps > 1) ? POLYMORPHIC : MONOMORPHIC;
- return GetICCode(kind(), type, name, state);
+ return GetCode(kind(), type, name, state);
}
-void StoreStubCompiler::GenerateStoreArrayLength() {
+void NamedStoreHandlerCompiler::GenerateStoreArrayLength() {
// Prepare tail call to StoreIC_ArrayLength.
__ Push(receiver(), value());
@@ -1410,13 +1294,12 @@ void StoreStubCompiler::GenerateStoreArrayLength() {
}
-Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
- MapHandleList* receiver_maps,
- CodeHandleList* handler_stubs,
+Handle<Code> PropertyICCompiler::CompileIndexedStorePolymorphic(
+ MapHandleList* receiver_maps, CodeHandleList* handler_stubs,
MapHandleList* transitioned_maps) {
Label miss;
- ASM_LOCATION("KeyedStoreStubCompiler::CompileStorePolymorphic");
+ ASM_LOCATION("PropertyICCompiler::CompileStorePolymorphic");
__ JumpIfSmi(receiver(), &miss);
@@ -1439,15 +1322,14 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
__ Bind(&miss);
TailCallBuiltin(masm(), MissBuiltin(kind()));
- return GetICCode(
- kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
+ return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
#undef __
#define __ ACCESS_MASM(masm)
-void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
+void IndexedHandlerCompiler::GenerateLoadDictionaryElement(
MacroAssembler* masm) {
// The return address is in lr.
Label slow, miss;
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/builtins.cc » ('j') | src/ia32/stub-cache-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698