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

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 1459083003: Fix object initialization when slack tracking for it's map is still enabled. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@toon
Patch Set: Fixed second nit in all platforms Created 5 years, 1 month 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/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 __ bind(&allocate); 428 __ bind(&allocate);
429 } 429 }
430 430
431 // Now allocate the JSObject on the heap. 431 // Now allocate the JSObject on the heap.
432 // a1: constructor function 432 // a1: constructor function
433 // a2: initial map 433 // a2: initial map
434 Label rt_call_reload_new_target; 434 Label rt_call_reload_new_target;
435 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 435 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset));
436 436
437 __ Allocate(a3, t0, t1, t2, &rt_call_reload_new_target, SIZE_IN_WORDS); 437 __ Allocate(a3, t0, a4, t2, &rt_call_reload_new_target, SIZE_IN_WORDS);
438 438
439 // Allocated the JSObject, now initialize the fields. Map is set to 439 // Allocated the JSObject, now initialize the fields. Map is set to
440 // initial map and properties and elements are set to empty fixed array. 440 // initial map and properties and elements are set to empty fixed array.
441 // a1: constructor function 441 // a1: constructor function
442 // a2: initial map 442 // a2: initial map
443 // a3: object size 443 // a3: object size
444 // t0: JSObject (not tagged) 444 // t0: JSObject (not tagged)
445 // a4: start of next object
445 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex); 446 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex);
446 __ mov(t1, t0); 447 __ mov(t1, t0);
448 STATIC_ASSERT(0 * kPointerSize == JSObject::kMapOffset);
447 __ sd(a2, MemOperand(t1, JSObject::kMapOffset)); 449 __ sd(a2, MemOperand(t1, JSObject::kMapOffset));
450 STATIC_ASSERT(1 * kPointerSize == JSObject::kPropertiesOffset);
448 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset)); 451 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset));
452 STATIC_ASSERT(2 * kPointerSize == JSObject::kElementsOffset);
449 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset)); 453 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset));
450 __ Daddu(t1, t1, Operand(3 * kPointerSize)); 454 __ Daddu(t1, t1, Operand(3 * kPointerSize));
451 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset);
452 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset);
453 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset);
454 455
455 // Fill all the in-object properties with appropriate filler. 456 // Fill all the in-object properties with appropriate filler.
456 // a1: constructor function 457 // a1: constructor function
457 // a2: initial map 458 // a2: initial map
458 // a3: object size (in words) 459 // a3: object size (in words)
459 // t0: JSObject (not tagged) 460 // t0: JSObject (not tagged)
461 // a4: start of next object
460 // t1: First in-object property of JSObject (not tagged) 462 // t1: First in-object property of JSObject (not tagged)
461 // a6: slack tracking counter (non-API function case) 463 // a6: slack tracking counter (non-API function case)
462 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize); 464 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize);
463 465
464 // Use t3 to hold undefined, which is used in several places below. 466 // Use t3 to hold undefined, which is used in several places below.
465 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); 467 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex);
466 468
467 if (!is_api_function) { 469 if (!is_api_function) {
468 Label no_inobject_slack_tracking; 470 Label no_inobject_slack_tracking;
469 471
470 // Check if slack tracking is enabled. 472 // Check if slack tracking is enabled.
471 __ Branch( 473 __ Branch(
472 &no_inobject_slack_tracking, lt, a6, 474 &no_inobject_slack_tracking, lt, a6,
473 Operand(static_cast<int64_t>(Map::kSlackTrackingCounterEnd))); 475 Operand(static_cast<int64_t>(Map::kSlackTrackingCounterEnd)));
474 476
475 // Allocate object with a slack. 477 // Allocate object with a slack.
476 __ lbu(a0, 478 __ lbu(a0, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
477 FieldMemOperand( 479 __ dsll(a0, a0, kPointerSizeLog2);
478 a2, 480 __ dsubu(a0, a4, a0);
479 Map::kInObjectPropertiesOrConstructorFunctionIndexOffset));
480 __ lbu(a2, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
481 __ dsubu(a0, a0, a2);
482 __ dsll(at, a0, kPointerSizeLog2);
483 __ daddu(a0, t1, at);
484 // a0: offset of first field after pre-allocated fields 481 // a0: offset of first field after pre-allocated fields
485 if (FLAG_debug_code) { 482 if (FLAG_debug_code) {
486 __ dsll(at, a3, kPointerSizeLog2); 483 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields, t1,
487 __ Daddu(t2, t0, Operand(at)); // End of object. 484 Operand(a0));
488 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields, a0,
489 Operand(t2));
490 } 485 }
491 __ InitializeFieldsWithFiller(t1, a0, t3); 486 __ InitializeFieldsWithFiller(t1, a0, t3);
492 // To allow for truncation. 487 // To allow for truncation.
493 __ LoadRoot(t3, Heap::kOnePointerFillerMapRootIndex); 488 __ LoadRoot(t3, Heap::kOnePointerFillerMapRootIndex);
494 // Fill the remaining fields with one pointer filler map. 489 // Fill the remaining fields with one pointer filler map.
495 490
496 __ bind(&no_inobject_slack_tracking); 491 __ bind(&no_inobject_slack_tracking);
497 } 492 }
498 493
499 __ dsll(at, a3, kPointerSizeLog2); 494 __ InitializeFieldsWithFiller(t1, a4, t3);
500 __ Daddu(a0, t0, Operand(at)); // End of object.
501 __ InitializeFieldsWithFiller(t1, a0, t3);
502 495
503 // Add the object tag to make the JSObject real, so that we can continue 496 // Add the object tag to make the JSObject real, so that we can continue
504 // and jump into the continuation code at any time from now on. 497 // and jump into the continuation code at any time from now on.
505 __ Daddu(t0, t0, Operand(kHeapObjectTag)); 498 __ Daddu(t0, t0, Operand(kHeapObjectTag));
506 499
507 // Continue with JSObject being successfully allocated. 500 // Continue with JSObject being successfully allocated.
508 // a4: JSObject 501 // a4: JSObject
509 __ jmp(&allocated); 502 __ jmp(&allocated);
510 503
511 // Reload the new target and fall-through. 504 // Reload the new target and fall-through.
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 } 1863 }
1871 } 1864 }
1872 1865
1873 1866
1874 #undef __ 1867 #undef __
1875 1868
1876 } // namespace internal 1869 } // namespace internal
1877 } // namespace v8 1870 } // namespace v8
1878 1871
1879 #endif // V8_TARGET_ARCH_MIPS64 1872 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698