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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 miss_restore_name); | 496 miss_restore_name); |
497 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { | 497 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { |
498 GenerateDictionaryNegativeLookup( | 498 GenerateDictionaryNegativeLookup( |
499 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); | 499 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); |
500 } | 500 } |
501 } | 501 } |
502 } | 502 } |
503 | 503 |
504 Register storage_reg = name_reg; | 504 Register storage_reg = name_reg; |
505 | 505 |
506 if (details.type() == CONSTANT_FUNCTION) { | 506 if (FLAG_track_fields && representation.IsSmi()) { |
507 Handle<HeapObject> constant( | |
508 HeapObject::cast(descriptors->GetValue(descriptor))); | |
509 __ LoadHeapObject(scratch1, constant); | |
510 __ Branch(miss_restore_name, ne, value_reg, Operand(scratch1)); | |
511 } else if (FLAG_track_fields && representation.IsSmi()) { | |
512 __ JumpIfNotSmi(value_reg, miss_restore_name); | 507 __ JumpIfNotSmi(value_reg, miss_restore_name); |
513 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 508 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
514 __ JumpIfSmi(value_reg, miss_restore_name); | 509 __ JumpIfSmi(value_reg, miss_restore_name); |
515 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 510 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
516 Label do_store, heap_number; | 511 Label do_store, heap_number; |
517 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); | 512 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); |
518 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); | 513 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); |
519 | 514 |
520 __ JumpIfNotSmi(value_reg, &heap_number); | 515 __ JumpIfNotSmi(value_reg, &heap_number); |
521 __ SmiUntag(scratch1, value_reg); | 516 __ SmiUntag(scratch1, value_reg); |
522 __ mtc1(scratch1, f6); | 517 __ mtc1(scratch1, f6); |
523 __ cvt_d_w(f4, f6); | 518 __ cvt_d_w(f4, f6); |
524 __ jmp(&do_store); | 519 __ jmp(&do_store); |
525 | 520 |
526 __ bind(&heap_number); | 521 __ bind(&heap_number); |
527 __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, | 522 __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, |
528 miss_restore_name, DONT_DO_SMI_CHECK); | 523 miss_restore_name, DONT_DO_SMI_CHECK); |
529 __ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | 524 __ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); |
530 | 525 |
531 __ bind(&do_store); | 526 __ bind(&do_store); |
532 __ sdc1(f4, FieldMemOperand(storage_reg, HeapNumber::kValueOffset)); | 527 __ sdc1(f4, FieldMemOperand(storage_reg, HeapNumber::kValueOffset)); |
533 } | 528 } |
534 | 529 |
535 // Stub never generated for non-global objects that require access | 530 // Stub never generated for non-global objects that require access |
536 // checks. | 531 // checks. |
537 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 532 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
538 | 533 |
539 // Perform map transition for the receiver if necessary. | 534 // Perform map transition for the receiver if necessary. |
540 if (details.type() == FIELD && | 535 if (object->map()->unused_property_fields() == 0) { |
541 object->map()->unused_property_fields() == 0) { | |
542 // The properties must be extended before we can store the value. | 536 // The properties must be extended before we can store the value. |
543 // We jump to a runtime call that extends the properties array. | 537 // We jump to a runtime call that extends the properties array. |
544 __ push(receiver_reg); | 538 __ push(receiver_reg); |
545 __ li(a2, Operand(transition)); | 539 __ li(a2, Operand(transition)); |
546 __ Push(a2, a0); | 540 __ Push(a2, a0); |
547 __ TailCallExternalReference( | 541 __ TailCallExternalReference( |
548 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), | 542 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), |
549 masm->isolate()), | 543 masm->isolate()), |
550 3, 1); | 544 3, 1); |
551 return; | 545 return; |
552 } | 546 } |
553 | 547 |
554 // Update the map of the object. | 548 // Update the map of the object. |
555 __ li(scratch1, Operand(transition)); | 549 __ li(scratch1, Operand(transition)); |
556 __ sw(scratch1, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); | 550 __ sw(scratch1, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); |
557 | 551 |
558 // Update the write barrier for the map field and pass the now unused | 552 // Update the write barrier for the map field and pass the now unused |
559 // name_reg as scratch register. | 553 // name_reg as scratch register. |
560 __ RecordWriteField(receiver_reg, | 554 __ RecordWriteField(receiver_reg, |
561 HeapObject::kMapOffset, | 555 HeapObject::kMapOffset, |
562 scratch1, | 556 scratch1, |
563 scratch2, | 557 scratch2, |
564 kRAHasNotBeenSaved, | 558 kRAHasNotBeenSaved, |
565 kDontSaveFPRegs, | 559 kDontSaveFPRegs, |
566 OMIT_REMEMBERED_SET, | 560 OMIT_REMEMBERED_SET, |
567 OMIT_SMI_CHECK); | 561 OMIT_SMI_CHECK); |
568 | 562 |
569 if (details.type() == CONSTANT_FUNCTION) return; | |
570 | |
571 int index = transition->instance_descriptors()->GetFieldIndex( | 563 int index = transition->instance_descriptors()->GetFieldIndex( |
572 transition->LastAdded()); | 564 transition->LastAdded()); |
573 | 565 |
574 // Adjust for the number of properties stored in the object. Even in the | 566 // Adjust for the number of properties stored in the object. Even in the |
575 // face of a transition we can use the old map here because the size of the | 567 // face of a transition we can use the old map here because the size of the |
576 // object and the number of in-object properties is not going to change. | 568 // object and the number of in-object properties is not going to change. |
577 index -= object->map()->inobject_properties(); | 569 index -= object->map()->inobject_properties(); |
578 | 570 |
579 // TODO(verwaest): Share this code as a code stub. | 571 // TODO(verwaest): Share this code as a code stub. |
580 SmiCheck smi_check = representation.IsTagged() | 572 SmiCheck smi_check = representation.IsTagged() |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a | 925 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a |
934 // struct from the function (which is currently the case). This means we pass | 926 // struct from the function (which is currently the case). This means we pass |
935 // the first argument in a1 instead of a0, if returns_handle is true. | 927 // the first argument in a1 instead of a0, if returns_handle is true. |
936 // CallApiFunctionAndReturn will set up a0. | 928 // CallApiFunctionAndReturn will set up a0. |
937 | 929 |
938 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 930 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
939 bool returns_handle = | 931 bool returns_handle = |
940 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); | 932 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); |
941 | 933 |
942 Register first_arg = returns_handle ? a1 : a0; | 934 Register first_arg = returns_handle ? a1 : a0; |
943 Register second_arg = returns_handle ? a2 : a1; | |
944 | 935 |
945 // first_arg = v8::Arguments& | 936 // first_arg = v8::Arguments& |
946 // Arguments is built at sp + 1 (sp is a reserved spot for ra). | 937 // Arguments is built at sp + 1 (sp is a reserved spot for ra). |
947 __ Addu(first_arg, sp, kPointerSize); | 938 __ Addu(first_arg, sp, kPointerSize); |
948 | 939 |
949 // v8::Arguments::implicit_args_ | 940 // v8::Arguments::implicit_args_ |
950 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize)); | 941 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize)); |
951 // v8::Arguments::values_ | 942 // v8::Arguments::values_ |
952 __ Addu(t0, a2, Operand(argc * kPointerSize)); | 943 __ Addu(t0, a2, Operand(argc * kPointerSize)); |
953 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize)); | 944 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize)); |
954 // v8::Arguments::length_ = argc | 945 // v8::Arguments::length_ = argc |
955 __ li(t0, Operand(argc)); | 946 __ li(t0, Operand(argc)); |
956 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize)); | 947 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize)); |
957 // v8::Arguments::is_construct_call = 0 | 948 // v8::Arguments::is_construct_call = 0 |
958 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize)); | 949 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize)); |
959 | 950 |
960 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; | 951 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; |
961 ApiFunction fun(function_address); | 952 ApiFunction fun(function_address); |
962 ExternalReference::Type type = | 953 ExternalReference::Type type = |
963 returns_handle ? | 954 returns_handle ? |
964 ExternalReference::DIRECT_API_CALL : | 955 ExternalReference::DIRECT_API_CALL : |
965 ExternalReference::DIRECT_API_CALL_NEW; | 956 ExternalReference::DIRECT_API_CALL_NEW; |
966 ExternalReference ref = | 957 ExternalReference ref = |
967 ExternalReference(&fun, | 958 ExternalReference(&fun, |
968 type, | 959 type, |
969 masm->isolate()); | 960 masm->isolate()); |
970 | |
971 Address thunk_address = returns_handle | |
972 ? FUNCTION_ADDR(&InvokeInvocationCallback) | |
973 : FUNCTION_ADDR(&InvokeFunctionCallback); | |
974 ExternalReference::Type thunk_type = | |
975 returns_handle ? | |
976 ExternalReference::PROFILING_API_CALL : | |
977 ExternalReference::PROFILING_API_CALL_NEW; | |
978 ApiFunction thunk_fun(thunk_address); | |
979 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | |
980 masm->isolate()); | |
981 | |
982 AllowExternalCallThatCantCauseGC scope(masm); | 961 AllowExternalCallThatCantCauseGC scope(masm); |
983 __ CallApiFunctionAndReturn(ref, | 962 __ CallApiFunctionAndReturn(ref, |
984 function_address, | |
985 thunk_ref, | |
986 second_arg, | |
987 kStackUnwindSpace, | 963 kStackUnwindSpace, |
988 returns_handle, | 964 returns_handle, |
989 kFastApiCallArguments + 1); | 965 kFastApiCallArguments + 1); |
990 } | 966 } |
991 | 967 |
992 class CallInterceptorCompiler BASE_EMBEDDED { | 968 class CallInterceptorCompiler BASE_EMBEDDED { |
993 public: | 969 public: |
994 CallInterceptorCompiler(StubCompiler* stub_compiler, | 970 CallInterceptorCompiler(StubCompiler* stub_compiler, |
995 const ParameterCount& arguments, | 971 const ParameterCount& arguments, |
996 Register name, | 972 Register name, |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 Operand(ExternalReference::isolate_address(isolate()))); | 1445 Operand(ExternalReference::isolate_address(isolate()))); |
1470 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); | 1446 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); |
1471 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); | 1447 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); |
1472 | 1448 |
1473 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1449 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1474 bool returns_handle = | 1450 bool returns_handle = |
1475 !CallbackTable::ReturnsVoid(isolate(), getter_address); | 1451 !CallbackTable::ReturnsVoid(isolate(), getter_address); |
1476 | 1452 |
1477 Register first_arg = returns_handle ? a1 : a0; | 1453 Register first_arg = returns_handle ? a1 : a0; |
1478 Register second_arg = returns_handle ? a2 : a1; | 1454 Register second_arg = returns_handle ? a2 : a1; |
1479 Register third_arg = returns_handle ? a3 : a2; | |
1480 | 1455 |
1481 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. | 1456 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. |
1482 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name> | 1457 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name> |
1483 | 1458 |
1484 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a | 1459 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a |
1485 // struct from the function (which is currently the case). This means we pass | 1460 // struct from the function (which is currently the case). This means we pass |
1486 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true. | 1461 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true. |
1487 // CallApiFunctionAndReturn will set up a0. | 1462 // CallApiFunctionAndReturn will set up a0. |
1488 | 1463 |
1489 const int kApiStackSpace = 1; | 1464 const int kApiStackSpace = 1; |
1490 FrameScope frame_scope(masm(), StackFrame::MANUAL); | 1465 FrameScope frame_scope(masm(), StackFrame::MANUAL); |
1491 __ EnterExitFrame(false, kApiStackSpace); | 1466 __ EnterExitFrame(false, kApiStackSpace); |
1492 | 1467 |
1493 // Create AccessorInfo instance on the stack above the exit frame with | 1468 // Create AccessorInfo instance on the stack above the exit frame with |
1494 // scratch2 (internal::Object** args_) as the data. | 1469 // scratch2 (internal::Object** args_) as the data. |
1495 __ sw(a2, MemOperand(sp, kPointerSize)); | 1470 __ sw(a2, MemOperand(sp, kPointerSize)); |
1496 // (second argument - see note above) = AccessorInfo& | 1471 // (second argument - see note above) = AccessorInfo& |
1497 __ Addu(second_arg, sp, kPointerSize); | 1472 __ Addu(second_arg, sp, kPointerSize); |
1498 | 1473 |
1499 const int kStackUnwindSpace = kFastApiCallArguments + 1; | 1474 const int kStackUnwindSpace = kFastApiCallArguments + 1; |
1500 | |
1501 ApiFunction fun(getter_address); | 1475 ApiFunction fun(getter_address); |
1502 ExternalReference::Type type = | 1476 ExternalReference::Type type = |
1503 returns_handle ? | 1477 returns_handle ? |
1504 ExternalReference::DIRECT_GETTER_CALL : | 1478 ExternalReference::DIRECT_GETTER_CALL : |
1505 ExternalReference::DIRECT_GETTER_CALL_NEW; | 1479 ExternalReference::DIRECT_GETTER_CALL_NEW; |
| 1480 |
1506 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 1481 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
1507 | |
1508 Address thunk_address = returns_handle | |
1509 ? FUNCTION_ADDR(&InvokeAccessorGetter) | |
1510 : FUNCTION_ADDR(&InvokeAccessorGetterCallback); | |
1511 ExternalReference::Type thunk_type = | |
1512 returns_handle ? | |
1513 ExternalReference::PROFILING_GETTER_CALL : | |
1514 ExternalReference::PROFILING_GETTER_CALL_NEW; | |
1515 ApiFunction thunk_fun(thunk_address); | |
1516 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | |
1517 isolate()); | |
1518 __ CallApiFunctionAndReturn(ref, | 1482 __ CallApiFunctionAndReturn(ref, |
1519 getter_address, | |
1520 thunk_ref, | |
1521 third_arg, | |
1522 kStackUnwindSpace, | 1483 kStackUnwindSpace, |
1523 returns_handle, | 1484 returns_handle, |
1524 5); | 1485 5); |
1525 } | 1486 } |
1526 | 1487 |
1527 | 1488 |
1528 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 1489 void BaseLoadStubCompiler::GenerateLoadInterceptor( |
1529 Register holder_reg, | 1490 Register holder_reg, |
1530 Handle<JSObject> object, | 1491 Handle<JSObject> object, |
1531 Handle<JSObject> interceptor_holder, | 1492 Handle<JSObject> interceptor_holder, |
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3773 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3734 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3774 } | 3735 } |
3775 } | 3736 } |
3776 | 3737 |
3777 | 3738 |
3778 #undef __ | 3739 #undef __ |
3779 | 3740 |
3780 } } // namespace v8::internal | 3741 } } // namespace v8::internal |
3781 | 3742 |
3782 #endif // V8_TARGET_ARCH_MIPS | 3743 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |