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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 } | 1147 } |
1148 | 1148 |
1149 | 1149 |
1150 #undef __ | 1150 #undef __ |
1151 #define __ ACCESS_MASM(masm) | 1151 #define __ ACCESS_MASM(masm) |
1152 | 1152 |
1153 | 1153 |
1154 void StoreStubCompiler::GenerateStoreViaSetter( | 1154 void StoreStubCompiler::GenerateStoreViaSetter( |
1155 MacroAssembler* masm, | 1155 MacroAssembler* masm, |
1156 Handle<HeapType> type, | 1156 Handle<HeapType> type, |
| 1157 Register receiver, |
1157 Handle<JSFunction> setter) { | 1158 Handle<JSFunction> setter) { |
1158 // ----------- S t a t e ------------- | 1159 // ----------- S t a t e ------------- |
1159 // -- rax : value | |
1160 // -- rcx : name | |
1161 // -- rdx : receiver | |
1162 // -- rsp[0] : return address | 1160 // -- rsp[0] : return address |
1163 // ----------------------------------- | 1161 // ----------------------------------- |
1164 { | 1162 { |
1165 FrameScope scope(masm, StackFrame::INTERNAL); | 1163 FrameScope scope(masm, StackFrame::INTERNAL); |
1166 Register receiver = rdx; | |
1167 Register value = rax; | |
1168 | 1164 |
1169 // Save value register, so we can restore it later. | 1165 // Save value register, so we can restore it later. |
1170 __ push(value); | 1166 __ push(value()); |
1171 | 1167 |
1172 if (!setter.is_null()) { | 1168 if (!setter.is_null()) { |
1173 // Call the JavaScript setter with receiver and value on the stack. | 1169 // Call the JavaScript setter with receiver and value on the stack. |
1174 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 1170 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
1175 // Swap in the global receiver. | 1171 // Swap in the global receiver. |
1176 __ movp(receiver, | 1172 __ movp(receiver, |
1177 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 1173 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
1178 } | 1174 } |
1179 __ push(receiver); | 1175 __ push(receiver); |
1180 __ push(value); | 1176 __ push(value()); |
1181 ParameterCount actual(1); | 1177 ParameterCount actual(1); |
1182 ParameterCount expected(setter); | 1178 ParameterCount expected(setter); |
1183 __ InvokeFunction(setter, expected, actual, | 1179 __ InvokeFunction(setter, expected, actual, |
1184 CALL_FUNCTION, NullCallWrapper()); | 1180 CALL_FUNCTION, NullCallWrapper()); |
1185 } else { | 1181 } else { |
1186 // If we generate a global code snippet for deoptimization only, remember | 1182 // If we generate a global code snippet for deoptimization only, remember |
1187 // the place to continue after deoptimization. | 1183 // the place to continue after deoptimization. |
1188 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 1184 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
1189 } | 1185 } |
1190 | 1186 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 } | 1274 } |
1279 | 1275 |
1280 | 1276 |
1281 Register* KeyedLoadStubCompiler::registers() { | 1277 Register* KeyedLoadStubCompiler::registers() { |
1282 // receiver, name, scratch1, scratch2, scratch3, scratch4. | 1278 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
1283 static Register registers[] = { rdx, rax, rbx, rcx, rdi, r8 }; | 1279 static Register registers[] = { rdx, rax, rbx, rcx, rdi, r8 }; |
1284 return registers; | 1280 return registers; |
1285 } | 1281 } |
1286 | 1282 |
1287 | 1283 |
| 1284 Register StoreStubCompiler::value() { |
| 1285 return rax; |
| 1286 } |
| 1287 |
| 1288 |
1288 Register* StoreStubCompiler::registers() { | 1289 Register* StoreStubCompiler::registers() { |
1289 // receiver, name, value, scratch1, scratch2, scratch3. | 1290 // receiver, name, scratch1, scratch2, scratch3. |
1290 static Register registers[] = { rdx, rcx, rax, rbx, rdi, r8 }; | 1291 static Register registers[] = { rdx, rcx, rbx, rdi, r8 }; |
1291 return registers; | 1292 return registers; |
1292 } | 1293 } |
1293 | 1294 |
1294 | 1295 |
1295 Register* KeyedStoreStubCompiler::registers() { | 1296 Register* KeyedStoreStubCompiler::registers() { |
1296 // receiver, name, value, scratch1, scratch2, scratch3. | 1297 // receiver, name, scratch1, scratch2, scratch3. |
1297 static Register registers[] = { rdx, rcx, rax, rbx, rdi, r8 }; | 1298 static Register registers[] = { rdx, rcx, rbx, rdi, r8 }; |
1298 return registers; | 1299 return registers; |
1299 } | 1300 } |
1300 | 1301 |
1301 | 1302 |
1302 #undef __ | 1303 #undef __ |
1303 #define __ ACCESS_MASM(masm) | 1304 #define __ ACCESS_MASM(masm) |
1304 | 1305 |
1305 | 1306 |
1306 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 1307 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
1307 Handle<HeapType> type, | 1308 Handle<HeapType> type, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 // ----------------------------------- | 1474 // ----------------------------------- |
1474 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1475 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1475 } | 1476 } |
1476 | 1477 |
1477 | 1478 |
1478 #undef __ | 1479 #undef __ |
1479 | 1480 |
1480 } } // namespace v8::internal | 1481 } } // namespace v8::internal |
1481 | 1482 |
1482 #endif // V8_TARGET_ARCH_X64 | 1483 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |