OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 current->property_dictionary()->FindEntry(name) == | 408 current->property_dictionary()->FindEntry(name) == |
409 NameDictionary::kNotFound); | 409 NameDictionary::kNotFound); |
410 | 410 |
411 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, | 411 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, |
412 scratch2); | 412 scratch2); |
413 | 413 |
414 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 414 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
415 reg = holder_reg; // From now on the object will be in holder_reg. | 415 reg = holder_reg; // From now on the object will be in holder_reg. |
416 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 416 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
417 } else { | 417 } else { |
| 418 Register map_reg = scratch1; |
| 419 __ mov(map_reg, FieldOperand(reg, HeapObject::kMapOffset)); |
418 if (depth != 1 || check == CHECK_ALL_MAPS) { | 420 if (depth != 1 || check == CHECK_ALL_MAPS) { |
419 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 421 Handle<WeakCell> cell = Map::WeakCellForMap(current_map); |
| 422 __ CmpWeakValue(map_reg, cell, scratch2); |
| 423 __ j(not_equal, miss); |
420 } | 424 } |
421 | 425 |
422 // Check access rights to the global object. This has to happen after | 426 // Check access rights to the global object. This has to happen after |
423 // the map check so that we know that the object is actually a global | 427 // the map check so that we know that the object is actually a global |
424 // object. | 428 // object. |
425 // This allows us to install generated handlers for accesses to the | 429 // This allows us to install generated handlers for accesses to the |
426 // global proxy (as opposed to using slow ICs). See corresponding code | 430 // global proxy (as opposed to using slow ICs). See corresponding code |
427 // in LookupForRead(). | 431 // in LookupForRead(). |
428 if (current_map->IsJSGlobalProxyMap()) { | 432 if (current_map->IsJSGlobalProxyMap()) { |
429 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 433 __ CheckAccessGlobalProxy(reg, map_reg, scratch2, miss); |
| 434 // Restore map_reg. |
| 435 __ mov(map_reg, FieldOperand(reg, HeapObject::kMapOffset)); |
430 } else if (current_map->IsJSGlobalObjectMap()) { | 436 } else if (current_map->IsJSGlobalObjectMap()) { |
431 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), | 437 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), |
432 name, scratch2, miss); | 438 name, scratch2, miss); |
433 } | 439 } |
434 | |
435 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | |
436 reg = holder_reg; // From now on the object will be in holder_reg. | 440 reg = holder_reg; // From now on the object will be in holder_reg. |
437 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 441 __ mov(reg, FieldOperand(map_reg, Map::kPrototypeOffset)); |
438 } | 442 } |
439 | 443 |
440 // Go to the next object in the prototype chain. | 444 // Go to the next object in the prototype chain. |
441 current = prototype; | 445 current = prototype; |
442 current_map = handle(current->map()); | 446 current_map = handle(current->map()); |
443 } | 447 } |
444 | 448 |
445 // Log the check depth. | 449 // Log the check depth. |
446 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 450 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
447 | 451 |
448 if (depth != 0 || check == CHECK_ALL_MAPS) { | 452 if (depth != 0 || check == CHECK_ALL_MAPS) { |
449 // Check the holder map. | 453 // Check the holder map. |
450 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 454 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 455 Handle<WeakCell> cell = Map::WeakCellForMap(current_map); |
| 456 __ CmpWeakValue(scratch1, cell, scratch2); |
| 457 __ j(not_equal, miss); |
451 } | 458 } |
452 | 459 |
453 // Perform security check for access to the global object. | 460 // Perform security check for access to the global object. |
454 DCHECK(current_map->IsJSGlobalProxyMap() || | 461 DCHECK(current_map->IsJSGlobalProxyMap() || |
455 !current_map->is_access_check_needed()); | 462 !current_map->is_access_check_needed()); |
456 if (current_map->IsJSGlobalProxyMap()) { | 463 if (current_map->IsJSGlobalProxyMap()) { |
457 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 464 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
458 } | 465 } |
459 | 466 |
460 // Return the register containing the holder. | 467 // Return the register containing the holder. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // Return the generated code. | 705 // Return the generated code. |
699 return GetCode(kind(), Code::NORMAL, name); | 706 return GetCode(kind(), Code::NORMAL, name); |
700 } | 707 } |
701 | 708 |
702 | 709 |
703 #undef __ | 710 #undef __ |
704 } | 711 } |
705 } // namespace v8::internal | 712 } // namespace v8::internal |
706 | 713 |
707 #endif // V8_TARGET_ARCH_IA32 | 714 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |