| 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 #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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 // NOTICE! This code is only reached after a smi-fast-case check, so | 556 // NOTICE! This code is only reached after a smi-fast-case check, so |
| 557 // it is certain that at least one operand isn't a smi. | 557 // it is certain that at least one operand isn't a smi. |
| 558 | 558 |
| 559 // Handle the case where the objects are identical. Either returns the answer | 559 // Handle the case where the objects are identical. Either returns the answer |
| 560 // or goes to slow. Only falls through if the objects were not identical. | 560 // or goes to slow. Only falls through if the objects were not identical. |
| 561 EmitIdenticalObjectComparison(masm, &slow, cc); | 561 EmitIdenticalObjectComparison(masm, &slow, cc); |
| 562 | 562 |
| 563 // If either is a Smi (we know that not both are), then they can only | 563 // If either is a Smi (we know that not both are), then they can only |
| 564 // be strictly equal if the other is a HeapNumber. | 564 // be strictly equal if the other is a HeapNumber. |
| 565 STATIC_ASSERT(kSmiTag == 0); | 565 STATIC_ASSERT(kSmiTag == 0); |
| 566 DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero); | 566 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
| 567 __ And(a6, lhs, Operand(rhs)); | 567 __ And(a6, lhs, Operand(rhs)); |
| 568 __ JumpIfNotSmi(a6, ¬_smis, a4); | 568 __ JumpIfNotSmi(a6, ¬_smis, a4); |
| 569 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: | 569 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: |
| 570 // 1) Return the answer. | 570 // 1) Return the answer. |
| 571 // 2) Go to slow. | 571 // 2) Go to slow. |
| 572 // 3) Fall through to both_loaded_as_doubles. | 572 // 3) Fall through to both_loaded_as_doubles. |
| 573 // 4) Jump to rhs_not_nan. | 573 // 4) Jump to rhs_not_nan. |
| 574 // In cases 3 and 4 we have found out we were dealing with a number-number | 574 // In cases 3 and 4 we have found out we were dealing with a number-number |
| 575 // comparison and the numbers have been loaded into f12 and f14 as doubles, | 575 // comparison and the numbers have been loaded into f12 and f14 as doubles, |
| 576 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. | 576 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. |
| (...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4260 Label allocate, done_allocate; | 4260 Label allocate, done_allocate; |
| 4261 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); | 4261 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); |
| 4262 __ bind(&done_allocate); | 4262 __ bind(&done_allocate); |
| 4263 | 4263 |
| 4264 // Setup the rest parameter array in v0. | 4264 // Setup the rest parameter array in v0. |
| 4265 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); | 4265 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); |
| 4266 __ sd(a1, FieldMemOperand(v0, JSArray::kMapOffset)); | 4266 __ sd(a1, FieldMemOperand(v0, JSArray::kMapOffset)); |
| 4267 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); | 4267 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); |
| 4268 __ sd(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); | 4268 __ sd(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); |
| 4269 __ sd(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); | 4269 __ sd(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); |
| 4270 __ Move(a1, Smi::kZero); | 4270 __ Move(a1, Smi::FromInt(0)); |
| 4271 __ Ret(USE_DELAY_SLOT); | 4271 __ Ret(USE_DELAY_SLOT); |
| 4272 __ sd(a1, FieldMemOperand(v0, JSArray::kLengthOffset)); // In delay slot | 4272 __ sd(a1, FieldMemOperand(v0, JSArray::kLengthOffset)); // In delay slot |
| 4273 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4273 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
| 4274 | 4274 |
| 4275 // Fall back to %AllocateInNewSpace. | 4275 // Fall back to %AllocateInNewSpace. |
| 4276 __ bind(&allocate); | 4276 __ bind(&allocate); |
| 4277 { | 4277 { |
| 4278 FrameScope scope(masm, StackFrame::INTERNAL); | 4278 FrameScope scope(masm, StackFrame::INTERNAL); |
| 4279 __ Push(Smi::FromInt(JSArray::kSize)); | 4279 __ Push(Smi::FromInt(JSArray::kSize)); |
| 4280 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4280 __ CallRuntime(Runtime::kAllocateInNewSpace); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 __ mov(a6, a5); | 4427 __ mov(a6, a5); |
| 4428 | 4428 |
| 4429 __ bind(&try_allocate); | 4429 __ bind(&try_allocate); |
| 4430 | 4430 |
| 4431 // Compute the sizes of backing store, parameter map, and arguments object. | 4431 // Compute the sizes of backing store, parameter map, and arguments object. |
| 4432 // 1. Parameter map, has 2 extra words containing context and backing store. | 4432 // 1. Parameter map, has 2 extra words containing context and backing store. |
| 4433 const int kParameterMapHeaderSize = | 4433 const int kParameterMapHeaderSize = |
| 4434 FixedArray::kHeaderSize + 2 * kPointerSize; | 4434 FixedArray::kHeaderSize + 2 * kPointerSize; |
| 4435 // If there are no mapped parameters, we do not need the parameter_map. | 4435 // If there are no mapped parameters, we do not need the parameter_map. |
| 4436 Label param_map_size; | 4436 Label param_map_size; |
| 4437 DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero); | 4437 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
| 4438 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a6, Operand(zero_reg)); | 4438 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a6, Operand(zero_reg)); |
| 4439 __ mov(t1, zero_reg); // In delay slot: param map size = 0 when a6 == 0. | 4439 __ mov(t1, zero_reg); // In delay slot: param map size = 0 when a6 == 0. |
| 4440 __ SmiScale(t1, a6, kPointerSizeLog2); | 4440 __ SmiScale(t1, a6, kPointerSizeLog2); |
| 4441 __ daddiu(t1, t1, kParameterMapHeaderSize); | 4441 __ daddiu(t1, t1, kParameterMapHeaderSize); |
| 4442 __ bind(¶m_map_size); | 4442 __ bind(¶m_map_size); |
| 4443 | 4443 |
| 4444 // 2. Backing store. | 4444 // 2. Backing store. |
| 4445 __ SmiScale(t2, a5, kPointerSizeLog2); | 4445 __ SmiScale(t2, a5, kPointerSizeLog2); |
| 4446 __ Daddu(t1, t1, Operand(t2)); | 4446 __ Daddu(t1, t1, Operand(t2)); |
| 4447 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); | 4447 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4493 __ Daddu(a4, v0, Operand(JSSloppyArgumentsObject::kSize)); | 4493 __ Daddu(a4, v0, Operand(JSSloppyArgumentsObject::kSize)); |
| 4494 __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset)); | 4494 __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset)); |
| 4495 | 4495 |
| 4496 // v0 = address of new object (tagged) | 4496 // v0 = address of new object (tagged) |
| 4497 // a2 = argument count (tagged) | 4497 // a2 = argument count (tagged) |
| 4498 // a4 = address of parameter map or backing store (tagged) | 4498 // a4 = address of parameter map or backing store (tagged) |
| 4499 // a6 = mapped parameter count (tagged) | 4499 // a6 = mapped parameter count (tagged) |
| 4500 // Initialize parameter map. If there are no mapped arguments, we're done. | 4500 // Initialize parameter map. If there are no mapped arguments, we're done. |
| 4501 Label skip_parameter_map; | 4501 Label skip_parameter_map; |
| 4502 Label skip3; | 4502 Label skip3; |
| 4503 __ Branch(&skip3, ne, a6, Operand(Smi::kZero)); | 4503 __ Branch(&skip3, ne, a6, Operand(Smi::FromInt(0))); |
| 4504 // Move backing store address to a1, because it is | 4504 // Move backing store address to a1, because it is |
| 4505 // expected there when filling in the unmapped arguments. | 4505 // expected there when filling in the unmapped arguments. |
| 4506 __ mov(a1, a4); | 4506 __ mov(a1, a4); |
| 4507 __ bind(&skip3); | 4507 __ bind(&skip3); |
| 4508 | 4508 |
| 4509 __ Branch(&skip_parameter_map, eq, a6, Operand(Smi::kZero)); | 4509 __ Branch(&skip_parameter_map, eq, a6, Operand(Smi::FromInt(0))); |
| 4510 | 4510 |
| 4511 __ LoadRoot(a5, Heap::kSloppyArgumentsElementsMapRootIndex); | 4511 __ LoadRoot(a5, Heap::kSloppyArgumentsElementsMapRootIndex); |
| 4512 __ sd(a5, FieldMemOperand(a4, FixedArray::kMapOffset)); | 4512 __ sd(a5, FieldMemOperand(a4, FixedArray::kMapOffset)); |
| 4513 __ Daddu(a5, a6, Operand(Smi::FromInt(2))); | 4513 __ Daddu(a5, a6, Operand(Smi::FromInt(2))); |
| 4514 __ sd(a5, FieldMemOperand(a4, FixedArray::kLengthOffset)); | 4514 __ sd(a5, FieldMemOperand(a4, FixedArray::kLengthOffset)); |
| 4515 __ sd(cp, FieldMemOperand(a4, FixedArray::kHeaderSize + 0 * kPointerSize)); | 4515 __ sd(cp, FieldMemOperand(a4, FixedArray::kHeaderSize + 0 * kPointerSize)); |
| 4516 __ SmiScale(t2, a6, kPointerSizeLog2); | 4516 __ SmiScale(t2, a6, kPointerSizeLog2); |
| 4517 __ Daddu(a5, a4, Operand(t2)); | 4517 __ Daddu(a5, a4, Operand(t2)); |
| 4518 __ Daddu(a5, a5, Operand(kParameterMapHeaderSize)); | 4518 __ Daddu(a5, a5, Operand(kParameterMapHeaderSize)); |
| 4519 __ sd(a5, FieldMemOperand(a4, FixedArray::kHeaderSize + 1 * kPointerSize)); | 4519 __ sd(a5, FieldMemOperand(a4, FixedArray::kHeaderSize + 1 * kPointerSize)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4546 __ Dsubu(a5, a5, Operand(Smi::FromInt(1))); | 4546 __ Dsubu(a5, a5, Operand(Smi::FromInt(1))); |
| 4547 __ SmiScale(a0, a5, kPointerSizeLog2); | 4547 __ SmiScale(a0, a5, kPointerSizeLog2); |
| 4548 __ Daddu(a0, a0, Operand(kParameterMapHeaderSize - kHeapObjectTag)); | 4548 __ Daddu(a0, a0, Operand(kParameterMapHeaderSize - kHeapObjectTag)); |
| 4549 __ Daddu(t2, a4, a0); | 4549 __ Daddu(t2, a4, a0); |
| 4550 __ sd(t1, MemOperand(t2)); | 4550 __ sd(t1, MemOperand(t2)); |
| 4551 __ Dsubu(a0, a0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); | 4551 __ Dsubu(a0, a0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); |
| 4552 __ Daddu(t2, a1, a0); | 4552 __ Daddu(t2, a1, a0); |
| 4553 __ sd(a7, MemOperand(t2)); | 4553 __ sd(a7, MemOperand(t2)); |
| 4554 __ Daddu(t1, t1, Operand(Smi::FromInt(1))); | 4554 __ Daddu(t1, t1, Operand(Smi::FromInt(1))); |
| 4555 __ bind(¶meters_test); | 4555 __ bind(¶meters_test); |
| 4556 __ Branch(¶meters_loop, ne, a5, Operand(Smi::kZero)); | 4556 __ Branch(¶meters_loop, ne, a5, Operand(Smi::FromInt(0))); |
| 4557 | 4557 |
| 4558 // Restore t1 = argument count (tagged). | 4558 // Restore t1 = argument count (tagged). |
| 4559 __ ld(a5, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset)); | 4559 __ ld(a5, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset)); |
| 4560 | 4560 |
| 4561 __ bind(&skip_parameter_map); | 4561 __ bind(&skip_parameter_map); |
| 4562 // v0 = address of new object (tagged) | 4562 // v0 = address of new object (tagged) |
| 4563 // a1 = address of backing store (tagged) | 4563 // a1 = address of backing store (tagged) |
| 4564 // a5 = argument count (tagged) | 4564 // a5 = argument count (tagged) |
| 4565 // a6 = mapped parameter count (tagged) | 4565 // a6 = mapped parameter count (tagged) |
| 4566 // t1 = scratch | 4566 // t1 = scratch |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5093 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); | 5093 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); |
| 5094 __ sd(scratch, MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize)); | 5094 __ sd(scratch, MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize)); |
| 5095 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 5095 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 5096 __ sd(scratch, MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize)); | 5096 __ sd(scratch, MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize)); |
| 5097 __ sd(scratch, MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) * | 5097 __ sd(scratch, MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) * |
| 5098 kPointerSize)); | 5098 kPointerSize)); |
| 5099 __ li(scratch, Operand(ExternalReference::isolate_address(isolate()))); | 5099 __ li(scratch, Operand(ExternalReference::isolate_address(isolate()))); |
| 5100 __ sd(scratch, MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize)); | 5100 __ sd(scratch, MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize)); |
| 5101 __ sd(holder, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize)); | 5101 __ sd(holder, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize)); |
| 5102 // should_throw_on_error -> false | 5102 // should_throw_on_error -> false |
| 5103 DCHECK(Smi::kZero == nullptr); | 5103 DCHECK(Smi::FromInt(0) == nullptr); |
| 5104 __ sd(zero_reg, | 5104 __ sd(zero_reg, |
| 5105 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize)); | 5105 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize)); |
| 5106 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); | 5106 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); |
| 5107 __ sd(scratch, MemOperand(sp, 0 * kPointerSize)); | 5107 __ sd(scratch, MemOperand(sp, 0 * kPointerSize)); |
| 5108 | 5108 |
| 5109 // v8::PropertyCallbackInfo::args_ array and name handle. | 5109 // v8::PropertyCallbackInfo::args_ array and name handle. |
| 5110 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5110 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5111 | 5111 |
| 5112 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5112 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
| 5113 __ mov(a0, sp); // a0 = Handle<Name> | 5113 __ mov(a0, sp); // a0 = Handle<Name> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5137 kStackUnwindSpace, kInvalidStackOffset, | 5137 kStackUnwindSpace, kInvalidStackOffset, |
| 5138 return_value_operand, NULL); | 5138 return_value_operand, NULL); |
| 5139 } | 5139 } |
| 5140 | 5140 |
| 5141 #undef __ | 5141 #undef __ |
| 5142 | 5142 |
| 5143 } // namespace internal | 5143 } // namespace internal |
| 5144 } // namespace v8 | 5144 } // namespace v8 |
| 5145 | 5145 |
| 5146 #endif // V8_TARGET_ARCH_MIPS64 | 5146 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |