Index: src/ic/ppc/handler-compiler-ppc.cc |
diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/ppc/handler-compiler-ppc.cc |
similarity index 89% |
copy from src/ic/arm/handler-compiler-arm.cc |
copy to src/ic/ppc/handler-compiler-ppc.cc |
index b29e78677fd41b21ebfb77f1c1dafb18508517b7..2f29c83412c55a63e50391eca7e44b58218b7c2a 100644 |
--- a/src/ic/arm/handler-compiler-arm.cc |
+++ b/src/ic/ppc/handler-compiler-ppc.cc |
@@ -4,7 +4,7 @@ |
#include "src/v8.h" |
-#if V8_TARGET_ARCH_ARM |
+#if V8_TARGET_ARCH_PPC |
#include "src/ic/call-optimization.h" |
#include "src/ic/handler-compiler.h" |
@@ -20,8 +20,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
Handle<JSFunction> getter) { |
// ----------- S t a t e ------------- |
- // -- r0 : receiver |
- // -- r2 : name |
+ // -- r3 : receiver |
+ // -- r5 : name |
// -- lr : return address |
// ----------------------------------- |
{ |
@@ -31,8 +31,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
// Call the JavaScript getter with the receiver on the stack. |
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
// Swap in the global receiver. |
- __ ldr(receiver, |
- FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
+ __ LoadP(receiver, |
+ FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
} |
__ push(receiver); |
ParameterCount actual(0); |
@@ -46,7 +46,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
} |
// Restore context register. |
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
} |
__ Ret(); |
} |
@@ -68,8 +68,8 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
// Call the JavaScript setter with receiver and value on the stack. |
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
// Swap in the global receiver. |
- __ ldr(receiver, |
- FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
+ __ LoadP(receiver, |
+ FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
} |
__ Push(receiver, value()); |
ParameterCount actual(1); |
@@ -83,10 +83,10 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
} |
// We have to return the passed value, not the return value of the setter. |
- __ pop(r0); |
+ __ pop(r3); |
// Restore context register. |
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
} |
__ Ret(); |
} |
@@ -108,28 +108,28 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
// Bail out if the receiver has a named interceptor or requires access checks. |
Register map = scratch1; |
- __ ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ ldrb(scratch0, FieldMemOperand(map, Map::kBitFieldOffset)); |
- __ tst(scratch0, Operand(kInterceptorOrAccessCheckNeededMask)); |
- __ b(ne, miss_label); |
+ __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
+ __ lbz(scratch0, FieldMemOperand(map, Map::kBitFieldOffset)); |
+ __ andi(r0, scratch0, Operand(kInterceptorOrAccessCheckNeededMask)); |
+ __ bne(miss_label, cr0); |
// Check that receiver is a JSObject. |
- __ ldrb(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
- __ cmp(scratch0, Operand(FIRST_SPEC_OBJECT_TYPE)); |
- __ b(lt, miss_label); |
+ __ lbz(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
+ __ cmpi(scratch0, Operand(FIRST_SPEC_OBJECT_TYPE)); |
+ __ blt(miss_label); |
// Load properties array. |
Register properties = scratch0; |
- __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
+ __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
// Check that the properties array is a dictionary. |
- __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset)); |
+ __ LoadP(map, FieldMemOperand(properties, HeapObject::kMapOffset)); |
Register tmp = properties; |
__ LoadRoot(tmp, Heap::kHashTableMapRootIndex); |
__ cmp(map, tmp); |
- __ b(ne, miss_label); |
+ __ bne(miss_label); |
// Restore the temporarily used register. |
- __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
+ __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
NameDictionaryLookupStub::GenerateNegativeLookup( |
@@ -149,17 +149,18 @@ void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
// Check we're still in the same context. |
Register scratch = prototype; |
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
- __ ldr(scratch, MemOperand(cp, offset)); |
- __ ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
- __ ldr(scratch, MemOperand(scratch, Context::SlotOffset(index))); |
+ __ LoadP(scratch, MemOperand(cp, offset)); |
+ __ LoadP(scratch, |
+ FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
+ __ LoadP(scratch, MemOperand(scratch, Context::SlotOffset(index))); |
__ Move(ip, function); |
__ cmp(ip, scratch); |
- __ b(ne, miss); |
+ __ bne(miss); |
// Load its initial map. The global functions all have initial maps. |
__ Move(prototype, Handle<Map>(function->initial_map())); |
// Load the prototype from the initial map. |
- __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
+ __ LoadP(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
} |
@@ -167,7 +168,7 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
MacroAssembler* masm, Register receiver, Register scratch1, |
Register scratch2, Label* miss_label) { |
__ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
- __ mov(r0, scratch1); |
+ __ mr(r3, scratch1); |
__ Ret(); |
} |
@@ -181,10 +182,10 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
DCHECK(cell->value()->IsTheHole()); |
__ mov(scratch, Operand(cell)); |
- __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); |
+ __ LoadP(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); |
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
__ cmp(scratch, ip); |
- __ b(ne, miss); |
+ __ bne(miss); |
} |
@@ -233,10 +234,10 @@ void PropertyHandlerCompiler::GenerateFastApiCall( |
DCHECK(optimization.is_simple_api_call()); |
// Abi for CallApiFunctionStub. |
- Register callee = r0; |
- Register call_data = r4; |
- Register holder = r2; |
- Register api_function_address = r1; |
+ Register callee = r3; |
+ Register call_data = r7; |
+ Register holder = r5; |
+ Register api_function_address = r4; |
// Put holder in place. |
CallOptimization::HolderLookup holder_lookup; |
@@ -266,7 +267,8 @@ void PropertyHandlerCompiler::GenerateFastApiCall( |
// Put call_data in place. |
if (isolate->heap()->InNewSpace(*call_data_obj)) { |
__ Move(call_data, api_call_info); |
- __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); |
+ __ LoadP(call_data, |
+ FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); |
} else if (call_data_obj->IsUndefined()) { |
call_data_undefined = true; |
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); |
@@ -338,7 +340,7 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, |
Label* miss_label) { |
__ Move(scratch1(), handle(constant, isolate())); |
__ cmp(value_reg, scratch1()); |
- __ b(ne, miss_label); |
+ __ bne(miss_label); |
} |
@@ -348,16 +350,16 @@ void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type, |
__ JumpIfSmi(value_reg, miss_label); |
HeapType::Iterator<Map> it = field_type->Classes(); |
if (!it.Done()) { |
- __ ldr(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
+ __ LoadP(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
Label do_store; |
while (true) { |
__ CompareMap(scratch1(), it.Current(), &do_store); |
it.Advance(); |
if (it.Done()) { |
- __ b(ne, miss_label); |
+ __ bne(miss_label); |
break; |
} |
- __ b(eq, &do_store); |
+ __ beq(&do_store); |
} |
__ bind(&do_store); |
} |
@@ -411,16 +413,16 @@ Register PropertyHandlerCompiler::CheckPrototypes( |
GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, |
scratch2); |
- __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); |
+ __ LoadP(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); |
reg = holder_reg; // From now on the object will be in holder_reg. |
- __ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); |
+ __ LoadP(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); |
} else { |
Register map_reg = scratch1; |
if (depth != 1 || check == CHECK_ALL_MAPS) { |
// CheckMap implicitly loads the map of |reg| into |map_reg|. |
__ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK); |
} else { |
- __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
+ __ LoadP(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
} |
// Check access rights to the global object. This has to happen after |
@@ -445,7 +447,7 @@ Register PropertyHandlerCompiler::CheckPrototypes( |
bool load_prototype_from_map = |
heap()->InNewSpace(*prototype) || depth == 1; |
if (load_prototype_from_map) { |
- __ ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
+ __ LoadP(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
} else { |
__ mov(reg, Operand(prototype)); |
} |
@@ -500,7 +502,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
// Return the constant value. |
- __ Move(r0, value); |
+ __ Move(r3, value); |
__ Ret(); |
} |
@@ -522,18 +524,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback( |
__ push(receiver()); |
if (heap()->InNewSpace(callback->data())) { |
__ Move(scratch3(), callback); |
- __ ldr(scratch3(), |
- FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); |
+ __ LoadP(scratch3(), |
+ FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); |
} else { |
__ Move(scratch3(), Handle<Object>(callback->data(), isolate())); |
} |
__ push(scratch3()); |
__ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
- __ mov(scratch4(), scratch3()); |
+ __ mr(scratch4(), scratch3()); |
__ Push(scratch3(), scratch4()); |
__ mov(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); |
__ Push(scratch4(), reg); |
- __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_ |
__ push(name()); |
// Abi for CallApiGetter |
@@ -590,8 +591,8 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
// the case, return immediately. |
Label interceptor_failed; |
__ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); |
- __ cmp(r0, scratch1()); |
- __ b(eq, &interceptor_failed); |
+ __ cmp(r3, scratch1()); |
+ __ beq(&interceptor_failed); |
frame_scope.GenerateLeaveFrame(); |
__ Ret(); |
@@ -627,9 +628,8 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
Handle<ExecutableAccessorInfo> callback) { |
Register holder_reg = Frontend(receiver(), name); |
- __ push(receiver()); // receiver |
- __ push(holder_reg); |
- __ mov(ip, Operand(callback)); // callback info |
+ __ Push(receiver(), holder_reg); // receiver |
+ __ mov(ip, Operand(callback)); // callback info |
__ push(ip); |
__ mov(ip, Operand(name)); |
__ Push(ip, value()); |
@@ -671,17 +671,17 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
// Get the value from the cell. |
Register result = StoreDescriptor::ValueRegister(); |
__ mov(result, Operand(cell)); |
- __ ldr(result, FieldMemOperand(result, Cell::kValueOffset)); |
+ __ LoadP(result, FieldMemOperand(result, Cell::kValueOffset)); |
// Check for deleted property if property can actually be deleted. |
if (is_configurable) { |
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
__ cmp(result, ip); |
- __ b(eq, &miss); |
+ __ beq(&miss); |
} |
Counters* counters = isolate()->counters(); |
- __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3); |
+ __ IncrementCounter(counters->named_load_global_stub(), 1, r4, r6); |
__ Ret(); |
FrontendFooter(name, &miss); |