Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 770373002: CheckPrototypes uses weak cells to embed maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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...) Expand 10 before | Expand all | Expand 10 after
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 // Save the map in scratch1 for later. 416 Register map_reg = scratch1;
417 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); 417 __ movp(map_reg, FieldOperand(reg, HeapObject::kMapOffset));
418 418
419 if (depth != 1 || check == CHECK_ALL_MAPS) { 419 if (depth != 1 || check == CHECK_ALL_MAPS) {
420 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); 420 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
421 __ CmpWeakValue(map_reg, cell, scratch2);
422 __ j(not_equal, miss);
421 } 423 }
422 424
423 // Check access rights to the global object. This has to happen after 425 // Check access rights to the global object. This has to happen after
424 // the map check so that we know that the object is actually a global 426 // the map check so that we know that the object is actually a global
425 // object. 427 // object.
426 // This allows us to install generated handlers for accesses to the 428 // This allows us to install generated handlers for accesses to the
427 // global proxy (as opposed to using slow ICs). See corresponding code 429 // global proxy (as opposed to using slow ICs). See corresponding code
428 // in LookupForRead(). 430 // in LookupForRead().
429 if (current_map->IsJSGlobalProxyMap()) { 431 if (current_map->IsJSGlobalProxyMap()) {
430 __ CheckAccessGlobalProxy(reg, scratch2, miss); 432 __ CheckAccessGlobalProxy(reg, scratch2, miss);
431 } else if (current_map->IsJSGlobalObjectMap()) { 433 } else if (current_map->IsJSGlobalObjectMap()) {
432 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), 434 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
433 name, scratch2, miss); 435 name, scratch2, miss);
434 } 436 }
435 reg = holder_reg; // From now on the object will be in holder_reg. 437 reg = holder_reg; // From now on the object will be in holder_reg.
436 438
437 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); 439 __ movp(reg, FieldOperand(map_reg, Map::kPrototypeOffset));
438 } 440 }
439 441
440 // Go to the next object in the prototype chain. 442 // Go to the next object in the prototype chain.
441 current = prototype; 443 current = prototype;
442 current_map = handle(current->map()); 444 current_map = handle(current->map());
443 } 445 }
444 446
445 // Log the check depth. 447 // Log the check depth.
446 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); 448 LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
447 449
448 if (depth != 0 || check == CHECK_ALL_MAPS) { 450 if (depth != 0 || check == CHECK_ALL_MAPS) {
449 // Check the holder map. 451 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
450 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); 452 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
453 __ CmpWeakValue(scratch1, cell, scratch2);
454 __ j(not_equal, miss);
451 } 455 }
452 456
453 // Perform security check for access to the global object. 457 // Perform security check for access to the global object.
454 DCHECK(current_map->IsJSGlobalProxyMap() || 458 DCHECK(current_map->IsJSGlobalProxyMap() ||
455 !current_map->is_access_check_needed()); 459 !current_map->is_access_check_needed());
456 if (current_map->IsJSGlobalProxyMap()) { 460 if (current_map->IsJSGlobalProxyMap()) {
457 __ CheckAccessGlobalProxy(reg, scratch1, miss); 461 __ CheckAccessGlobalProxy(reg, scratch1, miss);
458 } 462 }
459 463
460 // Return the register containing the holder. 464 // Return the register containing the holder.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // Return the generated code. 689 // Return the generated code.
686 return GetCode(kind(), Code::NORMAL, name); 690 return GetCode(kind(), Code::NORMAL, name);
687 } 691 }
688 692
689 693
690 #undef __ 694 #undef __
691 } 695 }
692 } // namespace v8::internal 696 } // namespace v8::internal
693 697
694 #endif // V8_TARGET_ARCH_X64 698 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698