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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/frames-mips.h ('k') | src/mips/lithium-codegen-mips.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 __ push(a1); 1638 __ push(a1);
1639 } else { 1639 } else {
1640 VisitForStackValue(expression); 1640 VisitForStackValue(expression);
1641 } 1641 }
1642 } 1642 }
1643 1643
1644 1644
1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1646 Comment cmnt(masm_, "[ ObjectLiteral"); 1646 Comment cmnt(masm_, "[ ObjectLiteral");
1647 1647
1648 int depth = 1; 1648 expr->BuildConstantProperties(isolate());
1649 expr->BuildConstantProperties(isolate(), &depth);
1650 Handle<FixedArray> constant_properties = expr->constant_properties(); 1649 Handle<FixedArray> constant_properties = expr->constant_properties();
1651 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1650 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1652 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1651 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1653 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1652 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1654 __ li(a1, Operand(constant_properties)); 1653 __ li(a1, Operand(constant_properties));
1655 int flags = expr->fast_elements() 1654 int flags = expr->fast_elements()
1656 ? ObjectLiteral::kFastElements 1655 ? ObjectLiteral::kFastElements
1657 : ObjectLiteral::kNoFlags; 1656 : ObjectLiteral::kNoFlags;
1658 flags |= expr->has_function() 1657 flags |= expr->has_function()
1659 ? ObjectLiteral::kHasFunction 1658 ? ObjectLiteral::kHasFunction
1660 : ObjectLiteral::kNoFlags; 1659 : ObjectLiteral::kNoFlags;
1661 __ li(a0, Operand(Smi::FromInt(flags))); 1660 __ li(a0, Operand(Smi::FromInt(flags)));
1662 int properties_count = constant_properties->length() / 2; 1661 int properties_count = constant_properties->length() / 2;
1663 if ((FLAG_track_double_fields && expr->may_store_doubles()) || 1662 if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
1664 depth > 1 || Serializer::enabled() || 1663 expr->depth() > 1 || Serializer::enabled() ||
1665 flags != ObjectLiteral::kFastElements || 1664 flags != ObjectLiteral::kFastElements ||
1666 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 1665 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1667 __ Push(a3, a2, a1, a0); 1666 __ Push(a3, a2, a1, a0);
1668 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1667 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1669 } else { 1668 } else {
1670 FastCloneShallowObjectStub stub(properties_count); 1669 FastCloneShallowObjectStub stub(properties_count);
1671 __ CallStub(&stub); 1670 __ CallStub(&stub);
1672 } 1671 }
1673 1672
1674 // If result_saved is true the result is on top of the stack. If 1673 // If result_saved is true the result is on top of the stack. If
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 context()->PlugTOS(); 1772 context()->PlugTOS();
1774 } else { 1773 } else {
1775 context()->Plug(v0); 1774 context()->Plug(v0);
1776 } 1775 }
1777 } 1776 }
1778 1777
1779 1778
1780 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1779 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1781 Comment cmnt(masm_, "[ ArrayLiteral"); 1780 Comment cmnt(masm_, "[ ArrayLiteral");
1782 1781
1783 int depth = 1; 1782 expr->BuildConstantElements(isolate());
1784 expr->BuildConstantElements(isolate(), &depth); 1783 int flags = expr->depth() == 1
1784 ? ArrayLiteral::kShallowElements
1785 : ArrayLiteral::kNoFlags;
1786
1785 ZoneList<Expression*>* subexprs = expr->values(); 1787 ZoneList<Expression*>* subexprs = expr->values();
1786 int length = subexprs->length(); 1788 int length = subexprs->length();
1787 1789
1788 Handle<FixedArray> constant_elements = expr->constant_elements(); 1790 Handle<FixedArray> constant_elements = expr->constant_elements();
1789 ASSERT_EQ(2, constant_elements->length()); 1791 ASSERT_EQ(2, constant_elements->length());
1790 ElementsKind constant_elements_kind = 1792 ElementsKind constant_elements_kind =
1791 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1793 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1792 bool has_fast_elements = 1794 bool has_fast_elements =
1793 IsFastObjectElementsKind(constant_elements_kind); 1795 IsFastObjectElementsKind(constant_elements_kind);
1794 Handle<FixedArrayBase> constant_elements_values( 1796 Handle<FixedArrayBase> constant_elements_values(
1795 FixedArrayBase::cast(constant_elements->get(1))); 1797 FixedArrayBase::cast(constant_elements->get(1)));
1796 1798
1797 __ mov(a0, result_register()); 1799 __ mov(a0, result_register());
1798 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1800 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1799 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1801 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1800 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1802 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1801 __ li(a1, Operand(constant_elements)); 1803 __ li(a1, Operand(constant_elements));
1802 if (has_fast_elements && constant_elements_values->map() == 1804 if (has_fast_elements && constant_elements_values->map() ==
1803 isolate()->heap()->fixed_cow_array_map()) { 1805 isolate()->heap()->fixed_cow_array_map()) {
1804 FastCloneShallowArrayStub stub( 1806 FastCloneShallowArrayStub stub(
1805 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1807 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1806 DONT_TRACK_ALLOCATION_SITE, 1808 DONT_TRACK_ALLOCATION_SITE,
1807 length); 1809 length);
1808 __ CallStub(&stub); 1810 __ CallStub(&stub);
1809 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1811 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
1810 1, a1, a2); 1812 1, a1, a2);
1811 } else if (depth > 1 || Serializer::enabled() || 1813 } else if (expr->depth() > 1 || Serializer::enabled() ||
1812 length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1814 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1813 __ Push(a3, a2, a1); 1815 __ li(a0, Operand(Smi::FromInt(flags)));
1814 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1816 __ Push(a3, a2, a1, a0);
1817 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1815 } else { 1818 } else {
1816 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1819 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1817 FLAG_smi_only_arrays); 1820 FLAG_smi_only_arrays);
1818 FastCloneShallowArrayStub::Mode mode = 1821 FastCloneShallowArrayStub::Mode mode =
1819 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1822 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1820 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites 1823 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1821 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; 1824 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1822 1825
1823 if (has_fast_elements) { 1826 if (has_fast_elements) {
1824 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1827 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 VisitForAccumulatorValue(args->at(0)); 2912 VisitForAccumulatorValue(args->at(0));
2910 2913
2911 Label materialize_true, materialize_false; 2914 Label materialize_true, materialize_false;
2912 Label* if_true = NULL; 2915 Label* if_true = NULL;
2913 Label* if_false = NULL; 2916 Label* if_false = NULL;
2914 Label* fall_through = NULL; 2917 Label* fall_through = NULL;
2915 context()->PrepareTest(&materialize_true, &materialize_false, 2918 context()->PrepareTest(&materialize_true, &materialize_false,
2916 &if_true, &if_false, &fall_through); 2919 &if_true, &if_false, &fall_through);
2917 2920
2918 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 2921 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
2919 __ And(t0, v0, Operand(kSmiTagMask)); 2922 __ SmiTst(v0, t0);
2920 Split(eq, t0, Operand(zero_reg), if_true, if_false, fall_through); 2923 Split(eq, t0, Operand(zero_reg), if_true, if_false, fall_through);
2921 2924
2922 context()->Plug(if_true, if_false); 2925 context()->Plug(if_true, if_false);
2923 } 2926 }
2924 2927
2925 2928
2926 void FullCodeGenerator::EmitIsNonNegativeSmi(CallRuntime* expr) { 2929 void FullCodeGenerator::EmitIsNonNegativeSmi(CallRuntime* expr) {
2927 ZoneList<Expression*>* args = expr->arguments(); 2930 ZoneList<Expression*>* args = expr->arguments();
2928 ASSERT(args->length() == 1); 2931 ASSERT(args->length() == 1);
2929 2932
2930 VisitForAccumulatorValue(args->at(0)); 2933 VisitForAccumulatorValue(args->at(0));
2931 2934
2932 Label materialize_true, materialize_false; 2935 Label materialize_true, materialize_false;
2933 Label* if_true = NULL; 2936 Label* if_true = NULL;
2934 Label* if_false = NULL; 2937 Label* if_false = NULL;
2935 Label* fall_through = NULL; 2938 Label* fall_through = NULL;
2936 context()->PrepareTest(&materialize_true, &materialize_false, 2939 context()->PrepareTest(&materialize_true, &materialize_false,
2937 &if_true, &if_false, &fall_through); 2940 &if_true, &if_false, &fall_through);
2938 2941
2939 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 2942 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
2940 __ And(at, v0, Operand(kSmiTagMask | 0x80000000)); 2943 __ NonNegativeSmiTst(v0, at);
2941 Split(eq, at, Operand(zero_reg), if_true, if_false, fall_through); 2944 Split(eq, at, Operand(zero_reg), if_true, if_false, fall_through);
2942 2945
2943 context()->Plug(if_true, if_false); 2946 context()->Plug(if_true, if_false);
2944 } 2947 }
2945 2948
2946 2949
2947 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { 2950 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) {
2948 ZoneList<Expression*>* args = expr->arguments(); 2951 ZoneList<Expression*>* args = expr->arguments();
2949 ASSERT(args->length() == 1); 2952 ASSERT(args->length() == 1);
2950 2953
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 VisitForStackValue(args->at(2)); 3376 VisitForStackValue(args->at(2));
3374 __ CallRuntime(Runtime::kLog, 2); 3377 __ CallRuntime(Runtime::kLog, 2);
3375 } 3378 }
3376 3379
3377 // Finally, we're expected to leave a value on the top of the stack. 3380 // Finally, we're expected to leave a value on the top of the stack.
3378 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 3381 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
3379 context()->Plug(v0); 3382 context()->Plug(v0);
3380 } 3383 }
3381 3384
3382 3385
3383 void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
3384 ASSERT(expr->arguments()->length() == 0);
3385 Label slow_allocate_heapnumber;
3386 Label heapnumber_allocated;
3387
3388 // Save the new heap number in callee-saved register s0, since
3389 // we call out to external C code below.
3390 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex);
3391 __ AllocateHeapNumber(s0, a1, a2, t6, &slow_allocate_heapnumber);
3392 __ jmp(&heapnumber_allocated);
3393
3394 __ bind(&slow_allocate_heapnumber);
3395
3396 // Allocate a heap number.
3397 __ CallRuntime(Runtime::kNumberAlloc, 0);
3398 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call.
3399
3400 __ bind(&heapnumber_allocated);
3401
3402 // Convert 32 random bits in v0 to 0.(32 random bits) in a double
3403 // by computing:
3404 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
3405 __ PrepareCallCFunction(1, a0);
3406 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
3407 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset));
3408 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
3409
3410 // 0x41300000 is the top half of 1.0 x 2^20 as a double.
3411 __ li(a1, Operand(0x41300000));
3412 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU.
3413 __ Move(f12, v0, a1);
3414 // Move 0x4130000000000000 to FPU.
3415 __ Move(f14, zero_reg, a1);
3416 // Subtract and store the result in the heap number.
3417 __ sub_d(f0, f12, f14);
3418 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset));
3419 __ mov(v0, s0);
3420
3421 context()->Plug(v0);
3422 }
3423
3424
3425 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { 3386 void FullCodeGenerator::EmitSubString(CallRuntime* expr) {
3426 // Load the arguments on the stack and call the stub. 3387 // Load the arguments on the stack and call the stub.
3427 SubStringStub stub; 3388 SubStringStub stub;
3428 ZoneList<Expression*>* args = expr->arguments(); 3389 ZoneList<Expression*>* args = expr->arguments();
3429 ASSERT(args->length() == 3); 3390 ASSERT(args->length() == 3);
3430 VisitForStackValue(args->at(0)); 3391 VisitForStackValue(args->at(0));
3431 VisitForStackValue(args->at(1)); 3392 VisitForStackValue(args->at(1));
3432 VisitForStackValue(args->at(2)); 3393 VisitForStackValue(args->at(2));
3433 __ CallStub(&stub); 3394 __ CallStub(&stub);
3434 context()->Plug(v0); 3395 context()->Plug(v0);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 Register string = v0; 3484 Register string = v0;
3524 Register index = a1; 3485 Register index = a1;
3525 Register value = a2; 3486 Register value = a2;
3526 3487
3527 VisitForStackValue(args->at(1)); // index 3488 VisitForStackValue(args->at(1)); // index
3528 VisitForStackValue(args->at(2)); // value 3489 VisitForStackValue(args->at(2)); // value
3529 VisitForAccumulatorValue(args->at(0)); // string 3490 VisitForAccumulatorValue(args->at(0)); // string
3530 __ Pop(index, value); 3491 __ Pop(index, value);
3531 3492
3532 if (FLAG_debug_code) { 3493 if (FLAG_debug_code) {
3533 __ And(at, value, Operand(kSmiTagMask)); 3494 __ SmiTst(value, at);
3534 __ ThrowIf(ne, kNonSmiValue, at, Operand(zero_reg)); 3495 __ ThrowIf(ne, kNonSmiValue, at, Operand(zero_reg));
3535 __ And(at, index, Operand(kSmiTagMask)); 3496 __ SmiTst(index, at);
3536 __ ThrowIf(ne, kNonSmiIndex, at, Operand(zero_reg)); 3497 __ ThrowIf(ne, kNonSmiIndex, at, Operand(zero_reg));
3537 __ SmiUntag(index, index); 3498 __ SmiUntag(index, index);
3538 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 3499 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
3539 Register scratch = t5; 3500 Register scratch = t5;
3540 __ EmitSeqStringSetCharCheck( 3501 __ EmitSeqStringSetCharCheck(
3541 string, index, value, scratch, one_byte_seq_type); 3502 string, index, value, scratch, one_byte_seq_type);
3542 __ SmiTag(index, index); 3503 __ SmiTag(index, index);
3543 } 3504 }
3544 3505
3545 __ SmiUntag(value, value); 3506 __ SmiUntag(value, value);
(...skipping 14 matching lines...) Expand all
3560 Register string = v0; 3521 Register string = v0;
3561 Register index = a1; 3522 Register index = a1;
3562 Register value = a2; 3523 Register value = a2;
3563 3524
3564 VisitForStackValue(args->at(1)); // index 3525 VisitForStackValue(args->at(1)); // index
3565 VisitForStackValue(args->at(2)); // value 3526 VisitForStackValue(args->at(2)); // value
3566 VisitForAccumulatorValue(args->at(0)); // string 3527 VisitForAccumulatorValue(args->at(0)); // string
3567 __ Pop(index, value); 3528 __ Pop(index, value);
3568 3529
3569 if (FLAG_debug_code) { 3530 if (FLAG_debug_code) {
3570 __ And(at, value, Operand(kSmiTagMask)); 3531 __ SmiTst(value, at);
3571 __ ThrowIf(ne, kNonSmiValue, at, Operand(zero_reg)); 3532 __ ThrowIf(ne, kNonSmiValue, at, Operand(zero_reg));
3572 __ And(at, index, Operand(kSmiTagMask)); 3533 __ SmiTst(index, at);
3573 __ ThrowIf(ne, kNonSmiIndex, at, Operand(zero_reg)); 3534 __ ThrowIf(ne, kNonSmiIndex, at, Operand(zero_reg));
3574 __ SmiUntag(index, index); 3535 __ SmiUntag(index, index);
3575 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 3536 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
3576 Register scratch = t5; 3537 Register scratch = t5;
3577 __ EmitSeqStringSetCharCheck( 3538 __ EmitSeqStringSetCharCheck(
3578 string, index, value, scratch, two_byte_seq_type); 3539 string, index, value, scratch, two_byte_seq_type);
3579 __ SmiTag(index, index); 3540 __ SmiTag(index, index);
3580 } 3541 }
3581 3542
3582 __ SmiUntag(value, value); 3543 __ SmiUntag(value, value);
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
5009 Assembler::target_address_at(pc_immediate_load_address)) == 4970 Assembler::target_address_at(pc_immediate_load_address)) ==
5010 reinterpret_cast<uint32_t>( 4971 reinterpret_cast<uint32_t>(
5011 isolate->builtins()->OsrAfterStackCheck()->entry())); 4972 isolate->builtins()->OsrAfterStackCheck()->entry()));
5012 return OSR_AFTER_STACK_CHECK; 4973 return OSR_AFTER_STACK_CHECK;
5013 } 4974 }
5014 4975
5015 4976
5016 } } // namespace v8::internal 4977 } } // namespace v8::internal
5017 4978
5018 #endif // V8_TARGET_ARCH_MIPS 4979 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/frames-mips.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698