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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1053 |
1054 | 1054 |
1055 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, | 1055 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, |
1056 Register name_reg, | 1056 Register name_reg, |
1057 Register scratch1, | 1057 Register scratch1, |
1058 Register scratch2, | 1058 Register scratch2, |
1059 Register scratch3, | 1059 Register scratch3, |
1060 Handle<AccessorInfo> callback, | 1060 Handle<AccessorInfo> callback, |
1061 Handle<String> name, | 1061 Handle<String> name, |
1062 Label* miss) { | 1062 Label* miss) { |
| 1063 ASSERT(!receiver.is(scratch2)); |
| 1064 ASSERT(!receiver.is(scratch3)); |
1063 Register dictionary = scratch1; | 1065 Register dictionary = scratch1; |
| 1066 bool must_preserve_dictionary_reg = receiver.is(dictionary); |
| 1067 |
| 1068 // Load the properties dictionary. |
| 1069 if (must_preserve_dictionary_reg) { |
| 1070 __ push(dictionary); |
| 1071 } |
1064 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 1072 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
1065 | 1073 |
1066 // Probe the dictionary. | 1074 // Probe the dictionary. |
1067 Label probe_done; | 1075 Label probe_done, pop_and_miss; |
1068 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), | 1076 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), |
1069 miss, | 1077 &pop_and_miss, |
1070 &probe_done, | 1078 &probe_done, |
1071 dictionary, | 1079 dictionary, |
1072 name_reg, | 1080 name_reg, |
1073 scratch2, | 1081 scratch2, |
1074 scratch3); | 1082 scratch3); |
| 1083 __ bind(&pop_and_miss); |
| 1084 if (must_preserve_dictionary_reg) { |
| 1085 __ pop(dictionary); |
| 1086 } |
| 1087 __ jmp(miss); |
1075 __ bind(&probe_done); | 1088 __ bind(&probe_done); |
1076 | 1089 |
1077 // If probing finds an entry in the dictionary, scratch2 contains the | 1090 // If probing finds an entry in the dictionary, scratch2 contains the |
1078 // index into the dictionary. Check that the value is the callback. | 1091 // index into the dictionary. Check that the value is the callback. |
1079 Register index = scratch2; | 1092 Register index = scratch2; |
1080 const int kElementsStartOffset = | 1093 const int kElementsStartOffset = |
1081 StringDictionary::kHeaderSize + | 1094 StringDictionary::kHeaderSize + |
1082 StringDictionary::kElementsStartIndex * kPointerSize; | 1095 StringDictionary::kElementsStartIndex * kPointerSize; |
1083 const int kValueOffset = kElementsStartOffset + kPointerSize; | 1096 const int kValueOffset = kElementsStartOffset + kPointerSize; |
1084 __ mov(scratch3, | 1097 __ mov(scratch3, |
1085 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag)); | 1098 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag)); |
| 1099 if (must_preserve_dictionary_reg) { |
| 1100 __ pop(dictionary); |
| 1101 } |
1086 __ cmp(scratch3, callback); | 1102 __ cmp(scratch3, callback); |
1087 __ j(not_equal, miss); | 1103 __ j(not_equal, miss); |
1088 } | 1104 } |
1089 | 1105 |
1090 | 1106 |
1091 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, | 1107 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, |
1092 Handle<JSObject> holder, | 1108 Handle<JSObject> holder, |
1093 Register receiver, | 1109 Register receiver, |
1094 Register name_reg, | 1110 Register name_reg, |
1095 Register scratch1, | 1111 Register scratch1, |
1096 Register scratch2, | 1112 Register scratch2, |
1097 Register scratch3, | 1113 Register scratch3, |
1098 Handle<AccessorInfo> callback, | 1114 Handle<AccessorInfo> callback, |
1099 Handle<String> name, | 1115 Handle<String> name, |
1100 Label* miss) { | 1116 Label* miss) { |
1101 // Check that the receiver isn't a smi. | 1117 // Check that the receiver isn't a smi. |
1102 __ JumpIfSmi(receiver, miss); | 1118 __ JumpIfSmi(receiver, miss); |
1103 | 1119 |
1104 // Check that the maps haven't changed. | 1120 // Check that the maps haven't changed. |
1105 Register reg = CheckPrototypes(object, receiver, holder, scratch1, | 1121 Register reg = CheckPrototypes(object, receiver, holder, scratch1, |
1106 scratch2, scratch3, name, miss); | 1122 scratch2, scratch3, name, miss); |
1107 | 1123 |
1108 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1124 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
1109 GenerateDictionaryLoadCallback( | 1125 GenerateDictionaryLoadCallback( |
1110 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); | 1126 reg, name_reg, scratch1, scratch2, scratch3, callback, name, miss); |
1111 } | 1127 } |
1112 | 1128 |
1113 // Insert additional parameters into the stack frame above return address. | 1129 // Insert additional parameters into the stack frame above return address. |
1114 ASSERT(!scratch3.is(reg)); | 1130 ASSERT(!scratch3.is(reg)); |
1115 __ pop(scratch3); // Get return address to place it below. | 1131 __ pop(scratch3); // Get return address to place it below. |
1116 | 1132 |
1117 __ push(receiver); // receiver | 1133 __ push(receiver); // receiver |
1118 __ mov(scratch2, esp); | 1134 __ mov(scratch2, esp); |
1119 ASSERT(!scratch2.is(reg)); | 1135 ASSERT(!scratch2.is(reg)); |
1120 __ push(reg); // holder | 1136 __ push(reg); // holder |
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4287 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4303 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
4288 } | 4304 } |
4289 } | 4305 } |
4290 | 4306 |
4291 | 4307 |
4292 #undef __ | 4308 #undef __ |
4293 | 4309 |
4294 } } // namespace v8::internal | 4310 } } // namespace v8::internal |
4295 | 4311 |
4296 #endif // V8_TARGET_ARCH_IA32 | 4312 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |