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

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

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: We still generated the arrays with feature flag off. Fixed. Created 7 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/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2770 int parameter_count = ToInteger32(instr->constant_parameter_count());
2771 if (dynamic_frame_alignment && FLAG_debug_code) { 2771 if (dynamic_frame_alignment && FLAG_debug_code) {
2772 __ cmp(Operand(esp, 2772 __ cmp(Operand(esp,
2773 (parameter_count + extra_value_count) * kPointerSize), 2773 (parameter_count + extra_value_count) * kPointerSize),
2774 Immediate(kAlignmentZapValue)); 2774 Immediate(kAlignmentZapValue));
2775 __ Assert(equal, "expected alignment marker"); 2775 __ Assert(equal, "expected alignment marker");
2776 } 2776 }
2777 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); 2777 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx);
2778 } else { 2778 } else {
2779 Register reg = ToRegister(instr->parameter_count()); 2779 Register reg = ToRegister(instr->parameter_count());
2780 // The argument count parameter is a smi
2781 __ SmiUntag(reg);
2780 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; 2782 Register return_addr_reg = reg.is(ecx) ? ebx : ecx;
2781 if (dynamic_frame_alignment && FLAG_debug_code) { 2783 if (dynamic_frame_alignment && FLAG_debug_code) {
2782 ASSERT(extra_value_count == 2); 2784 ASSERT(extra_value_count == 2);
2783 __ cmp(Operand(esp, reg, times_pointer_size, 2785 __ cmp(Operand(esp, reg, times_pointer_size,
2784 extra_value_count * kPointerSize), 2786 extra_value_count * kPointerSize),
2785 Immediate(kAlignmentZapValue)); 2787 Immediate(kAlignmentZapValue));
2786 __ Assert(equal, "expected alignment marker"); 2788 __ Assert(equal, "expected alignment marker");
2787 } 2789 }
2788 2790
2789 // emit code to restore stack based on instr->parameter_count() 2791 // emit code to restore stack based on instr->parameter_count()
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4202 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 4204 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4203 } 4205 }
4204 4206
4205 4207
4206 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 4208 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4207 ASSERT(ToRegister(instr->context()).is(esi)); 4209 ASSERT(ToRegister(instr->context()).is(esi));
4208 ASSERT(ToRegister(instr->constructor()).is(edi)); 4210 ASSERT(ToRegister(instr->constructor()).is(edi));
4209 ASSERT(ToRegister(instr->result()).is(eax)); 4211 ASSERT(ToRegister(instr->result()).is(eax));
4210 ASSERT(FLAG_optimize_constructed_arrays); 4212 ASSERT(FLAG_optimize_constructed_arrays);
4211 4213
4214 __ Set(eax, Immediate(instr->arity()));
4212 __ mov(ebx, instr->hydrogen()->property_cell()); 4215 __ mov(ebx, instr->hydrogen()->property_cell());
4213 Handle<Code> array_construct_code = 4216 Object* cell_value = instr->hydrogen()->property_cell()->value();
4214 isolate()->builtins()->ArrayConstructCode(); 4217 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value());
4215 __ Set(eax, Immediate(instr->arity())); 4218 if (instr->arity() == 0) {
4216 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); 4219 ArrayNoArgumentConstructorStub stub(kind);
4220 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4221 } else if (instr->arity() == 1) {
4222 ArraySingleArgumentConstructorStub stub(kind);
4223 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4224 } else {
4225 ArrayNArgumentsConstructorStub stub(kind);
4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4227 }
4217 } 4228 }
4218 4229
4219 4230
4220 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 4231 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4221 CallRuntime(instr->function(), instr->arity(), instr); 4232 CallRuntime(instr->function(), instr->arity(), instr);
4222 } 4233 }
4223 4234
4224 4235
4225 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { 4236 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4226 Register result = ToRegister(instr->result()); 4237 Register result = ToRegister(instr->result());
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after
6572 FixedArray::kHeaderSize - kPointerSize)); 6583 FixedArray::kHeaderSize - kPointerSize));
6573 __ bind(&done); 6584 __ bind(&done);
6574 } 6585 }
6575 6586
6576 6587
6577 #undef __ 6588 #undef __
6578 6589
6579 } } // namespace v8::internal 6590 } } // namespace v8::internal
6580 6591
6581 #endif // V8_TARGET_ARCH_IA32 6592 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698