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

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

Issue 221743005: Check in Lithium that allocation size in Smi range. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | test/mjsunit/regress/regress-alloc-smi-check.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 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 5933 matching lines...) Expand 10 before | Expand all | Expand 10 after
5944 __ Move(result, Immediate(Smi::FromInt(0))); 5944 __ Move(result, Immediate(Smi::FromInt(0)));
5945 5945
5946 PushSafepointRegistersScope scope(this); 5946 PushSafepointRegistersScope scope(this);
5947 if (instr->size()->IsRegister()) { 5947 if (instr->size()->IsRegister()) {
5948 Register size = ToRegister(instr->size()); 5948 Register size = ToRegister(instr->size());
5949 ASSERT(!size.is(result)); 5949 ASSERT(!size.is(result));
5950 __ SmiTag(ToRegister(instr->size())); 5950 __ SmiTag(ToRegister(instr->size()));
5951 __ push(size); 5951 __ push(size);
5952 } else { 5952 } else {
5953 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5953 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5954 __ push(Immediate(Smi::FromInt(size))); 5954 if (size >= 0 && size <= Smi::kMaxValue) {
5955 __ push(Immediate(Smi::FromInt(size)));
5956 } else {
5957 // We should never get here at runtime => abort
5958 __ int3();
5959 return;
5960 }
5955 } 5961 }
5956 5962
5957 int flags = AllocateDoubleAlignFlag::encode( 5963 int flags = AllocateDoubleAlignFlag::encode(
5958 instr->hydrogen()->MustAllocateDoubleAligned()); 5964 instr->hydrogen()->MustAllocateDoubleAligned());
5959 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { 5965 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5960 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation()); 5966 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5961 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 5967 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5962 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); 5968 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE);
5963 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { 5969 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5964 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 5970 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
6437 __ bind(deferred->exit()); 6443 __ bind(deferred->exit());
6438 __ bind(&done); 6444 __ bind(&done);
6439 } 6445 }
6440 6446
6441 6447
6442 #undef __ 6448 #undef __
6443 6449
6444 } } // namespace v8::internal 6450 } } // namespace v8::internal
6445 6451
6446 #endif // V8_TARGET_ARCH_IA32 6452 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | test/mjsunit/regress/regress-alloc-smi-check.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698