OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4060 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4061 } | 4061 } |
4062 | 4062 |
4063 | 4063 |
4064 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4064 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4065 DCHECK(ToRegister(instr->context()).is(cp)); | 4065 DCHECK(ToRegister(instr->context()).is(cp)); |
4066 DCHECK(ToRegister(instr->constructor()).is(a1)); | 4066 DCHECK(ToRegister(instr->constructor()).is(a1)); |
4067 DCHECK(ToRegister(instr->result()).is(v0)); | 4067 DCHECK(ToRegister(instr->result()).is(v0)); |
4068 | 4068 |
4069 __ li(a0, Operand(instr->arity())); | 4069 __ li(a0, Operand(instr->arity())); |
4070 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 4070 if (instr->arity() == 1) { |
| 4071 // We only need the allocation site for the case we have a length argument. |
| 4072 // The case may bail out to the runtime, which will determine the correct |
| 4073 // elements kind with the site. |
| 4074 __ li(a2, instr->hydrogen()->site()); |
| 4075 } else { |
| 4076 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 4077 } |
4071 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4078 ElementsKind kind = instr->hydrogen()->elements_kind(); |
4072 AllocationSiteOverrideMode override_mode = | 4079 AllocationSiteOverrideMode override_mode = |
4073 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 4080 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
4074 ? DISABLE_ALLOCATION_SITES | 4081 ? DISABLE_ALLOCATION_SITES |
4075 : DONT_OVERRIDE; | 4082 : DONT_OVERRIDE; |
4076 | 4083 |
4077 if (instr->arity() == 0) { | 4084 if (instr->arity() == 0) { |
4078 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 4085 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
4079 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4086 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4080 } else if (instr->arity() == 1) { | 4087 } else if (instr->arity() == 1) { |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 __ li(at, scope_info); | 5970 __ li(at, scope_info); |
5964 __ Push(at, ToRegister(instr->function())); | 5971 __ Push(at, ToRegister(instr->function())); |
5965 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5972 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5966 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5973 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5967 } | 5974 } |
5968 | 5975 |
5969 | 5976 |
5970 #undef __ | 5977 #undef __ |
5971 | 5978 |
5972 } } // namespace v8::internal | 5979 } } // namespace v8::internal |
OLD | NEW |