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

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 1495513004: PPC: [proxies] InstanceOfStub should bailout to %HasInPrototypeChain for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | 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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 __ bind(&function_prototype_valid); 1450 __ bind(&function_prototype_valid);
1451 __ AssertNotSmi(function_prototype); 1451 __ AssertNotSmi(function_prototype);
1452 1452
1453 // Update the global instanceof cache with the current {object} map and 1453 // Update the global instanceof cache with the current {object} map and
1454 // {function}. The cached answer will be set when it is known below. 1454 // {function}. The cached answer will be set when it is known below.
1455 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); 1455 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
1456 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); 1456 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
1457 1457
1458 // Loop through the prototype chain looking for the {function} prototype. 1458 // Loop through the prototype chain looking for the {function} prototype.
1459 // Assume true, and change to false if not found. 1459 // Assume true, and change to false if not found.
1460 Register const object_prototype = object_map; 1460 Register const object_instance_type = function_map;
1461 Register const null = scratch; 1461 Register const null = scratch;
1462 Label done, loop; 1462 Register const result = r3;
1463 __ LoadRoot(r3, Heap::kTrueValueRootIndex); 1463 Label done, loop, proxy_case;
1464 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1464 __ LoadRoot(null, Heap::kNullValueRootIndex); 1465 __ LoadRoot(null, Heap::kNullValueRootIndex);
1465 __ bind(&loop); 1466 __ bind(&loop);
1466 __ LoadP(object_prototype, 1467 __ CompareInstanceType(object_map, object_instance_type, JS_PROXY_TYPE);
1467 FieldMemOperand(object_map, Map::kPrototypeOffset)); 1468 __ beq(&proxy_case);
1468 __ cmp(object_prototype, function_prototype); 1469 __ LoadP(object, FieldMemOperand(object_map, Map::kPrototypeOffset));
1470 __ cmp(object, function_prototype);
1469 __ beq(&done); 1471 __ beq(&done);
1470 __ cmp(object_prototype, null); 1472 __ cmp(object, null);
1471 __ LoadP(object_map, 1473 __ LoadP(object_map, FieldMemOperand(object, HeapObject::kMapOffset));
1472 FieldMemOperand(object_prototype, HeapObject::kMapOffset));
1473 __ bne(&loop); 1474 __ bne(&loop);
1474 __ LoadRoot(r3, Heap::kFalseValueRootIndex); 1475 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1475 __ bind(&done); 1476 __ bind(&done);
1476 __ StoreRoot(r3, Heap::kInstanceofCacheAnswerRootIndex); 1477 __ StoreRoot(result, Heap::kInstanceofCacheAnswerRootIndex);
1477 __ Ret(); 1478 __ Ret();
1478 1479
1479 // Slow-case: Call the runtime function. 1480 // Proxy-case: Call the %HasInPrototypeChain runtime function.
1481 __ bind(&proxy_case);
1482 __ Push(object, function_prototype);
1483 // Invalidate the instanceof cache.
1484 __ LoadSmiLiteral(scratch, Smi::FromInt(0));
1485 __ StoreRoot(scratch, Heap::kInstanceofCacheFunctionRootIndex);
1486 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
1487
1488 // Slow-case: Call the %InstanceOf runtime function.
1480 __ bind(&slow_case); 1489 __ bind(&slow_case);
1481 __ Push(object, function); 1490 __ Push(object, function);
1482 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 1491 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
1483 } 1492 }
1484 1493
1485 1494
1486 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { 1495 void FunctionPrototypeStub::Generate(MacroAssembler* masm) {
1487 Label miss; 1496 Label miss;
1488 Register receiver = LoadDescriptor::ReceiverRegister(); 1497 Register receiver = LoadDescriptor::ReceiverRegister();
1489 // Ensure that the vector and slot registers won't be clobbered before 1498 // Ensure that the vector and slot registers won't be clobbered before
(...skipping 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5661 kStackUnwindSpace, NULL, 5670 kStackUnwindSpace, NULL,
5662 MemOperand(fp, 6 * kPointerSize), NULL); 5671 MemOperand(fp, 6 * kPointerSize), NULL);
5663 } 5672 }
5664 5673
5665 5674
5666 #undef __ 5675 #undef __
5667 } // namespace internal 5676 } // namespace internal
5668 } // namespace v8 5677 } // namespace v8
5669 5678
5670 #endif // V8_TARGET_ARCH_PPC 5679 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698