| Index: src/x64/ic-x64.cc
|
| diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc
|
| index 60403c6cfb5474e4f97dc91bbc1fba7c6ca5f85e..a03eba17f8663652d2825c046445f55daea4be71 100644
|
| --- a/src/x64/ic-x64.cc
|
| +++ b/src/x64/ic-x64.cc
|
| @@ -332,6 +332,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
|
| // -- rdx : receiver
|
| // -- rsp[0] : return address
|
| // -----------------------------------
|
| + ASSERT(rdx.is(ReceiverRegister()));
|
| + ASSERT(rax.is(NameRegister()));
|
| Label slow, check_name, index_smi, index_name, property_array_property;
|
| Label probe_dictionary, check_number_dictionary;
|
|
|
| @@ -490,17 +492,14 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
|
|
|
|
|
| void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : key
|
| - // -- rdx : receiver
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| + // Return address is on the stack.
|
| Label miss;
|
|
|
| - Register receiver = rdx;
|
| - Register index = rax;
|
| + Register receiver = ReceiverRegister();
|
| + Register index = NameRegister();
|
| Register scratch = rcx;
|
| Register result = rax;
|
| + ASSERT(!scratch.is(receiver) && !scratch.is(index));
|
|
|
| StringCharAtGenerator char_at_generator(receiver,
|
| index,
|
| @@ -522,35 +521,36 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
|
|
|
|
|
| void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : key
|
| - // -- rdx : receiver
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| + // Return address is on the stack.
|
| Label slow;
|
|
|
| + Register receiver = ReceiverRegister();
|
| + Register key = NameRegister();
|
| + Register scratch = rcx;
|
| + ASSERT(!scratch.is(receiver) && !scratch.is(key));
|
| +
|
| // Check that the receiver isn't a smi.
|
| - __ JumpIfSmi(rdx, &slow);
|
| + __ JumpIfSmi(receiver, &slow);
|
|
|
| // Check that the key is an array index, that is Uint32.
|
| STATIC_ASSERT(kSmiValueSize <= 32);
|
| - __ JumpUnlessNonNegativeSmi(rax, &slow);
|
| + __ JumpUnlessNonNegativeSmi(key, &slow);
|
|
|
| // Get the map of the receiver.
|
| - __ movp(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
|
| + __ movp(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
|
|
|
| // Check that it has indexed interceptor and access checks
|
| // are not enabled for this object.
|
| - __ movb(rcx, FieldOperand(rcx, Map::kBitFieldOffset));
|
| - __ andb(rcx, Immediate(kSlowCaseBitFieldMask));
|
| - __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor));
|
| + __ movb(scratch, FieldOperand(scratch, Map::kBitFieldOffset));
|
| + __ andb(scratch, Immediate(kSlowCaseBitFieldMask));
|
| + __ cmpb(scratch, Immediate(1 << Map::kHasIndexedInterceptor));
|
| __ j(not_zero, &slow);
|
|
|
| // Everything is fine, call runtime.
|
| - __ PopReturnAddressTo(rcx);
|
| - __ Push(rdx); // receiver
|
| - __ Push(rax); // key
|
| - __ PushReturnAddressFrom(rcx);
|
| + __ PopReturnAddressTo(scratch);
|
| + __ Push(receiver); // receiver
|
| + __ Push(key); // key
|
| + __ PushReturnAddressFrom(scratch);
|
|
|
| // Perform tail call to the entry.
|
| __ TailCallExternalReference(
|
| @@ -892,6 +892,8 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
| // -- rdx : receiver
|
| // -- rsp[0] : return address
|
| // -----------------------------------
|
| + ASSERT(rdx.is(ReceiverRegister()));
|
| + ASSERT(rax.is(NameRegister()));
|
| Label slow, notin;
|
| Operand mapped_location =
|
| GenerateMappedArgumentsLookup(
|
| @@ -956,6 +958,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
|
| // -- rcx : name
|
| // -- rsp[0] : return address
|
| // -----------------------------------
|
| + ASSERT(rax.is(ReceiverRegister()));
|
| + ASSERT(rcx.is(NameRegister()));
|
|
|
| // Probe the stub cache.
|
| Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
|
| @@ -972,6 +976,8 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
|
| // -- rcx : name
|
| // -- rsp[0] : return address
|
| // -----------------------------------
|
| + ASSERT(rax.is(ReceiverRegister()));
|
| + ASSERT(rcx.is(NameRegister()));
|
| Label miss, slow;
|
|
|
| GenerateNameDictionaryReceiverCheck(masm, rax, rdx, rbx, &miss);
|
| @@ -991,20 +997,25 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +// A register that isn't one of the parameters to the load ic.
|
| +static const Register LoadIC_TempRegister() { return rbx; }
|
| +
|
| +
|
| +static const Register KeyedLoadIC_TempRegister() {
|
| + return rbx;
|
| +}
|
| +
|
| +
|
| void LoadIC::GenerateMiss(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : receiver
|
| - // -- rcx : name
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| + // The return address is on the stack.
|
|
|
| Counters* counters = masm->isolate()->counters();
|
| __ IncrementCounter(counters->load_miss(), 1);
|
|
|
| - __ PopReturnAddressTo(rbx);
|
| - __ Push(rax); // receiver
|
| - __ Push(rcx); // name
|
| - __ PushReturnAddressFrom(rbx);
|
| + __ PopReturnAddressTo(LoadIC_TempRegister());
|
| + __ Push(ReceiverRegister()); // receiver
|
| + __ Push(NameRegister()); // name
|
| + __ PushReturnAddressFrom(LoadIC_TempRegister());
|
|
|
| // Perform tail call to the entry.
|
| ExternalReference ref =
|
| @@ -1014,16 +1025,12 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
|
|
|
|
|
| void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : receiver
|
| - // -- rcx : name
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| + // The return address is on the stack.
|
|
|
| - __ PopReturnAddressTo(rbx);
|
| - __ Push(rax); // receiver
|
| - __ Push(rcx); // name
|
| - __ PushReturnAddressFrom(rbx);
|
| + __ PopReturnAddressTo(LoadIC_TempRegister());
|
| + __ Push(ReceiverRegister()); // receiver
|
| + __ Push(NameRegister()); // name
|
| + __ PushReturnAddressFrom(LoadIC_TempRegister());
|
|
|
| // Perform tail call to the entry.
|
| __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
|
| @@ -1031,19 +1038,14 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
|
|
|
|
|
| void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : key
|
| - // -- rdx : receiver
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| -
|
| + // The return address is on the stack.
|
| Counters* counters = masm->isolate()->counters();
|
| __ IncrementCounter(counters->keyed_load_miss(), 1);
|
|
|
| - __ PopReturnAddressTo(rbx);
|
| - __ Push(rdx); // receiver
|
| - __ Push(rax); // name
|
| - __ PushReturnAddressFrom(rbx);
|
| + __ PopReturnAddressTo(KeyedLoadIC_TempRegister());
|
| + __ Push(ReceiverRegister()); // receiver
|
| + __ Push(NameRegister()); // name
|
| + __ PushReturnAddressFrom(KeyedLoadIC_TempRegister());
|
|
|
| // Perform tail call to the entry.
|
| ExternalReference ref =
|
| @@ -1060,16 +1062,12 @@ const Register KeyedLoadIC::NameRegister() { return rax; }
|
|
|
|
|
| void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax : key
|
| - // -- rdx : receiver
|
| - // -- rsp[0] : return address
|
| - // -----------------------------------
|
| + // The return address is on the stack.
|
|
|
| - __ PopReturnAddressTo(rbx);
|
| - __ Push(rdx); // receiver
|
| - __ Push(rax); // name
|
| - __ PushReturnAddressFrom(rbx);
|
| + __ PopReturnAddressTo(KeyedLoadIC_TempRegister());
|
| + __ Push(ReceiverRegister()); // receiver
|
| + __ Push(NameRegister()); // name
|
| + __ PushReturnAddressFrom(KeyedLoadIC_TempRegister());
|
|
|
| // Perform tail call to the entry.
|
| __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
|
|
|