OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 Register* StoreStubCompiler::registers() { | 1246 Register* StoreStubCompiler::registers() { |
1247 // receiver, name, scratch1, scratch2, scratch3. | 1247 // receiver, name, scratch1, scratch2, scratch3. |
1248 Register receiver = KeyedStoreIC::ReceiverRegister(); | 1248 Register receiver = KeyedStoreIC::ReceiverRegister(); |
1249 Register name = KeyedStoreIC::NameRegister(); | 1249 Register name = KeyedStoreIC::NameRegister(); |
1250 static Register registers[] = { receiver, name, rbx, rdi, r8 }; | 1250 static Register registers[] = { receiver, name, rbx, rdi, r8 }; |
1251 return registers; | 1251 return registers; |
1252 } | 1252 } |
1253 | 1253 |
1254 | 1254 |
1255 Register* KeyedStoreStubCompiler::registers() { | 1255 Register* KeyedStoreStubCompiler::registers() { |
1256 // receiver, name, scratch1, scratch2, scratch3. | 1256 // receiver, name, scratch1/map, scratch2, scratch3. |
1257 Register receiver = KeyedStoreIC::ReceiverRegister(); | 1257 Register receiver = KeyedStoreIC::ReceiverRegister(); |
1258 Register name = KeyedStoreIC::NameRegister(); | 1258 Register name = KeyedStoreIC::NameRegister(); |
1259 static Register registers[] = { receiver, name, rbx, rdi, r8 }; | 1259 Register map = KeyedStoreIC::MapRegister(); |
| 1260 static Register registers[] = { receiver, name, map, rdi, r8 }; |
1260 return registers; | 1261 return registers; |
1261 } | 1262 } |
1262 | 1263 |
1263 | 1264 |
1264 #undef __ | 1265 #undef __ |
1265 #define __ ACCESS_MASM(masm) | 1266 #define __ ACCESS_MASM(masm) |
1266 | 1267 |
1267 | 1268 |
1268 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 1269 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
1269 Handle<HeapType> type, | 1270 Handle<HeapType> type, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 if (check == PROPERTY && | 1355 if (check == PROPERTY && |
1355 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | 1356 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
1356 __ Cmp(this->name(), name); | 1357 __ Cmp(this->name(), name); |
1357 __ j(not_equal, &miss); | 1358 __ j(not_equal, &miss); |
1358 } | 1359 } |
1359 | 1360 |
1360 Label number_case; | 1361 Label number_case; |
1361 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 1362 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; |
1362 __ JumpIfSmi(receiver(), smi_target); | 1363 __ JumpIfSmi(receiver(), smi_target); |
1363 | 1364 |
| 1365 // Polymorphic keyed stores may use the map register |
1364 Register map_reg = scratch1(); | 1366 Register map_reg = scratch1(); |
| 1367 ASSERT(kind() != Code::KEYED_STORE_IC || |
| 1368 map_reg.is(KeyedStoreIC::MapRegister())); |
1365 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); | 1369 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |
1366 int receiver_count = types->length(); | 1370 int receiver_count = types->length(); |
1367 int number_of_handled_maps = 0; | 1371 int number_of_handled_maps = 0; |
1368 for (int current = 0; current < receiver_count; ++current) { | 1372 for (int current = 0; current < receiver_count; ++current) { |
1369 Handle<HeapType> type = types->at(current); | 1373 Handle<HeapType> type = types->at(current); |
1370 Handle<Map> map = IC::TypeToMap(*type, isolate()); | 1374 Handle<Map> map = IC::TypeToMap(*type, isolate()); |
1371 if (!map->is_deprecated()) { | 1375 if (!map->is_deprecated()) { |
1372 number_of_handled_maps++; | 1376 number_of_handled_maps++; |
1373 // Check map and tail call if there's a match | 1377 // Check map and tail call if there's a match |
1374 __ Cmp(map_reg, map); | 1378 __ Cmp(map_reg, map); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 // ----------------------------------- | 1441 // ----------------------------------- |
1438 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1442 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1439 } | 1443 } |
1440 | 1444 |
1441 | 1445 |
1442 #undef __ | 1446 #undef __ |
1443 | 1447 |
1444 } } // namespace v8::internal | 1448 } } // namespace v8::internal |
1445 | 1449 |
1446 #endif // V8_TARGET_ARCH_X64 | 1450 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |