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 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 __ stop("stop-at"); | 123 __ stop("stop-at"); |
124 } | 124 } |
125 #endif | 125 #endif |
126 | 126 |
127 if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { | 127 if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { |
128 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 128 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
129 __ ld(a2, MemOperand(sp, receiver_offset)); | 129 __ ld(a2, MemOperand(sp, receiver_offset)); |
130 __ AssertNotSmi(a2); | 130 __ AssertNotSmi(a2); |
131 __ GetObjectType(a2, a2, a2); | 131 __ GetObjectType(a2, a2, a2); |
132 __ Check(ge, kSloppyFunctionExpectsJSReceiverReceiver, a2, | 132 __ Check(ge, kSloppyFunctionExpectsJSReceiverReceiver, a2, |
133 Operand(FIRST_SPEC_OBJECT_TYPE)); | 133 Operand(FIRST_JS_RECEIVER_TYPE)); |
134 } | 134 } |
135 | 135 |
136 // Open a frame scope to indicate that there is a frame on the stack. The | 136 // Open a frame scope to indicate that there is a frame on the stack. The |
137 // MANUAL indicates that the scope shouldn't actually generate code to set up | 137 // MANUAL indicates that the scope shouldn't actually generate code to set up |
138 // the frame (that is done below). | 138 // the frame (that is done below). |
139 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 139 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
140 info->set_prologue_offset(masm_->pc_offset()); | 140 info->set_prologue_offset(masm_->pc_offset()); |
141 __ Prologue(info->IsCodePreAgingActive()); | 141 __ Prologue(info->IsCodePreAgingActive()); |
142 | 142 |
143 { Comment cmnt(masm_, "[ Allocate locals"); | 143 { Comment cmnt(masm_, "[ Allocate locals"); |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 __ Branch(&exit, eq, a0, Operand(at)); | 1037 __ Branch(&exit, eq, a0, Operand(at)); |
1038 Register null_value = a5; | 1038 Register null_value = a5; |
1039 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1039 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1040 __ Branch(&exit, eq, a0, Operand(null_value)); | 1040 __ Branch(&exit, eq, a0, Operand(null_value)); |
1041 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1041 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
1042 __ mov(a0, v0); | 1042 __ mov(a0, v0); |
1043 // Convert the object to a JS object. | 1043 // Convert the object to a JS object. |
1044 Label convert, done_convert; | 1044 Label convert, done_convert; |
1045 __ JumpIfSmi(a0, &convert); | 1045 __ JumpIfSmi(a0, &convert); |
1046 __ GetObjectType(a0, a1, a1); | 1046 __ GetObjectType(a0, a1, a1); |
1047 __ Branch(&done_convert, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 1047 __ Branch(&done_convert, ge, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
1048 __ bind(&convert); | 1048 __ bind(&convert); |
1049 ToObjectStub stub(isolate()); | 1049 ToObjectStub stub(isolate()); |
1050 __ CallStub(&stub); | 1050 __ CallStub(&stub); |
1051 __ mov(a0, v0); | 1051 __ mov(a0, v0); |
1052 __ bind(&done_convert); | 1052 __ bind(&done_convert); |
1053 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 1053 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
1054 __ push(a0); | 1054 __ push(a0); |
1055 | 1055 |
1056 // Check for proxies. | 1056 // Check for proxies. |
1057 Label call_runtime; | 1057 Label call_runtime; |
1058 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1058 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1059 __ GetObjectType(a0, a1, a1); | 1059 __ GetObjectType(a0, a1, a1); |
1060 __ Branch(&call_runtime, le, a1, Operand(LAST_JS_PROXY_TYPE)); | 1060 __ Branch(&call_runtime, le, a1, Operand(LAST_JS_PROXY_TYPE)); |
1061 | 1061 |
1062 // Check cache validity in generated code. This is a fast case for | 1062 // Check cache validity in generated code. This is a fast case for |
1063 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1063 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
1064 // guarantee cache validity, call the runtime system to check cache | 1064 // guarantee cache validity, call the runtime system to check cache |
1065 // validity or get the property names in a fixed array. | 1065 // validity or get the property names in a fixed array. |
1066 __ CheckEnumCache(null_value, &call_runtime); | 1066 __ CheckEnumCache(null_value, &call_runtime); |
1067 | 1067 |
1068 // The enum cache is valid. Load the map of the object being | 1068 // The enum cache is valid. Load the map of the object being |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 Label non_proxy; | 1110 Label non_proxy; |
1111 __ bind(&fixed_array); | 1111 __ bind(&fixed_array); |
1112 | 1112 |
1113 __ EmitLoadTypeFeedbackVector(a1); | 1113 __ EmitLoadTypeFeedbackVector(a1); |
1114 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1114 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1115 int vector_index = SmiFromSlot(slot)->value(); | 1115 int vector_index = SmiFromSlot(slot)->value(); |
1116 __ sd(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index))); | 1116 __ sd(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index))); |
1117 | 1117 |
1118 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1118 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1119 __ ld(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1119 __ ld(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1120 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1120 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1121 __ GetObjectType(a2, a3, a3); | 1121 __ GetObjectType(a2, a3, a3); |
1122 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); | 1122 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); |
1123 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1123 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1124 __ bind(&non_proxy); | 1124 __ bind(&non_proxy); |
1125 __ Push(a1, v0); // Smi and array | 1125 __ Push(a1, v0); // Smi and array |
1126 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 1126 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
1127 __ li(a0, Operand(Smi::FromInt(0))); | 1127 __ li(a0, Operand(Smi::FromInt(0))); |
1128 __ Push(a1, a0); // Fixed array length (as smi) and initial index. | 1128 __ Push(a1, a0); // Fixed array length (as smi) and initial index. |
1129 | 1129 |
1130 // Generate code for doing the condition check. | 1130 // Generate code for doing the condition check. |
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 Label materialize_true, materialize_false; | 3098 Label materialize_true, materialize_false; |
3099 Label* if_true = NULL; | 3099 Label* if_true = NULL; |
3100 Label* if_false = NULL; | 3100 Label* if_false = NULL; |
3101 Label* fall_through = NULL; | 3101 Label* fall_through = NULL; |
3102 context()->PrepareTest(&materialize_true, &materialize_false, | 3102 context()->PrepareTest(&materialize_true, &materialize_false, |
3103 &if_true, &if_false, &fall_through); | 3103 &if_true, &if_false, &fall_through); |
3104 | 3104 |
3105 __ JumpIfSmi(v0, if_false); | 3105 __ JumpIfSmi(v0, if_false); |
3106 __ GetObjectType(v0, a1, a1); | 3106 __ GetObjectType(v0, a1, a1); |
3107 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3107 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3108 Split(ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE), | 3108 Split(ge, a1, Operand(FIRST_JS_RECEIVER_TYPE), |
3109 if_true, if_false, fall_through); | 3109 if_true, if_false, fall_through); |
3110 | 3110 |
3111 context()->Plug(if_true, if_false); | 3111 context()->Plug(if_true, if_false); |
3112 } | 3112 } |
3113 | 3113 |
3114 | 3114 |
3115 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { | 3115 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { |
3116 ZoneList<Expression*>* args = expr->arguments(); | 3116 ZoneList<Expression*>* args = expr->arguments(); |
3117 DCHECK(args->length() == 1); | 3117 DCHECK(args->length() == 1); |
3118 | 3118 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3379 | 3379 |
3380 // If the object is a smi, we return null. | 3380 // If the object is a smi, we return null. |
3381 __ JumpIfSmi(v0, &null); | 3381 __ JumpIfSmi(v0, &null); |
3382 | 3382 |
3383 // Check that the object is a JS object but take special care of JS | 3383 // Check that the object is a JS object but take special care of JS |
3384 // functions to make sure they have 'Function' as their class. | 3384 // functions to make sure they have 'Function' as their class. |
3385 // Assume that there are only two callable types, and one of them is at | 3385 // Assume that there are only two callable types, and one of them is at |
3386 // either end of the type range for JS object types. Saves extra comparisons. | 3386 // either end of the type range for JS object types. Saves extra comparisons. |
3387 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 3387 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
3388 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 3388 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
3389 __ Branch(&null, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 3389 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
3390 | 3390 |
3391 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3391 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
3392 FIRST_SPEC_OBJECT_TYPE + 1); | 3392 FIRST_JS_RECEIVER_TYPE + 1); |
3393 __ Branch(&function, eq, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 3393 __ Branch(&function, eq, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
3394 | 3394 |
3395 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3395 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
3396 LAST_SPEC_OBJECT_TYPE - 1); | 3396 LAST_JS_RECEIVER_TYPE - 1); |
3397 __ Branch(&function, eq, a1, Operand(LAST_SPEC_OBJECT_TYPE)); | 3397 __ Branch(&function, eq, a1, Operand(LAST_JS_RECEIVER_TYPE)); |
3398 // Assume that there is no larger type. | 3398 // Assume that there is no larger type. |
3399 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 3399 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
3400 | 3400 |
3401 // Check if the constructor in the map is a JS function. | 3401 // Check if the constructor in the map is a JS function. |
3402 Register instance_type = a2; | 3402 Register instance_type = a2; |
3403 __ GetMapConstructor(v0, v0, a1, instance_type); | 3403 __ GetMapConstructor(v0, v0, a1, instance_type); |
3404 __ Branch(&non_function_constructor, ne, instance_type, | 3404 __ Branch(&non_function_constructor, ne, instance_type, |
3405 Operand(JS_FUNCTION_TYPE)); | 3405 Operand(JS_FUNCTION_TYPE)); |
3406 | 3406 |
3407 // v0 now contains the constructor function. Grab the | 3407 // v0 now contains the constructor function. Grab the |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4651 __ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); | 4651 __ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); |
4652 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4652 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
4653 __ And(a1, a1, | 4653 __ And(a1, a1, |
4654 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 4654 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
4655 Split(eq, a1, Operand(1 << Map::kIsCallable), if_true, if_false, | 4655 Split(eq, a1, Operand(1 << Map::kIsCallable), if_true, if_false, |
4656 fall_through); | 4656 fall_through); |
4657 } else if (String::Equals(check, factory->object_string())) { | 4657 } else if (String::Equals(check, factory->object_string())) { |
4658 __ JumpIfSmi(v0, if_false); | 4658 __ JumpIfSmi(v0, if_false); |
4659 __ LoadRoot(at, Heap::kNullValueRootIndex); | 4659 __ LoadRoot(at, Heap::kNullValueRootIndex); |
4660 __ Branch(if_true, eq, v0, Operand(at)); | 4660 __ Branch(if_true, eq, v0, Operand(at)); |
4661 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 4661 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
4662 __ GetObjectType(v0, v0, a1); | 4662 __ GetObjectType(v0, v0, a1); |
4663 __ Branch(if_false, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 4663 __ Branch(if_false, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
4664 // Check for callable or undetectable objects => false. | 4664 // Check for callable or undetectable objects => false. |
4665 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4665 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
4666 __ And(a1, a1, | 4666 __ And(a1, a1, |
4667 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 4667 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
4668 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); | 4668 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); |
4669 // clang-format off | 4669 // clang-format off |
4670 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ | 4670 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
4671 } else if (String::Equals(check, factory->type##_string())) { \ | 4671 } else if (String::Equals(check, factory->type##_string())) { \ |
4672 __ JumpIfSmi(v0, if_false); \ | 4672 __ JumpIfSmi(v0, if_false); \ |
4673 __ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); \ | 4673 __ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); \ |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4977 reinterpret_cast<uint64_t>( | 4977 reinterpret_cast<uint64_t>( |
4978 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4978 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4979 return OSR_AFTER_STACK_CHECK; | 4979 return OSR_AFTER_STACK_CHECK; |
4980 } | 4980 } |
4981 | 4981 |
4982 | 4982 |
4983 } // namespace internal | 4983 } // namespace internal |
4984 } // namespace v8 | 4984 } // namespace v8 |
4985 | 4985 |
4986 #endif // V8_TARGET_ARCH_MIPS64 | 4986 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |