OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6775 { ebx, edx, ecx, EMIT_REMEMBERED_SET}, | 6775 { ebx, edx, ecx, EMIT_REMEMBERED_SET}, |
6776 // KeyedStoreStubCompiler::GenerateStoreFastElement. | 6776 // KeyedStoreStubCompiler::GenerateStoreFastElement. |
6777 { edi, edx, ecx, EMIT_REMEMBERED_SET}, | 6777 { edi, edx, ecx, EMIT_REMEMBERED_SET}, |
6778 // ElementsTransitionGenerator::GenerateSmiOnlyToObject | 6778 // ElementsTransitionGenerator::GenerateSmiOnlyToObject |
6779 // and ElementsTransitionGenerator::GenerateSmiOnlyToDouble | 6779 // and ElementsTransitionGenerator::GenerateSmiOnlyToDouble |
6780 // and ElementsTransitionGenerator::GenerateDoubleToObject | 6780 // and ElementsTransitionGenerator::GenerateDoubleToObject |
6781 { edx, ebx, edi, EMIT_REMEMBERED_SET}, | 6781 { edx, ebx, edi, EMIT_REMEMBERED_SET}, |
6782 // ElementsTransitionGenerator::GenerateDoubleToObject | 6782 // ElementsTransitionGenerator::GenerateDoubleToObject |
6783 { eax, edx, esi, EMIT_REMEMBERED_SET}, | 6783 { eax, edx, esi, EMIT_REMEMBERED_SET}, |
6784 { edx, eax, edi, EMIT_REMEMBERED_SET}, | 6784 { edx, eax, edi, EMIT_REMEMBERED_SET}, |
| 6785 // StoreArrayLiteralElementStub::Generate |
| 6786 { ebx, eax, ecx, EMIT_REMEMBERED_SET}, |
6785 // Null termination. | 6787 // Null termination. |
6786 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} | 6788 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} |
6787 }; | 6789 }; |
6788 | 6790 |
6789 | 6791 |
6790 bool RecordWriteStub::IsPregenerated() { | 6792 bool RecordWriteStub::IsPregenerated() { |
6791 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | 6793 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; |
6792 !entry->object.is(no_reg); | 6794 !entry->object.is(no_reg); |
6793 entry++) { | 6795 entry++) { |
6794 if (object_.is(entry->object) && | 6796 if (object_.is(entry->object) && |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7017 } | 7019 } |
7018 | 7020 |
7019 __ bind(&need_incremental_pop_object); | 7021 __ bind(&need_incremental_pop_object); |
7020 __ pop(regs_.object()); | 7022 __ pop(regs_.object()); |
7021 | 7023 |
7022 __ bind(&need_incremental); | 7024 __ bind(&need_incremental); |
7023 | 7025 |
7024 // Fall through when we need to inform the incremental marker. | 7026 // Fall through when we need to inform the incremental marker. |
7025 } | 7027 } |
7026 | 7028 |
| 7029 |
| 7030 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
| 7031 // ----------- S t a t e ------------- |
| 7032 // -- eax : element value to store |
| 7033 // -- ebx : array literal |
| 7034 // -- edi : map of array literal |
| 7035 // -- ecx : element index as smi |
| 7036 // -- edx : array literal index in function |
| 7037 // -- esp[0] : return address |
| 7038 // ----------------------------------- |
| 7039 |
| 7040 Label element_done; |
| 7041 Label double_elements; |
| 7042 Label smi_element; |
| 7043 Label slow_elements; |
| 7044 Label slow_elements_from_double; |
| 7045 Label fast_elements; |
| 7046 |
| 7047 if (!FLAG_trace_elements_transitions) { |
| 7048 __ CheckFastElements(edi, &double_elements); |
| 7049 |
| 7050 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |
| 7051 __ JumpIfSmi(eax, &smi_element); |
| 7052 __ CheckFastSmiOnlyElements(edi, &fast_elements, Label::kNear); |
| 7053 |
| 7054 // Store into the array literal requires a elements transition. Call into |
| 7055 // the runtime. |
| 7056 } |
| 7057 |
| 7058 __ bind(&slow_elements); |
| 7059 __ pop(edi); // Pop return address and remember to put back later for tail |
| 7060 // call. |
| 7061 __ push(ebx); |
| 7062 __ push(ecx); |
| 7063 __ push(eax); |
| 7064 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 7065 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); |
| 7066 __ push(edx); |
| 7067 __ push(edi); // Return return address so that tail call returns to right |
| 7068 // place. |
| 7069 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |
| 7070 |
| 7071 if (!FLAG_trace_elements_transitions) { |
| 7072 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
| 7073 __ bind(&double_elements); |
| 7074 |
| 7075 __ push(edx); |
| 7076 __ mov(edx, FieldOperand(ebx, JSObject::kElementsOffset)); |
| 7077 __ StoreNumberToDoubleElements(eax, |
| 7078 edx, |
| 7079 ecx, |
| 7080 edi, |
| 7081 xmm0, |
| 7082 &slow_elements_from_double, |
| 7083 false); |
| 7084 __ pop(edx); |
| 7085 __ jmp(&element_done); |
| 7086 |
| 7087 __ bind(&slow_elements_from_double); |
| 7088 __ pop(edx); |
| 7089 __ jmp(&slow_elements); |
| 7090 |
| 7091 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |
| 7092 __ bind(&fast_elements); |
| 7093 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |
| 7094 __ lea(ecx, FieldOperand(ebx, ecx, times_half_pointer_size, |
| 7095 FixedArrayBase::kHeaderSize)); |
| 7096 __ mov(Operand(ecx, 0), eax); |
| 7097 // Update the write barrier for the array store. |
| 7098 __ RecordWrite(ebx, ecx, eax, |
| 7099 kDontSaveFPRegs, |
| 7100 EMIT_REMEMBERED_SET, |
| 7101 OMIT_SMI_CHECK); |
| 7102 __ jmp(&element_done); |
| 7103 |
| 7104 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or |
| 7105 // FAST_ELEMENTS, and value is Smi. |
| 7106 __ bind(&smi_element); |
| 7107 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |
| 7108 __ mov(FieldOperand(ebx, ecx, times_half_pointer_size, |
| 7109 FixedArrayBase::kHeaderSize), eax); |
| 7110 // Fall through |
| 7111 __ bind(&element_done); |
| 7112 __ ret(0); |
| 7113 } |
| 7114 } |
| 7115 |
7027 #undef __ | 7116 #undef __ |
7028 | 7117 |
7029 } } // namespace v8::internal | 7118 } } // namespace v8::internal |
7030 | 7119 |
7031 #endif // V8_TARGET_ARCH_IA32 | 7120 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |