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

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

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE 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
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 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 while (!save_iterator.Done()) { 2931 while (!save_iterator.Done()) {
2932 __ vldr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()), 2932 __ vldr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()),
2933 MemOperand(sp, count * kDoubleSize)); 2933 MemOperand(sp, count * kDoubleSize));
2934 save_iterator.Advance(); 2934 save_iterator.Advance();
2935 count++; 2935 count++;
2936 } 2936 }
2937 } 2937 }
2938 if (NeedsEagerFrame()) { 2938 if (NeedsEagerFrame()) {
2939 __ mov(sp, fp); 2939 __ mov(sp, fp);
2940 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 2940 __ ldm(ia_w, sp, fp.bit() | lr.bit());
2941 }
2942 if (instr->has_constant_parameter_count()) {
2943 int parameter_count = ToInteger32(instr->constant_parameter_count());
2944 int32_t sp_delta = (parameter_count + 1) * kPointerSize;
2945 if (sp_delta != 0) {
2946 __ add(sp, sp, Operand(sp_delta));
2947 }
2948 } else {
2949 Register reg = ToRegister(instr->parameter_count());
2950 __ SmiUntag(reg); // it is a smi
Hannes Payer (out of office) 2013/04/23 11:42:50 codestyle, move comment in a separate line before
mvstanton 2013/04/23 14:19:58 done, on all platforms
2951 __ add(sp, sp, Operand(reg, LSL, kPointerSizeLog2));
2952 }
2941 2953
2942 if (instr->has_constant_parameter_count()) {
2943 int parameter_count = ToInteger32(instr->constant_parameter_count());
2944 int32_t sp_delta = (parameter_count + 1) * kPointerSize;
2945 if (sp_delta != 0) {
2946 __ add(sp, sp, Operand(sp_delta));
2947 }
2948 } else {
2949 Register reg = ToRegister(instr->parameter_count());
2950 __ add(reg, reg, Operand(1));
2951 __ add(sp, sp, Operand(reg, LSL, kPointerSizeLog2));
2952 }
2953 }
2954 __ Jump(lr); 2954 __ Jump(lr);
2955 } 2955 }
2956 2956
2957 2957
2958 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { 2958 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2959 Register result = ToRegister(instr->result()); 2959 Register result = ToRegister(instr->result());
2960 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell()))); 2960 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
2961 __ ldr(result, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset)); 2961 __ ldr(result, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
2962 if (instr->hydrogen()->RequiresHoleCheck()) { 2962 if (instr->hydrogen()->RequiresHoleCheck()) {
2963 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 2963 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
4213 } 4213 }
4214 4214
4215 4215
4216 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 4216 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4217 ASSERT(ToRegister(instr->constructor()).is(r1)); 4217 ASSERT(ToRegister(instr->constructor()).is(r1));
4218 ASSERT(ToRegister(instr->result()).is(r0)); 4218 ASSERT(ToRegister(instr->result()).is(r0));
4219 ASSERT(FLAG_optimize_constructed_arrays); 4219 ASSERT(FLAG_optimize_constructed_arrays);
4220 4220
4221 __ mov(r0, Operand(instr->arity())); 4221 __ mov(r0, Operand(instr->arity()));
4222 __ mov(r2, Operand(instr->hydrogen()->property_cell())); 4222 __ mov(r2, Operand(instr->hydrogen()->property_cell()));
4223 Handle<Code> array_construct_code = 4223 Object* cell_value = instr->hydrogen()->property_cell()->value();
4224 isolate()->builtins()->ArrayConstructCode(); 4224 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value());
4225 4225 if (instr->arity() == 0) {
4226 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); 4226 ArrayNoArgumentConstructorStub stub(kind);
4227 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4228 } else if (instr->arity() == 1) {
4229 ArraySingleArgumentConstructorStub stub(kind);
4230 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4231 } else {
4232 ArrayNArgumentsConstructorStub stub(kind);
4233 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4234 }
4227 } 4235 }
4228 4236
4229 4237
4230 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 4238 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4231 CallRuntime(instr->function(), instr->arity(), instr); 4239 CallRuntime(instr->function(), instr->arity(), instr);
4232 } 4240 }
4233 4241
4234 4242
4235 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { 4243 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4236 Register result = ToRegister(instr->result()); 4244 Register result = ToRegister(instr->result());
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
5997 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6005 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5998 __ ldr(result, FieldMemOperand(scratch, 6006 __ ldr(result, FieldMemOperand(scratch,
5999 FixedArray::kHeaderSize - kPointerSize)); 6007 FixedArray::kHeaderSize - kPointerSize));
6000 __ bind(&done); 6008 __ bind(&done);
6001 } 6009 }
6002 6010
6003 6011
6004 #undef __ 6012 #undef __
6005 6013
6006 } } // namespace v8::internal 6014 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698