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 "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); | 372 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); |
373 | 373 |
374 // Check that the constructor is not constructing a JSFunction (see | 374 // Check that the constructor is not constructing a JSFunction (see |
375 // comments in Runtime_NewObject in runtime.cc). In which case the | 375 // comments in Runtime_NewObject in runtime.cc). In which case the |
376 // initial map's instance type would be JS_FUNCTION_TYPE. | 376 // initial map's instance type would be JS_FUNCTION_TYPE. |
377 // a1: constructor function | 377 // a1: constructor function |
378 // a2: initial map | 378 // a2: initial map |
379 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 379 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
380 __ Branch(&rt_call, eq, a3, Operand(JS_FUNCTION_TYPE)); | 380 __ Branch(&rt_call, eq, a3, Operand(JS_FUNCTION_TYPE)); |
381 | 381 |
382 // Use t7 to hold undefined, which is used in several places below. | |
383 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); | |
384 | |
385 if (!is_api_function) { | 382 if (!is_api_function) { |
386 Label allocate; | 383 Label allocate; |
387 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); | 384 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); |
388 // Check if slack tracking is enabled. | 385 // Check if slack tracking is enabled. |
389 __ lw(t0, bit_field3); | 386 __ lw(t0, bit_field3); |
390 __ DecodeField<Map::ConstructionCount>(t2, t0); | 387 __ DecodeField<Map::ConstructionCount>(t2, t0); |
391 __ Branch(&allocate, eq, t2, Operand(JSFunction::kNoSlackTracking)); | 388 __ Branch(&allocate, eq, t2, Operand(JSFunction::kNoSlackTracking)); |
392 // Decrease generous allocation count. | 389 // Decrease generous allocation count. |
393 __ Subu(t0, t0, Operand(1 << Map::ConstructionCount::kShift)); | 390 __ Subu(t0, t0, Operand(1 << Map::ConstructionCount::kShift)); |
394 __ Branch(USE_DELAY_SLOT, | 391 __ Branch(USE_DELAY_SLOT, |
395 &allocate, ne, t2, Operand(JSFunction::kFinishSlackTracking)); | 392 &allocate, ne, t2, Operand(JSFunction::kFinishSlackTracking)); |
396 __ sw(t0, bit_field3); // In delay slot. | 393 __ sw(t0, bit_field3); // In delay slot. |
397 | 394 |
398 __ Push(a1, a2, a1); // a1 = Constructor. | 395 __ Push(a1, a2, a1); // a1 = Constructor. |
399 __ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); | 396 __ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); |
400 | 397 |
401 __ Pop(a1, a2); | 398 __ Pop(a1, a2); |
| 399 // Slack tracking counter is kNoSlackTracking after runtime call. |
| 400 ASSERT(JSFunction::kNoSlackTracking == 0); |
| 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)); |
(...skipping 19 matching lines...) Expand all Loading... |
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 ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); |
440 | 440 |
| 441 // Use t7 to hold undefined, which is used in several places below. |
| 442 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
| 443 |
441 if (!is_api_function) { | 444 if (!is_api_function) { |
442 Label no_inobject_slack_tracking; | 445 Label no_inobject_slack_tracking; |
443 | 446 |
444 // Check if slack tracking is enabled. | 447 // Check if slack tracking is enabled. |
445 __ Branch(&no_inobject_slack_tracking, | 448 __ Branch(&no_inobject_slack_tracking, |
446 eq, t2, Operand(JSFunction::kNoSlackTracking)); | 449 eq, t2, Operand(JSFunction::kNoSlackTracking)); |
447 | 450 |
448 // Allocate object with a slack. | 451 // Allocate object with a slack. |
449 __ lbu(a0, FieldMemOperand(a2, Map::kPreAllocatedPropertyFieldsOffset)); | 452 __ lbu(a0, FieldMemOperand(a2, Map::kPreAllocatedPropertyFieldsOffset)); |
450 __ sll(at, a0, kPointerSizeLog2); | 453 __ sll(at, a0, kPointerSizeLog2); |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 __ break_(0xCC); | 1571 __ break_(0xCC); |
1569 } | 1572 } |
1570 } | 1573 } |
1571 | 1574 |
1572 | 1575 |
1573 #undef __ | 1576 #undef __ |
1574 | 1577 |
1575 } } // namespace v8::internal | 1578 } } // namespace v8::internal |
1576 | 1579 |
1577 #endif // V8_TARGET_ARCH_MIPS | 1580 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |