| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } else if (op->IsDoubleRegister()) { | 502 } else if (op->IsDoubleRegister()) { |
| 503 Abort(kToOperandIsDoubleRegisterUnimplemented); | 503 Abort(kToOperandIsDoubleRegisterUnimplemented); |
| 504 return Operand::Zero(); | 504 return Operand::Zero(); |
| 505 } | 505 } |
| 506 // Stack slots not implemented, use ToMemOperand instead. | 506 // Stack slots not implemented, use ToMemOperand instead. |
| 507 UNREACHABLE(); | 507 UNREACHABLE(); |
| 508 return Operand::Zero(); | 508 return Operand::Zero(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 static int ArgumentsOffsetWithoutFrame(int index) { |
| 513 ASSERT(index < 0); |
| 514 return -(index + 1) * kPointerSize; |
| 515 } |
| 516 |
| 517 |
| 512 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 518 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
| 513 ASSERT(!op->IsRegister()); | 519 ASSERT(!op->IsRegister()); |
| 514 ASSERT(!op->IsDoubleRegister()); | 520 ASSERT(!op->IsDoubleRegister()); |
| 515 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 521 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 516 return MemOperand(fp, StackSlotOffset(op->index())); | 522 if (NeedsEagerFrame()) { |
| 523 return MemOperand(fp, StackSlotOffset(op->index())); |
| 524 } else { |
| 525 // Retrieve parameter without eager stack-frame relative to the |
| 526 // stack-pointer. |
| 527 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); |
| 528 } |
| 517 } | 529 } |
| 518 | 530 |
| 519 | 531 |
| 520 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 532 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
| 521 ASSERT(op->IsDoubleStackSlot()); | 533 ASSERT(op->IsDoubleStackSlot()); |
| 522 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 534 if (NeedsEagerFrame()) { |
| 535 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); |
| 536 } else { |
| 537 // Retrieve parameter without eager stack-frame relative to the |
| 538 // stack-pointer. |
| 539 return MemOperand( |
| 540 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 541 } |
| 523 } | 542 } |
| 524 | 543 |
| 525 | 544 |
| 526 void LCodeGen::WriteTranslation(LEnvironment* environment, | 545 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 527 Translation* translation) { | 546 Translation* translation) { |
| 528 if (environment == NULL) return; | 547 if (environment == NULL) return; |
| 529 | 548 |
| 530 // The translation includes one command per value in the environment. | 549 // The translation includes one command per value in the environment. |
| 531 int translation_size = environment->translation_size(); | 550 int translation_size = environment->translation_size(); |
| 532 // The output frame height does not include the parameters. | 551 // The output frame height does not include the parameters. |
| (...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 __ VFPCompareAndSetFlags(input_reg, input_reg); | 2484 __ VFPCompareAndSetFlags(input_reg, input_reg); |
| 2466 EmitFalseBranch(instr, vc); | 2485 EmitFalseBranch(instr, vc); |
| 2467 | 2486 |
| 2468 Register scratch = scratch0(); | 2487 Register scratch = scratch0(); |
| 2469 __ VmovHigh(scratch, input_reg); | 2488 __ VmovHigh(scratch, input_reg); |
| 2470 __ cmp(scratch, Operand(kHoleNanUpper32)); | 2489 __ cmp(scratch, Operand(kHoleNanUpper32)); |
| 2471 EmitBranch(instr, eq); | 2490 EmitBranch(instr, eq); |
| 2472 } | 2491 } |
| 2473 | 2492 |
| 2474 | 2493 |
| 2494 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { |
| 2495 Representation rep = instr->hydrogen()->value()->representation(); |
| 2496 ASSERT(!rep.IsInteger32()); |
| 2497 Register scratch = ToRegister(instr->temp()); |
| 2498 |
| 2499 if (rep.IsDouble()) { |
| 2500 DwVfpRegister value = ToDoubleRegister(instr->value()); |
| 2501 __ VFPCompareAndSetFlags(value, 0.0); |
| 2502 EmitFalseBranch(instr, ne); |
| 2503 __ VmovHigh(scratch, value); |
| 2504 __ cmp(scratch, Operand(0x80000000)); |
| 2505 } else { |
| 2506 Register value = ToRegister(instr->value()); |
| 2507 __ CheckMap(value, |
| 2508 scratch, |
| 2509 Heap::kHeapNumberMapRootIndex, |
| 2510 instr->FalseLabel(chunk()), |
| 2511 DO_SMI_CHECK); |
| 2512 __ ldr(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset)); |
| 2513 __ ldr(ip, FieldMemOperand(value, HeapNumber::kMantissaOffset)); |
| 2514 __ cmp(scratch, Operand(0x80000000)); |
| 2515 __ cmp(ip, Operand(0x00000000), eq); |
| 2516 } |
| 2517 EmitBranch(instr, eq); |
| 2518 } |
| 2519 |
| 2520 |
| 2475 Condition LCodeGen::EmitIsObject(Register input, | 2521 Condition LCodeGen::EmitIsObject(Register input, |
| 2476 Register temp1, | 2522 Register temp1, |
| 2477 Label* is_not_object, | 2523 Label* is_not_object, |
| 2478 Label* is_object) { | 2524 Label* is_object) { |
| 2479 Register temp2 = scratch0(); | 2525 Register temp2 = scratch0(); |
| 2480 __ JumpIfSmi(input, is_not_object); | 2526 __ JumpIfSmi(input, is_not_object); |
| 2481 | 2527 |
| 2482 __ LoadRoot(temp2, Heap::kNullValueRootIndex); | 2528 __ LoadRoot(temp2, Heap::kNullValueRootIndex); |
| 2483 __ cmp(input, temp2); | 2529 __ cmp(input, temp2); |
| 2484 __ b(eq, is_object); | 2530 __ b(eq, is_object); |
| (...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4073 } | 4119 } |
| 4074 | 4120 |
| 4075 | 4121 |
| 4076 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4122 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4077 ASSERT(ToRegister(instr->context()).is(cp)); | 4123 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4078 ASSERT(ToRegister(instr->function()).is(r1)); | 4124 ASSERT(ToRegister(instr->function()).is(r1)); |
| 4079 ASSERT(ToRegister(instr->result()).is(r0)); | 4125 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4080 | 4126 |
| 4081 int arity = instr->arity(); | 4127 int arity = instr->arity(); |
| 4082 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4128 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 4083 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4129 if (instr->hydrogen()->IsTailCall()) { |
| 4130 if (NeedsEagerFrame()) __ mov(sp, fp); |
| 4131 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 4132 } else { |
| 4133 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4134 } |
| 4084 } | 4135 } |
| 4085 | 4136 |
| 4086 | 4137 |
| 4087 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4138 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 4088 ASSERT(ToRegister(instr->context()).is(cp)); | 4139 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4089 ASSERT(ToRegister(instr->result()).is(r0)); | 4140 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4090 | 4141 |
| 4091 int arity = instr->arity(); | 4142 int arity = instr->arity(); |
| 4092 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4143 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 4093 Handle<Code> ic = | 4144 Handle<Code> ic = |
| (...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5439 if (instr->size()->IsRegister()) { | 5490 if (instr->size()->IsRegister()) { |
| 5440 Register size = ToRegister(instr->size()); | 5491 Register size = ToRegister(instr->size()); |
| 5441 ASSERT(!size.is(result)); | 5492 ASSERT(!size.is(result)); |
| 5442 __ SmiTag(size); | 5493 __ SmiTag(size); |
| 5443 __ push(size); | 5494 __ push(size); |
| 5444 } else { | 5495 } else { |
| 5445 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5496 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5446 __ Push(Smi::FromInt(size)); | 5497 __ Push(Smi::FromInt(size)); |
| 5447 } | 5498 } |
| 5448 | 5499 |
| 5500 int flags = AllocateDoubleAlignFlag::encode( |
| 5501 instr->hydrogen()->MustAllocateDoubleAligned()); |
| 5449 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5502 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { |
| 5450 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation()); | 5503 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation()); |
| 5451 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); | 5504 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5452 CallRuntimeFromDeferred(Runtime::kAllocateInOldPointerSpace, 1, instr, | 5505 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); |
| 5453 instr->context()); | |
| 5454 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | 5506 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { |
| 5455 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); | 5507 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5456 CallRuntimeFromDeferred(Runtime::kAllocateInOldDataSpace, 1, instr, | 5508 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE); |
| 5457 instr->context()); | |
| 5458 } else { | 5509 } else { |
| 5459 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr, | 5510 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
| 5460 instr->context()); | |
| 5461 } | 5511 } |
| 5512 __ Push(Smi::FromInt(flags)); |
| 5513 |
| 5514 CallRuntimeFromDeferred( |
| 5515 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); |
| 5462 __ StoreToSafepointRegisterSlot(r0, result); | 5516 __ StoreToSafepointRegisterSlot(r0, result); |
| 5463 } | 5517 } |
| 5464 | 5518 |
| 5465 | 5519 |
| 5466 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5520 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| 5467 ASSERT(ToRegister(instr->value()).is(r0)); | 5521 ASSERT(ToRegister(instr->value()).is(r0)); |
| 5468 __ push(r0); | 5522 __ push(r0); |
| 5469 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5523 CallRuntime(Runtime::kToFastProperties, 1, instr); |
| 5470 } | 5524 } |
| 5471 | 5525 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5883 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5937 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5884 __ ldr(result, FieldMemOperand(scratch, | 5938 __ ldr(result, FieldMemOperand(scratch, |
| 5885 FixedArray::kHeaderSize - kPointerSize)); | 5939 FixedArray::kHeaderSize - kPointerSize)); |
| 5886 __ bind(&done); | 5940 __ bind(&done); |
| 5887 } | 5941 } |
| 5888 | 5942 |
| 5889 | 5943 |
| 5890 #undef __ | 5944 #undef __ |
| 5891 | 5945 |
| 5892 } } // namespace v8::internal | 5946 } } // namespace v8::internal |
| OLD | NEW |