Index: src/ic/mips/ic-mips.cc |
diff --git a/src/ic/mips/ic-mips.cc b/src/ic/mips/ic-mips.cc |
index 7dbaad788ae0b1558432c0c13504c27e51eeb528..0170959180396490119f36d05eef659d8f467d7b 100644 |
--- a/src/ic/mips/ic-mips.cc |
+++ b/src/ic/mips/ic-mips.cc |
@@ -163,7 +163,8 @@ |
static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, |
Register key, Register elements, |
Register scratch1, Register scratch2, |
- Register result, Label* slow) { |
+ Register result, Label* slow, |
+ LanguageMode language_mode) { |
// Register use: |
// |
// receiver - holds the receiver on entry. |
@@ -185,7 +186,7 @@ |
// |
// scratch2 - used to hold maps, prototypes, and the loaded value. |
Label check_prototypes, check_next_prototype; |
- Label done, in_bounds, return_undefined; |
+ Label done, in_bounds, absent; |
__ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
__ AssertFastElements(elements); |
@@ -203,7 +204,7 @@ |
__ lw(scratch2, FieldMemOperand(scratch2, Map::kPrototypeOffset)); |
// scratch2: current prototype |
__ LoadRoot(at, Heap::kNullValueRootIndex); |
- __ Branch(&return_undefined, eq, scratch2, Operand(at)); |
+ __ Branch(&absent, eq, scratch2, Operand(at)); |
__ lw(elements, FieldMemOperand(scratch2, JSObject::kElementsOffset)); |
__ lw(scratch2, FieldMemOperand(scratch2, HeapObject::kMapOffset)); |
// elements: elements of current prototype |
@@ -218,9 +219,14 @@ |
__ Branch(slow, ne, elements, Operand(at)); |
__ Branch(&check_next_prototype); |
- __ bind(&return_undefined); |
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
- __ Branch(&done); |
+ __ bind(&absent); |
+ if (is_strong(language_mode)) { |
+ // Strong mode accesses must throw in this case, so call the runtime. |
+ __ Branch(slow); |
+ } else { |
+ __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
+ __ Branch(&done); |
+ } |
__ bind(&in_bounds); |
// Fast case: Do the load. |
@@ -285,7 +291,7 @@ |
// Dictionary load failed, go slow (but don't miss). |
__ bind(&slow); |
- GenerateRuntimeGetProperty(masm); |
+ GenerateSlow(masm); |
} |
@@ -320,13 +326,16 @@ |
} |
-void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
+void LoadIC::GenerateSlow(MacroAssembler* masm) { |
// The return address is in ra. |
__ mov(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister()); |
__ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister()); |
- __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
+ ExternalReference ref = |
+ ExternalReference(IC_Utility(kLoadIC_Slow), masm->isolate()); |
+ int arg_count = 2; |
+ __ TailCallExternalReference(ref, arg_count, 1); |
} |
@@ -349,16 +358,20 @@ |
} |
-void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
+void KeyedLoadIC::GenerateSlow(MacroAssembler* masm) { |
// The return address is in ra. |
__ Push(LoadDescriptor::ReceiverRegister(), LoadDescriptor::NameRegister()); |
- __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
-} |
- |
- |
-void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
+ ExternalReference ref = |
+ ExternalReference(IC_Utility(kKeyedLoadIC_Slow), masm->isolate()); |
+ int arg_count = 2; |
+ __ TailCallExternalReference(ref, arg_count, 1); |
+} |
+ |
+ |
+void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm, |
+ LanguageMode language_mode) { |
// The return address is in ra. |
Label slow, check_name, index_smi, index_name, property_array_property; |
Label probe_dictionary, check_number_dictionary; |
@@ -382,7 +395,8 @@ |
// Check the receiver's map to see if it has fast elements. |
__ CheckFastElements(a0, a3, &check_number_dictionary); |
- GenerateFastArrayLoad(masm, receiver, key, a0, a3, t0, v0, &slow); |
+ GenerateFastArrayLoad(masm, receiver, key, a0, a3, t0, v0, &slow, |
+ language_mode); |
__ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, t0, a3); |
__ Ret(); |
@@ -403,7 +417,7 @@ |
__ bind(&slow); |
__ IncrementCounter(isolate->counters()->keyed_load_generic_slow(), 1, t0, |
a3); |
- GenerateRuntimeGetProperty(masm); |
+ GenerateSlow(masm); |
__ bind(&check_name); |
GenerateKeyNameCheck(masm, key, a0, a3, &index_name, &slow); |