Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 1086873003: Array() in optimized code can create with wrong ElementsKind in corner cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments and test failure. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 4045 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); 4056 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4057 } 4057 }
4058 4058
4059 4059
4060 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 4060 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4061 DCHECK(ToRegister(instr->context()).is(rsi)); 4061 DCHECK(ToRegister(instr->context()).is(rsi));
4062 DCHECK(ToRegister(instr->constructor()).is(rdi)); 4062 DCHECK(ToRegister(instr->constructor()).is(rdi));
4063 DCHECK(ToRegister(instr->result()).is(rax)); 4063 DCHECK(ToRegister(instr->result()).is(rax));
4064 4064
4065 __ Set(rax, instr->arity()); 4065 __ Set(rax, instr->arity());
4066 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); 4066 if (instr->arity() == 1) {
4067 // We only need the allocation site for the case we have a length argument.
4068 // The case may bail out to the runtime, which will determine the correct
4069 // elements kind with the site.
4070 __ Move(rbx, instr->hydrogen()->site());
4071 } else {
4072 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex);
4073 }
4074
4067 ElementsKind kind = instr->hydrogen()->elements_kind(); 4075 ElementsKind kind = instr->hydrogen()->elements_kind();
4068 AllocationSiteOverrideMode override_mode = 4076 AllocationSiteOverrideMode override_mode =
4069 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) 4077 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
4070 ? DISABLE_ALLOCATION_SITES 4078 ? DISABLE_ALLOCATION_SITES
4071 : DONT_OVERRIDE; 4079 : DONT_OVERRIDE;
4072 4080
4073 if (instr->arity() == 0) { 4081 if (instr->arity() == 0) {
4074 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); 4082 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode);
4075 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); 4083 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4076 } else if (instr->arity() == 1) { 4084 } else if (instr->arity() == 1) {
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
5911 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5919 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5912 RecordSafepoint(Safepoint::kNoLazyDeopt); 5920 RecordSafepoint(Safepoint::kNoLazyDeopt);
5913 } 5921 }
5914 5922
5915 5923
5916 #undef __ 5924 #undef __
5917 5925
5918 } } // namespace v8::internal 5926 } } // namespace v8::internal
5919 5927
5920 #endif // V8_TARGET_ARCH_X64 5928 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698