| 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 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 case Token::MUL: | 2481 case Token::MUL: |
| 2482 __ mul_d(f10, f12, f14); | 2482 __ mul_d(f10, f12, f14); |
| 2483 break; | 2483 break; |
| 2484 case Token::DIV: | 2484 case Token::DIV: |
| 2485 __ div_d(f10, f12, f14); | 2485 __ div_d(f10, f12, f14); |
| 2486 break; | 2486 break; |
| 2487 default: | 2487 default: |
| 2488 UNREACHABLE(); | 2488 UNREACHABLE(); |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 if (op_ != Token::DIV) { | 2491 if (result_type_ <= BinaryOpIC::INT32) { |
| 2492 // These operations produce an integer result. | |
| 2493 // Try to return a smi if we can. | |
| 2494 // Otherwise return a heap number if allowed, or jump to type | |
| 2495 // transition. | |
| 2496 | |
| 2497 Register except_flag = scratch2; | 2492 Register except_flag = scratch2; |
| 2498 __ EmitFPUTruncate(kRoundToZero, | 2493 const FPURoundingMode kRoundingMode = op_ == Token::DIV ? |
| 2494 kRoundToMinusInf : kRoundToZero; |
| 2495 const CheckForInexactConversion kConversion = op_ == Token::DIV ? |
| 2496 kCheckForInexactConversion : kDontCheckForInexactConversion; |
| 2497 __ EmitFPUTruncate(kRoundingMode, |
| 2499 scratch1, | 2498 scratch1, |
| 2500 f10, | 2499 f10, |
| 2501 at, | 2500 at, |
| 2502 f16, | 2501 f16, |
| 2503 except_flag); | 2502 except_flag, |
| 2504 | 2503 kConversion); |
| 2505 if (result_type_ <= BinaryOpIC::INT32) { | 2504 // If except_flag != 0, result does not fit in a 32-bit integer. |
| 2506 // If except_flag != 0, result does not fit in a 32-bit integer. | 2505 __ Branch(&transition, ne, except_flag, Operand(zero_reg)); |
| 2507 __ Branch(&transition, ne, except_flag, Operand(zero_reg)); | 2506 // Try to tag the result as a Smi, return heap number on overflow. |
| 2508 } | 2507 __ SmiTagCheckOverflow(scratch1, scratch1, scratch2); |
| 2509 | |
| 2510 // Check if the result fits in a smi. | |
| 2511 __ Addu(scratch2, scratch1, Operand(0x40000000)); | |
| 2512 // If not try to return a heap number. | |
| 2513 __ Branch(&return_heap_number, lt, scratch2, Operand(zero_reg)); | 2508 __ Branch(&return_heap_number, lt, scratch2, Operand(zero_reg)); |
| 2514 // Check for minus zero. Return heap number for minus zero if | 2509 // Check for minus zero, transition in that case (because we need |
| 2515 // double results are allowed; otherwise transition. | 2510 // to return a heap number). |
| 2516 Label not_zero; | 2511 Label not_zero; |
| 2512 ASSERT(kSmiTag == 0); |
| 2517 __ Branch(¬_zero, ne, scratch1, Operand(zero_reg)); | 2513 __ Branch(¬_zero, ne, scratch1, Operand(zero_reg)); |
| 2518 __ mfc1(scratch2, f11); | 2514 __ mfc1(scratch2, f11); |
| 2519 __ And(scratch2, scratch2, HeapNumber::kSignMask); | 2515 __ And(scratch2, scratch2, HeapNumber::kSignMask); |
| 2520 __ Branch(result_type_ <= BinaryOpIC::INT32 ? &transition | 2516 __ Branch(&transition, ne, scratch2, Operand(zero_reg)); |
| 2521 : &return_heap_number, | |
| 2522 ne, | |
| 2523 scratch2, | |
| 2524 Operand(zero_reg)); | |
| 2525 __ bind(¬_zero); | 2517 __ bind(¬_zero); |
| 2526 | 2518 |
| 2527 // Tag the result and return. | |
| 2528 __ Ret(USE_DELAY_SLOT); | 2519 __ Ret(USE_DELAY_SLOT); |
| 2529 __ SmiTag(v0, scratch1); // SmiTag emits one instruction. | 2520 __ mov(v0, scratch1); |
| 2530 } else { | |
| 2531 // DIV just falls through to allocating a heap number. | |
| 2532 } | 2521 } |
| 2533 | 2522 |
| 2534 __ bind(&return_heap_number); | 2523 __ bind(&return_heap_number); |
| 2535 // Return a heap number, or fall through to type transition or runtime | 2524 // Return a heap number, or fall through to type transition or runtime |
| 2536 // call if we can't. | 2525 // call if we can't. |
| 2537 // We are using FPU registers so s0 is available. | 2526 // We are using FPU registers so s0 is available. |
| 2538 heap_number_result = s0; | 2527 heap_number_result = s0; |
| 2539 BinaryOpStub_GenerateHeapResultAllocation(masm, | 2528 BinaryOpStub_GenerateHeapResultAllocation(masm, |
| 2540 heap_number_result, | 2529 heap_number_result, |
| 2541 heap_number_map, | 2530 heap_number_map, |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 } else { | 3842 } else { |
| 3854 ASSERT(HasArgsInRegisters()); | 3843 ASSERT(HasArgsInRegisters()); |
| 3855 // Patch the (relocated) inlined map check. | 3844 // Patch the (relocated) inlined map check. |
| 3856 | 3845 |
| 3857 // The offset was stored in t0 safepoint slot. | 3846 // The offset was stored in t0 safepoint slot. |
| 3858 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal). | 3847 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal). |
| 3859 __ LoadFromSafepointRegisterSlot(scratch, t0); | 3848 __ LoadFromSafepointRegisterSlot(scratch, t0); |
| 3860 __ Subu(inline_site, ra, scratch); | 3849 __ Subu(inline_site, ra, scratch); |
| 3861 // Get the map location in scratch and patch it. | 3850 // Get the map location in scratch and patch it. |
| 3862 __ GetRelocatedValue(inline_site, scratch, v1); // v1 used as scratch. | 3851 __ GetRelocatedValue(inline_site, scratch, v1); // v1 used as scratch. |
| 3863 __ sw(map, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 3852 __ sw(map, FieldMemOperand(scratch, Cell::kValueOffset)); |
| 3864 } | 3853 } |
| 3865 | 3854 |
| 3866 // Register mapping: a3 is object map and t0 is function prototype. | 3855 // Register mapping: a3 is object map and t0 is function prototype. |
| 3867 // Get prototype of object into a2. | 3856 // Get prototype of object into a2. |
| 3868 __ lw(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); | 3857 __ lw(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); |
| 3869 | 3858 |
| 3870 // We don't need map any more. Use it as a scratch register. | 3859 // We don't need map any more. Use it as a scratch register. |
| 3871 Register scratch2 = map; | 3860 Register scratch2 = map; |
| 3872 map = no_reg; | 3861 map = no_reg; |
| 3873 | 3862 |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5036 // a1 : the function to call | 5025 // a1 : the function to call |
| 5037 // a2 : cache cell for call target | 5026 // a2 : cache cell for call target |
| 5038 Label done; | 5027 Label done; |
| 5039 | 5028 |
| 5040 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5029 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5041 masm->isolate()->heap()->undefined_value()); | 5030 masm->isolate()->heap()->undefined_value()); |
| 5042 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 5031 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 5043 masm->isolate()->heap()->the_hole_value()); | 5032 masm->isolate()->heap()->the_hole_value()); |
| 5044 | 5033 |
| 5045 // Load the cache state into a3. | 5034 // Load the cache state into a3. |
| 5046 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5035 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5047 | 5036 |
| 5048 // A monomorphic cache hit or an already megamorphic state: invoke the | 5037 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 5049 // function without changing the state. | 5038 // function without changing the state. |
| 5050 __ Branch(&done, eq, a3, Operand(a1)); | 5039 __ Branch(&done, eq, a3, Operand(a1)); |
| 5051 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5040 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5052 __ Branch(&done, eq, a3, Operand(at)); | 5041 __ Branch(&done, eq, a3, Operand(at)); |
| 5053 | 5042 |
| 5054 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 5043 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 5055 // megamorphic. | 5044 // megamorphic. |
| 5056 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5045 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5057 | 5046 |
| 5058 __ Branch(USE_DELAY_SLOT, &done, eq, a3, Operand(at)); | 5047 __ Branch(USE_DELAY_SLOT, &done, eq, a3, Operand(at)); |
| 5059 // An uninitialized cache is patched with the function. | 5048 // An uninitialized cache is patched with the function. |
| 5060 // Store a1 in the delay slot. This may or may not get overwritten depending | 5049 // Store a1 in the delay slot. This may or may not get overwritten depending |
| 5061 // on the result of the comparison. | 5050 // on the result of the comparison. |
| 5062 __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5051 __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5063 // No need for a write barrier here - cells are rescanned. | 5052 // No need for a write barrier here - cells are rescanned. |
| 5064 | 5053 |
| 5065 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 5054 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 5066 // write-barrier is needed. | 5055 // write-barrier is needed. |
| 5067 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5056 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5068 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5057 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5069 | 5058 |
| 5070 __ bind(&done); | 5059 __ bind(&done); |
| 5071 } | 5060 } |
| 5072 | 5061 |
| 5073 | 5062 |
| 5074 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 5063 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| 5075 // Cache the called function in a global property cell. Cache states | 5064 // Cache the called function in a global property cell. Cache states |
| 5076 // are uninitialized, monomorphic (indicated by a JSFunction), and | 5065 // are uninitialized, monomorphic (indicated by a JSFunction), and |
| 5077 // megamorphic. | 5066 // megamorphic. |
| 5078 // a1 : the function to call | 5067 // a1 : the function to call |
| 5079 // a2 : cache cell for call target | 5068 // a2 : cache cell for call target |
| 5080 ASSERT(FLAG_optimize_constructed_arrays); | 5069 ASSERT(FLAG_optimize_constructed_arrays); |
| 5081 Label initialize, done, miss, megamorphic, not_array_function; | 5070 Label initialize, done, miss, megamorphic, not_array_function; |
| 5082 | 5071 |
| 5083 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5072 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5084 masm->isolate()->heap()->undefined_value()); | 5073 masm->isolate()->heap()->undefined_value()); |
| 5085 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 5074 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 5086 masm->isolate()->heap()->the_hole_value()); | 5075 masm->isolate()->heap()->the_hole_value()); |
| 5087 | 5076 |
| 5088 // Load the cache state into a3. | 5077 // Load the cache state into a3. |
| 5089 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5078 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5090 | 5079 |
| 5091 // A monomorphic cache hit or an already megamorphic state: invoke the | 5080 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 5092 // function without changing the state. | 5081 // function without changing the state. |
| 5093 __ Branch(&done, eq, a3, Operand(a1)); | 5082 __ Branch(&done, eq, a3, Operand(a1)); |
| 5094 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5083 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5095 __ Branch(&done, eq, a3, Operand(at)); | 5084 __ Branch(&done, eq, a3, Operand(at)); |
| 5096 | 5085 |
| 5097 // Special handling of the Array() function, which caches not only the | 5086 // Special handling of the Array() function, which caches not only the |
| 5098 // monomorphic Array function but the initial ElementsKind with special | 5087 // monomorphic Array function but the initial ElementsKind with special |
| 5099 // sentinels | 5088 // sentinels |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5110 __ bind(&miss); | 5099 __ bind(&miss); |
| 5111 | 5100 |
| 5112 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 5101 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 5113 // megamorphic. | 5102 // megamorphic. |
| 5114 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5103 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5115 __ Branch(&initialize, eq, a3, Operand(at)); | 5104 __ Branch(&initialize, eq, a3, Operand(at)); |
| 5116 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 5105 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 5117 // write-barrier is needed. | 5106 // write-barrier is needed. |
| 5118 __ bind(&megamorphic); | 5107 __ bind(&megamorphic); |
| 5119 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5108 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5120 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5109 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5121 __ jmp(&done); | 5110 __ jmp(&done); |
| 5122 | 5111 |
| 5123 // An uninitialized cache is patched with the function or sentinel to | 5112 // An uninitialized cache is patched with the function or sentinel to |
| 5124 // indicate the ElementsKind if function is the Array constructor. | 5113 // indicate the ElementsKind if function is the Array constructor. |
| 5125 __ bind(&initialize); | 5114 __ bind(&initialize); |
| 5126 // Make sure the function is the Array() function | 5115 // Make sure the function is the Array() function |
| 5127 __ LoadArrayFunction(a3); | 5116 __ LoadArrayFunction(a3); |
| 5128 __ Branch(¬_array_function, ne, a1, Operand(a3)); | 5117 __ Branch(¬_array_function, ne, a1, Operand(a3)); |
| 5129 | 5118 |
| 5130 // The target function is the Array constructor, install a sentinel value in | 5119 // 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 | 5120 // the constructor's type info cell that will track the initial ElementsKind |
| 5132 // that should be used for the array when its constructed. | 5121 // that should be used for the array when its constructed. |
| 5133 Handle<Object> initial_kind_sentinel = | 5122 Handle<Object> initial_kind_sentinel = |
| 5134 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), | 5123 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
| 5135 GetInitialFastElementsKind()); | 5124 GetInitialFastElementsKind()); |
| 5136 __ li(a3, Operand(initial_kind_sentinel)); | 5125 __ li(a3, Operand(initial_kind_sentinel)); |
| 5137 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5126 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5138 __ Branch(&done); | 5127 __ Branch(&done); |
| 5139 | 5128 |
| 5140 __ bind(¬_array_function); | 5129 __ bind(¬_array_function); |
| 5141 __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5130 __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5142 // No need for a write barrier here - cells are rescanned. | 5131 // No need for a write barrier here - cells are rescanned. |
| 5143 | 5132 |
| 5144 __ bind(&done); | 5133 __ bind(&done); |
| 5145 } | 5134 } |
| 5146 | 5135 |
| 5147 | 5136 |
| 5148 void CallFunctionStub::Generate(MacroAssembler* masm) { | 5137 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 5149 // a1 : the function to call | 5138 // a1 : the function to call |
| 5150 // a2 : cache cell for call target | 5139 // a2 : cache cell for call target |
| 5151 Label slow, non_function; | 5140 Label slow, non_function; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5207 | 5196 |
| 5208 // Slow-case: Non-function called. | 5197 // Slow-case: Non-function called. |
| 5209 __ bind(&slow); | 5198 __ bind(&slow); |
| 5210 if (RecordCallTarget()) { | 5199 if (RecordCallTarget()) { |
| 5211 // If there is a call target cache, mark it megamorphic in the | 5200 // If there is a call target cache, mark it megamorphic in the |
| 5212 // non-function case. MegamorphicSentinel is an immortal immovable | 5201 // non-function case. MegamorphicSentinel is an immortal immovable |
| 5213 // object (undefined) so no write barrier is needed. | 5202 // object (undefined) so no write barrier is needed. |
| 5214 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 5203 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5215 masm->isolate()->heap()->undefined_value()); | 5204 masm->isolate()->heap()->undefined_value()); |
| 5216 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5205 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5217 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 5206 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5218 } | 5207 } |
| 5219 // Check for function proxy. | 5208 // Check for function proxy. |
| 5220 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); | 5209 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 5221 __ push(a1); // Put proxy as additional argument. | 5210 __ push(a1); // Put proxy as additional argument. |
| 5222 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); | 5211 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); |
| 5223 __ li(a2, Operand(0, RelocInfo::NONE32)); | 5212 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 5224 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 5213 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); |
| 5225 __ SetCallKind(t1, CALL_AS_METHOD); | 5214 __ SetCallKind(t1, CALL_AS_METHOD); |
| 5226 { | 5215 { |
| 5227 Handle<Code> adaptor = | 5216 Handle<Code> adaptor = |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6905 // Dereference the address and check for this. | 6894 // Dereference the address and check for this. |
| 6906 __ lw(t0, MemOperand(t9)); | 6895 __ lw(t0, MemOperand(t9)); |
| 6907 __ Assert(ne, "Received invalid return address.", t0, | 6896 __ Assert(ne, "Received invalid return address.", t0, |
| 6908 Operand(reinterpret_cast<uint32_t>(kZapValue))); | 6897 Operand(reinterpret_cast<uint32_t>(kZapValue))); |
| 6909 } | 6898 } |
| 6910 __ Jump(t9); | 6899 __ Jump(t9); |
| 6911 } | 6900 } |
| 6912 | 6901 |
| 6913 | 6902 |
| 6914 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, | 6903 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, |
| 6915 ExternalReference function) { | |
| 6916 __ li(t9, Operand(function)); | |
| 6917 this->GenerateCall(masm, t9); | |
| 6918 } | |
| 6919 | |
| 6920 | |
| 6921 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, | |
| 6922 Register target) { | 6904 Register target) { |
| 6923 __ Move(t9, target); | 6905 __ Move(t9, target); |
| 6924 __ AssertStackIsAligned(); | 6906 __ AssertStackIsAligned(); |
| 6925 // Allocate space for arg slots. | 6907 // Allocate space for arg slots. |
| 6926 __ Subu(sp, sp, kCArgsSlotsSize); | 6908 __ Subu(sp, sp, kCArgsSlotsSize); |
| 6927 | 6909 |
| 6928 // Block the trampoline pool through the whole function to make sure the | 6910 // Block the trampoline pool through the whole function to make sure the |
| 6929 // number of generated instructions is constant. | 6911 // number of generated instructions is constant. |
| 6930 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); | 6912 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); |
| 6931 | 6913 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7493 | 7475 |
| 7494 __ bind(&need_incremental); | 7476 __ bind(&need_incremental); |
| 7495 | 7477 |
| 7496 // Fall through when we need to inform the incremental marker. | 7478 // Fall through when we need to inform the incremental marker. |
| 7497 } | 7479 } |
| 7498 | 7480 |
| 7499 | 7481 |
| 7500 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | 7482 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
| 7501 // ----------- S t a t e ------------- | 7483 // ----------- S t a t e ------------- |
| 7502 // -- a0 : element value to store | 7484 // -- a0 : element value to store |
| 7503 // -- a1 : array literal | |
| 7504 // -- a2 : map of array literal | |
| 7505 // -- a3 : element index as smi | 7485 // -- a3 : element index as smi |
| 7506 // -- t0 : array literal index in function as smi | 7486 // -- sp[0] : array literal index in function as smi |
| 7487 // -- sp[4] : array literal |
| 7488 // clobbers a1, a2, t0 |
| 7507 // ----------------------------------- | 7489 // ----------------------------------- |
| 7508 | 7490 |
| 7509 Label element_done; | 7491 Label element_done; |
| 7510 Label double_elements; | 7492 Label double_elements; |
| 7511 Label smi_element; | 7493 Label smi_element; |
| 7512 Label slow_elements; | 7494 Label slow_elements; |
| 7513 Label fast_elements; | 7495 Label fast_elements; |
| 7514 | 7496 |
| 7497 // Get array literal index, array literal and its map. |
| 7498 __ lw(t0, MemOperand(sp, 0 * kPointerSize)); |
| 7499 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); |
| 7500 __ lw(a2, FieldMemOperand(a1, JSObject::kMapOffset)); |
| 7501 |
| 7515 __ CheckFastElements(a2, t1, &double_elements); | 7502 __ CheckFastElements(a2, t1, &double_elements); |
| 7516 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements | 7503 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements |
| 7517 __ JumpIfSmi(a0, &smi_element); | 7504 __ JumpIfSmi(a0, &smi_element); |
| 7518 __ CheckFastSmiElements(a2, t1, &fast_elements); | 7505 __ CheckFastSmiElements(a2, t1, &fast_elements); |
| 7519 | 7506 |
| 7520 // Store into the array literal requires a elements transition. Call into | 7507 // Store into the array literal requires a elements transition. Call into |
| 7521 // the runtime. | 7508 // the runtime. |
| 7522 __ bind(&slow_elements); | 7509 __ bind(&slow_elements); |
| 7523 // call. | 7510 // call. |
| 7524 __ Push(a1, a3, a0); | 7511 __ Push(a1, a3, a0); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7769 // Initial map for the builtin Array function should be a map. | 7756 // Initial map for the builtin Array function should be a map. |
| 7770 __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 7757 __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 7771 // Will both indicate a NULL and a Smi. | 7758 // Will both indicate a NULL and a Smi. |
| 7772 __ And(at, a3, Operand(kSmiTagMask)); | 7759 __ And(at, a3, Operand(kSmiTagMask)); |
| 7773 __ Assert(ne, "Unexpected initial map for Array function", | 7760 __ Assert(ne, "Unexpected initial map for Array function", |
| 7774 at, Operand(zero_reg)); | 7761 at, Operand(zero_reg)); |
| 7775 __ GetObjectType(a3, a3, t0); | 7762 __ GetObjectType(a3, a3, t0); |
| 7776 __ Assert(eq, "Unexpected initial map for Array function", | 7763 __ Assert(eq, "Unexpected initial map for Array function", |
| 7777 t0, Operand(MAP_TYPE)); | 7764 t0, Operand(MAP_TYPE)); |
| 7778 | 7765 |
| 7779 // We should either have undefined in ebx or a valid jsglobalpropertycell | 7766 // We should either have undefined in a2 or a valid cell |
| 7780 Label okay_here; | 7767 Label okay_here; |
| 7781 Handle<Map> global_property_cell_map( | 7768 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)); | 7769 __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel)); |
| 7784 __ lw(a3, FieldMemOperand(a2, 0)); | 7770 __ lw(a3, FieldMemOperand(a2, 0)); |
| 7785 __ Assert(eq, "Expected property cell in register ebx", | 7771 __ Assert(eq, "Expected property cell in register a2", |
| 7786 a3, Operand(global_property_cell_map)); | 7772 a3, Operand(cell_map)); |
| 7787 __ bind(&okay_here); | 7773 __ bind(&okay_here); |
| 7788 } | 7774 } |
| 7789 | 7775 |
| 7790 if (FLAG_optimize_constructed_arrays) { | 7776 if (FLAG_optimize_constructed_arrays) { |
| 7791 Label no_info, switch_ready; | 7777 Label no_info, switch_ready; |
| 7792 // Get the elements kind and case on that. | 7778 // Get the elements kind and case on that. |
| 7793 __ Branch(&no_info, eq, a2, Operand(undefined_sentinel)); | 7779 __ Branch(&no_info, eq, a2, Operand(undefined_sentinel)); |
| 7794 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 7780 __ lw(a3, FieldMemOperand(a2, PropertyCell::kValueOffset)); |
| 7795 __ JumpIfNotSmi(a3, &no_info); | 7781 __ JumpIfNotSmi(a3, &no_info); |
| 7796 __ SmiUntag(a3); | 7782 __ SmiUntag(a3); |
| 7797 __ jmp(&switch_ready); | 7783 __ jmp(&switch_ready); |
| 7798 __ bind(&no_info); | 7784 __ bind(&no_info); |
| 7799 __ li(a3, Operand(GetInitialFastElementsKind())); | 7785 __ li(a3, Operand(GetInitialFastElementsKind())); |
| 7800 __ bind(&switch_ready); | 7786 __ bind(&switch_ready); |
| 7801 | 7787 |
| 7802 if (argument_count_ == ANY) { | 7788 if (argument_count_ == ANY) { |
| 7803 Label not_zero_case, not_one_case; | 7789 Label not_zero_case, not_one_case; |
| 7804 __ And(at, a0, a0); | 7790 __ And(at, a0, a0); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7929 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 7915 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 7930 } | 7916 } |
| 7931 } | 7917 } |
| 7932 | 7918 |
| 7933 | 7919 |
| 7934 #undef __ | 7920 #undef __ |
| 7935 | 7921 |
| 7936 } } // namespace v8::internal | 7922 } } // namespace v8::internal |
| 7937 | 7923 |
| 7938 #endif // V8_TARGET_ARCH_MIPS | 7924 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |