| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 } else { | 3853 } else { |
| 3854 ASSERT(HasArgsInRegisters()); | 3854 ASSERT(HasArgsInRegisters()); |
| 3855 // Patch the (relocated) inlined map check. | 3855 // Patch the (relocated) inlined map check. |
| 3856 | 3856 |
| 3857 // The offset was stored in t0 safepoint slot. | 3857 // The offset was stored in t0 safepoint slot. |
| 3858 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal). | 3858 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal). |
| 3859 __ LoadFromSafepointRegisterSlot(scratch, t0); | 3859 __ LoadFromSafepointRegisterSlot(scratch, t0); |
| 3860 __ Subu(inline_site, ra, scratch); | 3860 __ Subu(inline_site, ra, scratch); |
| 3861 // Get the map location in scratch and patch it. | 3861 // Get the map location in scratch and patch it. |
| 3862 __ GetRelocatedValue(inline_site, scratch, v1); // v1 used as scratch. | 3862 __ GetRelocatedValue(inline_site, scratch, v1); // v1 used as scratch. |
| 3863 __ sw(map, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 3863 __ sw(map, FieldMemOperand(scratch, Cell::kValueOffset)); |
| 3864 } | 3864 } |
| 3865 | 3865 |
| 3866 // Register mapping: a3 is object map and t0 is function prototype. | 3866 // Register mapping: a3 is object map and t0 is function prototype. |
| 3867 // Get prototype of object into a2. | 3867 // Get prototype of object into a2. |
| 3868 __ lw(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); | 3868 __ lw(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); |
| 3869 | 3869 |
| 3870 // We don't need map any more. Use it as a scratch register. | 3870 // We don't need map any more. Use it as a scratch register. |
| 3871 Register scratch2 = map; | 3871 Register scratch2 = map; |
| 3872 map = no_reg; | 3872 map = no_reg; |
| 3873 | 3873 |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5036 // a1 : the function to call | 5036 // a1 : the function to call |
| 5037 // a2 : cache cell for call target | 5037 // a2 : cache cell for call target |
| 5038 Label done; | 5038 Label done; |
| 5039 | 5039 |
| 5040 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5040 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5041 masm->isolate()->heap()->undefined_value()); | 5041 masm->isolate()->heap()->undefined_value()); |
| 5042 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 5042 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 5043 masm->isolate()->heap()->the_hole_value()); | 5043 masm->isolate()->heap()->the_hole_value()); |
| 5044 | 5044 |
| 5045 // Load the cache state into a3. | 5045 // Load the cache state into a3. |
| 5046 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5046 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5047 | 5047 |
| 5048 // A monomorphic cache hit or an already megamorphic state: invoke the | 5048 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 5049 // function without changing the state. | 5049 // function without changing the state. |
| 5050 __ Branch(&done, eq, a3, Operand(a1)); | 5050 __ Branch(&done, eq, a3, Operand(a1)); |
| 5051 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5051 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5052 __ Branch(&done, eq, a3, Operand(at)); | 5052 __ Branch(&done, eq, a3, Operand(at)); |
| 5053 | 5053 |
| 5054 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 5054 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 5055 // megamorphic. | 5055 // megamorphic. |
| 5056 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5056 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5057 | 5057 |
| 5058 __ Branch(USE_DELAY_SLOT, &done, eq, a3, Operand(at)); | 5058 __ Branch(USE_DELAY_SLOT, &done, eq, a3, Operand(at)); |
| 5059 // An uninitialized cache is patched with the function. | 5059 // An uninitialized cache is patched with the function. |
| 5060 // Store a1 in the delay slot. This may or may not get overwritten depending | 5060 // Store a1 in the delay slot. This may or may not get overwritten depending |
| 5061 // on the result of the comparison. | 5061 // on the result of the comparison. |
| 5062 __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5062 __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5063 // No need for a write barrier here - cells are rescanned. | 5063 // No need for a write barrier here - cells are rescanned. |
| 5064 | 5064 |
| 5065 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 5065 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 5066 // write-barrier is needed. | 5066 // write-barrier is needed. |
| 5067 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5067 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5068 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5068 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5069 | 5069 |
| 5070 __ bind(&done); | 5070 __ bind(&done); |
| 5071 } | 5071 } |
| 5072 | 5072 |
| 5073 | 5073 |
| 5074 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 5074 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| 5075 // Cache the called function in a global property cell. Cache states | 5075 // Cache the called function in a global property cell. Cache states |
| 5076 // are uninitialized, monomorphic (indicated by a JSFunction), and | 5076 // are uninitialized, monomorphic (indicated by a JSFunction), and |
| 5077 // megamorphic. | 5077 // megamorphic. |
| 5078 // a1 : the function to call | 5078 // a1 : the function to call |
| 5079 // a2 : cache cell for call target | 5079 // a2 : cache cell for call target |
| 5080 ASSERT(FLAG_optimize_constructed_arrays); | 5080 ASSERT(FLAG_optimize_constructed_arrays); |
| 5081 Label initialize, done, miss, megamorphic, not_array_function; | 5081 Label initialize, done, miss, megamorphic, not_array_function; |
| 5082 | 5082 |
| 5083 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5083 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5084 masm->isolate()->heap()->undefined_value()); | 5084 masm->isolate()->heap()->undefined_value()); |
| 5085 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 5085 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 5086 masm->isolate()->heap()->the_hole_value()); | 5086 masm->isolate()->heap()->the_hole_value()); |
| 5087 | 5087 |
| 5088 // Load the cache state into a3. | 5088 // Load the cache state into a3. |
| 5089 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5089 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5090 | 5090 |
| 5091 // A monomorphic cache hit or an already megamorphic state: invoke the | 5091 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 5092 // function without changing the state. | 5092 // function without changing the state. |
| 5093 __ Branch(&done, eq, a3, Operand(a1)); | 5093 __ Branch(&done, eq, a3, Operand(a1)); |
| 5094 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5094 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5095 __ Branch(&done, eq, a3, Operand(at)); | 5095 __ Branch(&done, eq, a3, Operand(at)); |
| 5096 | 5096 |
| 5097 // Special handling of the Array() function, which caches not only the | 5097 // Special handling of the Array() function, which caches not only the |
| 5098 // monomorphic Array function but the initial ElementsKind with special | 5098 // monomorphic Array function but the initial ElementsKind with special |
| 5099 // sentinels | 5099 // sentinels |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5110 __ bind(&miss); | 5110 __ bind(&miss); |
| 5111 | 5111 |
| 5112 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 5112 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 5113 // megamorphic. | 5113 // megamorphic. |
| 5114 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5114 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5115 __ Branch(&initialize, eq, a3, Operand(at)); | 5115 __ Branch(&initialize, eq, a3, Operand(at)); |
| 5116 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 5116 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 5117 // write-barrier is needed. | 5117 // write-barrier is needed. |
| 5118 __ bind(&megamorphic); | 5118 __ bind(&megamorphic); |
| 5119 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5119 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5120 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5120 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5121 __ jmp(&done); | 5121 __ jmp(&done); |
| 5122 | 5122 |
| 5123 // An uninitialized cache is patched with the function or sentinel to | 5123 // An uninitialized cache is patched with the function or sentinel to |
| 5124 // indicate the ElementsKind if function is the Array constructor. | 5124 // indicate the ElementsKind if function is the Array constructor. |
| 5125 __ bind(&initialize); | 5125 __ bind(&initialize); |
| 5126 // Make sure the function is the Array() function | 5126 // Make sure the function is the Array() function |
| 5127 __ LoadArrayFunction(a3); | 5127 __ LoadArrayFunction(a3); |
| 5128 __ Branch(¬_array_function, ne, a1, Operand(a3)); | 5128 __ Branch(¬_array_function, ne, a1, Operand(a3)); |
| 5129 | 5129 |
| 5130 // The target function is the Array constructor, install a sentinel value in | 5130 // The target function is the Array constructor, install a sentinel value in |
| 5131 // the constructor's type info cell that will track the initial ElementsKind | 5131 // the constructor's type info cell that will track the initial ElementsKind |
| 5132 // that should be used for the array when its constructed. | 5132 // that should be used for the array when its constructed. |
| 5133 Handle<Object> initial_kind_sentinel = | 5133 Handle<Object> initial_kind_sentinel = |
| 5134 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), | 5134 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
| 5135 GetInitialFastElementsKind()); | 5135 GetInitialFastElementsKind()); |
| 5136 __ li(a3, Operand(initial_kind_sentinel)); | 5136 __ li(a3, Operand(initial_kind_sentinel)); |
| 5137 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5137 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5138 __ Branch(&done); | 5138 __ Branch(&done); |
| 5139 | 5139 |
| 5140 __ bind(¬_array_function); | 5140 __ bind(¬_array_function); |
| 5141 __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5141 __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5142 // No need for a write barrier here - cells are rescanned. | 5142 // No need for a write barrier here - cells are rescanned. |
| 5143 | 5143 |
| 5144 __ bind(&done); | 5144 __ bind(&done); |
| 5145 } | 5145 } |
| 5146 | 5146 |
| 5147 | 5147 |
| 5148 void CallFunctionStub::Generate(MacroAssembler* masm) { | 5148 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 5149 // a1 : the function to call | 5149 // a1 : the function to call |
| 5150 // a2 : cache cell for call target | 5150 // a2 : cache cell for call target |
| 5151 Label slow, non_function; | 5151 Label slow, non_function; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5207 | 5207 |
| 5208 // Slow-case: Non-function called. | 5208 // Slow-case: Non-function called. |
| 5209 __ bind(&slow); | 5209 __ bind(&slow); |
| 5210 if (RecordCallTarget()) { | 5210 if (RecordCallTarget()) { |
| 5211 // If there is a call target cache, mark it megamorphic in the | 5211 // If there is a call target cache, mark it megamorphic in the |
| 5212 // non-function case. MegamorphicSentinel is an immortal immovable | 5212 // non-function case. MegamorphicSentinel is an immortal immovable |
| 5213 // object (undefined) so no write barrier is needed. | 5213 // object (undefined) so no write barrier is needed. |
| 5214 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5214 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5215 masm->isolate()->heap()->undefined_value()); | 5215 masm->isolate()->heap()->undefined_value()); |
| 5216 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5216 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5217 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5217 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5218 } | 5218 } |
| 5219 // Check for function proxy. | 5219 // Check for function proxy. |
| 5220 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); | 5220 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 5221 __ push(a1); // Put proxy as additional argument. | 5221 __ push(a1); // Put proxy as additional argument. |
| 5222 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); | 5222 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); |
| 5223 __ li(a2, Operand(0, RelocInfo::NONE32)); | 5223 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 5224 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 5224 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); |
| 5225 __ SetCallKind(t1, CALL_AS_METHOD); | 5225 __ SetCallKind(t1, CALL_AS_METHOD); |
| 5226 { | 5226 { |
| 5227 Handle<Code> adaptor = | 5227 Handle<Code> adaptor = |
| (...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7769 // Initial map for the builtin Array function should be a map. | 7769 // Initial map for the builtin Array function should be a map. |
| 7770 __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 7770 __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 7771 // Will both indicate a NULL and a Smi. | 7771 // Will both indicate a NULL and a Smi. |
| 7772 __ And(at, a3, Operand(kSmiTagMask)); | 7772 __ And(at, a3, Operand(kSmiTagMask)); |
| 7773 __ Assert(ne, "Unexpected initial map for Array function", | 7773 __ Assert(ne, "Unexpected initial map for Array function", |
| 7774 at, Operand(zero_reg)); | 7774 at, Operand(zero_reg)); |
| 7775 __ GetObjectType(a3, a3, t0); | 7775 __ GetObjectType(a3, a3, t0); |
| 7776 __ Assert(eq, "Unexpected initial map for Array function", | 7776 __ Assert(eq, "Unexpected initial map for Array function", |
| 7777 t0, Operand(MAP_TYPE)); | 7777 t0, Operand(MAP_TYPE)); |
| 7778 | 7778 |
| 7779 // We should either have undefined in ebx or a valid jsglobalpropertycell | 7779 // We should either have undefined in a2 or a valid cell |
| 7780 Label okay_here; | 7780 Label okay_here; |
| 7781 Handle<Map> global_property_cell_map( | 7781 Handle<Map> cell_map = masm->isolate()->factory()->cell_map(); |
| 7782 masm->isolate()->heap()->global_property_cell_map()); | |
| 7783 __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel)); | 7782 __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel)); |
| 7784 __ lw(a3, FieldMemOperand(a2, 0)); | 7783 __ lw(a3, FieldMemOperand(a2, 0)); |
| 7785 __ Assert(eq, "Expected property cell in register ebx", | 7784 __ Assert(eq, "Expected property cell in register a2", |
| 7786 a3, Operand(global_property_cell_map)); | 7785 a3, Operand(cell_map)); |
| 7787 __ bind(&okay_here); | 7786 __ bind(&okay_here); |
| 7788 } | 7787 } |
| 7789 | 7788 |
| 7790 if (FLAG_optimize_constructed_arrays) { | 7789 if (FLAG_optimize_constructed_arrays) { |
| 7791 Label no_info, switch_ready; | 7790 Label no_info, switch_ready; |
| 7792 // Get the elements kind and case on that. | 7791 // Get the elements kind and case on that. |
| 7793 __ Branch(&no_info, eq, a2, Operand(undefined_sentinel)); | 7792 __ Branch(&no_info, eq, a2, Operand(undefined_sentinel)); |
| 7794 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 7793 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); |
| 7795 __ JumpIfNotSmi(a3, &no_info); | 7794 __ JumpIfNotSmi(a3, &no_info); |
| 7796 __ SmiUntag(a3); | 7795 __ SmiUntag(a3); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7929 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 7928 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 7930 } | 7929 } |
| 7931 } | 7930 } |
| 7932 | 7931 |
| 7933 | 7932 |
| 7934 #undef __ | 7933 #undef __ |
| 7935 | 7934 |
| 7936 } } // namespace v8::internal | 7935 } } // namespace v8::internal |
| 7937 | 7936 |
| 7938 #endif // V8_TARGET_ARCH_MIPS | 7937 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |