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

Unified Diff: src/ic/s390/handler-compiler-s390.cc

Issue 1743263003: S390: Initial impl of debug and ic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix s390 files under correct target in BUILD.gn Created 4 years, 10 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
« no previous file with comments | « src/ic/s390/access-compiler-s390.cc ('k') | src/ic/s390/ic-compiler-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/s390/handler-compiler-s390.cc
diff --git a/src/ic/ppc/handler-compiler-ppc.cc b/src/ic/s390/handler-compiler-s390.cc
similarity index 92%
copy from src/ic/ppc/handler-compiler-ppc.cc
copy to src/ic/s390/handler-compiler-s390.cc
index 6e7d78afd3ef315a75899cc95339680d9be31751..3e25080d9df30b0c3ba75acfd584b2612eff431a 100644
--- a/src/ic/ppc/handler-compiler-ppc.cc
+++ b/src/ic/s390/handler-compiler-s390.cc
@@ -1,8 +1,8 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
+// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if V8_TARGET_ARCH_PPC
+#if V8_TARGET_ARCH_S390
#include "src/ic/handler-compiler.h"
@@ -16,17 +16,16 @@ namespace internal {
#define __ ACCESS_MASM(masm)
-
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder,
int accessor_index, int expected_arguments, Register scratch) {
// ----------- S t a t e -------------
- // -- r3 : receiver
- // -- r5 : name
+ // -- r2 : receiver
+ // -- r4 : name
// -- lr : return address
// -----------------------------------
{
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
+ FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
@@ -38,11 +37,11 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
- __ push(receiver);
+ __ Push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
- __ LoadAccessor(r4, holder, accessor_index, ACCESSOR_GETTER);
- __ InvokeFunction(r4, expected, actual, CALL_FUNCTION,
+ __ LoadAccessor(r3, holder, accessor_index, ACCESSOR_GETTER);
+ __ InvokeFunction(r3, expected, actual, CALL_FUNCTION,
CheckDebugStepCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
@@ -56,7 +55,6 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ Ret();
}
-
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder,
int accessor_index, int expected_arguments, Register scratch) {
@@ -64,10 +62,10 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
// -- lr : return address
// -----------------------------------
{
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
+ FrameScope scope(masm, StackFrame::INTERNAL);
// Save value register, so we can restore it later.
- __ push(value());
+ __ Push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
@@ -83,8 +81,8 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(receiver, value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
- __ LoadAccessor(r4, holder, accessor_index, ACCESSOR_SETTER);
- __ InvokeFunction(r4, expected, actual, CALL_FUNCTION,
+ __ LoadAccessor(r3, holder, accessor_index, ACCESSOR_SETTER);
+ __ InvokeFunction(r3, expected, actual, CALL_FUNCTION,
CheckDebugStepCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
@@ -93,7 +91,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
}
// We have to return the passed value, not the return value of the setter.
- __ pop(r3);
+ __ Pop(r2);
// Restore context register.
__ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
@@ -101,27 +99,23 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Ret();
}
-
void PropertyHandlerCompiler::PushVectorAndSlot(Register vector,
Register slot) {
MacroAssembler* masm = this->masm();
__ Push(vector, slot);
}
-
void PropertyHandlerCompiler::PopVectorAndSlot(Register vector, Register slot) {
MacroAssembler* masm = this->masm();
__ Pop(vector, slot);
}
-
void PropertyHandlerCompiler::DiscardVectorAndSlot() {
MacroAssembler* masm = this->masm();
// Remove vector and slot.
- __ addi(sp, sp, Operand(2 * kPointerSize));
+ __ la(sp, MemOperand(sp, 2 * kPointerSize));
}
-
void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
MacroAssembler* masm, Label* miss_label, Register receiver,
Handle<Name> name, Register scratch0, Register scratch1) {
@@ -139,13 +133,14 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
// Bail out if the receiver has a named interceptor or requires access checks.
Register map = scratch1;
__ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
- __ lbz(scratch0, FieldMemOperand(map, Map::kBitFieldOffset));
- __ andi(r0, scratch0, Operand(kInterceptorOrAccessCheckNeededMask));
- __ bne(miss_label, cr0);
+ __ LoadlB(scratch0, FieldMemOperand(map, Map::kBitFieldOffset));
+ __ AndP(r0, scratch0, Operand(kInterceptorOrAccessCheckNeededMask));
+ __ bne(miss_label);
// Check that receiver is a JSObject.
- __ lbz(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset));
- __ cmpi(scratch0, Operand(FIRST_JS_RECEIVER_TYPE));
+ // TODO(joransiu): Merge into SI compare
+ __ LoadlB(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset));
+ __ CmpP(scratch0, Operand(FIRST_JS_RECEIVER_TYPE));
__ blt(miss_label);
// Load properties array.
@@ -153,22 +148,18 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
__ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
// Check that the properties array is a dictionary.
__ LoadP(map, FieldMemOperand(properties, HeapObject::kMapOffset));
- Register tmp = properties;
- __ LoadRoot(tmp, Heap::kHashTableMapRootIndex);
- __ cmp(map, tmp);
+ __ CompareRoot(map, Heap::kHashTableMapRootIndex);
__ bne(miss_label);
// Restore the temporarily used register.
__ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
-
NameDictionaryLookupStub::GenerateNegativeLookup(
masm, miss_label, &done, receiver, properties, name, scratch1);
__ bind(&done);
__ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
}
-
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register result, Label* miss) {
__ LoadNativeContextSlot(index, result);
@@ -179,16 +170,14 @@ void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
__ LoadP(result, FieldMemOperand(result, Map::kPrototypeOffset));
}
-
void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
MacroAssembler* masm, Register receiver, Register scratch1,
Register scratch2, Label* miss_label) {
__ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
- __ mr(r3, scratch1);
+ __ LoadRR(r2, scratch1);
__ Ret();
}
-
// 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.
@@ -200,12 +189,10 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
- __ cmp(scratch, ip);
+ __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex);
__ bne(miss);
}
-
static void PushInterceptorArguments(MacroAssembler* masm, Register receiver,
Register holder, Register name,
Handle<JSObject> holder_obj) {
@@ -213,12 +200,11 @@ static void PushInterceptorArguments(MacroAssembler* masm, Register receiver,
STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1);
STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
- __ push(name);
- __ push(receiver);
- __ push(holder);
+ __ Push(name);
+ __ Push(receiver);
+ __ Push(holder);
}
-
static void CompileCallLoadPropertyWithInterceptor(
MacroAssembler* masm, Register receiver, Register holder, Register name,
Handle<JSObject> holder_obj, Runtime::FunctionId id) {
@@ -228,7 +214,6 @@ static void CompileCallLoadPropertyWithInterceptor(
__ CallRuntime(id);
}
-
// Generate call to api function.
void PropertyHandlerCompiler::GenerateApiAccessorCall(
MacroAssembler* masm, const CallOptimization& optimization,
@@ -237,20 +222,20 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
int accessor_index) {
DCHECK(!accessor_holder.is(scratch_in));
DCHECK(!receiver.is(scratch_in));
- __ push(receiver);
+ __ Push(receiver);
// Write the arguments to stack frame.
if (is_store) {
DCHECK(!receiver.is(store_parameter));
DCHECK(!scratch_in.is(store_parameter));
- __ push(store_parameter);
+ __ Push(store_parameter);
}
DCHECK(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub.
- Register callee = r3;
- Register data = r7;
- Register holder = r5;
- Register api_function_address = r4;
+ Register callee = r2;
+ Register data = r6;
+ Register holder = r4;
+ Register api_function_address = r3;
// Put callee in place.
__ LoadAccessor(callee, accessor_holder, accessor_index,
@@ -320,7 +305,6 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ TailCallStub(&stub);
}
-
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
StoreDescriptor::ValueRegister(),
@@ -328,7 +312,6 @@ static void StoreIC_PushArgs(MacroAssembler* masm) {
VectorStoreICDescriptor::VectorRegister());
}
-
void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
@@ -337,7 +320,6 @@ void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kStoreIC_Slow);
}
-
void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
@@ -346,11 +328,9 @@ void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
-
#undef __
#define __ ACCESS_MASM(masm())
-
void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
Handle<Name> name) {
if (!label->is_unused()) {
@@ -359,18 +339,15 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
}
}
-
void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
__ mov(this->name(), Operand(name));
}
-
void NamedStoreHandlerCompiler::RearrangeVectorAndSlot(
Register current_map, Register destination_map) {
DCHECK(false); // Not implemented.
}
-
void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
Register map_reg,
Register scratch,
@@ -379,13 +356,12 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
DCHECK(!map_reg.is(scratch));
__ LoadWeakValue(map_reg, cell, miss);
if (transition->CanBeDeprecated()) {
- __ lwz(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset));
- __ DecodeField<Map::Deprecated>(r0, scratch, SetRC);
- __ bne(miss, cr0);
+ __ LoadlW(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset));
+ __ DecodeField<Map::Deprecated>(r0, scratch);
+ __ bne(miss);
}
}
-
void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
int descriptor,
Register value_reg,
@@ -395,9 +371,8 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
DCHECK(!map_reg.is(value_reg));
DCHECK(!value_reg.is(scratch));
__ LoadInstanceDescriptors(map_reg, scratch);
- __ LoadP(scratch, FieldMemOperand(
- scratch, DescriptorArray::GetValueOffset(descriptor)));
- __ cmp(value_reg, scratch);
+ __ CmpP(value_reg, FieldMemOperand(
+ scratch, DescriptorArray::GetValueOffset(descriptor)));
__ bne(miss_label);
}
@@ -417,7 +392,6 @@ void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type,
}
}
-
Register PropertyHandlerCompiler::CheckPrototypes(
Register object_reg, Register holder_reg, Register scratch1,
Register scratch2, Handle<Name> name, Label* miss, PrototypeCheckType check,
@@ -554,7 +528,6 @@ Register PropertyHandlerCompiler::CheckPrototypes(
return return_holder ? reg : no_reg;
}
-
void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
if (!miss->is_unused()) {
Label success;
@@ -569,7 +542,6 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
}
-
void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
if (!miss->is_unused()) {
Label success;
@@ -581,14 +553,12 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
}
-
void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
// Return the constant value.
- __ Move(r3, value);
+ __ Move(r2, value);
__ Ret();
}
-
void NamedLoadHandlerCompiler::GenerateLoadCallback(
Register reg, Handle<AccessorInfo> callback) {
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
@@ -605,7 +575,7 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
- __ push(receiver());
+ __ Push(receiver());
// Push data from AccessorInfo.
Handle<Object> data(callback->data(), isolate());
if (data->IsUndefined() || data->IsSmi()) {
@@ -638,7 +608,6 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
__ TailCallStub(&stub);
}
-
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
LookupIterator* it, Register holder_reg) {
DCHECK(holder()->HasNamedInterceptor());
@@ -662,7 +631,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
// Save necessary data before invoking an interceptor.
// Requires a frame to make GC aware of pushed pointers.
{
- FrameAndConstantPoolScope frame_scope(masm(), StackFrame::INTERNAL);
+ FrameScope frame_scope(masm(), StackFrame::INTERNAL);
if (must_preserve_receiver_reg) {
__ Push(receiver(), holder_reg, this->name());
} else {
@@ -679,18 +648,17 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
// Check if interceptor provided a value for property. If it's
// the case, return immediately.
Label interceptor_failed;
- __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
- __ cmp(r3, scratch1());
- __ beq(&interceptor_failed);
+ __ CompareRoot(r2, Heap::kNoInterceptorResultSentinelRootIndex);
+ __ beq(&interceptor_failed, Label::kNear);
frame_scope.GenerateLeaveFrame();
__ Ret();
__ bind(&interceptor_failed);
InterceptorVectorSlotPop(holder_reg);
- __ pop(this->name());
- __ pop(holder_reg);
+ __ Pop(this->name());
+ __ Pop(holder_reg);
if (must_preserve_receiver_reg) {
- __ pop(receiver());
+ __ Pop(receiver());
}
// Leave the internal frame.
}
@@ -698,7 +666,6 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
GenerateLoadPostInterceptor(it, holder_reg);
}
-
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
// Call the runtime system to load the interceptor.
DCHECK(holder()->HasNamedInterceptor());
@@ -709,7 +676,6 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
__ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor);
}
-
Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback,
LanguageMode language_mode) {
@@ -725,7 +691,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
__ mov(ip, Operand(cell));
}
- __ push(ip);
+ __ Push(ip);
__ mov(ip, Operand(name));
__ Push(ip, value());
__ Push(Smi::FromInt(language_mode));
@@ -737,7 +703,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
return GetCode(kind(), Code::FAST, name);
}
-
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ Push(receiver(), this->name(), value());
@@ -749,12 +714,10 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
return GetCode(kind(), Code::FAST, name);
}
-
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
-
Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) {
Label miss;
@@ -771,13 +734,12 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
// Check for deleted property if property can actually be deleted.
if (is_configurable) {
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
- __ cmp(result, ip);
+ __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
__ beq(&miss);
}
Counters* counters = isolate()->counters();
- __ IncrementCounter(counters->ic_named_load_global_stub(), 1, r4, r6);
+ __ IncrementCounter(counters->ic_named_load_global_stub(), 1, r3, r5);
if (IC::ICUseVector(kind())) {
DiscardVectorAndSlot();
}
@@ -789,7 +751,6 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
return GetCode(kind(), Code::NORMAL, name);
}
-
#undef __
} // namespace internal
} // namespace v8
« no previous file with comments | « src/ic/s390/access-compiler-s390.cc ('k') | src/ic/s390/ic-compiler-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698