OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 // at least one map/handler pair. | 3358 // at least one map/handler pair. |
3359 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | 3359 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, |
3360 FixedArray::kHeaderSize + kPointerSize)); | 3360 FixedArray::kHeaderSize + kPointerSize)); |
3361 HandleArrayCases(masm, receiver, key, vector, slot, feedback, false, &miss); | 3361 HandleArrayCases(masm, receiver, key, vector, slot, feedback, false, &miss); |
3362 | 3362 |
3363 __ bind(&miss); | 3363 __ bind(&miss); |
3364 KeyedLoadIC::GenerateMiss(masm); | 3364 KeyedLoadIC::GenerateMiss(masm); |
3365 } | 3365 } |
3366 | 3366 |
3367 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3367 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3368 __ EmitLoadTypeFeedbackVector(VectorStoreICDescriptor::VectorRegister()); | 3368 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3369 StoreICStub stub(isolate(), state()); | 3369 StoreICStub stub(isolate(), state()); |
3370 stub.GenerateForTrampoline(masm); | 3370 stub.GenerateForTrampoline(masm); |
3371 } | 3371 } |
3372 | 3372 |
3373 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3373 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3374 __ EmitLoadTypeFeedbackVector(VectorStoreICDescriptor::VectorRegister()); | 3374 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3375 KeyedStoreICStub stub(isolate(), state()); | 3375 KeyedStoreICStub stub(isolate(), state()); |
3376 stub.GenerateForTrampoline(masm); | 3376 stub.GenerateForTrampoline(masm); |
3377 } | 3377 } |
3378 | 3378 |
3379 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | 3379 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } |
3380 | 3380 |
3381 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3381 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3382 GenerateImpl(masm, true); | 3382 GenerateImpl(masm, true); |
3383 } | 3383 } |
3384 | 3384 |
(...skipping 24 matching lines...) Expand all Loading... |
3409 __ mov(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); | 3409 __ mov(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); |
3410 | 3410 |
3411 // A named keyed store might have a 2 element array, all other cases can count | 3411 // A named keyed store might have a 2 element array, all other cases can count |
3412 // on an array with at least 2 {map, handler} pairs, so they can go right | 3412 // on an array with at least 2 {map, handler} pairs, so they can go right |
3413 // into polymorphic array handling. | 3413 // into polymorphic array handling. |
3414 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); | 3414 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); |
3415 __ j(not_equal, &start_polymorphic); | 3415 __ j(not_equal, &start_polymorphic); |
3416 | 3416 |
3417 // found, now call handler. | 3417 // found, now call handler. |
3418 Register handler = feedback; | 3418 Register handler = feedback; |
3419 DCHECK(handler.is(VectorStoreICDescriptor::ValueRegister())); | 3419 DCHECK(handler.is(StoreWithVectorDescriptor::ValueRegister())); |
3420 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); | 3420 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); |
3421 __ pop(vector); | 3421 __ pop(vector); |
3422 __ pop(receiver); | 3422 __ pop(receiver); |
3423 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); | 3423 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
3424 __ mov(Operand::StaticVariable(virtual_register), handler); | 3424 __ mov(Operand::StaticVariable(virtual_register), handler); |
3425 __ pop(handler); // Pop "value". | 3425 __ pop(handler); // Pop "value". |
3426 __ jmp(Operand::StaticVariable(virtual_register)); | 3426 __ jmp(Operand::StaticVariable(virtual_register)); |
3427 | 3427 |
3428 // Polymorphic, we have to loop from 2 to N | 3428 // Polymorphic, we have to loop from 2 to N |
3429 __ bind(&start_polymorphic); | 3429 __ bind(&start_polymorphic); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3469 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3469 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3470 __ jmp(&compare_map); | 3470 __ jmp(&compare_map); |
3471 } | 3471 } |
3472 | 3472 |
3473 | 3473 |
3474 static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, | 3474 static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
3475 Register key, Register vector, | 3475 Register key, Register vector, |
3476 Register slot, Register weak_cell, | 3476 Register slot, Register weak_cell, |
3477 Label* miss) { | 3477 Label* miss) { |
3478 // The store ic value is on the stack. | 3478 // The store ic value is on the stack. |
3479 DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister())); | 3479 DCHECK(weak_cell.is(StoreWithVectorDescriptor::ValueRegister())); |
3480 ExternalReference virtual_register = | 3480 ExternalReference virtual_register = |
3481 ExternalReference::virtual_handler_register(masm->isolate()); | 3481 ExternalReference::virtual_handler_register(masm->isolate()); |
3482 | 3482 |
3483 // feedback initially contains the feedback array | 3483 // feedback initially contains the feedback array |
3484 Label compare_smi_map; | 3484 Label compare_smi_map; |
3485 | 3485 |
3486 // Move the weak map into the weak_cell register. | 3486 // Move the weak map into the weak_cell register. |
3487 Register ic_map = weak_cell; | 3487 Register ic_map = weak_cell; |
3488 __ mov(ic_map, FieldOperand(weak_cell, WeakCell::kValueOffset)); | 3488 __ mov(ic_map, FieldOperand(weak_cell, WeakCell::kValueOffset)); |
3489 | 3489 |
(...skipping 18 matching lines...) Expand all Loading... |
3508 __ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, | 3508 __ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, |
3509 FixedArray::kHeaderSize + kPointerSize)); | 3509 FixedArray::kHeaderSize + kPointerSize)); |
3510 __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); | 3510 __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); |
3511 __ mov(Operand::StaticVariable(virtual_register), weak_cell); | 3511 __ mov(Operand::StaticVariable(virtual_register), weak_cell); |
3512 __ pop(weak_cell); // Pop "value". | 3512 __ pop(weak_cell); // Pop "value". |
3513 // jump to the handler. | 3513 // jump to the handler. |
3514 __ jmp(Operand::StaticVariable(virtual_register)); | 3514 __ jmp(Operand::StaticVariable(virtual_register)); |
3515 } | 3515 } |
3516 | 3516 |
3517 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 3517 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
3518 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // edx | 3518 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // edx |
3519 Register key = VectorStoreICDescriptor::NameRegister(); // ecx | 3519 Register key = StoreWithVectorDescriptor::NameRegister(); // ecx |
3520 Register value = VectorStoreICDescriptor::ValueRegister(); // eax | 3520 Register value = StoreWithVectorDescriptor::ValueRegister(); // eax |
3521 Register vector = VectorStoreICDescriptor::VectorRegister(); // ebx | 3521 Register vector = StoreWithVectorDescriptor::VectorRegister(); // ebx |
3522 Register slot = VectorStoreICDescriptor::SlotRegister(); // edi | 3522 Register slot = StoreWithVectorDescriptor::SlotRegister(); // edi |
3523 Label miss; | 3523 Label miss; |
3524 | 3524 |
3525 __ push(value); | 3525 __ push(value); |
3526 | 3526 |
3527 Register scratch = value; | 3527 Register scratch = value; |
3528 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, | 3528 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, |
3529 FixedArray::kHeaderSize)); | 3529 FixedArray::kHeaderSize)); |
3530 | 3530 |
3531 // Is it a weak cell? | 3531 // Is it a weak cell? |
3532 Label try_array; | 3532 Label try_array; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3673 __ pop(vector); | 3673 __ pop(vector); |
3674 __ pop(receiver); | 3674 __ pop(receiver); |
3675 __ jmp(miss); | 3675 __ jmp(miss); |
3676 | 3676 |
3677 __ bind(&load_smi_map); | 3677 __ bind(&load_smi_map); |
3678 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3678 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3679 __ jmp(&compare_map); | 3679 __ jmp(&compare_map); |
3680 } | 3680 } |
3681 | 3681 |
3682 void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 3682 void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
3683 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // edx | 3683 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // edx |
3684 Register key = VectorStoreICDescriptor::NameRegister(); // ecx | 3684 Register key = StoreWithVectorDescriptor::NameRegister(); // ecx |
3685 Register value = VectorStoreICDescriptor::ValueRegister(); // eax | 3685 Register value = StoreWithVectorDescriptor::ValueRegister(); // eax |
3686 Register vector = VectorStoreICDescriptor::VectorRegister(); // ebx | 3686 Register vector = StoreWithVectorDescriptor::VectorRegister(); // ebx |
3687 Register slot = VectorStoreICDescriptor::SlotRegister(); // edi | 3687 Register slot = StoreWithVectorDescriptor::SlotRegister(); // edi |
3688 Label miss; | 3688 Label miss; |
3689 | 3689 |
3690 __ push(value); | 3690 __ push(value); |
3691 | 3691 |
3692 Register scratch = value; | 3692 Register scratch = value; |
3693 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, | 3693 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, |
3694 FixedArray::kHeaderSize)); | 3694 FixedArray::kHeaderSize)); |
3695 | 3695 |
3696 // Is it a weak cell? | 3696 // Is it a weak cell? |
3697 Label try_array; | 3697 Label try_array; |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5278 kStackUnwindSpace, nullptr, return_value_operand, | 5278 kStackUnwindSpace, nullptr, return_value_operand, |
5279 NULL); | 5279 NULL); |
5280 } | 5280 } |
5281 | 5281 |
5282 #undef __ | 5282 #undef __ |
5283 | 5283 |
5284 } // namespace internal | 5284 } // namespace internal |
5285 } // namespace v8 | 5285 } // namespace v8 |
5286 | 5286 |
5287 #endif // V8_TARGET_ARCH_X87 | 5287 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |