Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // Always emit a 'return undefined' in case control fell off the end of 355 // Always emit a 'return undefined' in case control fell off the end of
356 // the body. 356 // the body.
357 { Comment cmnt(masm_, "[ return <undefined>;"); 357 { Comment cmnt(masm_, "[ return <undefined>;");
358 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 358 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
359 } 359 }
360 EmitReturnSequence(); 360 EmitReturnSequence();
361 } 361 }
362 362
363 363
364 void FullCodeGenerator::ClearAccumulator() { 364 void FullCodeGenerator::ClearAccumulator() {
365 DCHECK(Smi::kZero == 0); 365 DCHECK(Smi::FromInt(0) == 0);
366 __ mov(v0, zero_reg); 366 __ mov(v0, zero_reg);
367 } 367 }
368 368
369 369
370 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { 370 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) {
371 __ li(a2, Operand(profiling_counter_)); 371 __ li(a2, Operand(profiling_counter_));
372 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); 372 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset));
373 __ Subu(a3, a3, Operand(Smi::FromInt(delta))); 373 __ Subu(a3, a3, Operand(Smi::FromInt(delta)));
374 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); 374 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset));
375 } 375 }
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 Label fixed_array; 1044 Label fixed_array;
1045 __ lw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); 1045 __ lw(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 __ lw(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheOffset)); 1057 __ lw(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheOffset));
1058 __ lw(a2, FieldMemOperand(a2, DescriptorArray::kEnumCacheBridgeCacheOffset)); 1058 __ lw(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 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); 1075 __ lw(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 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); 1086 __ lw(a0, MemOperand(sp, 0 * kPointerSize));
1087 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); 1087 __ lw(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
1923 __ SubBranchOvf(v0, left, Operand(right), &stub_call); 1923 __ SubBranchOvf(v0, left, Operand(right), &stub_call);
1924 break; 1924 break;
1925 case Token::MUL: { 1925 case Token::MUL: {
1926 __ SmiUntag(scratch1, right); 1926 __ SmiUntag(scratch1, right);
1927 __ Mul(scratch2, v0, left, scratch1); 1927 __ Mul(scratch2, v0, left, scratch1);
1928 __ sra(scratch1, v0, 31); 1928 __ sra(scratch1, v0, 31);
1929 __ Branch(&stub_call, ne, scratch1, Operand(scratch2)); 1929 __ Branch(&stub_call, ne, scratch1, Operand(scratch2));
1930 __ Branch(&done, ne, v0, Operand(zero_reg)); 1930 __ Branch(&done, ne, v0, Operand(zero_reg));
1931 __ Addu(scratch2, right, left); 1931 __ Addu(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
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 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 3092 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
3093 EmitNamedPropertyLoad(prop); 3093 EmitNamedPropertyLoad(prop);
3094 break; 3094 break;
3095 } 3095 }
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 reinterpret_cast<uint32_t>( 3672 reinterpret_cast<uint32_t>(
3673 isolate->builtins()->OnStackReplacement()->entry())); 3673 isolate->builtins()->OnStackReplacement()->entry()));
3674 return ON_STACK_REPLACEMENT; 3674 return ON_STACK_REPLACEMENT;
3675 } 3675 }
3676 3676
3677 3677
3678 } // namespace internal 3678 } // namespace internal
3679 } // namespace v8 3679 } // namespace v8
3680 3680
3681 #endif // V8_TARGET_ARCH_MIPS 3681 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698