Chromium Code Reviews| Index: src/ic/x64/ic-x64.cc |
| diff --git a/src/ic/x64/ic-x64.cc b/src/ic/x64/ic-x64.cc |
| index 40aa231fd34db3989b64cfb9c010b8a1ba8b14d5..dfd76b165aa65f183f14bc99b5359375ad8a8cbe 100644 |
| --- a/src/ic/x64/ic-x64.cc |
| +++ b/src/ic/x64/ic-x64.cc |
| @@ -171,7 +171,7 @@ static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm, |
| static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, |
| Register key, Register elements, |
| Register scratch, Register result, |
| - Label* slow) { |
| + Label* slow, Strength strength) { |
| // Register use: |
| // |
| // receiver - holds the receiver on entry. |
| @@ -226,8 +226,13 @@ static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, |
| __ jmp(&check_next_prototype); |
| __ bind(&return_undefined); |
|
Toon Verwaest
2015/06/09 11:58:04
This probably shouldn't be named return_undefined
conradw
2015/06/09 13:09:27
Done.
|
| - __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| - __ jmp(&done); |
| + if (is_strong(strength)) { |
| + // Strong mode accesses must throw in this case, so call the runtime. |
| + __ jmp(slow); |
| + } else { |
| + __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| + __ jmp(&done); |
| + } |
| __ bind(&in_bounds); |
| // Fast case: Do the load. |
| @@ -274,7 +279,7 @@ static void GenerateKeyNameCheck(MacroAssembler* masm, Register key, |
| } |
| -void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| +void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm, Strength strength) { |
| // The return address is on the stack. |
| Label slow, check_name, index_smi, index_name, property_array_property; |
| Label probe_dictionary, check_number_dictionary; |
| @@ -296,7 +301,7 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| // Check the receiver's map to see if it has fast elements. |
| __ CheckFastElements(rax, &check_number_dictionary); |
| - GenerateFastArrayLoad(masm, receiver, key, rax, rbx, rax, &slow); |
| + GenerateFastArrayLoad(masm, receiver, key, rax, rbx, rax, &slow, strength); |
| Counters* counters = masm->isolate()->counters(); |
| __ IncrementCounter(counters->keyed_load_generic_smi(), 1); |
| __ ret(0); |
| @@ -317,7 +322,7 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| __ bind(&slow); |
| // Slow case: Jump to runtime. |
| __ IncrementCounter(counters->keyed_load_generic_slow(), 1); |
| - GenerateRuntimeGetProperty(masm); |
| + GenerateSlow(masm); |
| __ bind(&check_name); |
| GenerateKeyNameCheck(masm, key, rax, rbx, &index_name, &slow); |
| @@ -623,7 +628,7 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
| // Dictionary load failed, go slow (but don't miss). |
| __ bind(&slow); |
| - GenerateRuntimeGetProperty(masm); |
| + GenerateSlow(masm); |
| } |
| @@ -660,7 +665,7 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { |
| } |
| -void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| +void LoadIC::GenerateSlow(MacroAssembler* masm) { |
| // The return address is on the stack. |
| Register receiver = LoadDescriptor::ReceiverRegister(); |
| Register name = LoadDescriptor::NameRegister(); |
| @@ -672,7 +677,10 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| __ PushReturnAddressFrom(rbx); |
| // Perform tail call to the entry. |
| - __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
| + ExternalReference ref = |
| + ExternalReference(IC_Utility(kLoadIC_Slow), masm->isolate()); |
| + int arg_count = 2; |
| + __ TailCallExternalReference(ref, arg_count, 1); |
| } |
| @@ -691,7 +699,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| } |
| -void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| +void KeyedLoadIC::GenerateSlow(MacroAssembler* masm) { |
| // The return address is on the stack. |
| Register receiver = LoadDescriptor::ReceiverRegister(); |
| Register name = LoadDescriptor::NameRegister(); |
| @@ -703,7 +711,10 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| __ PushReturnAddressFrom(rbx); |
| // Perform tail call to the entry. |
| - __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
| + ExternalReference ref = |
| + ExternalReference(IC_Utility(kKeyedLoadIC_Slow), masm->isolate()); |
| + int arg_count = 2; |
| + __ TailCallExternalReference(ref, arg_count, 1); |
| } |