| 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 // Check the prototype chain. | 1036 // Check the prototype chain. |
| 1037 Register reg = CheckPrototypes( | 1037 Register reg = CheckPrototypes( |
| 1038 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); | 1038 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
| 1039 | 1039 |
| 1040 // Get the value from the properties. | 1040 // Get the value from the properties. |
| 1041 GenerateFastPropertyLoad(masm(), rax, reg, holder, index); | 1041 GenerateFastPropertyLoad(masm(), rax, reg, holder, index); |
| 1042 __ ret(0); | 1042 __ ret(0); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 | 1045 |
| 1046 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, | 1046 void StubCompiler::GenerateDictionaryLoadCallback( |
| 1047 Register name_reg, | 1047 Register receiver, |
| 1048 Register scratch1, | 1048 Register name_reg, |
| 1049 Register scratch2, | 1049 Register scratch1, |
| 1050 Register scratch3, | 1050 Register scratch2, |
| 1051 Handle<AccessorInfo> callback, | 1051 Register scratch3, |
| 1052 Handle<String> name, | 1052 Handle<ExecutableAccessorInfo> callback, |
| 1053 Label* miss) { | 1053 Handle<String> name, |
| 1054 Label* miss) { |
| 1054 ASSERT(!receiver.is(scratch1)); | 1055 ASSERT(!receiver.is(scratch1)); |
| 1055 ASSERT(!receiver.is(scratch2)); | 1056 ASSERT(!receiver.is(scratch2)); |
| 1056 ASSERT(!receiver.is(scratch3)); | 1057 ASSERT(!receiver.is(scratch3)); |
| 1057 | 1058 |
| 1058 // Load the properties dictionary. | 1059 // Load the properties dictionary. |
| 1059 Register dictionary = scratch1; | 1060 Register dictionary = scratch1; |
| 1060 __ movq(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 1061 __ movq(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 1061 | 1062 |
| 1062 // Probe the dictionary. | 1063 // Probe the dictionary. |
| 1063 Label probe_done; | 1064 Label probe_done; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1087 | 1088 |
| 1088 | 1089 |
| 1089 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, | 1090 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, |
| 1090 Handle<JSObject> holder, | 1091 Handle<JSObject> holder, |
| 1091 Register receiver, | 1092 Register receiver, |
| 1092 Register name_reg, | 1093 Register name_reg, |
| 1093 Register scratch1, | 1094 Register scratch1, |
| 1094 Register scratch2, | 1095 Register scratch2, |
| 1095 Register scratch3, | 1096 Register scratch3, |
| 1096 Register scratch4, | 1097 Register scratch4, |
| 1097 Handle<AccessorInfo> callback, | 1098 Handle<ExecutableAccessorInfo> callback, |
| 1098 Handle<String> name, | 1099 Handle<String> name, |
| 1099 Label* miss) { | 1100 Label* miss) { |
| 1100 // Check that the receiver isn't a smi. | 1101 // Check that the receiver isn't a smi. |
| 1101 __ JumpIfSmi(receiver, miss); | 1102 __ JumpIfSmi(receiver, miss); |
| 1102 | 1103 |
| 1103 // Check that the maps haven't changed. | 1104 // Check that the maps haven't changed. |
| 1104 Register reg = CheckPrototypes(object, receiver, holder, scratch1, | 1105 Register reg = CheckPrototypes(object, receiver, holder, scratch1, |
| 1105 scratch2, scratch3, name, miss); | 1106 scratch2, scratch3, name, miss); |
| 1106 | 1107 |
| 1107 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1108 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1108 GenerateDictionaryLoadCallback( | 1109 GenerateDictionaryLoadCallback( |
| 1109 reg, name_reg, scratch2, scratch3, scratch4, callback, name, miss); | 1110 reg, name_reg, scratch2, scratch3, scratch4, callback, name, miss); |
| 1110 } | 1111 } |
| 1111 | 1112 |
| 1112 // Insert additional parameters into the stack frame above return address. | 1113 // Insert additional parameters into the stack frame above return address. |
| 1113 ASSERT(!scratch2.is(reg)); | 1114 ASSERT(!scratch2.is(reg)); |
| 1114 __ pop(scratch2); // Get return address to place it below. | 1115 __ pop(scratch2); // Get return address to place it below. |
| 1115 | 1116 |
| 1116 __ push(receiver); // receiver | 1117 __ push(receiver); // receiver |
| 1117 __ push(reg); // holder | 1118 __ push(reg); // holder |
| 1118 if (heap()->InNewSpace(callback->data())) { | 1119 if (heap()->InNewSpace(callback->data())) { |
| 1119 __ Move(scratch1, callback); | 1120 __ Move(scratch1, callback); |
| 1120 __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data | 1121 __ push(FieldOperand(scratch1, ExecutableAccessorInfo::kDataOffset)); |
| 1121 } else { | 1122 } else { |
| 1122 __ Push(Handle<Object>(callback->data())); | 1123 __ Push(Handle<Object>(callback->data())); |
| 1123 } | 1124 } |
| 1124 __ PushAddress(ExternalReference::isolate_address()); // isolate | 1125 __ PushAddress(ExternalReference::isolate_address()); // isolate |
| 1125 __ push(name_reg); // name | 1126 __ push(name_reg); // name |
| 1126 // Save a pointer to where we pushed the arguments pointer. | 1127 // Save a pointer to where we pushed the arguments pointer. |
| 1127 // This will be passed as the const AccessorInfo& to the C++ callback. | 1128 // This will be passed as the const AccessorInfo& to the C++ callback. |
| 1128 | 1129 |
| 1129 #if defined(__MINGW64__) | 1130 #if defined(__MINGW64__) |
| 1130 Register accessor_info_arg = rdx; | 1131 Register accessor_info_arg = rdx; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 __ JumpIfSmi(receiver, miss); | 1203 __ JumpIfSmi(receiver, miss); |
| 1203 | 1204 |
| 1204 // So far the most popular follow ups for interceptor loads are FIELD | 1205 // So far the most popular follow ups for interceptor loads are FIELD |
| 1205 // and CALLBACKS, so inline only them, other cases may be added | 1206 // and CALLBACKS, so inline only them, other cases may be added |
| 1206 // later. | 1207 // later. |
| 1207 bool compile_followup_inline = false; | 1208 bool compile_followup_inline = false; |
| 1208 if (lookup->IsFound() && lookup->IsCacheable()) { | 1209 if (lookup->IsFound() && lookup->IsCacheable()) { |
| 1209 if (lookup->IsField()) { | 1210 if (lookup->IsField()) { |
| 1210 compile_followup_inline = true; | 1211 compile_followup_inline = true; |
| 1211 } else if (lookup->type() == CALLBACKS && | 1212 } else if (lookup->type() == CALLBACKS && |
| 1212 lookup->GetCallbackObject()->IsAccessorInfo()) { | 1213 lookup->GetCallbackObject()->IsExecutableAccessorInfo()) { |
| 1213 AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject()); | 1214 ExecutableAccessorInfo* callback = |
| 1215 ExecutableAccessorInfo::cast(lookup->GetCallbackObject()); |
| 1214 compile_followup_inline = callback->getter() != NULL && | 1216 compile_followup_inline = callback->getter() != NULL && |
| 1215 callback->IsCompatibleReceiver(*object); | 1217 callback->IsCompatibleReceiver(*object); |
| 1216 } | 1218 } |
| 1217 } | 1219 } |
| 1218 | 1220 |
| 1219 if (compile_followup_inline) { | 1221 if (compile_followup_inline) { |
| 1220 // Compile the interceptor call, followed by inline code to load the | 1222 // Compile the interceptor call, followed by inline code to load the |
| 1221 // property from further up the prototype chain if the call fails. | 1223 // property from further up the prototype chain if the call fails. |
| 1222 // Check that the maps haven't changed. | 1224 // Check that the maps haven't changed. |
| 1223 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1225 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 // We found FIELD property in prototype chain of interceptor's holder. | 1290 // We found FIELD property in prototype chain of interceptor's holder. |
| 1289 // Retrieve a field from field's holder. | 1291 // Retrieve a field from field's holder. |
| 1290 GenerateFastPropertyLoad(masm(), rax, holder_reg, | 1292 GenerateFastPropertyLoad(masm(), rax, holder_reg, |
| 1291 Handle<JSObject>(lookup->holder()), | 1293 Handle<JSObject>(lookup->holder()), |
| 1292 lookup->GetFieldIndex()); | 1294 lookup->GetFieldIndex()); |
| 1293 __ ret(0); | 1295 __ ret(0); |
| 1294 } else { | 1296 } else { |
| 1295 // We found CALLBACKS property in prototype chain of interceptor's | 1297 // We found CALLBACKS property in prototype chain of interceptor's |
| 1296 // holder. | 1298 // holder. |
| 1297 ASSERT(lookup->type() == CALLBACKS); | 1299 ASSERT(lookup->type() == CALLBACKS); |
| 1298 Handle<AccessorInfo> callback( | 1300 Handle<ExecutableAccessorInfo> callback( |
| 1299 AccessorInfo::cast(lookup->GetCallbackObject())); | 1301 ExecutableAccessorInfo::cast(lookup->GetCallbackObject())); |
| 1300 ASSERT(callback->getter() != NULL); | 1302 ASSERT(callback->getter() != NULL); |
| 1301 | 1303 |
| 1302 // Tail call to runtime. | 1304 // Tail call to runtime. |
| 1303 // Important invariant in CALLBACKS case: the code above must be | 1305 // Important invariant in CALLBACKS case: the code above must be |
| 1304 // structured to never clobber |receiver| register. | 1306 // structured to never clobber |receiver| register. |
| 1305 __ pop(scratch2); // return address | 1307 __ pop(scratch2); // return address |
| 1306 __ push(receiver); | 1308 __ push(receiver); |
| 1307 __ push(holder_reg); | 1309 __ push(holder_reg); |
| 1308 __ Move(holder_reg, callback); | 1310 __ Move(holder_reg, callback); |
| 1309 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); | 1311 __ push(FieldOperand(holder_reg, ExecutableAccessorInfo::kDataOffset)); |
| 1310 __ PushAddress(ExternalReference::isolate_address()); | 1312 __ PushAddress(ExternalReference::isolate_address()); |
| 1311 __ push(holder_reg); | 1313 __ push(holder_reg); |
| 1312 __ push(name_reg); | 1314 __ push(name_reg); |
| 1313 __ push(scratch2); // restore return address | 1315 __ push(scratch2); // restore return address |
| 1314 | 1316 |
| 1315 ExternalReference ref = | 1317 ExternalReference ref = |
| 1316 ExternalReference(IC_Utility(IC::kLoadCallbackProperty), | 1318 ExternalReference(IC_Utility(IC::kLoadCallbackProperty), |
| 1317 isolate()); | 1319 isolate()); |
| 1318 __ TailCallExternalReference(ref, 6, 1); | 1320 __ TailCallExternalReference(ref, 6, 1); |
| 1319 } | 1321 } |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 return GetCode(transition.is_null() | 2476 return GetCode(transition.is_null() |
| 2475 ? Code::FIELD | 2477 ? Code::FIELD |
| 2476 : Code::MAP_TRANSITION, name); | 2478 : Code::MAP_TRANSITION, name); |
| 2477 } | 2479 } |
| 2478 | 2480 |
| 2479 | 2481 |
| 2480 Handle<Code> StoreStubCompiler::CompileStoreCallback( | 2482 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 2481 Handle<String> name, | 2483 Handle<String> name, |
| 2482 Handle<JSObject> receiver, | 2484 Handle<JSObject> receiver, |
| 2483 Handle<JSObject> holder, | 2485 Handle<JSObject> holder, |
| 2484 Handle<AccessorInfo> callback) { | 2486 Handle<ExecutableAccessorInfo> callback) { |
| 2485 // ----------- S t a t e ------------- | 2487 // ----------- S t a t e ------------- |
| 2486 // -- rax : value | 2488 // -- rax : value |
| 2487 // -- rcx : name | 2489 // -- rcx : name |
| 2488 // -- rdx : receiver | 2490 // -- rdx : receiver |
| 2489 // -- rsp[0] : return address | 2491 // -- rsp[0] : return address |
| 2490 // ----------------------------------- | 2492 // ----------------------------------- |
| 2491 Label miss; | 2493 Label miss; |
| 2492 // Check that the maps haven't changed. | 2494 // Check that the maps haven't changed. |
| 2493 __ JumpIfSmi(rdx, &miss); | 2495 __ JumpIfSmi(rdx, &miss); |
| 2494 CheckPrototypes(receiver, rdx, holder, rbx, r8, rdi, name, &miss); | 2496 CheckPrototypes(receiver, rdx, holder, rbx, r8, rdi, name, &miss); |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3692 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3694 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
| 3693 } | 3695 } |
| 3694 } | 3696 } |
| 3695 | 3697 |
| 3696 | 3698 |
| 3697 #undef __ | 3699 #undef __ |
| 3698 | 3700 |
| 3699 } } // namespace v8::internal | 3701 } } // namespace v8::internal |
| 3700 | 3702 |
| 3701 #endif // V8_TARGET_ARCH_X64 | 3703 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |