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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 __ bind(&function_prototype_valid); | 1498 __ bind(&function_prototype_valid); |
1499 __ AssertNotSmi(function_prototype); | 1499 __ AssertNotSmi(function_prototype); |
1500 | 1500 |
1501 // Update the global instanceof cache with the current {object} map and | 1501 // Update the global instanceof cache with the current {object} map and |
1502 // {function}. The cached answer will be set when it is known below. | 1502 // {function}. The cached answer will be set when it is known below. |
1503 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); | 1503 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); |
1504 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); | 1504 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); |
1505 | 1505 |
1506 // Loop through the prototype chain looking for the {function} prototype. | 1506 // Loop through the prototype chain looking for the {function} prototype. |
1507 // Assume true, and change to false if not found. | 1507 // Assume true, and change to false if not found. |
1508 Register const object_prototype = object_map; | 1508 Register const object_instance_type = function_map; |
1509 Register const null = scratch; | 1509 Register const null = scratch; |
1510 Label done, loop; | 1510 Register const result = v0; |
1511 __ LoadRoot(v0, Heap::kTrueValueRootIndex); | 1511 Label done, loop, proxy_case; |
| 1512 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
1512 __ LoadRoot(null, Heap::kNullValueRootIndex); | 1513 __ LoadRoot(null, Heap::kNullValueRootIndex); |
1513 __ bind(&loop); | 1514 __ bind(&loop); |
1514 __ lw(object_prototype, FieldMemOperand(object_map, Map::kPrototypeOffset)); | 1515 __ lbu(object_instance_type, |
1515 __ Branch(&done, eq, object_prototype, Operand(function_prototype)); | 1516 FieldMemOperand(object_map, Map::kInstanceTypeOffset)); |
1516 __ Branch(USE_DELAY_SLOT, &loop, ne, object_prototype, Operand(null)); | 1517 __ Branch(&proxy_case, eq, object_instance_type, Operand(JS_PROXY_TYPE)); |
1517 __ lw(object_map, FieldMemOperand(object_prototype, HeapObject::kMapOffset)); | 1518 __ lw(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); |
1518 __ LoadRoot(v0, Heap::kFalseValueRootIndex); | 1519 __ Branch(&done, eq, object, Operand(function_prototype)); |
| 1520 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null)); |
| 1521 __ lw(object_map, |
| 1522 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot. |
| 1523 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
1519 __ bind(&done); | 1524 __ bind(&done); |
1520 __ Ret(USE_DELAY_SLOT); | 1525 __ Ret(USE_DELAY_SLOT); |
1521 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. | 1526 __ StoreRoot(result, |
| 1527 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. |
1522 | 1528 |
1523 // Slow-case: Call the runtime function. | 1529 // Proxy-case: Call the %HasInPrototypeChain runtime function. |
| 1530 __ bind(&proxy_case); |
| 1531 __ Push(object, function_prototype); |
| 1532 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1); |
| 1533 |
| 1534 // Slow-case: Call the %InstanceOf runtime function. |
1524 __ bind(&slow_case); | 1535 __ bind(&slow_case); |
1525 __ Push(object, function); | 1536 __ Push(object, function); |
1526 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); | 1537 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); |
1527 } | 1538 } |
1528 | 1539 |
1529 | 1540 |
1530 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 1541 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
1531 Label miss; | 1542 Label miss; |
1532 Register receiver = LoadDescriptor::ReceiverRegister(); | 1543 Register receiver = LoadDescriptor::ReceiverRegister(); |
1533 // Ensure that the vector and slot registers won't be clobbered before | 1544 // Ensure that the vector and slot registers won't be clobbered before |
(...skipping 4052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5586 MemOperand(fp, 6 * kPointerSize), NULL); | 5597 MemOperand(fp, 6 * kPointerSize), NULL); |
5587 } | 5598 } |
5588 | 5599 |
5589 | 5600 |
5590 #undef __ | 5601 #undef __ |
5591 | 5602 |
5592 } // namespace internal | 5603 } // namespace internal |
5593 } // namespace v8 | 5604 } // namespace v8 |
5594 | 5605 |
5595 #endif // V8_TARGET_ARCH_MIPS | 5606 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |