| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5367 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | 5367 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
| 5368 ASSERT(ToRegister(instr->context()).is(cp)); | 5368 ASSERT(ToRegister(instr->context()).is(cp)); |
| 5369 Label materialized; | 5369 Label materialized; |
| 5370 // Registers will be used as follows: | 5370 // Registers will be used as follows: |
| 5371 // t3 = literals array. | 5371 // t3 = literals array. |
| 5372 // a1 = regexp literal. | 5372 // a1 = regexp literal. |
| 5373 // a0 = regexp literal clone. | 5373 // a0 = regexp literal clone. |
| 5374 // a2 and t0-t2 are used as temporaries. | 5374 // a2 and t0-t2 are used as temporaries. |
| 5375 int literal_offset = | 5375 int literal_offset = |
| 5376 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); | 5376 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); |
| 5377 __ LoadHeapObject(t3, instr->hydrogen()->literals()); | 5377 __ li(t3, instr->hydrogen()->literals()); |
| 5378 __ lw(a1, FieldMemOperand(t3, literal_offset)); | 5378 __ lw(a1, FieldMemOperand(t3, literal_offset)); |
| 5379 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5379 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5380 __ Branch(&materialized, ne, a1, Operand(at)); | 5380 __ Branch(&materialized, ne, a1, Operand(at)); |
| 5381 | 5381 |
| 5382 // Create regexp literal using runtime function | 5382 // Create regexp literal using runtime function |
| 5383 // Result will be in v0. | 5383 // Result will be in v0. |
| 5384 __ li(t2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5384 __ li(t2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5385 __ li(t1, Operand(instr->hydrogen()->pattern())); | 5385 __ li(t1, Operand(instr->hydrogen()->pattern())); |
| 5386 __ li(t0, Operand(instr->hydrogen()->flags())); | 5386 __ li(t0, Operand(instr->hydrogen()->flags())); |
| 5387 __ Push(t3, t2, t1, t0); | 5387 __ Push(t3, t2, t1, t0); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5813 __ Subu(scratch, result, scratch); | 5813 __ Subu(scratch, result, scratch); |
| 5814 __ lw(result, FieldMemOperand(scratch, | 5814 __ lw(result, FieldMemOperand(scratch, |
| 5815 FixedArray::kHeaderSize - kPointerSize)); | 5815 FixedArray::kHeaderSize - kPointerSize)); |
| 5816 __ bind(&done); | 5816 __ bind(&done); |
| 5817 } | 5817 } |
| 5818 | 5818 |
| 5819 | 5819 |
| 5820 #undef __ | 5820 #undef __ |
| 5821 | 5821 |
| 5822 } } // namespace v8::internal | 5822 } } // namespace v8::internal |
| OLD | NEW |