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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // Always emit a 'return undefined' in case control fell off the end of | 354 // Always emit a 'return undefined' in case control fell off the end of |
355 // the body. | 355 // the body. |
356 { Comment cmnt(masm_, "[ return <undefined>;"); | 356 { Comment cmnt(masm_, "[ return <undefined>;"); |
357 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 357 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
358 } | 358 } |
359 EmitReturnSequence(); | 359 EmitReturnSequence(); |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 void FullCodeGenerator::ClearAccumulator() { | 363 void FullCodeGenerator::ClearAccumulator() { |
364 DCHECK(Smi::kZero == 0); | 364 DCHECK(Smi::FromInt(0) == 0); |
365 __ mov(v0, zero_reg); | 365 __ mov(v0, zero_reg); |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 369 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
370 __ li(a2, Operand(profiling_counter_)); | 370 __ li(a2, Operand(profiling_counter_)); |
371 __ ld(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 371 __ ld(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
372 __ Dsubu(a3, a3, Operand(Smi::FromInt(delta))); | 372 __ Dsubu(a3, a3, Operand(Smi::FromInt(delta))); |
373 __ sd(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 373 __ sd(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
374 } | 374 } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 Label fixed_array; | 1044 Label fixed_array; |
1045 __ ld(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | 1045 __ ld(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); |
1046 __ LoadRoot(at, Heap::kMetaMapRootIndex); | 1046 __ LoadRoot(at, Heap::kMetaMapRootIndex); |
1047 __ Branch(&fixed_array, ne, a2, Operand(at)); | 1047 __ Branch(&fixed_array, ne, a2, Operand(at)); |
1048 | 1048 |
1049 // We got a map in register v0. Get the enumeration cache from it. | 1049 // We got a map in register v0. Get the enumeration cache from it. |
1050 Label no_descriptors; | 1050 Label no_descriptors; |
1051 __ bind(&use_cache); | 1051 __ bind(&use_cache); |
1052 | 1052 |
1053 __ EnumLength(a1, v0); | 1053 __ EnumLength(a1, v0); |
1054 __ Branch(&no_descriptors, eq, a1, Operand(Smi::kZero)); | 1054 __ Branch(&no_descriptors, eq, a1, Operand(Smi::FromInt(0))); |
1055 | 1055 |
1056 __ LoadInstanceDescriptors(v0, a2); | 1056 __ LoadInstanceDescriptors(v0, a2); |
1057 __ ld(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheOffset)); | 1057 __ ld(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheOffset)); |
1058 __ ld(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 1058 __ ld(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
1059 | 1059 |
1060 // Set up the four remaining stack slots. | 1060 // Set up the four remaining stack slots. |
1061 __ li(a0, Operand(Smi::kZero)); | 1061 __ li(a0, Operand(Smi::FromInt(0))); |
1062 // Push map, enumeration cache, enumeration cache length (as smi) and zero. | 1062 // Push map, enumeration cache, enumeration cache length (as smi) and zero. |
1063 __ Push(v0, a2, a1, a0); | 1063 __ Push(v0, a2, a1, a0); |
1064 __ jmp(&loop); | 1064 __ jmp(&loop); |
1065 | 1065 |
1066 __ bind(&no_descriptors); | 1066 __ bind(&no_descriptors); |
1067 __ Drop(1); | 1067 __ Drop(1); |
1068 __ jmp(&exit); | 1068 __ jmp(&exit); |
1069 | 1069 |
1070 // We got a fixed array in register v0. Iterate through that. | 1070 // We got a fixed array in register v0. Iterate through that. |
1071 __ bind(&fixed_array); | 1071 __ bind(&fixed_array); |
1072 | 1072 |
1073 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check | 1073 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check |
1074 __ Push(a1, v0); // Smi and array | 1074 __ Push(a1, v0); // Smi and array |
1075 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 1075 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
1076 __ Push(a1); // Fixed array length (as smi). | 1076 __ Push(a1); // Fixed array length (as smi). |
1077 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); | 1077 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); |
1078 __ li(a0, Operand(Smi::kZero)); | 1078 __ li(a0, Operand(Smi::FromInt(0))); |
1079 __ Push(a0); // Initial index. | 1079 __ Push(a0); // Initial index. |
1080 | 1080 |
1081 // Generate code for doing the condition check. | 1081 // Generate code for doing the condition check. |
1082 __ bind(&loop); | 1082 __ bind(&loop); |
1083 SetExpressionAsStatementPosition(stmt->each()); | 1083 SetExpressionAsStatementPosition(stmt->each()); |
1084 | 1084 |
1085 // Load the current count to a0, load the length to a1. | 1085 // Load the current count to a0, load the length to a1. |
1086 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); | 1086 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); |
1087 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); | 1087 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); |
1088 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); | 1088 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 break; | 1923 break; |
1924 case Token::MUL: { | 1924 case Token::MUL: { |
1925 __ Dmulh(v0, left, right); | 1925 __ Dmulh(v0, left, right); |
1926 __ dsra32(scratch2, v0, 0); | 1926 __ dsra32(scratch2, v0, 0); |
1927 __ sra(scratch1, v0, 31); | 1927 __ sra(scratch1, v0, 31); |
1928 __ Branch(USE_DELAY_SLOT, &stub_call, ne, scratch2, Operand(scratch1)); | 1928 __ Branch(USE_DELAY_SLOT, &stub_call, ne, scratch2, Operand(scratch1)); |
1929 __ SmiTag(v0); | 1929 __ SmiTag(v0); |
1930 __ Branch(USE_DELAY_SLOT, &done, ne, v0, Operand(zero_reg)); | 1930 __ Branch(USE_DELAY_SLOT, &done, ne, v0, Operand(zero_reg)); |
1931 __ Daddu(scratch2, right, left); | 1931 __ Daddu(scratch2, right, left); |
1932 __ Branch(&stub_call, lt, scratch2, Operand(zero_reg)); | 1932 __ Branch(&stub_call, lt, scratch2, Operand(zero_reg)); |
1933 DCHECK(Smi::kZero == 0); | 1933 DCHECK(Smi::FromInt(0) == 0); |
1934 __ mov(v0, zero_reg); | 1934 __ mov(v0, zero_reg); |
1935 break; | 1935 break; |
1936 } | 1936 } |
1937 case Token::BIT_OR: | 1937 case Token::BIT_OR: |
1938 __ Or(v0, left, Operand(right)); | 1938 __ Or(v0, left, Operand(right)); |
1939 break; | 1939 break; |
1940 case Token::BIT_AND: | 1940 case Token::BIT_AND: |
1941 __ And(v0, left, Operand(right)); | 1941 __ And(v0, left, Operand(right)); |
1942 break; | 1942 break; |
1943 case Token::BIT_XOR: | 1943 case Token::BIT_XOR: |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 LhsKind assign_type = Property::GetAssignType(prop); | 3075 LhsKind assign_type = Property::GetAssignType(prop); |
3076 | 3076 |
3077 // Evaluate expression and get value. | 3077 // Evaluate expression and get value. |
3078 if (assign_type == VARIABLE) { | 3078 if (assign_type == VARIABLE) { |
3079 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 3079 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |
3080 AccumulatorValueContext context(this); | 3080 AccumulatorValueContext context(this); |
3081 EmitVariableLoad(expr->expression()->AsVariableProxy()); | 3081 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
3082 } else { | 3082 } else { |
3083 // Reserve space for result of postfix operation. | 3083 // Reserve space for result of postfix operation. |
3084 if (expr->is_postfix() && !context()->IsEffect()) { | 3084 if (expr->is_postfix() && !context()->IsEffect()) { |
3085 __ li(at, Operand(Smi::kZero)); | 3085 __ li(at, Operand(Smi::FromInt(0))); |
3086 PushOperand(at); | 3086 PushOperand(at); |
3087 } | 3087 } |
3088 switch (assign_type) { | 3088 switch (assign_type) { |
3089 case NAMED_PROPERTY: { | 3089 case NAMED_PROPERTY: { |
3090 // Put the object both on the stack and in the register. | 3090 // Put the object both on the stack and in the register. |
3091 VisitForStackValue(prop->obj()); | 3091 VisitForStackValue(prop->obj()); |
3092 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 3092 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
3093 EmitNamedPropertyLoad(prop); | 3093 EmitNamedPropertyLoad(prop); |
3094 break; | 3094 break; |
3095 } | 3095 } |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3679 reinterpret_cast<uint64_t>( | 3679 reinterpret_cast<uint64_t>( |
3680 isolate->builtins()->OnStackReplacement()->entry())); | 3680 isolate->builtins()->OnStackReplacement()->entry())); |
3681 return ON_STACK_REPLACEMENT; | 3681 return ON_STACK_REPLACEMENT; |
3682 } | 3682 } |
3683 | 3683 |
3684 | 3684 |
3685 } // namespace internal | 3685 } // namespace internal |
3686 } // namespace v8 | 3686 } // namespace v8 |
3687 | 3687 |
3688 #endif // V8_TARGET_ARCH_MIPS64 | 3688 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |