| 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 | 5 |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // -- sp[8 * (argc - 1)] : first argument | 35 // -- sp[8 * (argc - 1)] : first argument |
| 36 // -- sp[8 * agrc] : receiver | 36 // -- sp[8 * agrc] : receiver |
| 37 // ----------------------------------- | 37 // ----------------------------------- |
| 38 | 38 |
| 39 // Insert extra arguments. | 39 // Insert extra arguments. |
| 40 int num_extra_args = 0; | 40 int num_extra_args = 0; |
| 41 if (extra_args == NEEDS_CALLED_FUNCTION) { | 41 if (extra_args == NEEDS_CALLED_FUNCTION) { |
| 42 num_extra_args = 1; | 42 num_extra_args = 1; |
| 43 __ push(a1); | 43 __ push(a1); |
| 44 } else { | 44 } else { |
| 45 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); | 45 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // JumpToExternalReference expects s0 to contain the number of arguments | 48 // JumpToExternalReference expects s0 to contain the number of arguments |
| 49 // including the receiver and the extra arguments. | 49 // including the receiver and the extra arguments. |
| 50 __ Daddu(s0, a0, num_extra_args + 1); | 50 __ Daddu(s0, a0, num_extra_args + 1); |
| 51 __ dsll(s1, s0, kPointerSizeLog2); | 51 __ dsll(s1, s0, kPointerSizeLog2); |
| 52 __ Dsubu(s1, s1, kPointerSize); | 52 __ Dsubu(s1, s1, kPointerSize); |
| 53 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 53 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 54 } | 54 } |
| 55 | 55 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 bool create_memento) { | 322 bool create_memento) { |
| 323 // ----------- S t a t e ------------- | 323 // ----------- S t a t e ------------- |
| 324 // -- a0 : number of arguments | 324 // -- a0 : number of arguments |
| 325 // -- a1 : constructor function | 325 // -- a1 : constructor function |
| 326 // -- a2 : allocation site or undefined | 326 // -- a2 : allocation site or undefined |
| 327 // -- ra : return address | 327 // -- ra : return address |
| 328 // -- sp[...]: constructor arguments | 328 // -- sp[...]: constructor arguments |
| 329 // ----------------------------------- | 329 // ----------------------------------- |
| 330 | 330 |
| 331 // Should never create mementos for api functions. | 331 // Should never create mementos for api functions. |
| 332 ASSERT(!is_api_function || !create_memento); | 332 DCHECK(!is_api_function || !create_memento); |
| 333 | 333 |
| 334 Isolate* isolate = masm->isolate(); | 334 Isolate* isolate = masm->isolate(); |
| 335 | 335 |
| 336 // ----------- S t a t e ------------- | 336 // ----------- S t a t e ------------- |
| 337 // -- a0 : number of arguments | 337 // -- a0 : number of arguments |
| 338 // -- a1 : constructor function | 338 // -- a1 : constructor function |
| 339 // -- ra : return address | 339 // -- ra : return address |
| 340 // -- sp[...]: constructor arguments | 340 // -- sp[...]: constructor arguments |
| 341 // ----------------------------------- | 341 // ----------------------------------- |
| 342 | 342 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 __ Dsubu(a4, a4, Operand(1 << Map::ConstructionCount::kShift)); | 394 __ Dsubu(a4, a4, Operand(1 << Map::ConstructionCount::kShift)); |
| 395 __ Branch(USE_DELAY_SLOT, | 395 __ Branch(USE_DELAY_SLOT, |
| 396 &allocate, ne, a6, Operand(JSFunction::kFinishSlackTracking)); | 396 &allocate, ne, a6, Operand(JSFunction::kFinishSlackTracking)); |
| 397 __ sw(a4, bit_field3); // In delay slot. | 397 __ sw(a4, bit_field3); // In delay slot. |
| 398 | 398 |
| 399 __ Push(a1, a2, a1); // a1 = Constructor. | 399 __ Push(a1, a2, a1); // a1 = Constructor. |
| 400 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 400 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
| 401 | 401 |
| 402 __ Pop(a1, a2); | 402 __ Pop(a1, a2); |
| 403 // Slack tracking counter is kNoSlackTracking after runtime call. | 403 // Slack tracking counter is kNoSlackTracking after runtime call. |
| 404 ASSERT(JSFunction::kNoSlackTracking == 0); | 404 DCHECK(JSFunction::kNoSlackTracking == 0); |
| 405 __ mov(a6, zero_reg); | 405 __ mov(a6, zero_reg); |
| 406 | 406 |
| 407 __ bind(&allocate); | 407 __ bind(&allocate); |
| 408 } | 408 } |
| 409 | 409 |
| 410 // Now allocate the JSObject on the heap. | 410 // Now allocate the JSObject on the heap. |
| 411 // a1: constructor function | 411 // a1: constructor function |
| 412 // a2: initial map | 412 // a2: initial map |
| 413 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 413 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
| 414 if (create_memento) { | 414 if (create_memento) { |
| 415 __ Daddu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 415 __ Daddu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
| 416 } | 416 } |
| 417 | 417 |
| 418 __ Allocate(a3, t0, t1, t2, &rt_call, SIZE_IN_WORDS); | 418 __ Allocate(a3, t0, t1, t2, &rt_call, SIZE_IN_WORDS); |
| 419 | 419 |
| 420 // Allocated the JSObject, now initialize the fields. Map is set to | 420 // Allocated the JSObject, now initialize the fields. Map is set to |
| 421 // initial map and properties and elements are set to empty fixed array. | 421 // initial map and properties and elements are set to empty fixed array. |
| 422 // a1: constructor function | 422 // a1: constructor function |
| 423 // a2: initial map | 423 // a2: initial map |
| 424 // a3: object size (not including memento if create_memento) | 424 // a3: object size (not including memento if create_memento) |
| 425 // t0: JSObject (not tagged) | 425 // t0: JSObject (not tagged) |
| 426 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex); | 426 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex); |
| 427 __ mov(t1, t0); | 427 __ mov(t1, t0); |
| 428 __ sd(a2, MemOperand(t1, JSObject::kMapOffset)); | 428 __ sd(a2, MemOperand(t1, JSObject::kMapOffset)); |
| 429 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset)); | 429 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset)); |
| 430 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset)); | 430 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset)); |
| 431 __ Daddu(t1, t1, Operand(3*kPointerSize)); | 431 __ Daddu(t1, t1, Operand(3*kPointerSize)); |
| 432 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); | 432 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 433 ASSERT_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); | 433 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); |
| 434 ASSERT_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 434 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
| 435 | 435 |
| 436 // Fill all the in-object properties with appropriate filler. | 436 // Fill all the in-object properties with appropriate filler. |
| 437 // a1: constructor function | 437 // a1: constructor function |
| 438 // a2: initial map | 438 // a2: initial map |
| 439 // a3: object size (in words, including memento if create_memento) | 439 // a3: object size (in words, including memento if create_memento) |
| 440 // t0: JSObject (not tagged) | 440 // t0: JSObject (not tagged) |
| 441 // t1: First in-object property of JSObject (not tagged) | 441 // t1: First in-object property of JSObject (not tagged) |
| 442 // a6: slack tracking counter (non-API function case) | 442 // a6: slack tracking counter (non-API function case) |
| 443 ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); | 443 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize); |
| 444 | 444 |
| 445 // Use t3 to hold undefined, which is used in several places below. | 445 // Use t3 to hold undefined, which is used in several places below. |
| 446 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); | 446 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
| 447 | 447 |
| 448 if (!is_api_function) { | 448 if (!is_api_function) { |
| 449 Label no_inobject_slack_tracking; | 449 Label no_inobject_slack_tracking; |
| 450 | 450 |
| 451 // Check if slack tracking is enabled. | 451 // Check if slack tracking is enabled. |
| 452 __ Branch(&no_inobject_slack_tracking, | 452 __ Branch(&no_inobject_slack_tracking, |
| 453 eq, | 453 eq, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 477 | 477 |
| 478 if (create_memento) { | 478 if (create_memento) { |
| 479 __ Dsubu(a0, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 479 __ Dsubu(a0, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
| 480 __ dsll(a0, a0, kPointerSizeLog2); | 480 __ dsll(a0, a0, kPointerSizeLog2); |
| 481 __ Daddu(a0, t0, Operand(a0)); // End of object. | 481 __ Daddu(a0, t0, Operand(a0)); // End of object. |
| 482 __ InitializeFieldsWithFiller(t1, a0, t3); | 482 __ InitializeFieldsWithFiller(t1, a0, t3); |
| 483 | 483 |
| 484 // Fill in memento fields. | 484 // Fill in memento fields. |
| 485 // t1: points to the allocated but uninitialized memento. | 485 // t1: points to the allocated but uninitialized memento. |
| 486 __ LoadRoot(t3, Heap::kAllocationMementoMapRootIndex); | 486 __ LoadRoot(t3, Heap::kAllocationMementoMapRootIndex); |
| 487 ASSERT_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); | 487 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); |
| 488 __ sd(t3, MemOperand(t1)); | 488 __ sd(t3, MemOperand(t1)); |
| 489 __ Daddu(t1, t1, kPointerSize); | 489 __ Daddu(t1, t1, kPointerSize); |
| 490 // Load the AllocationSite. | 490 // Load the AllocationSite. |
| 491 __ ld(t3, MemOperand(sp, 2 * kPointerSize)); | 491 __ ld(t3, MemOperand(sp, 2 * kPointerSize)); |
| 492 ASSERT_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); | 492 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); |
| 493 __ sd(t3, MemOperand(t1)); | 493 __ sd(t3, MemOperand(t1)); |
| 494 __ Daddu(t1, t1, kPointerSize); | 494 __ Daddu(t1, t1, kPointerSize); |
| 495 } else { | 495 } else { |
| 496 __ dsll(at, a3, kPointerSizeLog2); | 496 __ dsll(at, a3, kPointerSizeLog2); |
| 497 __ Daddu(a0, t0, Operand(at)); // End of object. | 497 __ Daddu(a0, t0, Operand(at)); // End of object. |
| 498 __ InitializeFieldsWithFiller(t1, a0, t3); | 498 __ InitializeFieldsWithFiller(t1, a0, t3); |
| 499 } | 499 } |
| 500 | 500 |
| 501 // Add the object tag to make the JSObject real, so that we can continue | 501 // Add the object tag to make the JSObject real, so that we can continue |
| 502 // and jump into the continuation code at any time from now on. Any | 502 // and jump into the continuation code at any time from now on. Any |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // t0: JSObject | 546 // t0: JSObject |
| 547 // t1: start of next object | 547 // t1: start of next object |
| 548 __ LoadRoot(t2, Heap::kFixedArrayMapRootIndex); | 548 __ LoadRoot(t2, Heap::kFixedArrayMapRootIndex); |
| 549 __ mov(a2, t1); | 549 __ mov(a2, t1); |
| 550 __ sd(t2, MemOperand(a2, JSObject::kMapOffset)); | 550 __ sd(t2, MemOperand(a2, JSObject::kMapOffset)); |
| 551 // Tag number of elements. | 551 // Tag number of elements. |
| 552 __ dsll32(a0, a3, 0); | 552 __ dsll32(a0, a3, 0); |
| 553 __ sd(a0, MemOperand(a2, FixedArray::kLengthOffset)); | 553 __ sd(a0, MemOperand(a2, FixedArray::kLengthOffset)); |
| 554 __ Daddu(a2, a2, Operand(2 * kPointerSize)); | 554 __ Daddu(a2, a2, Operand(2 * kPointerSize)); |
| 555 | 555 |
| 556 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); | 556 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 557 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); | 557 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
| 558 | 558 |
| 559 // Initialize the fields to undefined. | 559 // Initialize the fields to undefined. |
| 560 // a1: constructor | 560 // a1: constructor |
| 561 // a2: First element of FixedArray (not tagged) | 561 // a2: First element of FixedArray (not tagged) |
| 562 // a3: number of elements in properties array | 562 // a3: number of elements in properties array |
| 563 // t0: JSObject | 563 // t0: JSObject |
| 564 // t1: FixedArray (not tagged) | 564 // t1: FixedArray (not tagged) |
| 565 __ dsll(a7, a3, kPointerSizeLog2); | 565 __ dsll(a7, a3, kPointerSizeLog2); |
| 566 __ daddu(t2, a2, a7); // End of object. | 566 __ daddu(t2, a2, a7); // End of object. |
| 567 ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 567 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
| 568 { Label loop, entry; | 568 { Label loop, entry; |
| 569 if (!is_api_function || create_memento) { | 569 if (!is_api_function || create_memento) { |
| 570 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); | 570 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
| 571 } else if (FLAG_debug_code) { | 571 } else if (FLAG_debug_code) { |
| 572 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); | 572 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); |
| 573 __ Assert(eq, kUndefinedValueNotLoaded, t3, Operand(a6)); | 573 __ Assert(eq, kUndefinedValueNotLoaded, t3, Operand(a6)); |
| 574 } | 574 } |
| 575 __ jmp(&entry); | 575 __ jmp(&entry); |
| 576 __ bind(&loop); | 576 __ bind(&loop); |
| 577 __ sd(t3, MemOperand(a2)); | 577 __ sd(t3, MemOperand(a2)); |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 __ break_(0xCC); | 1588 __ break_(0xCC); |
| 1589 } | 1589 } |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 | 1592 |
| 1593 #undef __ | 1593 #undef __ |
| 1594 | 1594 |
| 1595 } } // namespace v8::internal | 1595 } } // namespace v8::internal |
| 1596 | 1596 |
| 1597 #endif // V8_TARGET_ARCH_MIPS64 | 1597 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |