OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 183 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
184 HValue* boilerplate_size = | 184 HValue* boilerplate_size = |
185 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 185 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
186 HValue* size_in_words = | 186 HValue* size_in_words = |
187 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, | 187 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
188 Representation::Integer32())); | 188 Representation::Integer32())); |
189 builder.CheckIntegerEq(boilerplate_size, size_in_words); | 189 builder.CheckIntegerEq(boilerplate_size, size_in_words); |
190 | 190 |
191 HValue* size_in_bytes = | 191 HValue* size_in_bytes = |
192 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); | 192 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); |
| 193 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; |
| 194 if (FLAG_pretenure_literals) { |
| 195 flags = static_cast<HAllocate::Flags>( |
| 196 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
| 197 } |
193 HInstruction* object = | 198 HInstruction* object = |
194 AddInstruction(new(zone) HAllocate(context(), | 199 AddInstruction(new(zone) HAllocate(context(), |
195 size_in_bytes, | 200 size_in_bytes, |
196 HType::JSObject(), | 201 HType::JSObject(), |
197 HAllocate::CAN_ALLOCATE_IN_NEW_SPACE)); | 202 flags)); |
198 | 203 |
199 for (int i = 0; i < size; i += kPointerSize) { | 204 for (int i = 0; i < size; i += kPointerSize) { |
200 HInstruction* value = | 205 HInstruction* value = |
201 AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); | 206 AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); |
202 AddInstruction(new(zone) HStoreNamedField(object, | 207 AddInstruction(new(zone) HStoreNamedField(object, |
203 factory->empty_string(), | 208 factory->empty_string(), |
204 value, | 209 value, |
205 true, i)); | 210 true, i)); |
206 AddSimulate(BailoutId::StubEntry()); | 211 AddSimulate(BailoutId::StubEntry()); |
207 } | 212 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 381 } |
377 | 382 |
378 | 383 |
379 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 384 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
380 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this); | 385 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this); |
381 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); | 386 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); |
382 return chunk->Codegen(Code::COMPILED_STUB); | 387 return chunk->Codegen(Code::COMPILED_STUB); |
383 } | 388 } |
384 | 389 |
385 } } // namespace v8::internal | 390 } } // namespace v8::internal |
OLD | NEW |