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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 285543002: Recognize List constructor and turn it into CreateArray ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 36136)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -620,6 +620,15 @@
} else {
__ j(NOT_ZERO, &slow_case);
}
+ __ cmpl(EDX, Immediate(0));
+ __ j(LESS, &slow_case);
+
+ // Check for maximum allowed length.
+ const Immediate& max_len =
+ Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)));
+ __ cmpl(EDX, max_len);
+ __ j(GREATER, &slow_case);
+
__ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
__ movl(EDI, Address(EDI, Isolate::heap_offset()));
__ movl(EDI, Address(EDI, Heap::new_space_offset()));
@@ -634,8 +643,11 @@
__ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi.
ASSERT(kSmiTagShift == 1);
__ andl(EBX, Immediate(-kObjectAlignment));
- __ leal(EBX, Address(EAX, EBX, TIMES_1, 0));
+ // Check for overflow.
+ __ addl(EBX, EAX);
+ __ j(CARRY, &slow_case);
+
// Check if the allocation fits into the remaining space.
// EAX: potential new object start.
// EBX: potential next object start.
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698