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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 __ bind(&function_prototype_valid); | 1500 __ bind(&function_prototype_valid); |
1501 __ AssertNotSmi(function_prototype); | 1501 __ AssertNotSmi(function_prototype); |
1502 | 1502 |
1503 // Update the global instanceof cache with the current {object} map and | 1503 // Update the global instanceof cache with the current {object} map and |
1504 // {function}. The cached answer will be set when it is known below. | 1504 // {function}. The cached answer will be set when it is known below. |
1505 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); | 1505 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); |
1506 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); | 1506 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); |
1507 | 1507 |
1508 // Loop through the prototype chain looking for the {function} prototype. | 1508 // Loop through the prototype chain looking for the {function} prototype. |
1509 // Assume true, and change to false if not found. | 1509 // Assume true, and change to false if not found. |
1510 Register const object_prototype = object_map; | 1510 Register const object_instance_type = function_map; |
1511 Register const null = scratch; | 1511 Register const null = scratch; |
1512 Label done, loop; | 1512 Register const result = v0; |
1513 __ LoadRoot(v0, Heap::kTrueValueRootIndex); | 1513 Label done, loop, proxy_case; |
| 1514 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
1514 __ LoadRoot(null, Heap::kNullValueRootIndex); | 1515 __ LoadRoot(null, Heap::kNullValueRootIndex); |
1515 __ bind(&loop); | 1516 __ bind(&loop); |
1516 __ ld(object_prototype, FieldMemOperand(object_map, Map::kPrototypeOffset)); | 1517 __ lbu(object_instance_type, |
1517 __ Branch(&done, eq, object_prototype, Operand(function_prototype)); | 1518 FieldMemOperand(object_map, Map::kInstanceTypeOffset)); |
1518 __ Branch(USE_DELAY_SLOT, &loop, ne, object_prototype, Operand(null)); | 1519 __ Branch(&proxy_case, eq, object_instance_type, Operand(JS_PROXY_TYPE)); |
1519 __ ld(object_map, FieldMemOperand(object_prototype, HeapObject::kMapOffset)); | 1520 __ ld(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); |
1520 __ LoadRoot(v0, Heap::kFalseValueRootIndex); | 1521 __ Branch(&done, eq, object, Operand(function_prototype)); |
| 1522 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null)); |
| 1523 __ ld(object_map, |
| 1524 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot. |
| 1525 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
1521 __ bind(&done); | 1526 __ bind(&done); |
1522 __ Ret(USE_DELAY_SLOT); | 1527 __ Ret(USE_DELAY_SLOT); |
1523 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. | 1528 __ StoreRoot(result, |
| 1529 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. |
1524 | 1530 |
1525 // Slow-case: Call the runtime function. | 1531 // Proxy-case: Call the %HasInPrototypeChain runtime function. |
| 1532 __ bind(&proxy_case); |
| 1533 __ Push(object, function_prototype); |
| 1534 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1); |
| 1535 |
| 1536 // Slow-case: Call the %InstanceOf runtime function. |
1526 __ bind(&slow_case); | 1537 __ bind(&slow_case); |
1527 __ Push(object, function); | 1538 __ Push(object, function); |
1528 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); | 1539 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); |
1529 } | 1540 } |
1530 | 1541 |
1531 | 1542 |
1532 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 1543 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
1533 Label miss; | 1544 Label miss; |
1534 Register receiver = LoadDescriptor::ReceiverRegister(); | 1545 Register receiver = LoadDescriptor::ReceiverRegister(); |
1535 // Ensure that the vector and slot registers won't be clobbered before | 1546 // Ensure that the vector and slot registers won't be clobbered before |
(...skipping 4081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5617 MemOperand(fp, 6 * kPointerSize), NULL); | 5628 MemOperand(fp, 6 * kPointerSize), NULL); |
5618 } | 5629 } |
5619 | 5630 |
5620 | 5631 |
5621 #undef __ | 5632 #undef __ |
5622 | 5633 |
5623 } // namespace internal | 5634 } // namespace internal |
5624 } // namespace v8 | 5635 } // namespace v8 |
5625 | 5636 |
5626 #endif // V8_TARGET_ARCH_MIPS64 | 5637 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |