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

Side by Side Diff: src/arm64/lithium-codegen-arm64.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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.cc » ('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 #include "src/arm64/lithium-codegen-arm64.h" 7 #include "src/arm64/lithium-codegen-arm64.h"
8 #include "src/arm64/lithium-gap-resolver-arm64.h" 8 #include "src/arm64/lithium-gap-resolver-arm64.h"
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 DCHECK(ToRegister(instr->result()).is(x0)); 453 DCHECK(ToRegister(instr->result()).is(x0));
454 } 454 }
455 455
456 456
457 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 457 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
458 DCHECK(instr->IsMarkedAsCall()); 458 DCHECK(instr->IsMarkedAsCall());
459 DCHECK(ToRegister(instr->context()).is(cp)); 459 DCHECK(ToRegister(instr->context()).is(cp));
460 DCHECK(ToRegister(instr->constructor()).is(x1)); 460 DCHECK(ToRegister(instr->constructor()).is(x1));
461 461
462 __ Mov(x0, Operand(instr->arity())); 462 __ Mov(x0, Operand(instr->arity()));
463 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); 463 if (instr->arity() == 1) {
464 // We only need the allocation site for the case we have a length argument.
465 // The case may bail out to the runtime, which will determine the correct
466 // elements kind with the site.
467 __ Mov(x2, instr->hydrogen()->site());
468 } else {
469 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex);
470 }
471
464 472
465 ElementsKind kind = instr->hydrogen()->elements_kind(); 473 ElementsKind kind = instr->hydrogen()->elements_kind();
466 AllocationSiteOverrideMode override_mode = 474 AllocationSiteOverrideMode override_mode =
467 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) 475 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
468 ? DISABLE_ALLOCATION_SITES 476 ? DISABLE_ALLOCATION_SITES
469 : DONT_OVERRIDE; 477 : DONT_OVERRIDE;
470 478
471 if (instr->arity() == 0) { 479 if (instr->arity() == 0) {
472 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); 480 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode);
473 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); 481 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
(...skipping 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after
6009 Handle<ScopeInfo> scope_info = instr->scope_info(); 6017 Handle<ScopeInfo> scope_info = instr->scope_info();
6010 __ Push(scope_info); 6018 __ Push(scope_info);
6011 __ Push(ToRegister(instr->function())); 6019 __ Push(ToRegister(instr->function()));
6012 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6020 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6013 RecordSafepoint(Safepoint::kNoLazyDeopt); 6021 RecordSafepoint(Safepoint::kNoLazyDeopt);
6014 } 6022 }
6015 6023
6016 6024
6017 6025
6018 } } // namespace v8::internal 6026 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698