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

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

Issue 994533004: Contribution of PowerPC port (continuation of 422063005) - uplevel (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months 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/compiler/ppc/instruction-selector-ppc.cc ('k') | src/ic/ppc/ic-compiler-ppc.cc » ('j') | 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_PPC 7 #if V8_TARGET_ARCH_PPC
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 !scratch2.is(scratch1)); 420 !scratch2.is(scratch1));
421 421
422 // Keep track of the current object in register reg. 422 // Keep track of the current object in register reg.
423 Register reg = object_reg; 423 Register reg = object_reg;
424 int depth = 0; 424 int depth = 0;
425 425
426 Handle<JSObject> current = Handle<JSObject>::null(); 426 Handle<JSObject> current = Handle<JSObject>::null();
427 if (receiver_map->IsJSGlobalObjectMap()) { 427 if (receiver_map->IsJSGlobalObjectMap()) {
428 current = isolate()->global_object(); 428 current = isolate()->global_object();
429 } 429 }
430 // 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
432 // object.
433 // This allows us to install generated handlers for accesses to the
434 // global proxy (as opposed to using slow ICs). See corresponding code
435 // in LookupForRead().
436 if (receiver_map->IsJSGlobalProxyMap()) {
437 __ CheckAccessGlobalProxy(reg, scratch2, miss);
438 }
439
430 Handle<JSObject> prototype = Handle<JSObject>::null(); 440 Handle<JSObject> prototype = Handle<JSObject>::null();
431 Handle<Map> current_map = receiver_map; 441 Handle<Map> current_map = receiver_map;
432 Handle<Map> holder_map(holder()->map()); 442 Handle<Map> holder_map(holder()->map());
433 // Traverse the prototype chain and check the maps in the prototype chain for 443 // Traverse the prototype chain and check the maps in the prototype chain for
434 // fast and global objects or do negative lookup for normal objects. 444 // fast and global objects or do negative lookup for normal objects.
435 while (!current_map.is_identical_to(holder_map)) { 445 while (!current_map.is_identical_to(holder_map)) {
436 ++depth; 446 ++depth;
437 447
438 // Only global objects and objects that do not require access 448 // Only global objects and objects that do not require access
439 // checks are allowed in stubs. 449 // checks are allowed in stubs.
(...skipping 14 matching lines...) Expand all
454 464
455 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, 465 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1,
456 scratch2); 466 scratch2);
457 467
458 __ LoadP(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); 468 __ LoadP(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
459 reg = holder_reg; // From now on the object will be in holder_reg. 469 reg = holder_reg; // From now on the object will be in holder_reg.
460 __ LoadP(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); 470 __ LoadP(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
461 } else { 471 } else {
462 Register map_reg = scratch1; 472 Register map_reg = scratch1;
463 __ LoadP(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); 473 __ LoadP(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
464 if (depth != 1 || check == CHECK_ALL_MAPS) { 474
475 if (current_map->IsJSGlobalObjectMap()) {
476 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
477 name, scratch2, miss);
478 } else if (depth != 1 || check == CHECK_ALL_MAPS) {
465 Handle<WeakCell> cell = Map::WeakCellForMap(current_map); 479 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
466 __ CmpWeakValue(map_reg, cell, scratch2); 480 __ CmpWeakValue(map_reg, cell, scratch2);
467 __ bne(miss); 481 __ bne(miss);
468 } 482 }
469 483
470 // Check access rights to the global object. This has to happen after
471 // the map check so that we know that the object is actually a global
472 // object.
473 // This allows us to install generated handlers for accesses to the
474 // global proxy (as opposed to using slow ICs). See corresponding code
475 // in LookupForRead().
476 if (current_map->IsJSGlobalProxyMap()) {
477 __ CheckAccessGlobalProxy(reg, scratch2, miss);
478 } else if (current_map->IsJSGlobalObjectMap()) {
479 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
480 name, scratch2, miss);
481 }
482
483 reg = holder_reg; // From now on the object will be in holder_reg. 484 reg = holder_reg; // From now on the object will be in holder_reg.
484 485
485 __ LoadP(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); 486 __ LoadP(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
486 } 487 }
487 488
488 // Go to the next object in the prototype chain. 489 // Go to the next object in the prototype chain.
489 current = prototype; 490 current = prototype;
490 current_map = handle(current->map()); 491 current_map = handle(current->map());
491 } 492 }
492 493
493 // Log the check depth. 494 // Log the check depth.
494 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); 495 LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
495 496
496 if (depth != 0 || check == CHECK_ALL_MAPS) { 497 if (depth != 0 || check == CHECK_ALL_MAPS) {
497 // Check the holder map. 498 // Check the holder map.
498 __ LoadP(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); 499 __ LoadP(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
499 Handle<WeakCell> cell = Map::WeakCellForMap(current_map); 500 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
500 __ CmpWeakValue(scratch1, cell, scratch2); 501 __ CmpWeakValue(scratch1, cell, scratch2);
501 __ bne(miss); 502 __ bne(miss);
502 } 503 }
503 504
504 // Perform security check for access to the global object.
505 DCHECK(current_map->IsJSGlobalProxyMap() ||
506 !current_map->is_access_check_needed());
507 if (current_map->IsJSGlobalProxyMap()) {
508 __ CheckAccessGlobalProxy(reg, scratch1, miss);
509 }
510
511 // Return the register containing the holder. 505 // Return the register containing the holder.
512 return reg; 506 return reg;
513 } 507 }
514 508
515 509
516 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { 510 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
517 if (!miss->is_unused()) { 511 if (!miss->is_unused()) {
518 Label success; 512 Label success;
519 __ b(&success); 513 __ b(&success);
520 __ bind(miss); 514 __ bind(miss);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // Return the generated code. 743 // Return the generated code.
750 return GetCode(kind(), Code::NORMAL, name); 744 return GetCode(kind(), Code::NORMAL, name);
751 } 745 }
752 746
753 747
754 #undef __ 748 #undef __
755 } 749 }
756 } // namespace v8::internal 750 } // namespace v8::internal
757 751
758 #endif // V8_TARGET_ARCH_ARM 752 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/compiler/ppc/instruction-selector-ppc.cc ('k') | src/ic/ppc/ic-compiler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698