| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 if (details.type() == CONSTANT) { | 387 if (details.type() == CONSTANT) { |
| 388 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 388 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
| 389 __ LoadObject(scratch1, constant); | 389 __ LoadObject(scratch1, constant); |
| 390 __ Cmp(value_reg, scratch1); | 390 __ Cmp(value_reg, scratch1); |
| 391 __ B(ne, miss_label); | 391 __ B(ne, miss_label); |
| 392 } else if (representation.IsSmi()) { | 392 } else if (representation.IsSmi()) { |
| 393 __ JumpIfNotSmi(value_reg, miss_label); | 393 __ JumpIfNotSmi(value_reg, miss_label); |
| 394 } else if (representation.IsHeapObject()) { | 394 } else if (representation.IsHeapObject()) { |
| 395 __ JumpIfSmi(value_reg, miss_label); | 395 __ JumpIfSmi(value_reg, miss_label); |
| 396 } else if (representation.IsDouble()) { | 396 } else if (representation.IsDouble()) { |
| 397 UseScratchRegisterScope temps(masm); |
| 398 Register temp_double = temps.AcquireD(); |
| 399 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag); |
| 400 |
| 397 Label do_store, heap_number; | 401 Label do_store, heap_number; |
| 398 __ AllocateHeapNumber(storage_reg, slow, scratch1, scratch2); | 402 __ AllocateHeapNumber(storage_reg, slow, scratch1, scratch2); |
| 399 | 403 |
| 400 // TODO(jbramley): Is fp_scratch the most appropriate FP scratch register? | 404 __ JumpIfSmi(value_reg, &do_store); |
| 401 // It's only used in Fcmp, but it's not really safe to use it like this. | |
| 402 __ JumpIfNotSmi(value_reg, &heap_number); | |
| 403 __ SmiUntagToDouble(fp_scratch, value_reg); | |
| 404 __ B(&do_store); | |
| 405 | 405 |
| 406 __ Bind(&heap_number); | |
| 407 __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, | 406 __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, |
| 408 miss_label, DONT_DO_SMI_CHECK); | 407 miss_label, DONT_DO_SMI_CHECK); |
| 409 __ Ldr(fp_scratch, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | 408 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); |
| 410 | 409 |
| 411 __ Bind(&do_store); | 410 __ Bind(&do_store); |
| 412 __ Str(fp_scratch, FieldMemOperand(storage_reg, HeapNumber::kValueOffset)); | 411 __ Str(temp_double, FieldMemOperand(storage_reg, HeapNumber::kValueOffset)); |
| 413 } | 412 } |
| 414 | 413 |
| 415 // Stub never generated for non-global objects that require access checks. | 414 // Stub never generated for non-global objects that require access checks. |
| 416 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 415 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 417 | 416 |
| 418 // Perform map transition for the receiver if necessary. | 417 // Perform map transition for the receiver if necessary. |
| 419 if ((details.type() == FIELD) && | 418 if ((details.type() == FIELD) && |
| 420 (object->map()->unused_property_fields() == 0)) { | 419 (object->map()->unused_property_fields() == 0)) { |
| 421 // The properties must be extended before we can store the value. | 420 // The properties must be extended before we can store the value. |
| 422 // We jump to a runtime call that extends the properties array. | 421 // We jump to a runtime call that extends the properties array. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // object and the number of in-object properties is not going to change. | 538 // object and the number of in-object properties is not going to change. |
| 540 index -= object->map()->inobject_properties(); | 539 index -= object->map()->inobject_properties(); |
| 541 | 540 |
| 542 Representation representation = lookup->representation(); | 541 Representation representation = lookup->representation(); |
| 543 ASSERT(!representation.IsNone()); | 542 ASSERT(!representation.IsNone()); |
| 544 if (representation.IsSmi()) { | 543 if (representation.IsSmi()) { |
| 545 __ JumpIfNotSmi(value_reg, miss_label); | 544 __ JumpIfNotSmi(value_reg, miss_label); |
| 546 } else if (representation.IsHeapObject()) { | 545 } else if (representation.IsHeapObject()) { |
| 547 __ JumpIfSmi(value_reg, miss_label); | 546 __ JumpIfSmi(value_reg, miss_label); |
| 548 } else if (representation.IsDouble()) { | 547 } else if (representation.IsDouble()) { |
| 548 UseScratchRegisterScope temps(masm); |
| 549 Register temp_double = temps.AcquireD(); |
| 550 |
| 551 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag); |
| 552 |
| 549 // Load the double storage. | 553 // Load the double storage. |
| 550 if (index < 0) { | 554 if (index < 0) { |
| 551 int offset = (index * kPointerSize) + object->map()->instance_size(); | 555 int offset = (index * kPointerSize) + object->map()->instance_size(); |
| 552 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset)); | 556 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset)); |
| 553 } else { | 557 } else { |
| 554 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 558 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
| 555 __ Ldr(scratch1, | 559 __ Ldr(scratch1, |
| 556 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 560 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 557 __ Ldr(scratch1, FieldMemOperand(scratch1, offset)); | 561 __ Ldr(scratch1, FieldMemOperand(scratch1, offset)); |
| 558 } | 562 } |
| 559 | 563 |
| 560 // Store the value into the storage. | 564 // Store the value into the storage. |
| 561 Label do_store, heap_number; | 565 Label do_store, heap_number; |
| 562 // TODO(jbramley): Is fp_scratch the most appropriate FP scratch register? | |
| 563 // It's only used in Fcmp, but it's not really safe to use it like this. | |
| 564 __ JumpIfNotSmi(value_reg, &heap_number); | |
| 565 __ SmiUntagToDouble(fp_scratch, value_reg); | |
| 566 __ B(&do_store); | |
| 567 | 566 |
| 568 __ Bind(&heap_number); | 567 __ JumpIfSmi(value_reg, &do_store); |
| 568 |
| 569 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, | 569 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, |
| 570 miss_label, DONT_DO_SMI_CHECK); | 570 miss_label, DONT_DO_SMI_CHECK); |
| 571 __ Ldr(fp_scratch, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | 571 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); |
| 572 | 572 |
| 573 __ Bind(&do_store); | 573 __ Bind(&do_store); |
| 574 __ Str(fp_scratch, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); | 574 __ Str(temp_double, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); |
| 575 | 575 |
| 576 // Return the value (register x0). | 576 // Return the value (register x0). |
| 577 ASSERT(value_reg.is(x0)); | 577 ASSERT(value_reg.is(x0)); |
| 578 __ Ret(); | 578 __ Ret(); |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 | 581 |
| 582 // TODO(verwaest): Share this code as a code stub. | 582 // TODO(verwaest): Share this code as a code stub. |
| 583 SmiCheck smi_check = representation.IsTagged() | 583 SmiCheck smi_check = representation.IsTagged() |
| 584 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 584 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1002 |
| 1003 __ Push(receiver()); | 1003 __ Push(receiver()); |
| 1004 | 1004 |
| 1005 if (heap()->InNewSpace(callback->data())) { | 1005 if (heap()->InNewSpace(callback->data())) { |
| 1006 __ Mov(scratch3(), Operand(callback)); | 1006 __ Mov(scratch3(), Operand(callback)); |
| 1007 __ Ldr(scratch3(), FieldMemOperand(scratch3(), | 1007 __ Ldr(scratch3(), FieldMemOperand(scratch3(), |
| 1008 ExecutableAccessorInfo::kDataOffset)); | 1008 ExecutableAccessorInfo::kDataOffset)); |
| 1009 } else { | 1009 } else { |
| 1010 __ Mov(scratch3(), Operand(Handle<Object>(callback->data(), isolate()))); | 1010 __ Mov(scratch3(), Operand(Handle<Object>(callback->data(), isolate()))); |
| 1011 } | 1011 } |
| 1012 // TODO(jbramley): Find another scratch register and combine the pushes | |
| 1013 // together. Can we use scratch1() here? | |
| 1014 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); | 1012 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); |
| 1015 __ Push(scratch3(), scratch4()); | 1013 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); |
| 1016 __ Mov(scratch3(), ExternalReference::isolate_address(isolate())); | 1014 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg, name()); |
| 1017 __ Push(scratch4(), scratch3(), reg, name()); | |
| 1018 | 1015 |
| 1019 Register args_addr = scratch2(); | 1016 Register args_addr = scratch2(); |
| 1020 __ Add(args_addr, __ StackPointer(), kPointerSize); | 1017 __ Add(args_addr, __ StackPointer(), kPointerSize); |
| 1021 | 1018 |
| 1022 // Stack at this point: | 1019 // Stack at this point: |
| 1023 // sp[40] callback data | 1020 // sp[40] callback data |
| 1024 // sp[32] undefined | 1021 // sp[32] undefined |
| 1025 // sp[24] undefined | 1022 // sp[24] undefined |
| 1026 // sp[16] isolate | 1023 // sp[16] isolate |
| 1027 // args_addr -> sp[8] reg | 1024 // args_addr -> sp[8] reg |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 | 1487 |
| 1491 // Miss case, call the runtime. | 1488 // Miss case, call the runtime. |
| 1492 __ Bind(&miss); | 1489 __ Bind(&miss); |
| 1493 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1490 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1494 } | 1491 } |
| 1495 | 1492 |
| 1496 | 1493 |
| 1497 } } // namespace v8::internal | 1494 } } // namespace v8::internal |
| 1498 | 1495 |
| 1499 #endif // V8_TARGET_ARCH_ARM64 | 1496 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |