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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 823 |
824 // Stub never generated for non-global objects that require access | 824 // Stub never generated for non-global objects that require access |
825 // checks. | 825 // checks. |
826 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 826 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
827 | 827 |
828 // Perform map transition for the receiver if necessary. | 828 // Perform map transition for the receiver if necessary. |
829 if (details.type() == FIELD && | 829 if (details.type() == FIELD && |
830 object->map()->unused_property_fields() == 0) { | 830 object->map()->unused_property_fields() == 0) { |
831 // The properties must be extended before we can store the value. | 831 // The properties must be extended before we can store the value. |
832 // We jump to a runtime call that extends the properties array. | 832 // We jump to a runtime call that extends the properties array. |
833 __ PopReturnAddressTo(scratch1); | 833 __ pop(scratch1); // Return address. |
834 __ push(receiver_reg); | 834 __ push(receiver_reg); |
835 __ Push(transition); | 835 __ Push(transition); |
836 __ push(value_reg); | 836 __ push(value_reg); |
837 __ PushReturnAddressFrom(scratch1); | 837 __ push(scratch1); |
838 __ TailCallExternalReference( | 838 __ TailCallExternalReference( |
839 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), | 839 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), |
840 masm->isolate()), | 840 masm->isolate()), |
841 3, | 841 3, |
842 1); | 842 1); |
843 return; | 843 return; |
844 } | 844 } |
845 | 845 |
846 // Update the map of the object. | 846 // Update the map of the object. |
847 __ Move(scratch1, transition); | 847 __ Move(scratch1, transition); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1277 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1278 } | 1278 } |
1279 } | 1279 } |
1280 | 1280 |
1281 | 1281 |
1282 void BaseLoadStubCompiler::GenerateLoadCallback( | 1282 void BaseLoadStubCompiler::GenerateLoadCallback( |
1283 Register reg, | 1283 Register reg, |
1284 Handle<ExecutableAccessorInfo> callback) { | 1284 Handle<ExecutableAccessorInfo> callback) { |
1285 // Insert additional parameters into the stack frame above return address. | 1285 // Insert additional parameters into the stack frame above return address. |
1286 ASSERT(!scratch4().is(reg)); | 1286 ASSERT(!scratch4().is(reg)); |
1287 __ PopReturnAddressTo(scratch4()); | 1287 __ pop(scratch4()); // Get return address to place it below. |
1288 | 1288 |
1289 __ push(receiver()); // receiver | 1289 __ push(receiver()); // receiver |
1290 __ push(reg); // holder | 1290 __ push(reg); // holder |
1291 if (heap()->InNewSpace(callback->data())) { | 1291 if (heap()->InNewSpace(callback->data())) { |
1292 __ Move(scratch1(), callback); | 1292 __ Move(scratch1(), callback); |
1293 __ push(FieldOperand(scratch1(), | 1293 __ push(FieldOperand(scratch1(), |
1294 ExecutableAccessorInfo::kDataOffset)); // data | 1294 ExecutableAccessorInfo::kDataOffset)); // data |
1295 } else { | 1295 } else { |
1296 __ Push(Handle<Object>(callback->data(), isolate())); | 1296 __ Push(Handle<Object>(callback->data(), isolate())); |
1297 } | 1297 } |
(...skipping 19 matching lines...) Expand all Loading... |
1317 Register accessor_info_arg = returns_handle ? r8 : rdx; | 1317 Register accessor_info_arg = returns_handle ? r8 : rdx; |
1318 Register name_arg = returns_handle ? rdx : rcx; | 1318 Register name_arg = returns_handle ? rdx : rcx; |
1319 #else | 1319 #else |
1320 Register getter_arg = rdx; | 1320 Register getter_arg = rdx; |
1321 Register accessor_info_arg = rsi; | 1321 Register accessor_info_arg = rsi; |
1322 Register name_arg = rdi; | 1322 Register name_arg = rdi; |
1323 #endif | 1323 #endif |
1324 | 1324 |
1325 ASSERT(!name_arg.is(scratch4())); | 1325 ASSERT(!name_arg.is(scratch4())); |
1326 __ movq(name_arg, rsp); | 1326 __ movq(name_arg, rsp); |
1327 __ PushReturnAddressFrom(scratch4()); | 1327 __ push(scratch4()); // Restore return address. |
1328 | 1328 |
1329 // v8::Arguments::values_ and handler for name. | 1329 // v8::Arguments::values_ and handler for name. |
1330 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; | 1330 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; |
1331 | 1331 |
1332 // Allocate v8::AccessorInfo in non-GCed stack space. | 1332 // Allocate v8::AccessorInfo in non-GCed stack space. |
1333 const int kArgStackSpace = 1; | 1333 const int kArgStackSpace = 1; |
1334 | 1334 |
1335 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); | 1335 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); |
1336 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 1336 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
1337 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); | 1337 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 __ pop(receiver()); | 1437 __ pop(receiver()); |
1438 } | 1438 } |
1439 | 1439 |
1440 // Leave the internal frame. | 1440 // Leave the internal frame. |
1441 } | 1441 } |
1442 | 1442 |
1443 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); | 1443 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); |
1444 } else { // !compile_followup_inline | 1444 } else { // !compile_followup_inline |
1445 // Call the runtime system to load the interceptor. | 1445 // Call the runtime system to load the interceptor. |
1446 // Check that the maps haven't changed. | 1446 // Check that the maps haven't changed. |
1447 __ PopReturnAddressTo(scratch2()); | 1447 __ pop(scratch2()); // save old return address |
1448 PushInterceptorArguments(masm(), receiver(), holder_reg, | 1448 PushInterceptorArguments(masm(), receiver(), holder_reg, |
1449 this->name(), interceptor_holder); | 1449 this->name(), interceptor_holder); |
1450 __ PushReturnAddressFrom(scratch2()); | 1450 __ push(scratch2()); // restore old return address |
1451 | 1451 |
1452 ExternalReference ref = ExternalReference( | 1452 ExternalReference ref = ExternalReference( |
1453 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); | 1453 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); |
1454 __ TailCallExternalReference(ref, 6, 1); | 1454 __ TailCallExternalReference(ref, 6, 1); |
1455 } | 1455 } |
1456 } | 1456 } |
1457 | 1457 |
1458 | 1458 |
1459 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { | 1459 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { |
1460 if (kind_ == Code::KEYED_CALL_IC) { | 1460 if (kind_ == Code::KEYED_CALL_IC) { |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 | 2643 |
2644 Handle<Code> StoreStubCompiler::CompileStoreCallback( | 2644 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
2645 Handle<JSObject> object, | 2645 Handle<JSObject> object, |
2646 Handle<JSObject> holder, | 2646 Handle<JSObject> holder, |
2647 Handle<Name> name, | 2647 Handle<Name> name, |
2648 Handle<ExecutableAccessorInfo> callback) { | 2648 Handle<ExecutableAccessorInfo> callback) { |
2649 Label success; | 2649 Label success; |
2650 HandlerFrontend(object, receiver(), holder, name, &success); | 2650 HandlerFrontend(object, receiver(), holder, name, &success); |
2651 __ bind(&success); | 2651 __ bind(&success); |
2652 | 2652 |
2653 __ PopReturnAddressTo(scratch1()); | 2653 __ pop(scratch1()); // remove the return address |
2654 __ push(receiver()); | 2654 __ push(receiver()); |
2655 __ Push(callback); // callback info | 2655 __ Push(callback); // callback info |
2656 __ Push(name); | 2656 __ Push(name); |
2657 __ push(value()); | 2657 __ push(value()); |
2658 __ PushReturnAddressFrom(scratch1()); | 2658 __ push(scratch1()); // restore return address |
2659 | 2659 |
2660 // Do tail-call to the runtime system. | 2660 // Do tail-call to the runtime system. |
2661 ExternalReference store_callback_property = | 2661 ExternalReference store_callback_property = |
2662 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2662 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
2663 __ TailCallExternalReference(store_callback_property, 4, 1); | 2663 __ TailCallExternalReference(store_callback_property, 4, 1); |
2664 | 2664 |
2665 // Return the generated code. | 2665 // Return the generated code. |
2666 return GetCode(kind(), Code::CALLBACKS, name); | 2666 return GetCode(kind(), Code::CALLBACKS, name); |
2667 } | 2667 } |
2668 | 2668 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 } | 2710 } |
2711 | 2711 |
2712 | 2712 |
2713 #undef __ | 2713 #undef __ |
2714 #define __ ACCESS_MASM(masm()) | 2714 #define __ ACCESS_MASM(masm()) |
2715 | 2715 |
2716 | 2716 |
2717 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( | 2717 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( |
2718 Handle<JSObject> object, | 2718 Handle<JSObject> object, |
2719 Handle<Name> name) { | 2719 Handle<Name> name) { |
2720 __ PopReturnAddressTo(scratch1()); | 2720 __ pop(scratch1()); // remove the return address |
2721 __ push(receiver()); | 2721 __ push(receiver()); |
2722 __ push(this->name()); | 2722 __ push(this->name()); |
2723 __ push(value()); | 2723 __ push(value()); |
2724 __ Push(Smi::FromInt(strict_mode())); | 2724 __ Push(Smi::FromInt(strict_mode())); |
2725 __ PushReturnAddressFrom(scratch1()); | 2725 __ push(scratch1()); // restore return address |
2726 | 2726 |
2727 // Do tail-call to the runtime system. | 2727 // Do tail-call to the runtime system. |
2728 ExternalReference store_ic_property = | 2728 ExternalReference store_ic_property = |
2729 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 2729 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
2730 __ TailCallExternalReference(store_ic_property, 4, 1); | 2730 __ TailCallExternalReference(store_ic_property, 4, 1); |
2731 | 2731 |
2732 // Return the generated code. | 2732 // Return the generated code. |
2733 return GetCode(kind(), Code::INTERCEPTOR, name); | 2733 return GetCode(kind(), Code::INTERCEPTOR, name); |
2734 } | 2734 } |
2735 | 2735 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 // Get the value from the cell. | 2931 // Get the value from the cell. |
2932 __ Move(rbx, cell); | 2932 __ Move(rbx, cell); |
2933 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); | 2933 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); |
2934 | 2934 |
2935 // Check for deleted property if property can actually be deleted. | 2935 // Check for deleted property if property can actually be deleted. |
2936 if (!is_dont_delete) { | 2936 if (!is_dont_delete) { |
2937 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 2937 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
2938 __ j(equal, &miss); | 2938 __ j(equal, &miss); |
2939 } else if (FLAG_debug_code) { | 2939 } else if (FLAG_debug_code) { |
2940 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 2940 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
2941 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); | 2941 __ Check(not_equal, "DontDelete cells can't contain the hole"); |
2942 } | 2942 } |
2943 | 2943 |
2944 HandlerFrontendFooter(name, &success, &miss); | 2944 HandlerFrontendFooter(name, &success, &miss); |
2945 __ bind(&success); | 2945 __ bind(&success); |
2946 | 2946 |
2947 Counters* counters = isolate()->counters(); | 2947 Counters* counters = isolate()->counters(); |
2948 __ IncrementCounter(counters->named_load_global_stub(), 1); | 2948 __ IncrementCounter(counters->named_load_global_stub(), 1); |
2949 __ movq(rax, rbx); | 2949 __ movq(rax, rbx); |
2950 __ ret(0); | 2950 __ ret(0); |
2951 | 2951 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3514 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3514 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3515 } | 3515 } |
3516 } | 3516 } |
3517 | 3517 |
3518 | 3518 |
3519 #undef __ | 3519 #undef __ |
3520 | 3520 |
3521 } } // namespace v8::internal | 3521 } } // namespace v8::internal |
3522 | 3522 |
3523 #endif // V8_TARGET_ARCH_X64 | 3523 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |