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

Side by Side Diff: src/mips/code-stubs-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
« no previous file with comments | « src/layout-descriptor-inl.h ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // NOTICE! This code is only reached after a smi-fast-case check, so 559 // NOTICE! This code is only reached after a smi-fast-case check, so
560 // it is certain that at least one operand isn't a smi. 560 // it is certain that at least one operand isn't a smi.
561 561
562 // Handle the case where the objects are identical. Either returns the answer 562 // Handle the case where the objects are identical. Either returns the answer
563 // or goes to slow. Only falls through if the objects were not identical. 563 // or goes to slow. Only falls through if the objects were not identical.
564 EmitIdenticalObjectComparison(masm, &slow, cc); 564 EmitIdenticalObjectComparison(masm, &slow, cc);
565 565
566 // If either is a Smi (we know that not both are), then they can only 566 // If either is a Smi (we know that not both are), then they can only
567 // be strictly equal if the other is a HeapNumber. 567 // be strictly equal if the other is a HeapNumber.
568 STATIC_ASSERT(kSmiTag == 0); 568 STATIC_ASSERT(kSmiTag == 0);
569 DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero); 569 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
570 __ And(t2, lhs, Operand(rhs)); 570 __ And(t2, lhs, Operand(rhs));
571 __ JumpIfNotSmi(t2, &not_smis, t0); 571 __ JumpIfNotSmi(t2, &not_smis, t0);
572 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: 572 // One operand is a smi. EmitSmiNonsmiComparison generates code that can:
573 // 1) Return the answer. 573 // 1) Return the answer.
574 // 2) Go to slow. 574 // 2) Go to slow.
575 // 3) Fall through to both_loaded_as_doubles. 575 // 3) Fall through to both_loaded_as_doubles.
576 // 4) Jump to rhs_not_nan. 576 // 4) Jump to rhs_not_nan.
577 // In cases 3 and 4 we have found out we were dealing with a number-number 577 // In cases 3 and 4 we have found out we were dealing with a number-number
578 // comparison and the numbers have been loaded into f12 and f14 as doubles, 578 // comparison and the numbers have been loaded into f12 and f14 as doubles,
579 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. 579 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU.
(...skipping 3673 matching lines...) Expand 10 before | Expand all | Expand 10 after
4253 Label allocate, done_allocate; 4253 Label allocate, done_allocate;
4254 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); 4254 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS);
4255 __ bind(&done_allocate); 4255 __ bind(&done_allocate);
4256 4256
4257 // Setup the rest parameter array in v0. 4257 // Setup the rest parameter array in v0.
4258 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); 4258 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1);
4259 __ sw(a1, FieldMemOperand(v0, JSArray::kMapOffset)); 4259 __ sw(a1, FieldMemOperand(v0, JSArray::kMapOffset));
4260 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); 4260 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex);
4261 __ sw(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); 4261 __ sw(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset));
4262 __ sw(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); 4262 __ sw(a1, FieldMemOperand(v0, JSArray::kElementsOffset));
4263 __ Move(a1, Smi::kZero); 4263 __ Move(a1, Smi::FromInt(0));
4264 __ Ret(USE_DELAY_SLOT); 4264 __ Ret(USE_DELAY_SLOT);
4265 __ sw(a1, FieldMemOperand(v0, JSArray::kLengthOffset)); // In delay slot 4265 __ sw(a1, FieldMemOperand(v0, JSArray::kLengthOffset)); // In delay slot
4266 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); 4266 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
4267 4267
4268 // Fall back to %AllocateInNewSpace. 4268 // Fall back to %AllocateInNewSpace.
4269 __ bind(&allocate); 4269 __ bind(&allocate);
4270 { 4270 {
4271 FrameScope scope(masm, StackFrame::INTERNAL); 4271 FrameScope scope(masm, StackFrame::INTERNAL);
4272 __ Push(Smi::FromInt(JSArray::kSize)); 4272 __ Push(Smi::FromInt(JSArray::kSize));
4273 __ CallRuntime(Runtime::kAllocateInNewSpace); 4273 __ CallRuntime(Runtime::kAllocateInNewSpace);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 __ mov(t2, t1); 4414 __ mov(t2, t1);
4415 4415
4416 __ bind(&try_allocate); 4416 __ bind(&try_allocate);
4417 4417
4418 // Compute the sizes of backing store, parameter map, and arguments object. 4418 // Compute the sizes of backing store, parameter map, and arguments object.
4419 // 1. Parameter map, has 2 extra words containing context and backing store. 4419 // 1. Parameter map, has 2 extra words containing context and backing store.
4420 const int kParameterMapHeaderSize = 4420 const int kParameterMapHeaderSize =
4421 FixedArray::kHeaderSize + 2 * kPointerSize; 4421 FixedArray::kHeaderSize + 2 * kPointerSize;
4422 // If there are no mapped parameters, we do not need the parameter_map. 4422 // If there are no mapped parameters, we do not need the parameter_map.
4423 Label param_map_size; 4423 Label param_map_size;
4424 DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero); 4424 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
4425 __ Branch(USE_DELAY_SLOT, &param_map_size, eq, t2, Operand(zero_reg)); 4425 __ Branch(USE_DELAY_SLOT, &param_map_size, eq, t2, Operand(zero_reg));
4426 __ mov(t5, zero_reg); // In delay slot: param map size = 0 when t2 == 0. 4426 __ mov(t5, zero_reg); // In delay slot: param map size = 0 when t2 == 0.
4427 __ sll(t5, t2, 1); 4427 __ sll(t5, t2, 1);
4428 __ addiu(t5, t5, kParameterMapHeaderSize); 4428 __ addiu(t5, t5, kParameterMapHeaderSize);
4429 __ bind(&param_map_size); 4429 __ bind(&param_map_size);
4430 4430
4431 // 2. Backing store. 4431 // 2. Backing store.
4432 __ Lsa(t5, t5, t1, 1); 4432 __ Lsa(t5, t5, t1, 1);
4433 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); 4433 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize));
4434 4434
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 __ Addu(t0, v0, Operand(JSSloppyArgumentsObject::kSize)); 4479 __ Addu(t0, v0, Operand(JSSloppyArgumentsObject::kSize));
4480 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); 4480 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
4481 4481
4482 // v0 = address of new object (tagged) 4482 // v0 = address of new object (tagged)
4483 // a2 = argument count (tagged) 4483 // a2 = argument count (tagged)
4484 // t0 = address of parameter map or backing store (tagged) 4484 // t0 = address of parameter map or backing store (tagged)
4485 // t2 = mapped parameter count (tagged) 4485 // t2 = mapped parameter count (tagged)
4486 // Initialize parameter map. If there are no mapped arguments, we're done. 4486 // Initialize parameter map. If there are no mapped arguments, we're done.
4487 Label skip_parameter_map; 4487 Label skip_parameter_map;
4488 Label skip3; 4488 Label skip3;
4489 __ Branch(&skip3, ne, t2, Operand(Smi::kZero)); 4489 __ Branch(&skip3, ne, t2, Operand(Smi::FromInt(0)));
4490 // Move backing store address to a1, because it is 4490 // Move backing store address to a1, because it is
4491 // expected there when filling in the unmapped arguments. 4491 // expected there when filling in the unmapped arguments.
4492 __ mov(a1, t0); 4492 __ mov(a1, t0);
4493 __ bind(&skip3); 4493 __ bind(&skip3);
4494 4494
4495 __ Branch(&skip_parameter_map, eq, t2, Operand(Smi::kZero)); 4495 __ Branch(&skip_parameter_map, eq, t2, Operand(Smi::FromInt(0)));
4496 4496
4497 __ LoadRoot(t1, Heap::kSloppyArgumentsElementsMapRootIndex); 4497 __ LoadRoot(t1, Heap::kSloppyArgumentsElementsMapRootIndex);
4498 __ sw(t1, FieldMemOperand(t0, FixedArray::kMapOffset)); 4498 __ sw(t1, FieldMemOperand(t0, FixedArray::kMapOffset));
4499 __ Addu(t1, t2, Operand(Smi::FromInt(2))); 4499 __ Addu(t1, t2, Operand(Smi::FromInt(2)));
4500 __ sw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset)); 4500 __ sw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset));
4501 __ sw(cp, FieldMemOperand(t0, FixedArray::kHeaderSize + 0 * kPointerSize)); 4501 __ sw(cp, FieldMemOperand(t0, FixedArray::kHeaderSize + 0 * kPointerSize));
4502 __ Lsa(t1, t0, t2, 1); 4502 __ Lsa(t1, t0, t2, 1);
4503 __ Addu(t1, t1, Operand(kParameterMapHeaderSize)); 4503 __ Addu(t1, t1, Operand(kParameterMapHeaderSize));
4504 __ sw(t1, FieldMemOperand(t0, FixedArray::kHeaderSize + 1 * kPointerSize)); 4504 __ sw(t1, FieldMemOperand(t0, FixedArray::kHeaderSize + 1 * kPointerSize));
4505 4505
(...skipping 24 matching lines...) Expand all
4530 __ Subu(t1, t1, Operand(Smi::FromInt(1))); 4530 __ Subu(t1, t1, Operand(Smi::FromInt(1)));
4531 __ sll(a0, t1, 1); 4531 __ sll(a0, t1, 1);
4532 __ Addu(a0, a0, Operand(kParameterMapHeaderSize - kHeapObjectTag)); 4532 __ Addu(a0, a0, Operand(kParameterMapHeaderSize - kHeapObjectTag));
4533 __ Addu(t6, t0, a0); 4533 __ Addu(t6, t0, a0);
4534 __ sw(t5, MemOperand(t6)); 4534 __ sw(t5, MemOperand(t6));
4535 __ Subu(a0, a0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); 4535 __ Subu(a0, a0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize));
4536 __ Addu(t6, a1, a0); 4536 __ Addu(t6, a1, a0);
4537 __ sw(t3, MemOperand(t6)); 4537 __ sw(t3, MemOperand(t6));
4538 __ Addu(t5, t5, Operand(Smi::FromInt(1))); 4538 __ Addu(t5, t5, Operand(Smi::FromInt(1)));
4539 __ bind(&parameters_test); 4539 __ bind(&parameters_test);
4540 __ Branch(&parameters_loop, ne, t1, Operand(Smi::kZero)); 4540 __ Branch(&parameters_loop, ne, t1, Operand(Smi::FromInt(0)));
4541 4541
4542 // t1 = argument count (tagged). 4542 // t1 = argument count (tagged).
4543 __ lw(t1, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset)); 4543 __ lw(t1, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset));
4544 4544
4545 __ bind(&skip_parameter_map); 4545 __ bind(&skip_parameter_map);
4546 // v0 = address of new object (tagged) 4546 // v0 = address of new object (tagged)
4547 // a1 = address of backing store (tagged) 4547 // a1 = address of backing store (tagged)
4548 // t1 = argument count (tagged) 4548 // t1 = argument count (tagged)
4549 // t2 = mapped parameter count (tagged) 4549 // t2 = mapped parameter count (tagged)
4550 // t5 = scratch 4550 // t5 = scratch
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
5067 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); 5067 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset));
5068 __ sw(scratch, MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize)); 5068 __ sw(scratch, MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize));
5069 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 5069 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5070 __ sw(scratch, MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize)); 5070 __ sw(scratch, MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize));
5071 __ sw(scratch, MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) * 5071 __ sw(scratch, MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) *
5072 kPointerSize)); 5072 kPointerSize));
5073 __ li(scratch, Operand(ExternalReference::isolate_address(isolate()))); 5073 __ li(scratch, Operand(ExternalReference::isolate_address(isolate())));
5074 __ sw(scratch, MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize)); 5074 __ sw(scratch, MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize));
5075 __ sw(holder, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize)); 5075 __ sw(holder, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize));
5076 // should_throw_on_error -> false 5076 // should_throw_on_error -> false
5077 DCHECK(Smi::kZero == nullptr); 5077 DCHECK(Smi::FromInt(0) == nullptr);
5078 __ sw(zero_reg, 5078 __ sw(zero_reg,
5079 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize)); 5079 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize));
5080 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); 5080 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
5081 __ sw(scratch, MemOperand(sp, 0 * kPointerSize)); 5081 __ sw(scratch, MemOperand(sp, 0 * kPointerSize));
5082 5082
5083 // v8::PropertyCallbackInfo::args_ array and name handle. 5083 // v8::PropertyCallbackInfo::args_ array and name handle.
5084 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5084 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5085 5085
5086 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. 5086 // Load address of v8::PropertyAccessorInfo::args_ array and name handle.
5087 __ mov(a0, sp); // a0 = Handle<Name> 5087 __ mov(a0, sp); // a0 = Handle<Name>
(...skipping 22 matching lines...) Expand all
5110 kStackUnwindSpace, kInvalidStackOffset, 5110 kStackUnwindSpace, kInvalidStackOffset,
5111 return_value_operand, NULL); 5111 return_value_operand, NULL);
5112 } 5112 }
5113 5113
5114 #undef __ 5114 #undef __
5115 5115
5116 } // namespace internal 5116 } // namespace internal
5117 } // namespace v8 5117 } // namespace v8
5118 5118
5119 #endif // V8_TARGET_ARCH_MIPS 5119 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/layout-descriptor-inl.h ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698