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

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

Issue 10689005: Allow inlining of functions containing array literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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/lithium-codegen-ia32.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 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 4515
4516 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 4516 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
4517 __ li(a0, Operand(Smi::FromInt(instance_size))); 4517 __ li(a0, Operand(Smi::FromInt(instance_size)));
4518 __ push(a0); 4518 __ push(a0);
4519 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); 4519 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr);
4520 __ StoreToSafepointRegisterSlot(v0, result); 4520 __ StoreToSafepointRegisterSlot(v0, result);
4521 } 4521 }
4522 4522
4523 4523
4524 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 4524 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4525 Heap* heap = isolate()->heap(); 4525 Handle<FixedArray> literals(instr->environment()->closure()->literals());
4526 ElementsKind boilerplate_elements_kind = 4526 ElementsKind boilerplate_elements_kind =
4527 instr->hydrogen()->boilerplate_elements_kind(); 4527 instr->hydrogen()->boilerplate_elements_kind();
4528 4528
4529 // Deopt if the array literal boilerplate ElementsKind is of a type different 4529 // Deopt if the array literal boilerplate ElementsKind is of a type different
4530 // than the expected one. The check isn't necessary if the boilerplate has 4530 // than the expected one. The check isn't necessary if the boilerplate has
4531 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. 4531 // already been converted to TERMINAL_FAST_ELEMENTS_KIND.
4532 if (CanTransitionToMoreGeneralFastElementsKind( 4532 if (CanTransitionToMoreGeneralFastElementsKind(
4533 boilerplate_elements_kind, true)) { 4533 boilerplate_elements_kind, true)) {
4534 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); 4534 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object());
4535 // Load map into a2. 4535 // Load map into a2.
4536 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); 4536 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset));
4537 // Load the map's "bit field 2". 4537 // Load the map's "bit field 2".
4538 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); 4538 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset));
4539 // Retrieve elements_kind from bit field 2. 4539 // Retrieve elements_kind from bit field 2.
4540 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); 4540 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount);
4541 DeoptimizeIf(ne, 4541 DeoptimizeIf(ne,
4542 instr->environment(), 4542 instr->environment(),
4543 a2, 4543 a2,
4544 Operand(boilerplate_elements_kind)); 4544 Operand(boilerplate_elements_kind));
4545 } 4545 }
4546 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 4546
4547 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 4547 // Set up the parameters to the stub/runtime call.
4548 __ LoadHeapObject(a3, literals);
4548 __ li(a2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); 4549 __ li(a2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
4549 // Boilerplate already exists, constant elements are never accessed. 4550 // Boilerplate already exists, constant elements are never accessed.
4550 // Pass an empty fixed array. 4551 // Pass an empty fixed array.
4551 __ li(a1, Operand(Handle<FixedArray>(heap->empty_fixed_array()))); 4552 __ li(a1, Operand(isolate()->factory()->empty_fixed_array()));
4552 __ Push(a3, a2, a1); 4553 __ Push(a3, a2, a1);
4553 4554
4554 // Pick the right runtime function or stub to call. 4555 // Pick the right runtime function or stub to call.
4555 int length = instr->hydrogen()->length(); 4556 int length = instr->hydrogen()->length();
4556 if (instr->hydrogen()->IsCopyOnWrite()) { 4557 if (instr->hydrogen()->IsCopyOnWrite()) {
4557 ASSERT(instr->hydrogen()->depth() == 1); 4558 ASSERT(instr->hydrogen()->depth() == 1);
4558 FastCloneShallowArrayStub::Mode mode = 4559 FastCloneShallowArrayStub::Mode mode =
4559 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; 4560 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS;
4560 FastCloneShallowArrayStub stub(mode, length); 4561 FastCloneShallowArrayStub stub(mode, length);
4561 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4562 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 __ Subu(scratch, result, scratch); 5204 __ Subu(scratch, result, scratch);
5204 __ lw(result, FieldMemOperand(scratch, 5205 __ lw(result, FieldMemOperand(scratch,
5205 FixedArray::kHeaderSize - kPointerSize)); 5206 FixedArray::kHeaderSize - kPointerSize));
5206 __ bind(&done); 5207 __ bind(&done);
5207 } 5208 }
5208 5209
5209 5210
5210 #undef __ 5211 #undef __
5211 5212
5212 } } // namespace v8::internal 5213 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698