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 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4210 __ LoadHeapObject(temp1, current_prototype); | 4210 __ LoadHeapObject(temp1, current_prototype); |
4211 } | 4211 } |
4212 | 4212 |
4213 // Check the holder map. | 4213 // Check the holder map. |
4214 DoCheckMapCommon(temp1, temp2, | 4214 DoCheckMapCommon(temp1, temp2, |
4215 Handle<Map>(current_prototype->map()), | 4215 Handle<Map>(current_prototype->map()), |
4216 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); | 4216 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
4217 } | 4217 } |
4218 | 4218 |
4219 | 4219 |
| 4220 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
| 4221 class DeferredAllocateObject: public LDeferredCode { |
| 4222 public: |
| 4223 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) |
| 4224 : LDeferredCode(codegen), instr_(instr) { } |
| 4225 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } |
| 4226 virtual LInstruction* instr() { return instr_; } |
| 4227 private: |
| 4228 LAllocateObject* instr_; |
| 4229 }; |
| 4230 |
| 4231 DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr); |
| 4232 |
| 4233 // TODO(mstarzinger): Implement inlined version instead of jumping to |
| 4234 // deferred runtime call. |
| 4235 __ jmp(deferred->entry()); |
| 4236 |
| 4237 __ bind(deferred->exit()); |
| 4238 } |
| 4239 |
| 4240 |
| 4241 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
| 4242 Register result = ToRegister(instr->result()); |
| 4243 Handle<JSFunction> constructor = instr->hydrogen()->constructor(); |
| 4244 |
| 4245 // TODO(3095996): Get rid of this. For now, we need to make the |
| 4246 // result register contain a valid pointer because it is already |
| 4247 // contained in the register pointer map. |
| 4248 __ mov(result, zero_reg); |
| 4249 |
| 4250 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 4251 __ LoadHeapObject(a0, constructor); |
| 4252 __ push(a0); |
| 4253 CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr); |
| 4254 __ StoreToSafepointRegisterSlot(v0, result); |
| 4255 } |
| 4256 |
| 4257 |
4220 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4258 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
4221 Heap* heap = isolate()->heap(); | 4259 Heap* heap = isolate()->heap(); |
4222 ElementsKind boilerplate_elements_kind = | 4260 ElementsKind boilerplate_elements_kind = |
4223 instr->hydrogen()->boilerplate_elements_kind(); | 4261 instr->hydrogen()->boilerplate_elements_kind(); |
4224 | 4262 |
4225 // Deopt if the array literal boilerplate ElementsKind is of a type different | 4263 // Deopt if the array literal boilerplate ElementsKind is of a type different |
4226 // than the expected one. The check isn't necessary if the boilerplate has | 4264 // than the expected one. The check isn't necessary if the boilerplate has |
4227 // already been converted to FAST_ELEMENTS. | 4265 // already been converted to FAST_ELEMENTS. |
4228 if (boilerplate_elements_kind != FAST_ELEMENTS) { | 4266 if (boilerplate_elements_kind != FAST_ELEMENTS) { |
4229 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); | 4267 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 ASSERT(!environment->HasBeenRegistered()); | 4778 ASSERT(!environment->HasBeenRegistered()); |
4741 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4779 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4742 ASSERT(osr_pc_offset_ == -1); | 4780 ASSERT(osr_pc_offset_ == -1); |
4743 osr_pc_offset_ = masm()->pc_offset(); | 4781 osr_pc_offset_ = masm()->pc_offset(); |
4744 } | 4782 } |
4745 | 4783 |
4746 | 4784 |
4747 #undef __ | 4785 #undef __ |
4748 | 4786 |
4749 } } // namespace v8::internal | 4787 } } // namespace v8::internal |
OLD | NEW |