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

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

Issue 153923005: A64: Synchronize with r17525. (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/lithium-codegen-mips.h ('k') | src/mips/lithium-gap-resolver-mips.cc » ('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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (r.IsInteger32()) { 359 if (r.IsInteger32()) {
360 ASSERT(literal->IsNumber()); 360 ASSERT(literal->IsNumber());
361 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); 361 __ li(scratch, Operand(static_cast<int32_t>(literal->Number())));
362 } else if (r.IsSmi()) { 362 } else if (r.IsSmi()) {
363 ASSERT(constant->HasSmiValue()); 363 ASSERT(constant->HasSmiValue());
364 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value()))); 364 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value())));
365 } else if (r.IsDouble()) { 365 } else if (r.IsDouble()) {
366 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); 366 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate);
367 } else { 367 } else {
368 ASSERT(r.IsSmiOrTagged()); 368 ASSERT(r.IsSmiOrTagged());
369 __ LoadObject(scratch, literal); 369 __ li(scratch, literal);
370 } 370 }
371 return scratch; 371 return scratch;
372 } else if (op->IsStackSlot() || op->IsArgument()) { 372 } else if (op->IsStackSlot() || op->IsArgument()) {
373 __ lw(scratch, ToMemOperand(op)); 373 __ lw(scratch, ToMemOperand(op));
374 return scratch; 374 return scratch;
375 } 375 }
376 UNREACHABLE(); 376 UNREACHABLE();
377 return scratch; 377 return scratch;
378 } 378 }
379 379
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 662
663 void LCodeGen::LoadContextFromDeferred(LOperand* context) { 663 void LCodeGen::LoadContextFromDeferred(LOperand* context) {
664 if (context->IsRegister()) { 664 if (context->IsRegister()) {
665 __ Move(cp, ToRegister(context)); 665 __ Move(cp, ToRegister(context));
666 } else if (context->IsStackSlot()) { 666 } else if (context->IsStackSlot()) {
667 __ lw(cp, ToMemOperand(context)); 667 __ lw(cp, ToMemOperand(context));
668 } else if (context->IsConstantOperand()) { 668 } else if (context->IsConstantOperand()) {
669 HConstant* constant = 669 HConstant* constant =
670 chunk_->LookupConstant(LConstantOperand::cast(context)); 670 chunk_->LookupConstant(LConstantOperand::cast(context));
671 __ LoadObject(cp, Handle<Object>::cast(constant->handle(isolate()))); 671 __ li(cp, Handle<Object>::cast(constant->handle(isolate())));
672 } else { 672 } else {
673 UNREACHABLE(); 673 UNREACHABLE();
674 } 674 }
675 } 675 }
676 676
677 677
678 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, 678 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id,
679 int argc, 679 int argc,
680 LInstruction* instr, 680 LInstruction* instr,
681 LOperand* context) { 681 LOperand* context) {
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 1640
1641 1641
1642 void LCodeGen::DoConstantE(LConstantE* instr) { 1642 void LCodeGen::DoConstantE(LConstantE* instr) {
1643 __ li(ToRegister(instr->result()), Operand(instr->value())); 1643 __ li(ToRegister(instr->result()), Operand(instr->value()));
1644 } 1644 }
1645 1645
1646 1646
1647 void LCodeGen::DoConstantT(LConstantT* instr) { 1647 void LCodeGen::DoConstantT(LConstantT* instr) {
1648 Handle<Object> value = instr->value(isolate()); 1648 Handle<Object> value = instr->value(isolate());
1649 AllowDeferredHandleDereference smi_check; 1649 AllowDeferredHandleDereference smi_check;
1650 __ LoadObject(ToRegister(instr->result()), value); 1650 __ li(ToRegister(instr->result()), value);
1651 } 1651 }
1652 1652
1653 1653
1654 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { 1654 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1655 Register result = ToRegister(instr->result()); 1655 Register result = ToRegister(instr->result());
1656 Register map = ToRegister(instr->value()); 1656 Register map = ToRegister(instr->value());
1657 __ EnumLength(result, map); 1657 __ EnumLength(result, map);
1658 } 1658 }
1659 1659
1660 1660
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 InstanceofStub stub(flags); 2644 InstanceofStub stub(flags);
2645 2645
2646 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 2646 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
2647 LoadContextFromDeferred(instr->context()); 2647 LoadContextFromDeferred(instr->context());
2648 2648
2649 // Get the temp register reserved by the instruction. This needs to be t0 as 2649 // Get the temp register reserved by the instruction. This needs to be t0 as
2650 // its slot of the pushing of safepoint registers is used to communicate the 2650 // its slot of the pushing of safepoint registers is used to communicate the
2651 // offset to the location of the map check. 2651 // offset to the location of the map check.
2652 Register temp = ToRegister(instr->temp()); 2652 Register temp = ToRegister(instr->temp());
2653 ASSERT(temp.is(t0)); 2653 ASSERT(temp.is(t0));
2654 __ LoadHeapObject(InstanceofStub::right(), instr->function()); 2654 __ li(InstanceofStub::right(), instr->function());
2655 static const int kAdditionalDelta = 7; 2655 static const int kAdditionalDelta = 7;
2656 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; 2656 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
2657 Label before_push_delta; 2657 Label before_push_delta;
2658 __ bind(&before_push_delta); 2658 __ bind(&before_push_delta);
2659 { 2659 {
2660 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); 2660 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
2661 __ li(temp, Operand(delta * kPointerSize), CONSTANT_SIZE); 2661 __ li(temp, Operand(delta * kPointerSize), CONSTANT_SIZE);
2662 __ StoreToSafepointRegisterSlot(temp, temp); 2662 __ StoreToSafepointRegisterSlot(temp, temp);
2663 } 2663 }
2664 CallCodeGeneric(stub.GetCode(isolate()), 2664 CallCodeGeneric(stub.GetCode(isolate()),
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3396 void LCodeGen::DoOuterContext(LOuterContext* instr) { 3396 void LCodeGen::DoOuterContext(LOuterContext* instr) {
3397 Register context = ToRegister(instr->context()); 3397 Register context = ToRegister(instr->context());
3398 Register result = ToRegister(instr->result()); 3398 Register result = ToRegister(instr->result());
3399 __ lw(result, 3399 __ lw(result,
3400 MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); 3400 MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX)));
3401 } 3401 }
3402 3402
3403 3403
3404 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { 3404 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3405 ASSERT(ToRegister(instr->context()).is(cp)); 3405 ASSERT(ToRegister(instr->context()).is(cp));
3406 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs()); 3406 __ li(scratch0(), instr->hydrogen()->pairs());
3407 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); 3407 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3408 // The context is the first argument. 3408 // The context is the first argument.
3409 __ Push(cp, scratch0(), scratch1()); 3409 __ Push(cp, scratch0(), scratch1());
3410 CallRuntime(Runtime::kDeclareGlobals, 3, instr); 3410 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3411 } 3411 }
3412 3412
3413 3413
3414 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { 3414 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
3415 Register context = ToRegister(instr->context()); 3415 Register context = ToRegister(instr->context());
3416 Register result = ToRegister(instr->result()); 3416 Register result = ToRegister(instr->result());
(...skipping 16 matching lines...) Expand all
3433 A1State a1_state) { 3433 A1State a1_state) {
3434 bool dont_adapt_arguments = 3434 bool dont_adapt_arguments =
3435 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3435 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3436 bool can_invoke_directly = 3436 bool can_invoke_directly =
3437 dont_adapt_arguments || formal_parameter_count == arity; 3437 dont_adapt_arguments || formal_parameter_count == arity;
3438 3438
3439 LPointerMap* pointers = instr->pointer_map(); 3439 LPointerMap* pointers = instr->pointer_map();
3440 3440
3441 if (can_invoke_directly) { 3441 if (can_invoke_directly) {
3442 if (a1_state == A1_UNINITIALIZED) { 3442 if (a1_state == A1_UNINITIALIZED) {
3443 __ LoadHeapObject(a1, function); 3443 __ li(a1, function);
3444 } 3444 }
3445 3445
3446 // Change context. 3446 // Change context.
3447 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 3447 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
3448 3448
3449 // Set r0 to arguments count if adaption is not needed. Assumes that r0 3449 // Set r0 to arguments count if adaption is not needed. Assumes that r0
3450 // is available to write to at this point. 3450 // is available to write to at this point.
3451 if (dont_adapt_arguments) { 3451 if (dont_adapt_arguments) {
3452 __ li(a0, Operand(arity)); 3452 __ li(a0, Operand(arity));
3453 } 3453 }
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 __ mtc1(scratch, single_scratch); 4577 __ mtc1(scratch, single_scratch);
4578 } else { 4578 } else {
4579 __ mtc1(ToRegister(input), single_scratch); 4579 __ mtc1(ToRegister(input), single_scratch);
4580 } 4580 }
4581 __ cvt_d_w(ToDoubleRegister(output), single_scratch); 4581 __ cvt_d_w(ToDoubleRegister(output), single_scratch);
4582 } 4582 }
4583 4583
4584 4584
4585 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { 4585 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) {
4586 LOperand* input = instr->value(); 4586 LOperand* input = instr->value();
4587 ASSERT(input->IsRegister());
4588 LOperand* output = instr->result(); 4587 LOperand* output = instr->result();
4589 ASSERT(output->IsRegister());
4590 Register scratch = scratch0(); 4588 Register scratch = scratch0();
4591 4589
4592 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch); 4590 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch);
4593 if (!instr->hydrogen()->value()->HasRange() || 4591 if (!instr->hydrogen()->value()->HasRange() ||
4594 !instr->hydrogen()->value()->range()->IsInSmiRange()) { 4592 !instr->hydrogen()->value()->range()->IsInSmiRange()) {
4595 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); 4593 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg));
4596 } 4594 }
4597 } 4595 }
4598 4596
4599 4597
4600 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { 4598 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
4601 LOperand* input = instr->value(); 4599 LOperand* input = instr->value();
4602 LOperand* output = instr->result(); 4600 LOperand* output = instr->result();
4603 4601
4604 FPURegister dbl_scratch = double_scratch0(); 4602 FPURegister dbl_scratch = double_scratch0();
4605 __ mtc1(ToRegister(input), dbl_scratch); 4603 __ mtc1(ToRegister(input), dbl_scratch);
4606 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); 4604 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22);
4607 } 4605 }
4608 4606
4609 4607
4608 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) {
4609 LOperand* input = instr->value();
4610 LOperand* output = instr->result();
4611 if (!instr->hydrogen()->value()->HasRange() ||
4612 !instr->hydrogen()->value()->range()->IsInSmiRange()) {
4613 Register scratch = scratch0();
4614 __ And(scratch, ToRegister(input), Operand(0xc0000000));
4615 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
4616 }
4617 __ SmiTag(ToRegister(output), ToRegister(input));
4618 }
4619
4620
4610 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { 4621 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
4611 class DeferredNumberTagI V8_FINAL : public LDeferredCode { 4622 class DeferredNumberTagI V8_FINAL : public LDeferredCode {
4612 public: 4623 public:
4613 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) 4624 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
4614 : LDeferredCode(codegen), instr_(instr) { } 4625 : LDeferredCode(codegen), instr_(instr) { }
4615 virtual void Generate() V8_OVERRIDE { 4626 virtual void Generate() V8_OVERRIDE {
4616 codegen()->DoDeferredNumberTagI(instr_, 4627 codegen()->DoDeferredNumberTagI(instr_,
4617 instr_->value(), 4628 instr_->value(),
4618 SIGNED_INT32); 4629 SIGNED_INT32);
4619 } 4630 }
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
5356 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { 5367 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5357 ASSERT(ToRegister(instr->context()).is(cp)); 5368 ASSERT(ToRegister(instr->context()).is(cp));
5358 Label materialized; 5369 Label materialized;
5359 // Registers will be used as follows: 5370 // Registers will be used as follows:
5360 // t3 = literals array. 5371 // t3 = literals array.
5361 // a1 = regexp literal. 5372 // a1 = regexp literal.
5362 // a0 = regexp literal clone. 5373 // a0 = regexp literal clone.
5363 // a2 and t0-t2 are used as temporaries. 5374 // a2 and t0-t2 are used as temporaries.
5364 int literal_offset = 5375 int literal_offset =
5365 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); 5376 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
5366 __ LoadHeapObject(t3, instr->hydrogen()->literals()); 5377 __ li(t3, instr->hydrogen()->literals());
5367 __ lw(a1, FieldMemOperand(t3, literal_offset)); 5378 __ lw(a1, FieldMemOperand(t3, literal_offset));
5368 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 5379 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5369 __ Branch(&materialized, ne, a1, Operand(at)); 5380 __ Branch(&materialized, ne, a1, Operand(at));
5370 5381
5371 // Create regexp literal using runtime function 5382 // Create regexp literal using runtime function
5372 // Result will be in v0. 5383 // Result will be in v0.
5373 __ li(t2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); 5384 __ li(t2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5374 __ li(t1, Operand(instr->hydrogen()->pattern())); 5385 __ li(t1, Operand(instr->hydrogen()->pattern()));
5375 __ li(t0, Operand(instr->hydrogen()->flags())); 5386 __ li(t0, Operand(instr->hydrogen()->flags()));
5376 __ Push(t3, t2, t1, t0); 5387 __ Push(t3, t2, t1, t0);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
5802 __ Subu(scratch, result, scratch); 5813 __ Subu(scratch, result, scratch);
5803 __ lw(result, FieldMemOperand(scratch, 5814 __ lw(result, FieldMemOperand(scratch,
5804 FixedArray::kHeaderSize - kPointerSize)); 5815 FixedArray::kHeaderSize - kPointerSize));
5805 __ bind(&done); 5816 __ bind(&done);
5806 } 5817 }
5807 5818
5808 5819
5809 #undef __ 5820 #undef __
5810 5821
5811 } } // namespace v8::internal 5822 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-gap-resolver-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698