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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 HConstant* constant = chunk_->LookupConstant(const_op); | 381 HConstant* constant = chunk_->LookupConstant(const_op); |
382 Handle<Object> literal = constant->handle(isolate()); | 382 Handle<Object> literal = constant->handle(isolate()); |
383 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 383 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
384 if (r.IsInteger32()) { | 384 if (r.IsInteger32()) { |
385 ASSERT(literal->IsNumber()); | 385 ASSERT(literal->IsNumber()); |
386 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 386 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
387 } else if (r.IsDouble()) { | 387 } else if (r.IsDouble()) { |
388 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); | 388 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
389 } else { | 389 } else { |
390 ASSERT(r.IsSmiOrTagged()); | 390 ASSERT(r.IsSmiOrTagged()); |
391 __ LoadObject(scratch, literal); | 391 __ Move(scratch, literal); |
392 } | 392 } |
393 return scratch; | 393 return scratch; |
394 } else if (op->IsStackSlot() || op->IsArgument()) { | 394 } else if (op->IsStackSlot() || op->IsArgument()) { |
395 __ ldr(scratch, ToMemOperand(op)); | 395 __ ldr(scratch, ToMemOperand(op)); |
396 return scratch; | 396 return scratch; |
397 } | 397 } |
398 UNREACHABLE(); | 398 UNREACHABLE(); |
399 return scratch; | 399 return scratch; |
400 } | 400 } |
401 | 401 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 697 |
698 | 698 |
699 void LCodeGen::LoadContextFromDeferred(LOperand* context) { | 699 void LCodeGen::LoadContextFromDeferred(LOperand* context) { |
700 if (context->IsRegister()) { | 700 if (context->IsRegister()) { |
701 __ Move(cp, ToRegister(context)); | 701 __ Move(cp, ToRegister(context)); |
702 } else if (context->IsStackSlot()) { | 702 } else if (context->IsStackSlot()) { |
703 __ ldr(cp, ToMemOperand(context)); | 703 __ ldr(cp, ToMemOperand(context)); |
704 } else if (context->IsConstantOperand()) { | 704 } else if (context->IsConstantOperand()) { |
705 HConstant* constant = | 705 HConstant* constant = |
706 chunk_->LookupConstant(LConstantOperand::cast(context)); | 706 chunk_->LookupConstant(LConstantOperand::cast(context)); |
707 __ LoadObject(cp, Handle<Object>::cast(constant->handle(isolate()))); | 707 __ Move(cp, Handle<Object>::cast(constant->handle(isolate()))); |
708 } else { | 708 } else { |
709 UNREACHABLE(); | 709 UNREACHABLE(); |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, | 714 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, |
715 int argc, | 715 int argc, |
716 LInstruction* instr, | 716 LInstruction* instr, |
717 LOperand* context) { | 717 LOperand* context) { |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 | 1833 |
1834 | 1834 |
1835 void LCodeGen::DoConstantE(LConstantE* instr) { | 1835 void LCodeGen::DoConstantE(LConstantE* instr) { |
1836 __ mov(ToRegister(instr->result()), Operand(instr->value())); | 1836 __ mov(ToRegister(instr->result()), Operand(instr->value())); |
1837 } | 1837 } |
1838 | 1838 |
1839 | 1839 |
1840 void LCodeGen::DoConstantT(LConstantT* instr) { | 1840 void LCodeGen::DoConstantT(LConstantT* instr) { |
1841 Handle<Object> value = instr->value(isolate()); | 1841 Handle<Object> value = instr->value(isolate()); |
1842 AllowDeferredHandleDereference smi_check; | 1842 AllowDeferredHandleDereference smi_check; |
1843 __ LoadObject(ToRegister(instr->result()), value); | 1843 __ Move(ToRegister(instr->result()), value); |
1844 } | 1844 } |
1845 | 1845 |
1846 | 1846 |
1847 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1847 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1848 Register result = ToRegister(instr->result()); | 1848 Register result = ToRegister(instr->result()); |
1849 Register map = ToRegister(instr->value()); | 1849 Register map = ToRegister(instr->value()); |
1850 __ EnumLength(result, map); | 1850 __ EnumLength(result, map); |
1851 } | 1851 } |
1852 | 1852 |
1853 | 1853 |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 InstanceofStub stub(flags); | 2790 InstanceofStub stub(flags); |
2791 | 2791 |
2792 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 2792 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
2793 LoadContextFromDeferred(instr->context()); | 2793 LoadContextFromDeferred(instr->context()); |
2794 | 2794 |
2795 // Get the temp register reserved by the instruction. This needs to be r4 as | 2795 // Get the temp register reserved by the instruction. This needs to be r4 as |
2796 // its slot of the pushing of safepoint registers is used to communicate the | 2796 // its slot of the pushing of safepoint registers is used to communicate the |
2797 // offset to the location of the map check. | 2797 // offset to the location of the map check. |
2798 Register temp = ToRegister(instr->temp()); | 2798 Register temp = ToRegister(instr->temp()); |
2799 ASSERT(temp.is(r4)); | 2799 ASSERT(temp.is(r4)); |
2800 __ LoadHeapObject(InstanceofStub::right(), instr->function()); | 2800 __ Move(InstanceofStub::right(), instr->function()); |
2801 static const int kAdditionalDelta = 5; | 2801 static const int kAdditionalDelta = 5; |
2802 // Make sure that code size is predicable, since we use specific constants | 2802 // Make sure that code size is predicable, since we use specific constants |
2803 // offsets in the code to find embedded values.. | 2803 // offsets in the code to find embedded values.. |
2804 PredictableCodeSizeScope predictable(masm_, 6 * Assembler::kInstrSize); | 2804 PredictableCodeSizeScope predictable(masm_, 6 * Assembler::kInstrSize); |
2805 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; | 2805 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; |
2806 Label before_push_delta; | 2806 Label before_push_delta; |
2807 __ bind(&before_push_delta); | 2807 __ bind(&before_push_delta); |
2808 __ BlockConstPoolFor(kAdditionalDelta); | 2808 __ BlockConstPoolFor(kAdditionalDelta); |
2809 __ mov(temp, Operand(delta * kPointerSize)); | 2809 __ mov(temp, Operand(delta * kPointerSize)); |
2810 // The mov above can generate one or two instructions. The delta was computed | 2810 // The mov above can generate one or two instructions. The delta was computed |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3530 Register context = ToRegister(instr->context()); | 3530 Register context = ToRegister(instr->context()); |
3531 Register result = ToRegister(instr->result()); | 3531 Register result = ToRegister(instr->result()); |
3532 __ ldr(result, | 3532 __ ldr(result, |
3533 MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 3533 MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
3534 } | 3534 } |
3535 | 3535 |
3536 | 3536 |
3537 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { | 3537 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { |
3538 ASSERT(ToRegister(instr->context()).is(cp)); | 3538 ASSERT(ToRegister(instr->context()).is(cp)); |
3539 __ push(cp); // The context is the first argument. | 3539 __ push(cp); // The context is the first argument. |
3540 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs()); | 3540 __ Move(scratch0(), instr->hydrogen()->pairs()); |
3541 __ push(scratch0()); | 3541 __ push(scratch0()); |
3542 __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); | 3542 __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); |
3543 __ push(scratch0()); | 3543 __ push(scratch0()); |
3544 CallRuntime(Runtime::kDeclareGlobals, 3, instr); | 3544 CallRuntime(Runtime::kDeclareGlobals, 3, instr); |
3545 } | 3545 } |
3546 | 3546 |
3547 | 3547 |
3548 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { | 3548 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { |
3549 Register context = ToRegister(instr->context()); | 3549 Register context = ToRegister(instr->context()); |
3550 Register result = ToRegister(instr->result()); | 3550 Register result = ToRegister(instr->result()); |
(...skipping 16 matching lines...) Expand all Loading... |
3567 R1State r1_state) { | 3567 R1State r1_state) { |
3568 bool dont_adapt_arguments = | 3568 bool dont_adapt_arguments = |
3569 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 3569 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
3570 bool can_invoke_directly = | 3570 bool can_invoke_directly = |
3571 dont_adapt_arguments || formal_parameter_count == arity; | 3571 dont_adapt_arguments || formal_parameter_count == arity; |
3572 | 3572 |
3573 LPointerMap* pointers = instr->pointer_map(); | 3573 LPointerMap* pointers = instr->pointer_map(); |
3574 | 3574 |
3575 if (can_invoke_directly) { | 3575 if (can_invoke_directly) { |
3576 if (r1_state == R1_UNINITIALIZED) { | 3576 if (r1_state == R1_UNINITIALIZED) { |
3577 __ LoadHeapObject(r1, function); | 3577 __ Move(r1, function); |
3578 } | 3578 } |
3579 | 3579 |
3580 // Change context. | 3580 // Change context. |
3581 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 3581 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
3582 | 3582 |
3583 // Set r0 to arguments count if adaption is not needed. Assumes that r0 | 3583 // Set r0 to arguments count if adaption is not needed. Assumes that r0 |
3584 // is available to write to at this point. | 3584 // is available to write to at this point. |
3585 if (dont_adapt_arguments) { | 3585 if (dont_adapt_arguments) { |
3586 __ mov(r0, Operand(arity)); | 3586 __ mov(r0, Operand(arity)); |
3587 } | 3587 } |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | 5414 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
5415 ASSERT(ToRegister(instr->context()).is(cp)); | 5415 ASSERT(ToRegister(instr->context()).is(cp)); |
5416 Label materialized; | 5416 Label materialized; |
5417 // Registers will be used as follows: | 5417 // Registers will be used as follows: |
5418 // r6 = literals array. | 5418 // r6 = literals array. |
5419 // r1 = regexp literal. | 5419 // r1 = regexp literal. |
5420 // r0 = regexp literal clone. | 5420 // r0 = regexp literal clone. |
5421 // r2-5 are used as temporaries. | 5421 // r2-5 are used as temporaries. |
5422 int literal_offset = | 5422 int literal_offset = |
5423 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); | 5423 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); |
5424 __ LoadHeapObject(r6, instr->hydrogen()->literals()); | 5424 __ Move(r6, instr->hydrogen()->literals()); |
5425 __ ldr(r1, FieldMemOperand(r6, literal_offset)); | 5425 __ ldr(r1, FieldMemOperand(r6, literal_offset)); |
5426 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 5426 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
5427 __ cmp(r1, ip); | 5427 __ cmp(r1, ip); |
5428 __ b(ne, &materialized); | 5428 __ b(ne, &materialized); |
5429 | 5429 |
5430 // Create regexp literal using runtime function | 5430 // Create regexp literal using runtime function |
5431 // Result will be in r0. | 5431 // Result will be in r0. |
5432 __ mov(r5, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5432 __ mov(r5, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
5433 __ mov(r4, Operand(instr->hydrogen()->pattern())); | 5433 __ mov(r4, Operand(instr->hydrogen()->pattern())); |
5434 __ mov(r3, Operand(instr->hydrogen()->flags())); | 5434 __ mov(r3, Operand(instr->hydrogen()->flags())); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5819 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5819 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5820 __ ldr(result, FieldMemOperand(scratch, | 5820 __ ldr(result, FieldMemOperand(scratch, |
5821 FixedArray::kHeaderSize - kPointerSize)); | 5821 FixedArray::kHeaderSize - kPointerSize)); |
5822 __ bind(&done); | 5822 __ bind(&done); |
5823 } | 5823 } |
5824 | 5824 |
5825 | 5825 |
5826 #undef __ | 5826 #undef __ |
5827 | 5827 |
5828 } } // namespace v8::internal | 5828 } } // namespace v8::internal |
OLD | NEW |