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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 | |
437 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. |
438 | 441 __ mov(reg, FieldOperand(map_reg, Map::kPrototypeOffset)); |
439 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | |
440 } | 442 } |
441 | 443 |
442 // Go to the next object in the prototype chain. | 444 // Go to the next object in the prototype chain. |
443 current = prototype; | 445 current = prototype; |
444 current_map = handle(current->map()); | 446 current_map = handle(current->map()); |
445 } | 447 } |
446 | 448 |
447 // Log the check depth. | 449 // Log the check depth. |
448 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 450 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
449 | 451 |
450 if (depth != 0 || check == CHECK_ALL_MAPS) { | 452 if (depth != 0 || check == CHECK_ALL_MAPS) { |
451 // Check the holder map. | 453 // Check the holder map. |
452 __ 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); |
453 } | 458 } |
454 | 459 |
455 // Perform security check for access to the global object. | 460 // Perform security check for access to the global object. |
456 DCHECK(current_map->IsJSGlobalProxyMap() || | 461 DCHECK(current_map->IsJSGlobalProxyMap() || |
457 !current_map->is_access_check_needed()); | 462 !current_map->is_access_check_needed()); |
458 if (current_map->IsJSGlobalProxyMap()) { | 463 if (current_map->IsJSGlobalProxyMap()) { |
459 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 464 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
460 } | 465 } |
461 | 466 |
462 // 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... |
700 // Return the generated code. | 705 // Return the generated code. |
701 return GetCode(kind(), Code::NORMAL, name); | 706 return GetCode(kind(), Code::NORMAL, name); |
702 } | 707 } |
703 | 708 |
704 | 709 |
705 #undef __ | 710 #undef __ |
706 } | 711 } |
707 } // namespace v8::internal | 712 } // namespace v8::internal |
708 | 713 |
709 #endif // V8_TARGET_ARCH_X87 | 714 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |