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

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

Issue 16341004: Fix for bug 245480. Calling new Array(a) with a single argument could (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed an unnecessary function Created 7 years, 6 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') | src/x64/lithium-codegen-x64.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 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 4207 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 __ Set(eax, Immediate(instr->arity())); 4218 __ Set(eax, Immediate(instr->arity()));
4219 __ mov(ebx, instr->hydrogen()->property_cell()); 4219 __ mov(ebx, instr->hydrogen()->property_cell());
4220 ElementsKind kind = instr->hydrogen()->elements_kind(); 4220 ElementsKind kind = instr->hydrogen()->elements_kind();
4221 bool disable_allocation_sites = 4221 bool disable_allocation_sites =
4222 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); 4222 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE);
4223 4223
4224 if (instr->arity() == 0) { 4224 if (instr->arity() == 0) {
4225 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); 4225 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites);
4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4227 } else if (instr->arity() == 1) { 4227 } else if (instr->arity() == 1) {
4228 Label done;
4229 if (IsFastPackedElementsKind(kind)) {
4230 Label packed_case;
4231 // We might need a change here
4232 // look at the first argument
4233 __ mov(ecx, Operand(esp, 0));
4234 __ test(ecx, ecx);
4235 __ j(zero, &packed_case);
4236
4237 ElementsKind holey_kind = GetHoleyElementsKind(kind);
4238 ArraySingleArgumentConstructorStub stub(holey_kind,
4239 disable_allocation_sites);
4240 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4241 __ jmp(&done);
4242 __ bind(&packed_case);
4243 }
4244
4228 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); 4245 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites);
4229 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 4246 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4247 __ bind(&done);
4230 } else { 4248 } else {
4231 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); 4249 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites);
4232 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 4250 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4233 } 4251 }
4234 } 4252 }
4235 4253
4236 4254
4237 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 4255 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4238 CallRuntime(instr->function(), instr->arity(), instr); 4256 CallRuntime(instr->function(), instr->arity(), instr);
4239 } 4257 }
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
6486 FixedArray::kHeaderSize - kPointerSize)); 6504 FixedArray::kHeaderSize - kPointerSize));
6487 __ bind(&done); 6505 __ bind(&done);
6488 } 6506 }
6489 6507
6490 6508
6491 #undef __ 6509 #undef __
6492 6510
6493 } } // namespace v8::internal 6511 } } // namespace v8::internal
6494 6512
6495 #endif // V8_TARGET_ARCH_IA32 6513 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698