| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 static void ProbeTable(Isolate* isolate, | 43 static void ProbeTable(Isolate* isolate, |
| 44 MacroAssembler* masm, | 44 MacroAssembler* masm, |
| 45 Code::Flags flags, | 45 Code::Flags flags, |
| 46 StubCache::Table table, | 46 StubCache::Table table, |
| 47 Register receiver, | 47 Register receiver, |
| 48 Register name, | 48 Register name, |
| 49 // The offset is scaled by 4, based on | 49 // The offset is scaled by 4, based on |
| 50 // kHeapObjectTagSize, which is two bits | 50 // kHeapObjectTagSize, which is two bits |
| 51 Register offset) { | 51 Register offset) { |
| 52 // We need to scale up the pointer by 2 because the offset is scaled by less | 52 // We need to scale up the pointer by 2 when the offset is scaled by less |
| 53 // than the pointer size. | 53 // than the pointer size. |
| 54 ASSERT(kPointerSizeLog2 == kHeapObjectTagSize + 1); | 54 ASSERT(kPointerSize == kInt64Size |
| 55 ScaleFactor scale_factor = times_2; | 55 ? kPointerSizeLog2 == kHeapObjectTagSize + 1 |
| 56 : kPointerSizeLog2 == kHeapObjectTagSize); |
| 57 ScaleFactor scale_factor = kPointerSize == kInt64Size ? times_2 : times_1; |
| 56 | 58 |
| 57 ASSERT_EQ(3 * kPointerSize, sizeof(StubCache::Entry)); | 59 ASSERT_EQ(3 * kPointerSize, sizeof(StubCache::Entry)); |
| 58 // The offset register holds the entry offset times four (due to masking | 60 // The offset register holds the entry offset times four (due to masking |
| 59 // and shifting optimizations). | 61 // and shifting optimizations). |
| 60 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); | 62 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); |
| 61 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); | 63 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); |
| 62 Label miss; | 64 Label miss; |
| 63 | 65 |
| 64 // Multiply by 3 because there are 3 fields per entry (name, code, map). | 66 // Multiply by 3 because there are 3 fields per entry (name, code, map). |
| 65 __ lea(offset, Operand(offset, offset, times_2, 0)); | 67 __ lea(offset, Operand(offset, offset, times_2, 0)); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 static void PushInterceptorArguments(MacroAssembler* masm, | 315 static void PushInterceptorArguments(MacroAssembler* masm, |
| 314 Register receiver, | 316 Register receiver, |
| 315 Register holder, | 317 Register holder, |
| 316 Register name, | 318 Register name, |
| 317 Handle<JSObject> holder_obj) { | 319 Handle<JSObject> holder_obj) { |
| 318 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0); | 320 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0); |
| 319 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1); | 321 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1); |
| 320 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2); | 322 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2); |
| 321 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3); | 323 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3); |
| 322 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4); | 324 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4); |
| 323 __ push(name); | 325 __ Push(name); |
| 324 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); | 326 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); |
| 325 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); | 327 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); |
| 326 __ Move(kScratchRegister, interceptor); | 328 __ Move(kScratchRegister, interceptor); |
| 327 __ push(kScratchRegister); | 329 __ Push(kScratchRegister); |
| 328 __ push(receiver); | 330 __ Push(receiver); |
| 329 __ push(holder); | 331 __ Push(holder); |
| 330 } | 332 } |
| 331 | 333 |
| 332 | 334 |
| 333 static void CompileCallLoadPropertyWithInterceptor( | 335 static void CompileCallLoadPropertyWithInterceptor( |
| 334 MacroAssembler* masm, | 336 MacroAssembler* masm, |
| 335 Register receiver, | 337 Register receiver, |
| 336 Register holder, | 338 Register holder, |
| 337 Register name, | 339 Register name, |
| 338 Handle<JSObject> holder_obj, | 340 Handle<JSObject> holder_obj, |
| 339 IC::UtilityId id) { | 341 IC::UtilityId id) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 350 Handle<Map> receiver_map, | 352 Handle<Map> receiver_map, |
| 351 Register receiver, | 353 Register receiver, |
| 352 Register scratch_in, | 354 Register scratch_in, |
| 353 bool is_store, | 355 bool is_store, |
| 354 int argc, | 356 int argc, |
| 355 Register* values) { | 357 Register* values) { |
| 356 ASSERT(optimization.is_simple_api_call()); | 358 ASSERT(optimization.is_simple_api_call()); |
| 357 | 359 |
| 358 __ PopReturnAddressTo(scratch_in); | 360 __ PopReturnAddressTo(scratch_in); |
| 359 // receiver | 361 // receiver |
| 360 __ push(receiver); | 362 __ Push(receiver); |
| 361 // Write the arguments to stack frame. | 363 // Write the arguments to stack frame. |
| 362 for (int i = 0; i < argc; i++) { | 364 for (int i = 0; i < argc; i++) { |
| 363 Register arg = values[argc-1-i]; | 365 Register arg = values[argc-1-i]; |
| 364 ASSERT(!receiver.is(arg)); | 366 ASSERT(!receiver.is(arg)); |
| 365 ASSERT(!scratch_in.is(arg)); | 367 ASSERT(!scratch_in.is(arg)); |
| 366 __ push(arg); | 368 __ Push(arg); |
| 367 } | 369 } |
| 368 __ PushReturnAddressFrom(scratch_in); | 370 __ PushReturnAddressFrom(scratch_in); |
| 369 // Stack now matches JSFunction abi. | 371 // Stack now matches JSFunction abi. |
| 370 | 372 |
| 371 // Abi for CallApiFunctionStub. | 373 // Abi for CallApiFunctionStub. |
| 372 Register callee = rax; | 374 Register callee = rax; |
| 373 Register call_data = rbx; | 375 Register call_data = rbx; |
| 374 Register holder = rcx; | 376 Register holder = rcx; |
| 375 Register api_function_address = rdx; | 377 Register api_function_address = rdx; |
| 376 Register scratch = rdi; // scratch_in is no longer valid. | 378 Register scratch = rdi; // scratch_in is no longer valid. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // Stub never generated for non-global objects that require access | 516 // Stub never generated for non-global objects that require access |
| 515 // checks. | 517 // checks. |
| 516 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 518 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 517 | 519 |
| 518 // Perform map transition for the receiver if necessary. | 520 // Perform map transition for the receiver if necessary. |
| 519 if (details.type() == FIELD && | 521 if (details.type() == FIELD && |
| 520 object->map()->unused_property_fields() == 0) { | 522 object->map()->unused_property_fields() == 0) { |
| 521 // The properties must be extended before we can store the value. | 523 // The properties must be extended before we can store the value. |
| 522 // We jump to a runtime call that extends the properties array. | 524 // We jump to a runtime call that extends the properties array. |
| 523 __ PopReturnAddressTo(scratch1); | 525 __ PopReturnAddressTo(scratch1); |
| 524 __ push(receiver_reg); | 526 __ Push(receiver_reg); |
| 525 __ Push(transition); | 527 __ Push(transition); |
| 526 __ push(value_reg); | 528 __ Push(value_reg); |
| 527 __ PushReturnAddressFrom(scratch1); | 529 __ PushReturnAddressFrom(scratch1); |
| 528 __ TailCallExternalReference( | 530 __ TailCallExternalReference( |
| 529 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), | 531 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), |
| 530 masm->isolate()), | 532 masm->isolate()), |
| 531 3, | 533 3, |
| 532 1); | 534 1); |
| 533 return; | 535 return; |
| 534 } | 536 } |
| 535 | 537 |
| 536 // Update the map of the object. | 538 // Update the map of the object. |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 ASSERT(!scratch4().is(reg)); | 928 ASSERT(!scratch4().is(reg)); |
| 927 __ PopReturnAddressTo(scratch4()); | 929 __ PopReturnAddressTo(scratch4()); |
| 928 | 930 |
| 929 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 931 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
| 930 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 932 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
| 931 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 933 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
| 932 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 934 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
| 933 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 935 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
| 934 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 936 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
| 935 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 937 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
| 936 __ push(receiver()); // receiver | 938 __ Push(receiver()); // receiver |
| 937 if (heap()->InNewSpace(callback->data())) { | 939 if (heap()->InNewSpace(callback->data())) { |
| 938 ASSERT(!scratch2().is(reg)); | 940 ASSERT(!scratch2().is(reg)); |
| 939 __ Move(scratch2(), callback); | 941 __ Move(scratch2(), callback); |
| 940 __ push(FieldOperand(scratch2(), | 942 __ Push(FieldOperand(scratch2(), |
| 941 ExecutableAccessorInfo::kDataOffset)); // data | 943 ExecutableAccessorInfo::kDataOffset)); // data |
| 942 } else { | 944 } else { |
| 943 __ Push(Handle<Object>(callback->data(), isolate())); | 945 __ Push(Handle<Object>(callback->data(), isolate())); |
| 944 } | 946 } |
| 945 ASSERT(!kScratchRegister.is(reg)); | 947 ASSERT(!kScratchRegister.is(reg)); |
| 946 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 948 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 947 __ push(kScratchRegister); // return value | 949 __ Push(kScratchRegister); // return value |
| 948 __ push(kScratchRegister); // return value default | 950 __ Push(kScratchRegister); // return value default |
| 949 __ PushAddress(ExternalReference::isolate_address(isolate())); | 951 __ PushAddress(ExternalReference::isolate_address(isolate())); |
| 950 __ push(reg); // holder | 952 __ Push(reg); // holder |
| 951 __ push(name()); // name | 953 __ Push(name()); // name |
| 952 // Save a pointer to where we pushed the arguments pointer. This will be | 954 // Save a pointer to where we pushed the arguments pointer. This will be |
| 953 // passed as the const PropertyAccessorInfo& to the C++ callback. | 955 // passed as the const PropertyAccessorInfo& to the C++ callback. |
| 954 | 956 |
| 955 __ PushReturnAddressFrom(scratch4()); | 957 __ PushReturnAddressFrom(scratch4()); |
| 956 | 958 |
| 957 // Abi for CallApiGetter | 959 // Abi for CallApiGetter |
| 958 Register api_function_address = r8; | 960 Register api_function_address = r8; |
| 959 Address getter_address = v8::ToCData<Address>(callback->getter()); | 961 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 960 __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); | 962 __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); |
| 961 | 963 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder(); | 1011 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder(); |
| 1010 bool must_preserve_receiver_reg = !receiver().is(holder_reg) && | 1012 bool must_preserve_receiver_reg = !receiver().is(holder_reg) && |
| 1011 (lookup->type() == CALLBACKS || must_perfrom_prototype_check); | 1013 (lookup->type() == CALLBACKS || must_perfrom_prototype_check); |
| 1012 | 1014 |
| 1013 // Save necessary data before invoking an interceptor. | 1015 // Save necessary data before invoking an interceptor. |
| 1014 // Requires a frame to make GC aware of pushed pointers. | 1016 // Requires a frame to make GC aware of pushed pointers. |
| 1015 { | 1017 { |
| 1016 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 1018 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 1017 | 1019 |
| 1018 if (must_preserve_receiver_reg) { | 1020 if (must_preserve_receiver_reg) { |
| 1019 __ push(receiver()); | 1021 __ Push(receiver()); |
| 1020 } | 1022 } |
| 1021 __ push(holder_reg); | 1023 __ Push(holder_reg); |
| 1022 __ push(this->name()); | 1024 __ Push(this->name()); |
| 1023 | 1025 |
| 1024 // Invoke an interceptor. Note: map checks from receiver to | 1026 // Invoke an interceptor. Note: map checks from receiver to |
| 1025 // interceptor's holder has been compiled before (see a caller | 1027 // interceptor's holder has been compiled before (see a caller |
| 1026 // of this method.) | 1028 // of this method.) |
| 1027 CompileCallLoadPropertyWithInterceptor( | 1029 CompileCallLoadPropertyWithInterceptor( |
| 1028 masm(), receiver(), holder_reg, this->name(), interceptor_holder, | 1030 masm(), receiver(), holder_reg, this->name(), interceptor_holder, |
| 1029 IC::kLoadPropertyWithInterceptorOnly); | 1031 IC::kLoadPropertyWithInterceptorOnly); |
| 1030 | 1032 |
| 1031 // Check if interceptor provided a value for property. If it's | 1033 // Check if interceptor provided a value for property. If it's |
| 1032 // the case, return immediately. | 1034 // the case, return immediately. |
| 1033 Label interceptor_failed; | 1035 Label interceptor_failed; |
| 1034 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | 1036 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1035 __ j(equal, &interceptor_failed); | 1037 __ j(equal, &interceptor_failed); |
| 1036 frame_scope.GenerateLeaveFrame(); | 1038 frame_scope.GenerateLeaveFrame(); |
| 1037 __ ret(0); | 1039 __ ret(0); |
| 1038 | 1040 |
| 1039 __ bind(&interceptor_failed); | 1041 __ bind(&interceptor_failed); |
| 1040 __ pop(this->name()); | 1042 __ Pop(this->name()); |
| 1041 __ pop(holder_reg); | 1043 __ Pop(holder_reg); |
| 1042 if (must_preserve_receiver_reg) { | 1044 if (must_preserve_receiver_reg) { |
| 1043 __ pop(receiver()); | 1045 __ Pop(receiver()); |
| 1044 } | 1046 } |
| 1045 | 1047 |
| 1046 // Leave the internal frame. | 1048 // Leave the internal frame. |
| 1047 } | 1049 } |
| 1048 | 1050 |
| 1049 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); | 1051 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); |
| 1050 } else { // !compile_followup_inline | 1052 } else { // !compile_followup_inline |
| 1051 // Call the runtime system to load the interceptor. | 1053 // Call the runtime system to load the interceptor. |
| 1052 // Check that the maps haven't changed. | 1054 // Check that the maps haven't changed. |
| 1053 __ PopReturnAddressTo(scratch2()); | 1055 __ PopReturnAddressTo(scratch2()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1075 | 1077 |
| 1076 Handle<Code> StoreStubCompiler::CompileStoreCallback( | 1078 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 1077 Handle<JSObject> object, | 1079 Handle<JSObject> object, |
| 1078 Handle<JSObject> holder, | 1080 Handle<JSObject> holder, |
| 1079 Handle<Name> name, | 1081 Handle<Name> name, |
| 1080 Handle<ExecutableAccessorInfo> callback) { | 1082 Handle<ExecutableAccessorInfo> callback) { |
| 1081 Register holder_reg = HandlerFrontend( | 1083 Register holder_reg = HandlerFrontend( |
| 1082 IC::CurrentTypeOf(object, isolate()), receiver(), holder, name); | 1084 IC::CurrentTypeOf(object, isolate()), receiver(), holder, name); |
| 1083 | 1085 |
| 1084 __ PopReturnAddressTo(scratch1()); | 1086 __ PopReturnAddressTo(scratch1()); |
| 1085 __ push(receiver()); | 1087 __ Push(receiver()); |
| 1086 __ push(holder_reg); | 1088 __ Push(holder_reg); |
| 1087 __ Push(callback); // callback info | 1089 __ Push(callback); // callback info |
| 1088 __ Push(name); | 1090 __ Push(name); |
| 1089 __ push(value()); | 1091 __ Push(value()); |
| 1090 __ PushReturnAddressFrom(scratch1()); | 1092 __ PushReturnAddressFrom(scratch1()); |
| 1091 | 1093 |
| 1092 // Do tail-call to the runtime system. | 1094 // Do tail-call to the runtime system. |
| 1093 ExternalReference store_callback_property = | 1095 ExternalReference store_callback_property = |
| 1094 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 1096 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 1095 __ TailCallExternalReference(store_callback_property, 5, 1); | 1097 __ TailCallExternalReference(store_callback_property, 5, 1); |
| 1096 | 1098 |
| 1097 // Return the generated code. | 1099 // Return the generated code. |
| 1098 return GetCode(kind(), Code::FAST, name); | 1100 return GetCode(kind(), Code::FAST, name); |
| 1099 } | 1101 } |
| 1100 | 1102 |
| 1101 | 1103 |
| 1102 #undef __ | 1104 #undef __ |
| 1103 #define __ ACCESS_MASM(masm) | 1105 #define __ ACCESS_MASM(masm) |
| 1104 | 1106 |
| 1105 | 1107 |
| 1106 void StoreStubCompiler::GenerateStoreViaSetter( | 1108 void StoreStubCompiler::GenerateStoreViaSetter( |
| 1107 MacroAssembler* masm, | 1109 MacroAssembler* masm, |
| 1108 Handle<HeapType> type, | 1110 Handle<HeapType> type, |
| 1109 Register receiver, | 1111 Register receiver, |
| 1110 Handle<JSFunction> setter) { | 1112 Handle<JSFunction> setter) { |
| 1111 // ----------- S t a t e ------------- | 1113 // ----------- S t a t e ------------- |
| 1112 // -- rsp[0] : return address | 1114 // -- rsp[0] : return address |
| 1113 // ----------------------------------- | 1115 // ----------------------------------- |
| 1114 { | 1116 { |
| 1115 FrameScope scope(masm, StackFrame::INTERNAL); | 1117 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1116 | 1118 |
| 1117 // Save value register, so we can restore it later. | 1119 // Save value register, so we can restore it later. |
| 1118 __ push(value()); | 1120 __ Push(value()); |
| 1119 | 1121 |
| 1120 if (!setter.is_null()) { | 1122 if (!setter.is_null()) { |
| 1121 // Call the JavaScript setter with receiver and value on the stack. | 1123 // Call the JavaScript setter with receiver and value on the stack. |
| 1122 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 1124 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1123 // Swap in the global receiver. | 1125 // Swap in the global receiver. |
| 1124 __ movp(receiver, | 1126 __ movp(receiver, |
| 1125 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 1127 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1126 } | 1128 } |
| 1127 __ push(receiver); | 1129 __ Push(receiver); |
| 1128 __ push(value()); | 1130 __ Push(value()); |
| 1129 ParameterCount actual(1); | 1131 ParameterCount actual(1); |
| 1130 ParameterCount expected(setter); | 1132 ParameterCount expected(setter); |
| 1131 __ InvokeFunction(setter, expected, actual, | 1133 __ InvokeFunction(setter, expected, actual, |
| 1132 CALL_FUNCTION, NullCallWrapper()); | 1134 CALL_FUNCTION, NullCallWrapper()); |
| 1133 } else { | 1135 } else { |
| 1134 // If we generate a global code snippet for deoptimization only, remember | 1136 // If we generate a global code snippet for deoptimization only, remember |
| 1135 // the place to continue after deoptimization. | 1137 // the place to continue after deoptimization. |
| 1136 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 1138 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 1137 } | 1139 } |
| 1138 | 1140 |
| 1139 // We have to return the passed value, not the return value of the setter. | 1141 // We have to return the passed value, not the return value of the setter. |
| 1140 __ pop(rax); | 1142 __ Pop(rax); |
| 1141 | 1143 |
| 1142 // Restore context register. | 1144 // Restore context register. |
| 1143 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 1145 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1144 } | 1146 } |
| 1145 __ ret(0); | 1147 __ ret(0); |
| 1146 } | 1148 } |
| 1147 | 1149 |
| 1148 | 1150 |
| 1149 #undef __ | 1151 #undef __ |
| 1150 #define __ ACCESS_MASM(masm()) | 1152 #define __ ACCESS_MASM(masm()) |
| 1151 | 1153 |
| 1152 | 1154 |
| 1153 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( | 1155 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( |
| 1154 Handle<JSObject> object, | 1156 Handle<JSObject> object, |
| 1155 Handle<Name> name) { | 1157 Handle<Name> name) { |
| 1156 __ PopReturnAddressTo(scratch1()); | 1158 __ PopReturnAddressTo(scratch1()); |
| 1157 __ push(receiver()); | 1159 __ Push(receiver()); |
| 1158 __ push(this->name()); | 1160 __ Push(this->name()); |
| 1159 __ push(value()); | 1161 __ Push(value()); |
| 1160 __ PushReturnAddressFrom(scratch1()); | 1162 __ PushReturnAddressFrom(scratch1()); |
| 1161 | 1163 |
| 1162 // Do tail-call to the runtime system. | 1164 // Do tail-call to the runtime system. |
| 1163 ExternalReference store_ic_property = | 1165 ExternalReference store_ic_property = |
| 1164 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 1166 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
| 1165 __ TailCallExternalReference(store_ic_property, 3, 1); | 1167 __ TailCallExternalReference(store_ic_property, 3, 1); |
| 1166 | 1168 |
| 1167 // Return the generated code. | 1169 // Return the generated code. |
| 1168 return GetCode(kind(), Code::FAST, name); | 1170 return GetCode(kind(), Code::FAST, name); |
| 1169 } | 1171 } |
| 1170 | 1172 |
| 1171 | 1173 |
| 1172 void StoreStubCompiler::GenerateStoreArrayLength() { | 1174 void StoreStubCompiler::GenerateStoreArrayLength() { |
| 1173 // Prepare tail call to StoreIC_ArrayLength. | 1175 // Prepare tail call to StoreIC_ArrayLength. |
| 1174 __ PopReturnAddressTo(scratch1()); | 1176 __ PopReturnAddressTo(scratch1()); |
| 1175 __ push(receiver()); | 1177 __ Push(receiver()); |
| 1176 __ push(value()); | 1178 __ Push(value()); |
| 1177 __ PushReturnAddressFrom(scratch1()); | 1179 __ PushReturnAddressFrom(scratch1()); |
| 1178 | 1180 |
| 1179 ExternalReference ref = | 1181 ExternalReference ref = |
| 1180 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), | 1182 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), |
| 1181 masm()->isolate()); | 1183 masm()->isolate()); |
| 1182 __ TailCallExternalReference(ref, 2, 1); | 1184 __ TailCallExternalReference(ref, 2, 1); |
| 1183 } | 1185 } |
| 1184 | 1186 |
| 1185 | 1187 |
| 1186 Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic( | 1188 Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 { | 1284 { |
| 1283 FrameScope scope(masm, StackFrame::INTERNAL); | 1285 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1284 | 1286 |
| 1285 if (!getter.is_null()) { | 1287 if (!getter.is_null()) { |
| 1286 // Call the JavaScript getter with the receiver on the stack. | 1288 // Call the JavaScript getter with the receiver on the stack. |
| 1287 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 1289 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1288 // Swap in the global receiver. | 1290 // Swap in the global receiver. |
| 1289 __ movp(receiver, | 1291 __ movp(receiver, |
| 1290 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 1292 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1291 } | 1293 } |
| 1292 __ push(receiver); | 1294 __ Push(receiver); |
| 1293 ParameterCount actual(0); | 1295 ParameterCount actual(0); |
| 1294 ParameterCount expected(getter); | 1296 ParameterCount expected(getter); |
| 1295 __ InvokeFunction(getter, expected, actual, | 1297 __ InvokeFunction(getter, expected, actual, |
| 1296 CALL_FUNCTION, NullCallWrapper()); | 1298 CALL_FUNCTION, NullCallWrapper()); |
| 1297 } else { | 1299 } else { |
| 1298 // If we generate a global code snippet for deoptimization only, remember | 1300 // If we generate a global code snippet for deoptimization only, remember |
| 1299 // the place to continue after deoptimization. | 1301 // the place to continue after deoptimization. |
| 1300 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 1302 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 1301 } | 1303 } |
| 1302 | 1304 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 // ----------------------------------- | 1442 // ----------------------------------- |
| 1441 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1443 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1442 } | 1444 } |
| 1443 | 1445 |
| 1444 | 1446 |
| 1445 #undef __ | 1447 #undef __ |
| 1446 | 1448 |
| 1447 } } // namespace v8::internal | 1449 } } // namespace v8::internal |
| 1448 | 1450 |
| 1449 #endif // V8_TARGET_ARCH_X64 | 1451 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |