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 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4930 ld(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); | 4930 ld(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); |
4931 bind(&loop); | 4931 bind(&loop); |
4932 JumpIfSmi(result, &done); | 4932 JumpIfSmi(result, &done); |
4933 GetObjectType(result, temp, temp2); | 4933 GetObjectType(result, temp, temp2); |
4934 Branch(&done, ne, temp2, Operand(MAP_TYPE)); | 4934 Branch(&done, ne, temp2, Operand(MAP_TYPE)); |
4935 ld(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); | 4935 ld(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); |
4936 Branch(&loop); | 4936 Branch(&loop); |
4937 bind(&done); | 4937 bind(&done); |
4938 } | 4938 } |
4939 | 4939 |
4940 | |
4941 void MacroAssembler::TryGetFunctionPrototype(Register function, Register result, | |
4942 Register scratch, Label* miss) { | |
4943 // Get the prototype or initial map from the function. | |
4944 ld(result, | |
4945 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | |
4946 | |
4947 // If the prototype or initial map is the hole, don't return it and | |
4948 // simply miss the cache instead. This will allow us to allocate a | |
4949 // prototype object on-demand in the runtime system. | |
4950 LoadRoot(t8, Heap::kTheHoleValueRootIndex); | |
4951 Branch(miss, eq, result, Operand(t8)); | |
4952 | |
4953 // If the function does not have an initial map, we're done. | |
4954 Label done; | |
4955 GetObjectType(result, scratch, scratch); | |
4956 Branch(&done, ne, scratch, Operand(MAP_TYPE)); | |
4957 | |
4958 // Get the prototype from the initial map. | |
4959 ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); | |
4960 | |
4961 // All done. | |
4962 bind(&done); | |
4963 } | |
4964 | |
4965 | |
4966 void MacroAssembler::GetObjectType(Register object, | 4940 void MacroAssembler::GetObjectType(Register object, |
4967 Register map, | 4941 Register map, |
4968 Register type_reg) { | 4942 Register type_reg) { |
4969 ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 4943 ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
4970 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 4944 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
4971 } | 4945 } |
4972 | 4946 |
4973 | 4947 |
4974 // ----------------------------------------------------------------------------- | 4948 // ----------------------------------------------------------------------------- |
4975 // Runtime calls. | 4949 // Runtime calls. |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6925 if (mag.shift > 0) sra(result, result, mag.shift); | 6899 if (mag.shift > 0) sra(result, result, mag.shift); |
6926 srl(at, dividend, 31); | 6900 srl(at, dividend, 31); |
6927 Addu(result, result, Operand(at)); | 6901 Addu(result, result, Operand(at)); |
6928 } | 6902 } |
6929 | 6903 |
6930 | 6904 |
6931 } // namespace internal | 6905 } // namespace internal |
6932 } // namespace v8 | 6906 } // namespace v8 |
6933 | 6907 |
6934 #endif // V8_TARGET_ARCH_MIPS64 | 6908 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |