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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 Label* slow) { | 472 Label* slow) { |
473 // r0 : value | 473 // r0 : value |
474 Label exit; | 474 Label exit; |
475 | 475 |
476 int descriptor = transition->LastAdded(); | 476 int descriptor = transition->LastAdded(); |
477 DescriptorArray* descriptors = transition->instance_descriptors(); | 477 DescriptorArray* descriptors = transition->instance_descriptors(); |
478 PropertyDetails details = descriptors->GetDetails(descriptor); | 478 PropertyDetails details = descriptors->GetDetails(descriptor); |
479 Representation representation = details.representation(); | 479 Representation representation = details.representation(); |
480 ASSERT(!representation.IsNone()); | 480 ASSERT(!representation.IsNone()); |
481 | 481 |
482 if (details.type() == CONSTANT_FUNCTION) { | 482 if (details.type() == CONSTANT) { |
483 Handle<HeapObject> constant( | 483 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
484 HeapObject::cast(descriptors->GetValue(descriptor))); | 484 __ LoadObject(scratch1, constant); |
485 __ LoadHeapObject(scratch1, constant); | |
486 __ cmp(value_reg, scratch1); | 485 __ cmp(value_reg, scratch1); |
487 __ b(ne, miss_label); | 486 __ b(ne, miss_label); |
488 } else if (FLAG_track_fields && representation.IsSmi()) { | 487 } else if (FLAG_track_fields && representation.IsSmi()) { |
489 __ JumpIfNotSmi(value_reg, miss_label); | 488 __ JumpIfNotSmi(value_reg, miss_label); |
490 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 489 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
491 __ JumpIfSmi(value_reg, miss_label); | 490 __ JumpIfSmi(value_reg, miss_label); |
492 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 491 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
493 Label do_store, heap_number; | 492 Label do_store, heap_number; |
494 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); | 493 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); |
495 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); | 494 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // Update the write barrier for the map field. | 535 // Update the write barrier for the map field. |
537 __ RecordWriteField(receiver_reg, | 536 __ RecordWriteField(receiver_reg, |
538 HeapObject::kMapOffset, | 537 HeapObject::kMapOffset, |
539 scratch1, | 538 scratch1, |
540 scratch2, | 539 scratch2, |
541 kLRHasNotBeenSaved, | 540 kLRHasNotBeenSaved, |
542 kDontSaveFPRegs, | 541 kDontSaveFPRegs, |
543 OMIT_REMEMBERED_SET, | 542 OMIT_REMEMBERED_SET, |
544 OMIT_SMI_CHECK); | 543 OMIT_SMI_CHECK); |
545 | 544 |
546 if (details.type() == CONSTANT_FUNCTION) { | 545 if (details.type() == CONSTANT) { |
547 ASSERT(value_reg.is(r0)); | 546 ASSERT(value_reg.is(r0)); |
548 __ Ret(); | 547 __ Ret(); |
549 return; | 548 return; |
550 } | 549 } |
551 | 550 |
552 int index = transition->instance_descriptors()->GetFieldIndex( | 551 int index = transition->instance_descriptors()->GetFieldIndex( |
553 transition->LastAdded()); | 552 transition->LastAdded()); |
554 | 553 |
555 // Adjust for the number of properties stored in the object. Even in the | 554 // Adjust for the number of properties stored in the object. Even in the |
556 // face of a transition we can use the old map here because the size of the | 555 // face of a transition we can use the old map here because the size of the |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1391 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1393 } else { | 1392 } else { |
1394 KeyedLoadFieldStub stub(field.is_inobject(holder), | 1393 KeyedLoadFieldStub stub(field.is_inobject(holder), |
1395 field.translate(holder), | 1394 field.translate(holder), |
1396 representation); | 1395 representation); |
1397 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1396 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1398 } | 1397 } |
1399 } | 1398 } |
1400 | 1399 |
1401 | 1400 |
1402 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { | 1401 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
1403 // Return the constant value. | 1402 // Return the constant value. |
1404 __ LoadHeapObject(r0, value); | 1403 __ LoadObject(r0, value); |
1405 __ Ret(); | 1404 __ Ret(); |
1406 } | 1405 } |
1407 | 1406 |
1408 | 1407 |
1409 void BaseLoadStubCompiler::GenerateLoadCallback( | 1408 void BaseLoadStubCompiler::GenerateLoadCallback( |
1410 Register reg, | 1409 Register reg, |
1411 Handle<ExecutableAccessorInfo> callback) { | 1410 Handle<ExecutableAccessorInfo> callback) { |
1412 // Build AccessorInfo::args_ list on the stack and push property name below | 1411 // Build AccessorInfo::args_ list on the stack and push property name below |
1413 // the exit frame to make GC aware of them and store pointers to them. | 1412 // the exit frame to make GC aware of them and store pointers to them. |
1414 __ push(receiver()); | 1413 __ push(receiver()); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 __ add(r0, r0, Operand(Smi::FromInt(argc))); | 1806 __ add(r0, r0, Operand(Smi::FromInt(argc))); |
1808 | 1807 |
1809 // Get the elements' length. | 1808 // Get the elements' length. |
1810 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1809 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
1811 | 1810 |
1812 // Check if we could survive without allocation. | 1811 // Check if we could survive without allocation. |
1813 __ cmp(r0, r4); | 1812 __ cmp(r0, r4); |
1814 __ b(gt, &call_builtin); | 1813 __ b(gt, &call_builtin); |
1815 | 1814 |
1816 __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize)); | 1815 __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize)); |
1817 __ StoreNumberToDoubleElements(r4, r0, elements, r5, | 1816 __ StoreNumberToDoubleElements(r4, r0, elements, r5, d0, |
1818 &call_builtin, argc * kDoubleSize); | 1817 &call_builtin, argc * kDoubleSize); |
1819 | 1818 |
1820 // Save new length. | 1819 // Save new length. |
1821 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1820 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
1822 | 1821 |
1823 // Check for a smi. | 1822 // Check for a smi. |
1824 __ Drop(argc + 1); | 1823 __ Drop(argc + 1); |
1825 __ Ret(); | 1824 __ Ret(); |
1826 | 1825 |
1827 __ bind(&with_write_barrier); | 1826 __ bind(&with_write_barrier); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2663 Handle<Code> CallStubCompiler::CompileCallConstant( | 2662 Handle<Code> CallStubCompiler::CompileCallConstant( |
2664 Handle<Object> object, | 2663 Handle<Object> object, |
2665 Handle<JSObject> holder, | 2664 Handle<JSObject> holder, |
2666 Handle<Name> name, | 2665 Handle<Name> name, |
2667 CheckType check, | 2666 CheckType check, |
2668 Handle<JSFunction> function) { | 2667 Handle<JSFunction> function) { |
2669 if (HasCustomCallGenerator(function)) { | 2668 if (HasCustomCallGenerator(function)) { |
2670 Handle<Code> code = CompileCustomCall(object, holder, | 2669 Handle<Code> code = CompileCustomCall(object, holder, |
2671 Handle<Cell>::null(), | 2670 Handle<Cell>::null(), |
2672 function, Handle<String>::cast(name), | 2671 function, Handle<String>::cast(name), |
2673 Code::CONSTANT_FUNCTION); | 2672 Code::CONSTANT); |
2674 // A null handle means bail out to the regular compiler code below. | 2673 // A null handle means bail out to the regular compiler code below. |
2675 if (!code.is_null()) return code; | 2674 if (!code.is_null()) return code; |
2676 } | 2675 } |
2677 | 2676 |
2678 Label success; | 2677 Label success; |
2679 | 2678 |
2680 CompileHandlerFrontend(object, holder, name, check, &success); | 2679 CompileHandlerFrontend(object, holder, name, check, &success); |
2681 __ bind(&success); | 2680 __ bind(&success); |
2682 CompileHandlerBackend(function); | 2681 CompileHandlerBackend(function); |
2683 | 2682 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 // -- r1 : receiver | 3187 // -- r1 : receiver |
3189 // ----------------------------------- | 3188 // ----------------------------------- |
3190 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3189 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3191 } | 3190 } |
3192 | 3191 |
3193 | 3192 |
3194 static void GenerateSmiKeyCheck(MacroAssembler* masm, | 3193 static void GenerateSmiKeyCheck(MacroAssembler* masm, |
3195 Register key, | 3194 Register key, |
3196 Register scratch0, | 3195 Register scratch0, |
3197 DwVfpRegister double_scratch0, | 3196 DwVfpRegister double_scratch0, |
3198 DwVfpRegister double_scratch1, | 3197 LowDwVfpRegister double_scratch1, |
3199 Label* fail) { | 3198 Label* fail) { |
3200 Label key_ok; | 3199 Label key_ok; |
3201 // Check for smi or a smi inside a heap number. We convert the heap | 3200 // Check for smi or a smi inside a heap number. We convert the heap |
3202 // number and check if the conversion is exact and fits into the smi | 3201 // number and check if the conversion is exact and fits into the smi |
3203 // range. | 3202 // range. |
3204 __ JumpIfSmi(key, &key_ok); | 3203 __ JumpIfSmi(key, &key_ok); |
3205 __ CheckMap(key, | 3204 __ CheckMap(key, |
3206 scratch0, | 3205 scratch0, |
3207 Heap::kHeapNumberMapRootIndex, | 3206 Heap::kHeapNumberMapRootIndex, |
3208 fail, | 3207 fail, |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 // indexes. | 3596 // indexes. |
3598 __ cmp(key_reg, scratch1); | 3597 __ cmp(key_reg, scratch1); |
3599 if (IsGrowStoreMode(store_mode)) { | 3598 if (IsGrowStoreMode(store_mode)) { |
3600 __ b(hs, &grow); | 3599 __ b(hs, &grow); |
3601 } else { | 3600 } else { |
3602 __ b(hs, &miss_force_generic); | 3601 __ b(hs, &miss_force_generic); |
3603 } | 3602 } |
3604 | 3603 |
3605 __ bind(&finish_store); | 3604 __ bind(&finish_store); |
3606 __ StoreNumberToDoubleElements(value_reg, key_reg, elements_reg, | 3605 __ StoreNumberToDoubleElements(value_reg, key_reg, elements_reg, |
3607 scratch1, &transition_elements_kind); | 3606 scratch1, d0, &transition_elements_kind); |
3608 __ Ret(); | 3607 __ Ret(); |
3609 | 3608 |
3610 // Handle store cache miss, replacing the ic with the generic stub. | 3609 // Handle store cache miss, replacing the ic with the generic stub. |
3611 __ bind(&miss_force_generic); | 3610 __ bind(&miss_force_generic); |
3612 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric); | 3611 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric); |
3613 | 3612 |
3614 __ bind(&transition_elements_kind); | 3613 __ bind(&transition_elements_kind); |
3615 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss); | 3614 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss); |
3616 | 3615 |
3617 if (is_js_array && IsGrowStoreMode(store_mode)) { | 3616 if (is_js_array && IsGrowStoreMode(store_mode)) { |
(...skipping 27 matching lines...) Expand all Loading... |
3645 // Initialize the new FixedDoubleArray. | 3644 // Initialize the new FixedDoubleArray. |
3646 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); | 3645 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); |
3647 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 3646 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
3648 __ mov(scratch1, | 3647 __ mov(scratch1, |
3649 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 3648 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
3650 __ str(scratch1, | 3649 __ str(scratch1, |
3651 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); | 3650 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); |
3652 | 3651 |
3653 __ mov(scratch1, elements_reg); | 3652 __ mov(scratch1, elements_reg); |
3654 __ StoreNumberToDoubleElements(value_reg, key_reg, scratch1, | 3653 __ StoreNumberToDoubleElements(value_reg, key_reg, scratch1, |
3655 scratch2, &transition_elements_kind); | 3654 scratch2, d0, &transition_elements_kind); |
3656 | 3655 |
3657 __ mov(scratch1, Operand(kHoleNanLower32)); | 3656 __ mov(scratch1, Operand(kHoleNanLower32)); |
3658 __ mov(scratch2, Operand(kHoleNanUpper32)); | 3657 __ mov(scratch2, Operand(kHoleNanUpper32)); |
3659 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) { | 3658 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) { |
3660 int offset = FixedDoubleArray::OffsetOfElementAt(i); | 3659 int offset = FixedDoubleArray::OffsetOfElementAt(i); |
3661 __ str(scratch1, FieldMemOperand(elements_reg, offset)); | 3660 __ str(scratch1, FieldMemOperand(elements_reg, offset)); |
3662 __ str(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize)); | 3661 __ str(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize)); |
3663 } | 3662 } |
3664 | 3663 |
3665 // Install the new backing store in the JSArray. | 3664 // Install the new backing store in the JSArray. |
(...skipping 26 matching lines...) Expand all Loading... |
3692 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3691 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3693 } | 3692 } |
3694 } | 3693 } |
3695 | 3694 |
3696 | 3695 |
3697 #undef __ | 3696 #undef __ |
3698 | 3697 |
3699 } } // namespace v8::internal | 3698 } } // namespace v8::internal |
3700 | 3699 |
3701 #endif // V8_TARGET_ARCH_ARM | 3700 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |