| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 __ Fcmp(scratch_, 0.0); | 189 __ Fcmp(scratch_, 0.0); |
| 190 __ B(le, label); | 190 __ B(le, label); |
| 191 } | 191 } |
| 192 | 192 |
| 193 private: | 193 private: |
| 194 const FPRegister& value_; | 194 const FPRegister& value_; |
| 195 const FPRegister& scratch_; | 195 const FPRegister& scratch_; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 | 198 |
| 199 // Test the input and branch if it is a heap number. |
| 200 class BranchIfHeapNumber : public BranchGenerator { |
| 201 public: |
| 202 BranchIfHeapNumber(LCodeGen* codegen, const Register& value) |
| 203 : BranchGenerator(codegen), value_(value) { } |
| 204 |
| 205 virtual void Emit(Label* label) const { |
| 206 __ JumpIfHeapNumber(value_, label); |
| 207 } |
| 208 |
| 209 virtual void EmitInverted(Label* label) const { |
| 210 __ JumpIfNotHeapNumber(value_, label); |
| 211 } |
| 212 |
| 213 private: |
| 214 const Register& value_; |
| 215 }; |
| 216 |
| 217 |
| 199 void LCodeGen::WriteTranslation(LEnvironment* environment, | 218 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 200 Translation* translation) { | 219 Translation* translation) { |
| 201 if (environment == NULL) return; | 220 if (environment == NULL) return; |
| 202 | 221 |
| 203 // The translation includes one command per value in the environment. | 222 // The translation includes one command per value in the environment. |
| 204 int translation_size = environment->translation_size(); | 223 int translation_size = environment->translation_size(); |
| 205 // The output frame height does not include the parameters. | 224 // The output frame height does not include the parameters. |
| 206 int height = translation_size - environment->parameter_count(); | 225 int height = translation_size - environment->parameter_count(); |
| 207 | 226 |
| 208 WriteTranslation(environment->outer(), translation); | 227 WriteTranslation(environment->outer(), translation); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 615 } |
| 597 | 616 |
| 598 if (info()->saves_caller_doubles()) { | 617 if (info()->saves_caller_doubles()) { |
| 599 Comment(";;; Save clobbered callee double registers"); | 618 Comment(";;; Save clobbered callee double registers"); |
| 600 ASSERT(NeedsEagerFrame()); | 619 ASSERT(NeedsEagerFrame()); |
| 601 BitVector* doubles = chunk()->allocated_double_registers(); | 620 BitVector* doubles = chunk()->allocated_double_registers(); |
| 602 BitVector::Iterator iterator(doubles); | 621 BitVector::Iterator iterator(doubles); |
| 603 int count = 0; | 622 int count = 0; |
| 604 while (!iterator.Done()) { | 623 while (!iterator.Done()) { |
| 605 FPRegister value = FPRegister::FromAllocationIndex(iterator.Current()); | 624 FPRegister value = FPRegister::FromAllocationIndex(iterator.Current()); |
| 606 // TODO(jbramley): Make Poke support FPRegisters. | 625 __ Poke(value, count * kDoubleSize); |
| 607 __ Str(value, MemOperand(__ StackPointer(), count * kDoubleSize)); | |
| 608 iterator.Advance(); | 626 iterator.Advance(); |
| 609 count++; | 627 count++; |
| 610 } | 628 } |
| 611 } | 629 } |
| 612 | 630 |
| 613 // Allocate a local context if needed. | 631 // Allocate a local context if needed. |
| 614 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 632 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 615 if (heap_slots > 0) { | 633 if (heap_slots > 0) { |
| 616 Comment(";;; Allocate local context"); | 634 Comment(";;; Allocate local context"); |
| 617 // Argument to NewContext is the function, which is in x1. | 635 // Argument to NewContext is the function, which is in x1. |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 | 1233 |
| 1216 template<class InstrType> | 1234 template<class InstrType> |
| 1217 void LCodeGen::EmitBranchIfNonZeroNumber(InstrType instr, | 1235 void LCodeGen::EmitBranchIfNonZeroNumber(InstrType instr, |
| 1218 const FPRegister& value, | 1236 const FPRegister& value, |
| 1219 const FPRegister& scratch) { | 1237 const FPRegister& scratch) { |
| 1220 BranchIfNonZeroNumber branch(this, value, scratch); | 1238 BranchIfNonZeroNumber branch(this, value, scratch); |
| 1221 EmitBranchGeneric(instr, branch); | 1239 EmitBranchGeneric(instr, branch); |
| 1222 } | 1240 } |
| 1223 | 1241 |
| 1224 | 1242 |
| 1243 template<class InstrType> |
| 1244 void LCodeGen::EmitBranchIfHeapNumber(InstrType instr, |
| 1245 const Register& value) { |
| 1246 BranchIfHeapNumber branch(this, value); |
| 1247 EmitBranchGeneric(instr, branch); |
| 1248 } |
| 1249 |
| 1250 |
| 1225 void LCodeGen::DoGap(LGap* gap) { | 1251 void LCodeGen::DoGap(LGap* gap) { |
| 1226 for (int i = LGap::FIRST_INNER_POSITION; | 1252 for (int i = LGap::FIRST_INNER_POSITION; |
| 1227 i <= LGap::LAST_INNER_POSITION; | 1253 i <= LGap::LAST_INNER_POSITION; |
| 1228 i++) { | 1254 i++) { |
| 1229 LGap::InnerPosition inner_pos = static_cast<LGap::InnerPosition>(i); | 1255 LGap::InnerPosition inner_pos = static_cast<LGap::InnerPosition>(i); |
| 1230 LParallelMove* move = gap->GetParallelMove(inner_pos); | 1256 LParallelMove* move = gap->GetParallelMove(inner_pos); |
| 1231 if (move != NULL) { | 1257 if (move != NULL) { |
| 1232 resolver_.Resolve(move); | 1258 resolver_.Resolve(move); |
| 1233 } | 1259 } |
| 1234 } | 1260 } |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 if (r.IsSmiOrInteger32() || r.IsDouble()) { | 2915 if (r.IsSmiOrInteger32() || r.IsDouble()) { |
| 2890 __ B(instr->TrueLabel(chunk_)); | 2916 __ B(instr->TrueLabel(chunk_)); |
| 2891 } else { | 2917 } else { |
| 2892 ASSERT(r.IsTagged()); | 2918 ASSERT(r.IsTagged()); |
| 2893 Register value = ToRegister(instr->value()); | 2919 Register value = ToRegister(instr->value()); |
| 2894 HType type = instr->hydrogen()->value()->type(); | 2920 HType type = instr->hydrogen()->value()->type(); |
| 2895 if (type.IsTaggedNumber()) { | 2921 if (type.IsTaggedNumber()) { |
| 2896 __ B(instr->TrueLabel(chunk_)); | 2922 __ B(instr->TrueLabel(chunk_)); |
| 2897 } | 2923 } |
| 2898 __ JumpIfSmi(value, instr->TrueLabel(chunk_)); | 2924 __ JumpIfSmi(value, instr->TrueLabel(chunk_)); |
| 2899 // TODO(jbramley): Add an EmitBranch helper for this. | 2925 |
| 2900 __ JumpForHeapNumber(value, NoReg, | 2926 EmitBranchIfHeapNumber(instr, value); |
| 2901 instr->TrueLabel(chunk_), instr->FalseLabel(chunk_)); | |
| 2902 } | 2927 } |
| 2903 } | 2928 } |
| 2904 | 2929 |
| 2905 | 2930 |
| 2906 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | 2931 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { |
| 2907 Label* is_object = instr->TrueLabel(chunk_); | 2932 Label* is_object = instr->TrueLabel(chunk_); |
| 2908 Label* is_not_object = instr->FalseLabel(chunk_); | 2933 Label* is_not_object = instr->FalseLabel(chunk_); |
| 2909 Register value = ToRegister(instr->value()); | 2934 Register value = ToRegister(instr->value()); |
| 2910 Register map = ToRegister(instr->temp1()); | 2935 Register map = ToRegister(instr->temp1()); |
| 2911 Register scratch = ToRegister(instr->temp2()); | 2936 Register scratch = ToRegister(instr->temp2()); |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4389 __ CallRuntime(Runtime::kTraceExit, 1); | 4414 __ CallRuntime(Runtime::kTraceExit, 1); |
| 4390 } | 4415 } |
| 4391 | 4416 |
| 4392 if (info()->saves_caller_doubles()) { | 4417 if (info()->saves_caller_doubles()) { |
| 4393 ASSERT(NeedsEagerFrame()); | 4418 ASSERT(NeedsEagerFrame()); |
| 4394 BitVector* doubles = chunk()->allocated_double_registers(); | 4419 BitVector* doubles = chunk()->allocated_double_registers(); |
| 4395 BitVector::Iterator iterator(doubles); | 4420 BitVector::Iterator iterator(doubles); |
| 4396 int count = 0; | 4421 int count = 0; |
| 4397 while (!iterator.Done()) { | 4422 while (!iterator.Done()) { |
| 4398 FPRegister value = FPRegister::FromAllocationIndex(iterator.Current()); | 4423 FPRegister value = FPRegister::FromAllocationIndex(iterator.Current()); |
| 4399 // TODO(jbramley): Make Peek support FPRegisters. | 4424 __ Peek(value, count * kDoubleSize); |
| 4400 __ Ldr(value, MemOperand(__ StackPointer(), count * kDoubleSize)); | |
| 4401 iterator.Advance(); | 4425 iterator.Advance(); |
| 4402 count++; | 4426 count++; |
| 4403 } | 4427 } |
| 4404 } | 4428 } |
| 4405 | 4429 |
| 4406 int no_frame_start = -1; | 4430 int no_frame_start = -1; |
| 4407 if (NeedsEagerFrame()) { | 4431 if (NeedsEagerFrame()) { |
| 4408 Register stack_pointer = masm()->StackPointer(); | 4432 Register stack_pointer = masm()->StackPointer(); |
| 4409 __ Mov(stack_pointer, fp); | 4433 __ Mov(stack_pointer, fp); |
| 4410 no_frame_start = masm_->pc_offset(); | 4434 no_frame_start = masm_->pc_offset(); |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5497 __ Bind(&out_of_object); | 5521 __ Bind(&out_of_object); |
| 5498 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5522 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5499 // Index is equal to negated out of object property index plus 1. | 5523 // Index is equal to negated out of object property index plus 1. |
| 5500 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5524 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5501 __ Ldr(result, FieldMemOperand(result, | 5525 __ Ldr(result, FieldMemOperand(result, |
| 5502 FixedArray::kHeaderSize - kPointerSize)); | 5526 FixedArray::kHeaderSize - kPointerSize)); |
| 5503 __ Bind(&done); | 5527 __ Bind(&done); |
| 5504 } | 5528 } |
| 5505 | 5529 |
| 5506 } } // namespace v8::internal | 5530 } } // namespace v8::internal |
| OLD | NEW |