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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 395 matching lines...) Loading... |
406 current->property_dictionary()->FindEntry(name) == | 406 current->property_dictionary()->FindEntry(name) == |
407 NameDictionary::kNotFound); | 407 NameDictionary::kNotFound); |
408 | 408 |
409 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, | 409 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, |
410 scratch2); | 410 scratch2); |
411 | 411 |
412 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 412 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
413 reg = holder_reg; // From now on the object will be in holder_reg. | 413 reg = holder_reg; // From now on the object will be in holder_reg. |
414 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 414 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
415 } else { | 415 } else { |
416 bool in_new_space = heap()->InNewSpace(*prototype); | 416 // Save the map in scratch1 for later. |
417 // Two possible reasons for loading the prototype from the map: | 417 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
418 // (1) Can't store references to new space in code. | 418 |
419 // (2) Handler is shared for all receivers with the same prototype | |
420 // map (but not necessarily the same prototype instance). | |
421 bool load_prototype_from_map = in_new_space || depth == 1; | |
422 if (load_prototype_from_map) { | |
423 // Save the map in scratch1 for later. | |
424 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | |
425 } | |
426 if (depth != 1 || check == CHECK_ALL_MAPS) { | 419 if (depth != 1 || check == CHECK_ALL_MAPS) { |
427 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 420 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
428 } | 421 } |
429 | 422 |
430 // Check access rights to the global object. This has to happen after | 423 // Check access rights to the global object. This has to happen after |
431 // the map check so that we know that the object is actually a global | 424 // the map check so that we know that the object is actually a global |
432 // object. | 425 // object. |
433 // This allows us to install generated handlers for accesses to the | 426 // This allows us to install generated handlers for accesses to the |
434 // global proxy (as opposed to using slow ICs). See corresponding code | 427 // global proxy (as opposed to using slow ICs). See corresponding code |
435 // in LookupForRead(). | 428 // in LookupForRead(). |
436 if (current_map->IsJSGlobalProxyMap()) { | 429 if (current_map->IsJSGlobalProxyMap()) { |
437 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 430 __ CheckAccessGlobalProxy(reg, scratch2, miss); |
438 } else if (current_map->IsJSGlobalObjectMap()) { | 431 } else if (current_map->IsJSGlobalObjectMap()) { |
439 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), | 432 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), |
440 name, scratch2, miss); | 433 name, scratch2, miss); |
441 } | 434 } |
442 reg = holder_reg; // From now on the object will be in holder_reg. | 435 reg = holder_reg; // From now on the object will be in holder_reg. |
443 | 436 |
444 if (load_prototype_from_map) { | 437 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
445 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | |
446 } else { | |
447 __ Move(reg, prototype); | |
448 } | |
449 } | 438 } |
450 | 439 |
451 // Go to the next object in the prototype chain. | 440 // Go to the next object in the prototype chain. |
452 current = prototype; | 441 current = prototype; |
453 current_map = handle(current->map()); | 442 current_map = handle(current->map()); |
454 } | 443 } |
455 | 444 |
456 // Log the check depth. | 445 // Log the check depth. |
457 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 446 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
458 | 447 |
(...skipping 237 matching lines...) Loading... |
696 // Return the generated code. | 685 // Return the generated code. |
697 return GetCode(kind(), Code::NORMAL, name); | 686 return GetCode(kind(), Code::NORMAL, name); |
698 } | 687 } |
699 | 688 |
700 | 689 |
701 #undef __ | 690 #undef __ |
702 } | 691 } |
703 } // namespace v8::internal | 692 } // namespace v8::internal |
704 | 693 |
705 #endif // V8_TARGET_ARCH_X64 | 694 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |