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_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 // -- sp[4 * (argc - 1)] : first argument | 35 // -- sp[4 * (argc - 1)] : first argument |
36 // -- sp[4 * agrc] : receiver | 36 // -- sp[4 * 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 __ Addu(s0, a0, num_extra_args + 1); | 50 __ Addu(s0, a0, num_extra_args + 1); |
51 __ sll(s1, s0, kPointerSizeLog2); | 51 __ sll(s1, s0, kPointerSizeLog2); |
52 __ Subu(s1, s1, kPointerSize); | 52 __ Subu(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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 __ Subu(t0, t0, Operand(1 << Map::ConstructionCount::kShift)); | 390 __ Subu(t0, t0, Operand(1 << Map::ConstructionCount::kShift)); |
391 __ Branch(USE_DELAY_SLOT, | 391 __ Branch(USE_DELAY_SLOT, |
392 &allocate, ne, t2, Operand(JSFunction::kFinishSlackTracking)); | 392 &allocate, ne, t2, Operand(JSFunction::kFinishSlackTracking)); |
393 __ sw(t0, bit_field3); // In delay slot. | 393 __ sw(t0, bit_field3); // In delay slot. |
394 | 394 |
395 __ Push(a1, a2, a1); // a1 = Constructor. | 395 __ Push(a1, a2, a1); // a1 = Constructor. |
396 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 396 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
397 | 397 |
398 __ Pop(a1, a2); | 398 __ Pop(a1, a2); |
399 // Slack tracking counter is kNoSlackTracking after runtime call. | 399 // Slack tracking counter is kNoSlackTracking after runtime call. |
400 ASSERT(JSFunction::kNoSlackTracking == 0); | 400 DCHECK(JSFunction::kNoSlackTracking == 0); |
401 __ mov(t2, zero_reg); | 401 __ mov(t2, zero_reg); |
402 | 402 |
403 __ bind(&allocate); | 403 __ bind(&allocate); |
404 } | 404 } |
405 | 405 |
406 // Now allocate the JSObject on the heap. | 406 // Now allocate the JSObject on the heap. |
407 // a1: constructor function | 407 // a1: constructor function |
408 // a2: initial map | 408 // a2: initial map |
409 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 409 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
410 if (create_memento) { | 410 if (create_memento) { |
411 __ Addu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 411 __ Addu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
412 } | 412 } |
413 | 413 |
414 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); | 414 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); |
415 | 415 |
416 // Allocated the JSObject, now initialize the fields. Map is set to | 416 // Allocated the JSObject, now initialize the fields. Map is set to |
417 // initial map and properties and elements are set to empty fixed array. | 417 // initial map and properties and elements are set to empty fixed array. |
418 // a1: constructor function | 418 // a1: constructor function |
419 // a2: initial map | 419 // a2: initial map |
420 // a3: object size (not including memento if create_memento) | 420 // a3: object size (not including memento if create_memento) |
421 // t4: JSObject (not tagged) | 421 // t4: JSObject (not tagged) |
422 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); | 422 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); |
423 __ mov(t5, t4); | 423 __ mov(t5, t4); |
424 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); | 424 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); |
425 __ sw(t6, MemOperand(t5, JSObject::kPropertiesOffset)); | 425 __ sw(t6, MemOperand(t5, JSObject::kPropertiesOffset)); |
426 __ sw(t6, MemOperand(t5, JSObject::kElementsOffset)); | 426 __ sw(t6, MemOperand(t5, JSObject::kElementsOffset)); |
427 __ Addu(t5, t5, Operand(3*kPointerSize)); | 427 __ Addu(t5, t5, Operand(3*kPointerSize)); |
428 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); | 428 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
429 ASSERT_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); | 429 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); |
430 ASSERT_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 430 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
431 | 431 |
432 // Fill all the in-object properties with appropriate filler. | 432 // Fill all the in-object properties with appropriate filler. |
433 // a1: constructor function | 433 // a1: constructor function |
434 // a2: initial map | 434 // a2: initial map |
435 // a3: object size (in words, including memento if create_memento) | 435 // a3: object size (in words, including memento if create_memento) |
436 // t4: JSObject (not tagged) | 436 // t4: JSObject (not tagged) |
437 // t5: First in-object property of JSObject (not tagged) | 437 // t5: First in-object property of JSObject (not tagged) |
438 // t2: slack tracking counter (non-API function case) | 438 // t2: slack tracking counter (non-API function case) |
439 ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); | 439 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize); |
440 | 440 |
441 // Use t7 to hold undefined, which is used in several places below. | 441 // Use t7 to hold undefined, which is used in several places below. |
442 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); | 442 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
443 | 443 |
444 if (!is_api_function) { | 444 if (!is_api_function) { |
445 Label no_inobject_slack_tracking; | 445 Label no_inobject_slack_tracking; |
446 | 446 |
447 // Check if slack tracking is enabled. | 447 // Check if slack tracking is enabled. |
448 __ Branch(&no_inobject_slack_tracking, | 448 __ Branch(&no_inobject_slack_tracking, |
449 eq, t2, Operand(JSFunction::kNoSlackTracking)); | 449 eq, t2, Operand(JSFunction::kNoSlackTracking)); |
(...skipping 19 matching lines...) Expand all Loading... |
469 | 469 |
470 if (create_memento) { | 470 if (create_memento) { |
471 __ Subu(a0, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 471 __ Subu(a0, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
472 __ sll(a0, a0, kPointerSizeLog2); | 472 __ sll(a0, a0, kPointerSizeLog2); |
473 __ Addu(a0, t4, Operand(a0)); // End of object. | 473 __ Addu(a0, t4, Operand(a0)); // End of object. |
474 __ InitializeFieldsWithFiller(t5, a0, t7); | 474 __ InitializeFieldsWithFiller(t5, a0, t7); |
475 | 475 |
476 // Fill in memento fields. | 476 // Fill in memento fields. |
477 // t5: points to the allocated but uninitialized memento. | 477 // t5: points to the allocated but uninitialized memento. |
478 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex); | 478 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex); |
479 ASSERT_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); | 479 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); |
480 __ sw(t7, MemOperand(t5)); | 480 __ sw(t7, MemOperand(t5)); |
481 __ Addu(t5, t5, kPointerSize); | 481 __ Addu(t5, t5, kPointerSize); |
482 // Load the AllocationSite. | 482 // Load the AllocationSite. |
483 __ lw(t7, MemOperand(sp, 2 * kPointerSize)); | 483 __ lw(t7, MemOperand(sp, 2 * kPointerSize)); |
484 ASSERT_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); | 484 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); |
485 __ sw(t7, MemOperand(t5)); | 485 __ sw(t7, MemOperand(t5)); |
486 __ Addu(t5, t5, kPointerSize); | 486 __ Addu(t5, t5, kPointerSize); |
487 } else { | 487 } else { |
488 __ sll(at, a3, kPointerSizeLog2); | 488 __ sll(at, a3, kPointerSizeLog2); |
489 __ Addu(a0, t4, Operand(at)); // End of object. | 489 __ Addu(a0, t4, Operand(at)); // End of object. |
490 __ InitializeFieldsWithFiller(t5, a0, t7); | 490 __ InitializeFieldsWithFiller(t5, a0, t7); |
491 } | 491 } |
492 | 492 |
493 // Add the object tag to make the JSObject real, so that we can continue | 493 // Add the object tag to make the JSObject real, so that we can continue |
494 // and jump into the continuation code at any time from now on. Any | 494 // and jump into the continuation code at any time from now on. Any |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // a3: number of elements in properties array (untagged) | 534 // a3: number of elements in properties array (untagged) |
535 // t4: JSObject | 535 // t4: JSObject |
536 // t5: start of next object | 536 // t5: start of next object |
537 __ LoadRoot(t6, Heap::kFixedArrayMapRootIndex); | 537 __ LoadRoot(t6, Heap::kFixedArrayMapRootIndex); |
538 __ mov(a2, t5); | 538 __ mov(a2, t5); |
539 __ sw(t6, MemOperand(a2, JSObject::kMapOffset)); | 539 __ sw(t6, MemOperand(a2, JSObject::kMapOffset)); |
540 __ sll(a0, a3, kSmiTagSize); | 540 __ sll(a0, a3, kSmiTagSize); |
541 __ sw(a0, MemOperand(a2, FixedArray::kLengthOffset)); | 541 __ sw(a0, MemOperand(a2, FixedArray::kLengthOffset)); |
542 __ Addu(a2, a2, Operand(2 * kPointerSize)); | 542 __ Addu(a2, a2, Operand(2 * kPointerSize)); |
543 | 543 |
544 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); | 544 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
545 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); | 545 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
546 | 546 |
547 // Initialize the fields to undefined. | 547 // Initialize the fields to undefined. |
548 // a1: constructor | 548 // a1: constructor |
549 // a2: First element of FixedArray (not tagged) | 549 // a2: First element of FixedArray (not tagged) |
550 // a3: number of elements in properties array | 550 // a3: number of elements in properties array |
551 // t4: JSObject | 551 // t4: JSObject |
552 // t5: FixedArray (not tagged) | 552 // t5: FixedArray (not tagged) |
553 __ sll(t3, a3, kPointerSizeLog2); | 553 __ sll(t3, a3, kPointerSizeLog2); |
554 __ addu(t6, a2, t3); // End of object. | 554 __ addu(t6, a2, t3); // End of object. |
555 ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 555 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
556 { Label loop, entry; | 556 { Label loop, entry; |
557 if (!is_api_function || create_memento) { | 557 if (!is_api_function || create_memento) { |
558 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); | 558 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
559 } else if (FLAG_debug_code) { | 559 } else if (FLAG_debug_code) { |
560 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); | 560 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); |
561 __ Assert(eq, kUndefinedValueNotLoaded, t7, Operand(t2)); | 561 __ Assert(eq, kUndefinedValueNotLoaded, t7, Operand(t2)); |
562 } | 562 } |
563 __ jmp(&entry); | 563 __ jmp(&entry); |
564 __ bind(&loop); | 564 __ bind(&loop); |
565 __ sw(t7, MemOperand(a2)); | 565 __ sw(t7, MemOperand(a2)); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 __ break_(0xCC); | 1572 __ break_(0xCC); |
1573 } | 1573 } |
1574 } | 1574 } |
1575 | 1575 |
1576 | 1576 |
1577 #undef __ | 1577 #undef __ |
1578 | 1578 |
1579 } } // namespace v8::internal | 1579 } } // namespace v8::internal |
1580 | 1580 |
1581 #endif // V8_TARGET_ARCH_MIPS | 1581 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |